From 07f4126b0f4bfacbf1b96442feebd59e2b431b2c Mon Sep 17 00:00:00 2001 From: Bass Date: Sat, 9 Nov 2019 13:25:40 +0000 Subject: Slight lang reformat --- src/main/resources/assets/tectech/lang/en_US.lang | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 483174e2f3..34d402f086 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -1,8 +1,10 @@ #Creative Tab Name itemGroup.TecTech=TecTech Interdimensional + #Blocks tile.quantumGlass.name=Quantum Glass tile.quantumStuff.name=Quantum Stuff + #Items item.em.debugContainer.name=Debug EM Container item.em.definitionContainer.name=EM Recipe Hint @@ -23,6 +25,7 @@ item.tm.teslaCoilCapacitor.4.name=IV Tesla Capacitor item.tm.itemTeslaComponent.0.name=Electrum Tesla Windings item.tm.itemTeslaComponent.1.name=Superconductive Tesla Windings + #Death Messages death.attack.microwaving=%1$s was dehydrated by radiation. death.attack.microwaving.player=%1$s was dehydrated by radiation while fighting %2$s. @@ -30,6 +33,7 @@ death.attack.elementalPollution=%1$s was vaping from the wrong hole. death.attack.elementalPollution.player=%1$s was vaping from the wrong hole while fighting %2$s. death.attack.subspace=%1$s was N-th dimensionally displeased. death.attack.subspace.player=%1$s N-th dimensionally displeased while fighting %2$s. + #Machine hulls gt.blockmachines.hull.tier.10.name=UEV Machine Hull gt.blockmachines.hull.tier.11.name=UIV Machine Hull @@ -37,6 +41,7 @@ gt.blockmachines.hull.tier.12.name=UMV Machine Hull gt.blockmachines.hull.tier.13.name=UXV Machine Hull gt.blockmachines.hull.tier.14.name=OPV Machine Hull gt.blockmachines.hull.tier.15.name=MAX Machine Hull + #Transformers gt.blockmachines.wetransformer.tier.00.name=Ultra Low Voltage Power Transformer gt.blockmachines.wetransformer.tier.00.desc=LV -> ULV (Use Soft Mallet to invert) @@ -94,6 +99,7 @@ gt.blockmachines.transformer.ha.tier.13.name=Extended Mega Ultimate Hi-Amp Trans gt.blockmachines.transformer.ha.tier.13.desc=OPV -> UXV (Use Soft Mallet to invert) gt.blockmachines.transformer.ha.tier.14.name=Overpowered Hi-Amp Transformer gt.blockmachines.transformer.ha.tier.14.desc=MAX -> OPV (Use Soft Mallet to invert) + #Hatches tt.base.emhatch.desc.0=Max stacks amount: tt.base.emhatch.desc.1=Stack capacity: -- cgit From 5c74bb9ec3d5263001c8d24222274bb78e9b904f Mon Sep 17 00:00:00 2001 From: Bass Date: Sat, 9 Nov 2019 13:36:01 +0000 Subject: Lang even harder --- src/main/resources/assets/tectech/lang/en_US.lang | 163 +++++++++++++--------- 1 file changed, 99 insertions(+), 64 deletions(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 34d402f086..bb0cfbb59e 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -248,70 +248,70 @@ gt.blockmachines.hatch.dynamomulti64.tier.13.name=IV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti.desc.0=Multiple Ampere Energy Extractor for Multiblocks gt.blockmachines.hatch.dynamomulti.desc.1=Amperes Out -gt.blockmachines.hatch.dynamotunnel1.tier.05=IV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.05=IV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.05=IV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.05=IV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.05=IV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.05=IV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.05=IV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.06=LuV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.06=LuV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.06=LuV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.06=LuV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.06=LuV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.06=LuV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.06=LuV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.07=ZPM 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.07=ZPM 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.07=ZPM 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.07=ZPM 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.07=ZPM 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.07=ZPM 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.07=ZPM 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.08=UV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.08=UV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.08=UV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.08=UV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.08=UV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.08=UV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.08=UV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.09=UHV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.09=UHV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.09=UHV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.09=UHV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.09=UHV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.09=UHV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.09=UHV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.10=UEV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.10=UEV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.10=UEV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.10=UEV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.10=UEV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.10=UEV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.10=UEV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.11=UIV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.11=UIV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.11=UIV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.11=UIV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.11=UIV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.11=UIV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.11=UIV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.12=UMV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.12=UMV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.12=UMV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.12=UMV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.12=UMV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.12=UMV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.12=UMV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.13=UXV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.13=UXV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.13=UXV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.13=UXV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.13=UXV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.13=UXV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.13=UXV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel.tier.14=Legendary Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel.tier.14.name=Legendary Laser Source Hatch gt.blockmachines.hatch.dynamotunnel.desc.0=Energy extracting terminal for Multiblocks gt.blockmachines.hatch.dynamotunnel.desc.1=Throughput @@ -331,6 +331,41 @@ gt.blockmachines.emout.tier.12.name=UMV Elemental Output Hatch gt.blockmachines.emout.tier.13.name=UXV Elemental Output Hatch gt.blockmachines.emout.desc=Elemental Output for Multiblocks +#Casings +gt.blockcasingsNH.10.name=UEV Machine Casing +gt.blockcasingsNH.11.name=UIV Machine Casing +gt.blockcasingsNH.12.name=UMV Machine Casing +gt.blockcasingsNH.13.name=UXV Machine Casing +gt.blockcasingsNH.14.name=OPV Machine Casing +gt.blockcasingsNH.15.name=MAX Machine Casing + +gt.blockcasingsTT.0.name=High Power Casing +gt.blockcasingsTT.1.name=Computer Casing +gt.blockcasingsTT.2.name=Computer Heat Vent +gt.blockcasingsTT.3.name=Advanced Computer Casing +gt.blockcasingsTT.4.name=Molecular Casing +gt.blockcasingsTT.5.name=Advanced Molecular Casing +gt.blockcasingsTT.6.name=Containment Field Generator +gt.blockcasingsTT.7.name=Molecular Coil +gt.blockcasingsTT.8.name=Hollow Casing +gt.blockcasingsTT.9.name=Spacetime Altering Casing +gt.blockcasingsTT.10.name=Teleportation Casing +gt.blockcasingsTT.11.name=Dimensional Bridge Generator +gt.blockcasingsTT.12.name=Ultimate Molecular Casing +gt.blockcasingsTT.13.name=Ultimate Advanced Molecular Casing +gt.blockcasingsTT.14.name=Ultimate Containment Field Generator +gt.blockcasingsTT.15.name=Debug Sides + +gt.blockcasingsBA0.0.name=Redstone Alloy Primary Tesla Windings +gt.blockcasingsBA0.1.name=MV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.2.name=HV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.3.name=EV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.4.name=IV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.5.name=LuV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.6.name=Tesla Base Casing +gt.blockcasingsBA0.7.name=Tesla Toroid Casing +gt.blockcasingsBA0.8.name=Tesla Secondary Windings + #Multiblocks gt.blockmachines.multimachine.em.transformer.name=Active Transformer gt.blockmachines.multimachine.em.transformer.hint=1 - Energy IO Hatches or High Power Casing -- cgit From b664a5351d1e35c34ee14010c5354544c2e71c33 Mon Sep 17 00:00:00 2001 From: Bass Date: Sun, 10 Nov 2019 04:41:33 +0000 Subject: Removing debug code --- .../metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java | 1 - .../metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java | 1 - .../tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java | 1 - .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java | 1 - .../tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java | 1 - 5 files changed, 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 1498dafecc..682c7536bf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -229,7 +229,6 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } else { return true; } - System.out.println(clientLocale); return true; } 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 8000298443..362ba9f3c5 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 @@ -204,7 +204,6 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity } else { return true; } - System.out.println(clientLocale); return true; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index ae9ee1c524..90879f1b60 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -239,7 +239,6 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } else { return true; } - System.out.println(clientLocale); return true; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index c78d314c07..6fe6b164e1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -539,7 +539,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } else { return true; } - System.out.println(clientLocale); return true; } 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 6170bd081f..e03ea94928 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 @@ -494,7 +494,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } else { return true; } - System.out.println(clientLocale); return true; } -- cgit From 58f60f709d201af2957df7e12ddd6525776063a7 Mon Sep 17 00:00:00 2001 From: Bass Date: Tue, 12 Nov 2019 21:54:24 +0000 Subject: Lang work --- .../tectech/loader/thing/MachineLoader.java | 11 ++-- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 11 ++-- .../GT_MetaTileEntity_Hatch_DataConnector.java | 23 +++++-- .../hatch/GT_MetaTileEntity_Hatch_Holder.java | 14 ++-- .../hatch/GT_MetaTileEntity_Hatch_InputData.java | 16 ++++- .../GT_MetaTileEntity_Hatch_InputDataItems.java | 28 +++++--- .../hatch/GT_MetaTileEntity_Hatch_OutputData.java | 16 ++++- .../GT_MetaTileEntity_Hatch_OutputDataItems.java | 17 ++++- .../hatch/GT_MetaTileEntity_Hatch_Param.java | 33 +++++++--- .../hatch/GT_MetaTileEntity_Hatch_ParamText.java | 30 ++++++--- .../hatch/GT_MetaTileEntity_Hatch_Rack.java | 29 ++++++--- .../hatch/GT_MetaTileEntity_Hatch_Uncertainty.java | 21 ++++-- .../pipe/GT_MetaTileEntity_Pipe_Data.java | 9 +-- .../pipe/GT_MetaTileEntity_Pipe_EM.java | 9 +-- .../pipe/GT_MetaTileEntity_Pipe_Energy.java | 9 +-- .../single/GT_MetaTileEntity_DataReader.java | 5 +- .../single/GT_MetaTileEntity_OwnerDetector.java | 5 +- src/main/resources/assets/tectech/lang/en_US.lang | 75 ++++++++++++++++++++++ 18 files changed, 280 insertions(+), 81 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 0f127f9f6f..2c0b59632c 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -16,6 +16,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.CommonValues.VOLTAGE_NAMES; import static com.github.technus.tectech.thing.CustomItemList.*; /** @@ -585,9 +586,9 @@ public class MachineLoader implements Runnable { // Hatches // =================================================================================================== - Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.05", "Parametrizer", 5).getStackForm(1L)); + Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.05", "Parametrizer", 5).getStackForm(1L));//TODO refactor aName to hatch.param.tier.04 and aTier to 4, check recipe for NH ParametrizerX_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15421, "hatch.param.tier.07", "Parametrizer X", 7).getStackForm(1L)); - ParametrizerTXT_Hatch.set(new GT_MetaTileEntity_Hatch_ParamText(15422, "hatch.param.tier.10", "Parametrizer tXt", 10).getStackForm(1L)); + ParametrizerTXT_Hatch.set(new GT_MetaTileEntity_Hatch_ParamText(15422, "hatch.param.tier.10", "Parametrizer tXt", 10).getStackForm(1L));//TODO check recipe for NH Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15430, "hatch.certain.tier.07", "Uncertainty Resolver", 7).getStackForm(1L)); UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15431, "hatch.certain.tier.10", "Uncertainty Resolver X", 10).getStackForm(1L)); @@ -597,10 +598,10 @@ public class MachineLoader implements Runnable { dataInAss_Hatch.set(new GT_MetaTileEntity_Hatch_InputDataItems(15442, "hatch.datainass.tier.07", "Assembly line Slave Connector", 7).getStackForm(1L)); dataOutAss_Hatch.set(new GT_MetaTileEntity_Hatch_OutputDataItems(15443, "hatch.dataoutass.tier.07", "Data Bank Master Connector", 7).getStackForm(1L)); - rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8, "4 Slot Rack").getStackForm(1L)); - holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8, "For Research Station").getStackForm(1L)); + rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8).getStackForm(1L)); + holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8).getStackForm(1L)); - capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.03", "Capacitor Hatch", 3, "For Tesla Tower").getStackForm(1L)); + capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.03", "Capacitor Hatch", 3).getStackForm(1L)); // =================================================================================================== // Pipes 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 44612f0c9b..9b71fea6db 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 @@ -26,6 +26,7 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.getUniqueIdentifier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 03.04.2017. @@ -35,8 +36,8 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { private static Textures.BlockIcons.CustomIcon TM_H_ACTIVE; private static Map componentBinds = new HashMap<>(); - public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier, String descr) { - super(aID, aName, aNameRegional, aTier, 16, descr); + public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 16, ""); Util.setTier(aTier,this); } @@ -109,7 +110,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor Hatch"); + return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor Hatch");//Capacitor Hatch } @Override @@ -130,8 +131,8 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { public String[] getDescription() { return new String[]{ CommonValues.BASS_MARK, - mDescription, - EnumChatFormatting.AQUA + "Stores 'nergy! (for a while)" + translateToLocal("gt.blockmachines.hatch.capacitor.desc.0"),//For Tesla Tower + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.capacitor.desc.1")//Stores 'nergy! (for a while) }; } 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 cb88d9861d..376c5c7294 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 @@ -14,13 +14,16 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.CommonValues.MOVE_AT; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 11.12.2016. @@ -30,6 +33,8 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector 0) { - return new String[]{"ID: " + EnumChatFormatting.AQUA + id, "Content: " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), "PacketHistory: " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; + return new String[]{translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; } return new String[]{ - "Content: " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), - "PacketHistory: " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0), + translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), + translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0), }; } @@ -158,7 +173,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, "Quantum Data Output for Multiblocks"); + super(aID, aName, aNameRegional, aTier, ""); Util.setTier(aTier,this); } @@ -74,6 +78,16 @@ public class GT_MetaTileEntity_Hatch_OutputData extends GT_MetaTileEntity_Hatch_ q = null; } + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.hatch.dataout.desc.0"),//Quantum Data Output for Multiblocks + translateToLocal("gt.blockmachines.hatch.dataout.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.dataout.desc.2")//Must be painted to work + }; + } + @Override public IConnectsToDataPipe getNext(IConnectsToDataPipe source/*==this*/) { IGregTechTileEntity base = getBaseMetaTileEntity(); 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 472f998d89..d98675d0f2 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,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; +import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Util; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; @@ -13,10 +14,13 @@ 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.util.EnumChatFormatting; + +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, "ItemStack Data Output for Multiblocks"); + super(aID, aName, aNameRegional, aTier, ""); Util.setTier(aTier,this); } @@ -44,6 +48,7 @@ public class GT_MetaTileEntity_Hatch_OutputDataItems extends GT_MetaTileEntity_H if (aBaseMetaTileEntity.isClientSide()) { return true; } else { + super.onRightclick(aBaseMetaTileEntity, aPlayer); aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -136,4 +141,14 @@ public class GT_MetaTileEntity_Hatch_OutputDataItems extends GT_MetaTileEntity_H } return null; } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.hatch.dataoutass.desc.0"),//ItemStack Data Output for Multiblocks + translateToLocal("gt.blockmachines.hatch.dataoutass.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.dataoutass.desc.2")//Must be painted to work + }; + } } 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 e1c99e4080..b94836657d 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 @@ -13,11 +13,16 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; + +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 15.12.2016. @@ -32,8 +37,10 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { private static Textures.BlockIcons.CustomIcon ScreenON; private static Textures.BlockIcons.CustomIcon ScreenOFF; + private String clientLocale = "en_US"; + public GT_MetaTileEntity_Hatch_Param(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "For parametrization of Multiblocks"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -51,7 +58,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if (mTier > 5) { + if (mTier > 5) {//TODO update mTier to 4 after recipe check return new GT_Container_ParamAdv(aPlayerInventory, aBaseMetaTileEntity); } return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity); @@ -59,7 +66,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if (mTier > 5) { + if (mTier > 5) {//TODO update mTier to 4 after recipe check return new GT_GUIContainer_ParamAdv(aPlayerInventory, aBaseMetaTileEntity); } return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity); @@ -102,11 +109,11 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { return new String[]{ - "Parametrizer ID: " + EnumChatFormatting.GREEN + param, - "Value 0D: " + EnumChatFormatting.AQUA + value0D, - "Value 1D: " + EnumChatFormatting.BLUE + value1D, - "Input 0D: " + EnumChatFormatting.GOLD + input0D, - "Input 1D: " + EnumChatFormatting.YELLOW + input1D, + translateToLocalFormatted("tt.keyword.Parametrizer", clientLocale)+ " " + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.GREEN + param, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 0D: " + EnumChatFormatting.AQUA + value0D, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 1D: " + EnumChatFormatting.BLUE + value1D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 0D: " + EnumChatFormatting.GOLD + input0D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 1D: " + EnumChatFormatting.YELLOW + input1D, }; } @@ -196,6 +203,12 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -204,8 +217,8 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_GENERAL, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=mine*craft\u00b2" + translateToLocal("gt.blockmachines.hatch.param.desc.0"),//For parametrization of Multiblocks + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.hatch.param.desc.1") +"\u00b2"//E=mine*craft }; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java index c9c84cfbc0..09f11710da 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java @@ -14,6 +14,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; + +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 15.12.2016. @@ -22,6 +26,8 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P public String value0s=""; public String value1s=""; + private String clientLocale = "en_US"; + public GT_MetaTileEntity_Hatch_ParamText(int aID, String aName, String aNameRegional, int aTier) { super(aID,aName,aNameRegional,aTier); } @@ -70,13 +76,13 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P @Override public String[] getInfoData() { return new String[]{ - "Parametrizer ID: " + EnumChatFormatting.GREEN + param, - "Value 0S: " + EnumChatFormatting.DARK_AQUA + value0s, - "Value 1S: " + EnumChatFormatting.DARK_BLUE + value1s, - "Value 0D: " + EnumChatFormatting.AQUA + value0D, - "Value 1D: " + EnumChatFormatting.BLUE + value1D, - "Input 0D: " + EnumChatFormatting.GOLD + input0D, - "Input 1D: " + EnumChatFormatting.YELLOW + input1D, + translateToLocalFormatted("tt.keyword.Parametrizer", clientLocale)+ " " + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.GREEN + param, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 0S: " + EnumChatFormatting.DARK_AQUA + value0s, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 1S: " + EnumChatFormatting.DARK_BLUE + value1s, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 0D: " + EnumChatFormatting.AQUA + value0D, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 1D: " + EnumChatFormatting.BLUE + value1D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 0D: " + EnumChatFormatting.GOLD + input0D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 1D: " + EnumChatFormatting.YELLOW + input1D, }; } @@ -146,6 +152,12 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -154,8 +166,8 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_GENERAL, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=mine*craft\u00b2" + translateToLocal("gt.blockmachines.hatch.param.desc.0"),//For parametrization of Multiblocks + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.hatch.param.desc.1") +"\u00b2"//E=mine*craft }; } } 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 db5920184e..47d7037946 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 @@ -18,10 +18,12 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import org.apache.commons.lang3.reflect.FieldUtils; import java.util.HashMap; import java.util.Map; @@ -29,6 +31,8 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.MULTI_CHECK_AT; import static com.github.technus.tectech.Util.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; /** * Created by Tec on 03.04.2017. @@ -40,8 +44,10 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { private float overClock = 1, overVolt = 1; private static Map componentBinds = new HashMap<>(); - public GT_MetaTileEntity_Hatch_Rack(int aID, String aName, String aNameRegional, int aTier, String descr) { - super(aID, aName, aNameRegional, aTier, 4, descr); + private String clientLocale = "en_US"; + + public GT_MetaTileEntity_Hatch_Rack(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 4, ""); Util.setTier(aTier,this); } @@ -131,7 +137,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Rack(aPlayerInventory, aBaseMetaTileEntity, "Computer Rack"); + return new GT_GUIContainer_Rack(aPlayerInventory, aBaseMetaTileEntity, translateToLocal("gt.blockmachines.hatch.rack.tier.08.name"));//Computer Rack } @Override @@ -139,6 +145,12 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } //if(aBaseMetaTileEntity.isActive()) // aPlayer.addChatComponentMessage(new ChatComponentText("It is still active...")); //else if(heat>0) @@ -249,8 +261,8 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - mDescription, - EnumChatFormatting.AQUA + "Holds Computer Components" + translateToLocal("gt.blockmachines.hatch.rack.desc.0"),//4 Slot Rack + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.rack.desc.1")//Holds Computer Components }; } @@ -262,9 +274,10 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { return new String[]{ - "Base computation: " + EnumChatFormatting.AQUA + getComputationPower(1, 0, false), - "After overclocking: " + EnumChatFormatting.AQUA + getComputationPower(overClock, 0, false), - "Heat Accumulated: " + EnumChatFormatting.RED + (heat + 99) / 100 + EnumChatFormatting.RESET + " %"}; + translateToLocalFormatted("tt.keyphrase.Base_computation", clientLocale) + ": " + EnumChatFormatting.AQUA + getComputationPower(1, 0, false), + translateToLocalFormatted("tt.keyphrase.After_overclocking", clientLocale) + ": " + EnumChatFormatting.AQUA + getComputationPower(overClock, 0, false), + translateToLocalFormatted("tt.keyphrase.Heat_Accumulated", clientLocale) + ": " + EnumChatFormatting.RED + (heat + 99) / 100 + EnumChatFormatting.RESET + " %" + }; //heat==0? --> ((heat+9)/10) = 0 //Heat==1-10? --> 1 } 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 361b9c678f..80b7185ba4 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 @@ -16,11 +16,16 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; + +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 15.12.2016. @@ -31,8 +36,10 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch public short[] matrix = new short[]{500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; public byte selection = -1, mode = 0, status = -128;//all 8 bits set + private String clientLocale = "en_US"; + public GT_MetaTileEntity_Hatch_Uncertainty(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Feeling certain, or not?"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); regenerate(); } @@ -100,7 +107,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch @Override public String[] getInfoData() { return new String[]{ - "Status: " + EnumChatFormatting.GOLD + status + translateToLocalFormatted("tt.keyword.Status", clientLocale) + ": " + EnumChatFormatting.GOLD + status }; } @@ -174,6 +181,12 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -182,8 +195,8 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Schrödinger equation in a box" + translateToLocal("gt.blockmachines.hatch.certain.desc.0"),//Feeling certain, or not? + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.hatch.certain.desc.1")//Schrödinger equation in a box }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java index 6c406313fb..59ad1b927e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java @@ -26,6 +26,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 26.02.2017. @@ -98,10 +99,10 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Advanced data transmission", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Don't stare at the beam!", - EnumChatFormatting.AQUA + "Must be painted to work", - EnumChatFormatting.AQUA + "Do not cross or split" + translateToLocal("gt.blockmachines.pipe.datastream.desc.0"),//Advanced data transmission + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.pipe.datastream.desc.1"),//Don't stare at the beam! + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.datastream.desc.2"),//Must be painted to work + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.datastream.desc.3")//Do not cross or split }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java index 742d298bc6..98e0feccd1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java @@ -27,6 +27,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 26.02.2017. @@ -99,10 +100,10 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnec public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Quantum tunneling device.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Not a portal!!!", - EnumChatFormatting.AQUA + "Must be painted to work", - EnumChatFormatting.AQUA + "Do not cross,split or turn" + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.0"),//Quantum tunneling device. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.1"),//Not a portal!!! + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.2"),//Must be painted to work + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.3")//Do not cross, split or turn }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java index 4cc40b471c..ce315fcd86 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java @@ -29,6 +29,7 @@ import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM.EMCandyActive; import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM.EMcandy; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements IConnectsToEnergyTunnel,IActivePipe { private static Textures.BlockIcons.CustomIcon EMpipe; @@ -95,10 +96,10 @@ public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements ICo public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Laser tunneling device.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Bright Vacuum!!!", - EnumChatFormatting.AQUA + "Must be painted to work", - EnumChatFormatting.AQUA + "Do not split or turn" + translateToLocal("gt.blockmachines.pipe.energystream.desc.0"),//Laser tunneling device. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.pipe.energystream.desc.1"),//Bright Vacuum!!! + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.energystream.desc.2"),//Must be painted to work + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.energystream.desc.3")//Do not split or turn }; } 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 6d594512bd..4222becec0 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 @@ -42,7 +42,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine 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,"Reads Data Sticks and Orbs",1,1,"dataReader.png",""); + super(aID,aName,aNameRegional,aTier,1,"",1,1,"dataReader.png",""); Util.setTier(aTier,this); } @@ -134,7 +134,8 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, + CommonValues.TEC_MARK_GENERAL, + "Reads Data Sticks and Orbs", EnumChatFormatting.BLUE + "Power it up and", EnumChatFormatting.BLUE + "Put the data storage in" }; 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 7f44fb45ca..09a0b61c73 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 @@ -30,7 +30,7 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac private boolean interdimensional=true; public GT_MetaTileEntity_OwnerDetector(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Screwdrive to change mode"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -143,7 +143,8 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, + CommonValues.TEC_MARK_GENERAL, + "Screwdrive to change mode", EnumChatFormatting.BLUE + "Looks for his pa", EnumChatFormatting.BLUE + "Emits signal when happy" }; diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index bb0cfbb59e..4de4d2a4da 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -331,6 +331,48 @@ gt.blockmachines.emout.tier.12.name=UMV Elemental Output Hatch gt.blockmachines.emout.tier.13.name=UXV Elemental Output Hatch gt.blockmachines.emout.desc=Elemental Output for Multiblocks +#TODO change tier.05 to tier.04 +gt.blockmachines.hatch.param.tier.05.name=Parametrizer +gt.blockmachines.hatch.param.tier.07.name=Parametrizer X +gt.blockmachines.hatch.param.tier.10.name=Parametrizer tXt +gt.blockmachines.hatch.param.desc.0=For parametrization of Multiblocks +gt.blockmachines.hatch.param.desc.1=E=mine*craft + +gt.blockmachines.hatch.certain.tier.07.name=Uncertainty Resolver +gt.blockmachines.hatch.certain.tier.10.name=Uncertainty Resolver X +gt.blockmachines.hatch.certain.desc.0=Feeling certain, or not? +gt.blockmachines.hatch.certain.desc.1=Schrödinger equation in a box + +gt.blockmachines.hatch.datain.tier.07.name=Optical Slave Connector +gt.blockmachines.hatch.datain.desc.0=Quantum Data Input for Multiblocks +gt.blockmachines.hatch.datain.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.datain.desc.2=Must be painted to work + +gt.blockmachines.hatch.dataout.tier.07.name=Optical Master Connector +gt.blockmachines.hatch.dataout.desc.0=Quantum Data Output for Multiblocks +gt.blockmachines.hatch.dataout.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.dataout.desc.2=Must be painted to work + +gt.blockmachines.hatch.datainass.tier.07.name=Assembly line Slave Connector +gt.blockmachines.hatch.datainass.desc.0=ItemStack Data Input for Multiblocks +gt.blockmachines.hatch.datainass.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.datainass.desc.2=Must be painted to work + +gt.blockmachines.hatch.dataoutass.tier.07.name=Data Bank Master Connector +gt.blockmachines.hatch.dataoutass.desc.0=ItemStack Data Output for Multiblocks +gt.blockmachines.hatch.dataoutass.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.dataoutass.desc.2=Must be painted to work + +gt.blockmachines.hatch.rack.tier.08.name=Computer Rack +gt.blockmachines.hatch.rack.desc.0=4 Slot Rack +gt.blockmachines.hatch.rack.desc.1=Holds Computer Components +gt.blockmachines.hatch.holder.tier.09.name=Object Holder +gt.blockmachines.hatch.holder.desc.0=For Research Station +gt.blockmachines.hatch.holder.desc.1=Advanced Holding Mechanism! +gt.blockmachines.hatch.capacitor.tier.03.name=Capacitor Hatch +gt.blockmachines.hatch.capacitor.desc.0=For Tesla Tower +gt.blockmachines.hatch.capacitor.desc.1=Stores 'nergy! (for a while) + #Casings gt.blockcasingsNH.10.name=UEV Machine Casing gt.blockcasingsNH.11.name=UIV Machine Casing @@ -543,6 +585,29 @@ gt.blockmachines.multimachine.em.blackholegenerator.hint.1=2 - Elemental Hatches gt.blockmachines.multimachine.em.blackholegenerator.desc.0=Singularity based power generation. gt.blockmachines.multimachine.em.blackholegenerator.desc.1=Super unstable!!! +#Pipes +gt.blockmachines.pipe.elementalmatter.name=Quantum "Tunnel" +gt.blockmachines.pipe.elementalmatter.desc.0=Quantum tunneling device. +gt.blockmachines.pipe.elementalmatter.desc.1=Not a portal!!! +gt.blockmachines.pipe.elementalmatter.desc.2=Must be painted to work +gt.blockmachines.pipe.elementalmatter.desc.3=Do not cross, split or turn + +gt.blockmachines.pipe.energystream.name=Laser Vacuum Pipe +gt.blockmachines.pipe.energystream.desc.0=Laser tunneling device. +gt.blockmachines.pipe.energystream.desc.1=Bright Vacuum!!! +gt.blockmachines.pipe.energystream.desc.2=Must be painted to work +gt.blockmachines.pipe.energystream.desc.3=Do not split or turn + +gt.blockmachines.pipe.datastream.name=Optical Fiber Cable +gt.blockmachines.pipe.datastream.desc.0=Advanced data transmission +gt.blockmachines.pipe.datastream.desc.1=Don't stare at the beam! +gt.blockmachines.pipe.datastream.desc.2=Must be painted to work +gt.blockmachines.pipe.datastream.desc.3=Do not cross or split + +#Single blocks +gt.blockmachines.machine.tt.ownerdetector.name=Owner detector +gt.blockmachines.machine.tt.datareader.name=Data Reader + #Keywords and phrases #Example: ID:3 tt.keyword.ID=ID @@ -575,6 +640,12 @@ tt.keyword.Efficiency=Efficiency tt.keyword.PowerPass=PowerPass #Button that vents EM tt.keyword.SafeVoid=SafeVoid +tt.keyword.Parametrizer=Parametrizer +tt.keyword.Value=Value +tt.keyword.Input=Input +tt.keyword.Status=Status +tt.keyword.Content=Content +tt.keyword.PacketHistory=PacketHistory tt.keyphrase.LIFE_TIME=LIFE TIME tt.keyphrase.CARRIES_COLOR=CARRIES COLOR @@ -593,6 +664,10 @@ tt.keyphrase.Tier_Rating=Tier Rating tt.keyphrase.Amp_Rating=Amp Rating tt.keyphrase.Computation_Available=Computation Available tt.keyphrase.Computation_Remaining=Computation Remaining +tt.keyphrase.Content_Stack_Count=Content: Stack Count +tt.keyphrase.Base_computation=Base computation +tt.keyphrase.After_overclocking=After overclocking +tt.keyphrase.Heat_Accumulated=Heat Accumulated #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret -- cgit From 8b23cc83bae6caa56d599379db2c6de6344342f7 Mon Sep 17 00:00:00 2001 From: Bass Date: Thu, 14 Nov 2019 14:48:30 +0000 Subject: Lang functional completion Almost every string should now be present in the lang file, anyone is welcome to contribute additional lang support for other locales. --- .../tectech/thing/block/QuantumGlassItem.java | 5 +- .../tectech/thing/block/ReactorSimItem.java | 5 +- .../tectech/thing/casing/GT_Item_CasingsBA0.java | 34 +--- .../tectech/thing/casing/GT_Item_CasingsTT.java | 65 +++---- .../tectech/thing/casing/GT_Item_HintTT.java | 13 +- .../technus/tectech/thing/item/AvrProgrammer.java | 15 +- .../thing/item/ConstructableTriggerItem.java | 11 +- .../item/DebugElementalInstanceContainer_EM.java | 9 +- .../item/ElementalDefinitionContainer_EM.java | 7 +- .../item/ElementalDefinitionScanStorage_EM.java | 11 +- .../technus/tectech/thing/item/EuMeterGT.java | 29 ++- .../thing/item/FrontRotationTriggerItem.java | 7 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 9 +- .../tectech/thing/item/TeslaCoilCapacitor.java | 9 +- .../tectech/thing/item/TeslaCoilComponent.java | 3 +- .../technus/tectech/thing/item/TeslaCoilCover.java | 11 +- .../technus/tectech/thing/item/TeslaStaff.java | 5 +- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 2 +- .../GT_MetaTileEntity_Hatch_CreativeData.java | 16 +- ...T_MetaTileEntity_Hatch_CreativeMaintenance.java | 8 +- .../GT_MetaTileEntity_Hatch_DataConnector.java | 2 +- .../single/GT_MetaTileEntity_BuckConverter.java | 10 +- .../single/GT_MetaTileEntity_DataReader.java | 7 +- .../single/GT_MetaTileEntity_DebugPollutor.java | 10 +- .../GT_MetaTileEntity_DebugPowerGenerator.java | 10 +- .../GT_MetaTileEntity_DebugStructureWriter.java | 10 +- .../single/GT_MetaTileEntity_OwnerDetector.java | 22 ++- .../single/GT_MetaTileEntity_TeslaCoil.java | 52 ++++-- src/main/resources/assets/tectech/lang/en_US.lang | 202 ++++++++++++++++++++- 29 files changed, 430 insertions(+), 169 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java index aff5f8bbb7..05cbca7990 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java @@ -9,6 +9,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 11.04.2017. @@ -23,7 +24,7 @@ public class QuantumGlassItem extends ItemBlock { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { aList.add(TEC_MARK_EM); - aList.add("Dense yet transparent"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Glassy & Classy"); + aList.add(translateToLocal("tile.quantumGlass.desc.0"));//Dense yet transparent + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("tile.quantumGlass.desc.1"));//Glassy & Classy } } diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java index 4625dca434..14cb682c6f 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java @@ -9,6 +9,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 30.09.2017. @@ -23,7 +24,7 @@ public class ReactorSimItem extends ItemBlock { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { aList.add(TEC_MARK_GENERAL); - aList.add("ReactorSimulator 9001"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Explodes, but not as much..."); + aList.add(translateToLocal("tile.reactorSim.desc.0"));//Fission Reaction Uncertainty Resolver 9001 + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("tile.reactorSim.desc.1"));//Explodes, but not as much... } } diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java index 7decce34ae..31ad485306 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java @@ -9,6 +9,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; import static com.github.technus.tectech.CommonValues.*; +import static net.minecraft.util.StatCollector.translateToLocal; public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract { public GT_Item_CasingsBA0(Block par1) { @@ -17,47 +18,32 @@ public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - if(aStack.getItemDamage() < 15) { + if (aStack.getItemDamage() < 15) { aList.add(BASS_MARK); } else { aList.add(COSMIC_MARK); } switch (aStack.getItemDamage()) { case 0://"Redstone Alloy Primary Tesla Windings" - aList.add("Handles up to 32 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 1://"MV Superconductor Primary Tesla Windings" - aList.add("Handles up to 128 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 2://"HV Superconductor Primary Tesla Windings" - aList.add("Handles up to 512 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 3://"EV Superconductor Primary Tesla Windings" - aList.add("Handles up to 2048 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 4://"IV Superconductor Primary Tesla Windings" - aList.add("Handles up to 8192 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 5://"LuV Superconductor Primary Tesla Windings" - aList.add("Handles up to 32768 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); + aList.add(translateToLocal("gt.blockcasingsBA0.0.desc.0") + " " + V[aStack.getItemDamage() + 1] + " EU/t");//Handles up to + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.0.desc.1"));//What one man calls God, another calls the laws of physics. break; case 6://"Tesla Base Casing" - aList.add("The base of a wondrous contraption"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "it's alive, IT'S ALIVE!"); + aList.add(translateToLocal("gt.blockcasingsBA0.6.desc.0"));//The base of a wondrous contraption + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.6.desc.1"));//it's alive, IT'S ALIVE! break; case 7://"Tesla Toroid Casing" - aList.add("Made out of the finest tin foil!"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faraday suits might come later"); + aList.add(translateToLocal("gt.blockcasingsBA0.7.desc.0"));//Made out of the finest tin foil! + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.7.desc.1"));//Faraday suits might come later break; case 8://"Tesla Secondary Windings" - aList.add("Picks up power from a primary coil"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Who wouldn't want a 32k epoxy multi?"); + aList.add(translateToLocal("gt.blockcasingsBA0.8.desc.0"));//Picks up power from a primary coil + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.8.desc.1"));//Who wouldn't want a 32k epoxy multi? break; default://WTF? aList.add("Damn son where did you get that!?"); diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java index 2fd58c408f..9778b1f846 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java @@ -9,6 +9,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; import static com.github.technus.tectech.CommonValues.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 03.10.2016. @@ -27,68 +28,68 @@ public class GT_Item_CasingsTT extends GT_Item_Casings_Abstract { } switch (aStack.getItemDamage()) { case 0://"High Power Casing" - aList.add("Well suited for high power applications."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "The power levels are rising!"); + aList.add(translateToLocal("gt.blockcasingsTT.0.desc.0"));//Well suited for high power applications. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.0.desc.1"));//The power levels are rising! break; case 1://"Computer Casing" - aList.add("Nice and clean casing."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Dust can break it!?"); + aList.add(translateToLocal("gt.blockcasingsTT.1.desc.0"));//Nice and clean casing. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.1.desc.1"));//Dust can break it!? break; case 2://"Computer Heat Vent" - aList.add("Air vent with a filter."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Perfectly muffled sound!"); + aList.add(translateToLocal("gt.blockcasingsTT.2.desc.0"));//Air vent with a filter. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.2.desc.1"));//Perfectly muffled sound! break; case 3://"Advanced Computer Casing" - aList.add("Contains high bandwidth bus"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "couple thousand qubits wide."); + aList.add(translateToLocal("gt.blockcasingsTT.3.desc.0"));//Contains high bandwidth bus + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.3.desc.1"));//couple thousand qubits wide. break; case 4://"Molecular Casing" - aList.add("Stops elemental things."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Radiation and emotions too..."); + aList.add(translateToLocal("gt.blockcasingsTT.4.desc.0"));//Stops elemental things. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.4.desc.1"));//Radiation and emotions too... break; case 5://"Advanced Molecular Casing" - aList.add("Cooling and stabilization."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "A comfortable machine bed."); + aList.add(translateToLocal("gt.blockcasingsTT.5.desc.0"));//Cooling and stabilization. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.5.desc.1"));//A comfortable machine bed. break; case 6://"Containment Field Generator" - aList.add("Creates a field that..."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "can stop even force carriers."); + aList.add(translateToLocal("gt.blockcasingsTT.6.desc.0"));//Creates a field that... + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.6.desc.1"));//can stop even force carriers. break; case 7://"Molecular Coil" - aList.add("Well it does things too..."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "[Use this coil!]"); + aList.add(translateToLocal("gt.blockcasingsTT.7.desc.0"));//Well it does things too... + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.7.desc.1"));//[Use this coil!] break; case 8://"Collider Hollow Casing" - aList.add("Reinforced accelerator tunnel."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Most advanced pipe ever."); + aList.add(translateToLocal("gt.blockcasingsTT.8.desc.0"));//Reinforced accelerator tunnel. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.8.desc.1"));//Most advanced pipe ever. break; case 9://"Spacetime Altering Casing" - aList.add("C is no longer the limit."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Wibbly wobbly timey wimey stuff."); + aList.add(translateToLocal("gt.blockcasingsTT.9.desc.0"));//c is no longer the limit. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.9.desc.1"));//Wibbly wobbly timey wimey stuff. break; case 10://"Teleportation Casing" - aList.add("Remote connection."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Better touch with a stick."); + aList.add(translateToLocal("gt.blockcasingsTT.10.desc.0"));//Remote connection. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.10.desc.1"));//Better touch with a stick. break; case 11://"Dimensional Bridge Generator" - aList.add("Interdimensional Operations."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Around the universe and other places too."); + aList.add(translateToLocal("gt.blockcasingsTT.11.desc.0"));//Interdimensional Operations. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.11.desc.1"));//Around the universe and other places too. break; case 12://"Ultimate Molecular Casing" - aList.add("Ultimate in every way."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I don't know what it can't do."); + aList.add(translateToLocal("gt.blockcasingsTT.12.desc.0"));//Ultimate in every way. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.12.desc.1"));//I don't know what it can't do. break; case 13://"Ultimate Advanced Molecular Casing" - aList.add("More Ultimate in every way."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I don't know what I am doing!"); + aList.add(translateToLocal("gt.blockcasingsTT.13.desc.0"));//More Ultimate in every way. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.13.desc.1"));//I don't know what I am doing! break; case 14://"Ultimate Containment Field Generator" - aList.add("Black Hole..."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Meh..."); + aList.add(translateToLocal("gt.blockcasingsTT.14.desc.0"));//Black Hole... + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.14.desc.1"));//Meh... break; case 15://"Debug Sides" - aList.add("Lazy man way of determining sides."); - aList.add(EnumChatFormatting.BLUE.toString() + "0, 1, 2, 3, 4, 5, 6?!"); + aList.add(translateToLocal("gt.blockcasingsTT.15.desc.0"));//Lazy man way of determining sides. + aList.add(EnumChatFormatting.BLUE.toString() + translateToLocal("gt.blockcasingsTT.15.desc.1"));//0, 1, 2, 3, 4, 5, 6?! break; default://WTF? aList.add("Damn son where did you get that!?"); diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java index 77e0a4172e..186510ff14 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java @@ -9,6 +9,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 03.10.2016. @@ -21,22 +22,22 @@ public class GT_Item_HintTT extends GT_Item_Casings_Abstract { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { aList.add(TEC_MARK_GENERAL); - aList.add("Helps while building"); + aList.add(translateToLocal("gt.blockhintTT.desc.0"));//Helps while building switch (aStack.getItemDamage()) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Placeholder for a certain group."); + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockhintTT.desc.1"));//Placeholder for a certain group. break; case 12: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "General placeholder."); + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockhintTT.desc.2"));//General placeholder. break; case 13: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Make sure it contains Air material."); + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockhintTT.desc.3"));//Make sure it contains Air material. break; case 14: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Make sure it does not contain Air material."); + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockhintTT.desc.4"));//Make sure it does not contain Air material. break; case 15: - aList.add(EnumChatFormatting.BLUE.toString() + "ERROR, what did u expect?"); + aList.add(EnumChatFormatting.BLUE.toString() + translateToLocal("gt.blockhintTT.desc.5"));//ERROR, what did u expect? break; default://WTF? aList.add("Damn son where did you get that!?"); diff --git a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java index 277c2de355..90f3312342 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java +++ b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java @@ -29,6 +29,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static net.minecraft.util.StatCollector.translateToLocal; @Optional.InterfaceList( {@Optional.Interface(iface="dan200.computercraft.api.media.IMedia",modid = "ComputerCraft"), @@ -111,13 +112,13 @@ public class AvrProgrammer extends Item implements IMedia { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - if(aStack.stackTagCompound.hasKey("avr")) { - NBTTagCompound avr=aStack.stackTagCompound.getCompoundTag("avr"); - aList.add("Current PC: " +avr.getInteger("programCounter")); - aList.add("Awoken: " +avr.getBoolean("awoken")); - aList.add("Active: " +avr.getBoolean("active")); - aList.add("Debug: " +avr.getBoolean("debugRun")); - aList.add("Delay: " +avr.getBoolean("delay")); + if (aStack.stackTagCompound.hasKey("avr")) { + NBTTagCompound avr = aStack.stackTagCompound.getCompoundTag("avr"); + aList.add(translateToLocal("item.em.programmer.desc.0") + ": " + avr.getInteger("programCounter"));//Current PC + aList.add(translateToLocal("item.em.programmer.desc.1") + ": " + avr.getBoolean("awoken"));//Awoken + aList.add(translateToLocal("item.em.programmer.desc.2") + ": " + avr.getBoolean("active"));//Active + aList.add(translateToLocal("item.em.programmer.desc.3") + ": " + avr.getBoolean("debugRun"));//Debug + aList.add(translateToLocal("item.em.programmer.desc.4") + ": " + avr.getBoolean("delay"));//Delay } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 57f3bbade1..c578f322f6 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -26,6 +26,7 @@ import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.Util.StructureBuilder; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; import static gregtech.api.GregTech_API.sBlockCasings1; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -111,11 +112,11 @@ public final class ConstructableTriggerItem extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.TEC_MARK_GENERAL); - aList.add("Triggers Constructable Interface"); - aList.add(EnumChatFormatting.BLUE + "Shows multiblock construction details,"); - aList.add(EnumChatFormatting.BLUE + "just Use on a multiblock controller."); - aList.add(EnumChatFormatting.BLUE + "(Sneak Use in creative to build)"); - aList.add(EnumChatFormatting.BLUE + "Quantity affects tier/mode/type"); + aList.add(translateToLocal("item.em.constructable.desc.0"));//Triggers Constructable Interface + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.1"));//Shows multiblock construction details, + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.2"));//just Use on a multiblock controller. + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.3"));//(Sneak Use in creative to build) + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.4"));//Quantity affects tier/mode/type } public static void run() { diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index 4d88f321ed..6ebfce328e 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 @@ -32,6 +32,7 @@ import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -118,14 +119,14 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { - aList.add("Contains:"); + aList.add(translateToLocal("item.em.debugContainer.desc.0") + ": ");//Contains Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); } else { - aList.add("Container for elemental matter"); - aList.add(EnumChatFormatting.BLUE + "Right click on elemental hatches"); + 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 } } catch (Exception e) { - aList.add("---Unexpected Termination---"); + aList.add(translateToLocal("item.em.debugContainer.desc.3"));//---Unexpected Termination--- } } 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 c14e231fc9..87c4409171 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 @@ -22,6 +22,7 @@ import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -111,13 +112,13 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { - aList.add("Should Contain:"); + aList.add(translateToLocal("item.em.definitionContainer.desc.0") + ": ");//Should Contain Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); } else { - aList.add("Recipe Hint"); + aList.add(translateToLocal("item.em.definitionContainer.desc.1"));//Recipe Hint } } catch (Exception e) { - aList.add("---Unexpected Termination---"); + aList.add(translateToLocal("item.em.definitionContainer.desc.2"));//---Unexpected Termination--- } } 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 a8f8a083a5..f9aafa1f7f 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 @@ -27,6 +27,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -73,18 +74,18 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.TEC_MARK_EM); try { - if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("elementalInfo")) { - aList.add(EnumChatFormatting.BLUE+"Contains scan result"); - aList.add("Use to read"); + if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("elementalInfo")) { + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.definitionScanStorage.desc.0"));//Contains scan result + aList.add(translateToLocal("item.em.definitionScanStorage.desc.1"));//Use to read //if(DEBUG_MODE) { // aList.add("DEBUG MODE INFO - U CHEATER"); // Collections.addAll(aList, Util.infoFromNBT(aStack.stackTagCompound.getCompoundTag("elementalInfo"))); //} } else { - aList.add("Storage for matter scan data"); + aList.add(translateToLocal("item.em.definitionScanStorage.desc.2"));//Storage for matter scan data } } catch (Exception e) { - aList.add("---Unexpected Termination---"); + aList.add(translateToLocal("item.em.definitionScanStorage.desc.3"));//---Unexpected Termination--- } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java index 4ff7c6991b..8f113c008b 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java +++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java @@ -16,12 +16,15 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; +import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class EuMeterGT extends Item { public static EuMeterGT INSTANCE; @@ -40,15 +43,23 @@ public class EuMeterGT extends Item { return aPlayer instanceof EntityPlayerMP; } if (aPlayer instanceof EntityPlayerMP && !aPlayer.isSneaking() && tTileEntity instanceof IGregTechTileEntity) { + String clientLocale = "en_US"; + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } + if (tTileEntity instanceof BaseMetaTileEntity) { GT_Utility.sendChatToPlayer(aPlayer, EnumChatFormatting.AQUA + "----- X:" + aX + " Y:" + aY + " Z:" + aZ + " D:" + aWorld.provider.dimensionId + " S:" + aSide + " -----"); - GT_Utility.sendChatToPlayer(aPlayer, "Stored energy: " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyStored()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyCapacity())); - GT_Utility.sendChatToPlayer(aPlayer, "Stored EU: " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getStoredEU()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getEUCapacity())); - GT_Utility.sendChatToPlayer(aPlayer, "Average I/O: " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricOutput())); - GT_Utility.sendChatToPlayer(aPlayer, "Voltage I/O (max): " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputVoltage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputVoltage())); - GT_Utility.sendChatToPlayer(aPlayer, "Voltage I/O max: " + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxSafeInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxEnergyOutput())); - GT_Utility.sendChatToPlayer(aPlayer, "Amperage I/O (max): " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputAmperage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputAmperage())); - GT_Utility.sendChatToPlayer(aPlayer, "Side capabilities: " + (((BaseMetaTileEntity) tTileEntity).inputEnergyFrom((byte) aSide) ? "input " : "") + (((BaseMetaTileEntity) tTileEntity).outputsEnergyTo((byte) aSide) ? "output " : "")); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Stored_energy", clientLocale) + ": " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyStored()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyCapacity())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Stored_EU", clientLocale) + ": " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getStoredEU()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getEUCapacity())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Average_IO", clientLocale) + ": " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricOutput())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Average_IO_(max)", clientLocale) + ": " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputVoltage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputVoltage())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Average_IO_max", clientLocale) + ": " + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxSafeInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxEnergyOutput())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Amperage_IO_(max)", clientLocale) + ": " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputAmperage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputAmperage())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Side_capabilities", clientLocale) + ": " + (((BaseMetaTileEntity) tTileEntity).inputEnergyFrom((byte) aSide) ? translateToLocalFormatted("tt.keyword.input", clientLocale) + " " : "") + (((BaseMetaTileEntity) tTileEntity).outputsEnergyTo((byte) aSide) ? translateToLocalFormatted("tt.keyword.output", clientLocale) : "")); return true; } else if (tTileEntity instanceof BaseMetaPipeEntity) { if (((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) { @@ -70,8 +81,8 @@ public class EuMeterGT extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.TEC_MARK_GENERAL); - aList.add("Measures basic EU related stuff"); - aList.add(EnumChatFormatting.BLUE + "Just right click on blocks."); + aList.add(translateToLocal("item.em.EuMeterGT.desc.0"));//Measures basic EU related stuff + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.EuMeterGT.desc.1"));//Just right click on blocks. } public static void run() { diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index 014c8b6721..e678dbd6cb 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -18,6 +18,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -56,9 +57,9 @@ public final class FrontRotationTriggerItem extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.TEC_MARK_GENERAL); - aList.add("Triggers Front Rotation Interface"); - aList.add(EnumChatFormatting.BLUE + "Rotates only the front panel,"); - aList.add(EnumChatFormatting.BLUE + "which allows structure rotation."); + aList.add(translateToLocal("item.em.frontRotate.desc.0"));//Triggers Front Rotation Interface + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.frontRotate.desc.1"));//Rotates only the front panel, + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.frontRotate.desc.2"));//which allows structure rotation. } public static void run() { 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 92215af921..e64ab1eaa6 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 @@ -27,6 +27,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; import static com.github.technus.tectech.thing.CustomItemList.parametrizerMemory; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -131,14 +132,14 @@ public final class ParametrizerMemoryCard extends Item { public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { NBTTagCompound tNBT = aStack.getTagCompound(); aList.add(CommonValues.BASS_MARK); - aList.add("Stores Parameters"); + aList.add(translateToLocal("item.em.parametrizerMemoryCard.desc.0"));//Stores Parameters if (aStack.getItemDamage() == 1) { - aList.add(EnumChatFormatting.BLUE + "Use on Parametrizer/Controller to configure it"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.parametrizerMemoryCard.desc.1"));//Use on Parametrizer/Controller to configure it } else { - aList.add(EnumChatFormatting.BLUE + "Use on Parametrizer to store parameters"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.parametrizerMemoryCard.desc.2"));//Use on Parametrizer to store parameters } - aList.add(EnumChatFormatting.BLUE + "Sneak right click to lock/unlock"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.parametrizerMemoryCard.desc.3"));//Sneak right click to lock/unlock double temp; if(tNBT!=null && tNBT.hasKey("param")) { diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java index 557b356d52..8767982898 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java @@ -17,6 +17,7 @@ import java.util.List; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaCapacitor; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaCoilCapacitor extends Item { @@ -33,12 +34,12 @@ public final class TeslaCoilCapacitor extends Item { public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 4) { - aList.add("Stores " + V[aStack.getItemDamage() + 1] * 512 + " EU in a tesla tower at " + V[aStack.getItemDamage() + 1] + " EU/t"); + aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.0") + " " + V[aStack.getItemDamage() + 1] * 512 + " " + translateToLocal("item.tm.teslaCoilCapacitor.desc.1") +" " + V[aStack.getItemDamage() + 1] + " EU/t");//Stores 16384 EU in a tesla tower at 32 EU/t } else { - aList.add("Yeet this broken item into some spicy water!"); + aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.2"));//Yeet this broken item into some spicy water! } - aList.add(EnumChatFormatting.BLUE + "Insert into a Capacitor hatch of a Tesla Tower"); - aList.add(EnumChatFormatting.BLUE + "Capacitors are the same thing as batteries, right?"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCoilCapacitor.desc.3"));//Insert into a Capacitor hatch of a Tesla Tower + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCoilCapacitor.desc.4"));//Capacitors are the same thing as batteries, right? } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java index cfd6b3b653..2ba984c9cc 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java @@ -16,6 +16,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaComponent; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaCoilComponent extends Item { @@ -31,7 +32,7 @@ public final class TeslaCoilComponent extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - aList.add(EnumChatFormatting.BLUE + "Tesla bois need these!"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.itemTeslaComponent.desc"));//Tesla bois need these! } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java index 2a1fff39a3..cf08c03f38 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java @@ -16,6 +16,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaCover; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaCoilCover extends Item { @@ -33,17 +34,17 @@ public final class TeslaCoilCover extends Item { aList.add(CommonValues.BASS_MARK); switch (aStack.getItemDamage()) { case 0: - aList.add("Tesla-Enables Machines!"); + aList.add(translateToLocal("item.tm.teslaCover.desc.0"));//Tesla-Enables Machines! break; case 1: - aList.add("Tesla-Enables Machines! (BUT LOUDER!!)"); + aList.add(translateToLocal("item.tm.teslaCover.desc.1"));//Tesla-Enables Machines! (BUT LOUDER!!) break; default: - aList.add("Yeet this broken item into some spicy water!"); + aList.add(translateToLocal("item.tm.teslaCover.desc.2"));//Yeet this broken item into some spicy water! break; } - aList.add(EnumChatFormatting.BLUE + "Use on top of a machine to enable Tesla capabilities"); - aList.add(EnumChatFormatting.BLUE + "Who the hell uses cables anyway?"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.3"));//Use on top of a machine to enable Tesla capabilities + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.4"));//Who the hell uses cables anyway? } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java index 0102d367c3..03afa1b66b 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java @@ -14,6 +14,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaStaff; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaStaff extends Item { @@ -27,7 +28,7 @@ public final class TeslaStaff extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - aList.add("Power of the gods, at the whim of a mortal!"); + aList.add(translateToLocal("item.tm.teslaStaff.desc")); } @Override @@ -47,4 +48,4 @@ public final class TeslaStaff extends Item { GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); teslaStaff.set(INSTANCE); } -} \ No newline at end of file +} 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 9b71fea6db..4527a9d6ff 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 @@ -110,7 +110,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor Hatch");//Capacitor Hatch + return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, translateToLocal("gt.blockmachines.hatch.capacitor.tier.03.name"));//Capacitor Hatch } @Override 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 d12b0d42d8..3d18550d09 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,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; +import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Util; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; @@ -10,15 +11,17 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_Utility; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.CommonValues.MOVE_AT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 27.10.2016. */ 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, "Quantum Data Output"); + super(aID, aName, aNameRegional, aTier, ""); Util.setTier(aTier,this); } @@ -114,4 +117,15 @@ public class GT_MetaTileEntity_Hatch_CreativeData extends GT_MetaTileEntity_Hatc } } } + + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.debug.tt.data.desc.0"),//Quantum Data Output + translateToLocal("gt.blockmachines.debug.tt.data.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.debug.tt.data.desc.2")//Must be painted to work + }; + } } 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 fe963c4d51..6f5a9b377c 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 @@ -10,6 +10,8 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static net.minecraft.util.StatCollector.translateToLocal; + public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEntity_Hatch_Maintenance { public GT_MetaTileEntity_Hatch_CreativeMaintenance(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); @@ -24,9 +26,9 @@ public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEnti public String[] getDescription() { return new String[]{ CommonValues.BASS_MARK, - mDescription, - "Does fix everything but itself.", - EnumChatFormatting.AQUA + "Fixing is for plebs!" + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.0"),//For maintaining Multiblocks + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.1"),//Does fix everything but itself. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.2")//Fixing is for plebs! }; } 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 376c5c7294..74564a7a57 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 @@ -173,7 +173,7 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector histLowLimit) { histSettingLow--; @@ -116,7 +122,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB histSettingLow = histSettingHigh - 1; } histLow = (float) histSettingLow / histSteps; - PlayerChatHelper.SendInfo(aPlayer, "Hysteresis low set to " + round(histLow * 100F) + "%"); + PlayerChatHelper.SendInfo(aPlayer, translateToLocalFormatted("tt.keyphrase.Hysteresis_low_set_to", clientLocale) + " " + round(histLow * 100F) + "%"); } } @@ -131,7 +137,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB transferRadius++; } } - PlayerChatHelper.SendInfo(aPlayer, "Tesla radius set to " + transferRadius + "m"); + PlayerChatHelper.SendInfo(aPlayer, translateToLocalFormatted("tt.keyphrase.Tesla_radius_set_to", clientLocale) + " " + transferRadius + "m"); return false; } @@ -158,7 +164,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB } //And after this cheeky-ness, toss the string XD - return powerPassToggle ? "Sending power!" : "Receiving power!"; + return powerPassToggle ? translateToLocalFormatted("tt.keyphrase.Sending_power", clientLocale) + "!" : translateToLocalFormatted("tt.keyphrase.Receiving_power", clientLocale) + "!"; } @Override @@ -336,4 +342,20 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB } sparkList.clear(); } -} \ No newline at end of file + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + +} diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 4de4d2a4da..b3ae51a407 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -2,29 +2,88 @@ itemGroup.TecTech=TecTech Interdimensional #Blocks -tile.quantumGlass.name=Quantum Glass tile.quantumStuff.name=Quantum Stuff +tile.quantumGlass.name=Quantum Glass +tile.quantumGlass.desc.0=Dense yet transparent +tile.quantumGlass.desc.1=Glassy & Classy + +tile.reactorSim.name=Reactor Simulator +tile.reactorSim.desc.0=Fission Reaction Uncertainty Resolver 9001 +tile.reactorSim.desc.1=Explodes, but not as much... + #Items +item.em.programmer.name=AVR programmer +item.em.programmer.desc.0=Current PC +item.em.programmer.desc.1=Awoken +item.em.programmer.desc.2=Active +item.em.programmer.desc.3=Debug +item.em.programmer.desc.4=Delay + item.em.debugContainer.name=Debug EM Container +item.em.debugContainer.desc.0=Contains +item.em.debugContainer.desc.1=Container for elemental matter +item.em.debugContainer.desc.2=Right click on elemental hatches +item.em.debugContainer.desc.3=---Unexpected Termination--- + item.em.definitionContainer.name=EM Recipe Hint +item.em.definitionContainer.desc.0=Should Contain +item.em.definitionContainer.desc.1=Recipe Hint +item.em.definitionContainer.desc.2=---Unexpected Termination--- + item.em.definitionScanStorage.name=EM Scan Storage +item.em.definitionScanStorage.desc.0=Contains scan result +item.em.definitionScanStorage.desc.1=Use to read +item.em.definitionScanStorage.desc.2=Storage for matter scan data +item.em.definitionScanStorage.desc.3=---Unexpected Termination--- + item.em.constructable.name=Multiblock Machine Blueprint +item.em.constructable.desc.0=Triggers Constructable Interface +item.em.constructable.desc.1=Shows multiblock construction details, +item.em.constructable.desc.2=just Use on a multiblock controller. +item.em.constructable.desc.3=(Sneak Use in creative to build) +item.em.constructable.desc.4=Quantity affects tier/mode/type + +item.em.EuMeterGT.name=GT EU meter +item.em.EuMeterGT.desc.0=Measures basic EU related stuff +item.em.EuMeterGT.desc.1=Just right click on blocks. + item.em.frontRotate.name=Front Rotation Scrench +item.em.frontRotate.desc.0=Triggers Front Rotation Interface +item.em.frontRotate.desc.1=Rotates only the front panel, +item.em.frontRotate.desc.2=which allows structure rotation. + item.em.parametrizerMemoryCard.name=Parametrizer Memory Card -item.em.EuMeterGT.name=GT EU meter -item.tm.teslaCover.0.name=Tesla Coil Cover -item.tm.teslaCover.1.name=Tesla Coil Cover Rich Edition -item.tm.teslaStaff.name=Tesla Staff +item.em.parametrizerMemoryCard.desc.0=Stores Parameters +item.em.parametrizerMemoryCard.desc.1=Use on Parametrizer/Controller to configure it +item.em.parametrizerMemoryCard.desc.2=Use on Parametrizer to store parameters +item.em.parametrizerMemoryCard.desc.3=Sneak right click to lock/unlock item.tm.teslaCoilCapacitor.0.name=LV Tesla Capacitor item.tm.teslaCoilCapacitor.1.name=MV Tesla Capacitor item.tm.teslaCoilCapacitor.2.name=HV Tesla Capacitor item.tm.teslaCoilCapacitor.3.name=EV Tesla Capacitor item.tm.teslaCoilCapacitor.4.name=IV Tesla Capacitor +item.tm.teslaCoilCapacitor.desc.0=Stores +item.tm.teslaCoilCapacitor.desc.1=EU in a tesla tower at +item.tm.teslaCoilCapacitor.desc.2=Yeet this broken item into some spicy water! +item.tm.teslaCoilCapacitor.desc.3=Insert into a Capacitor hatch of a Tesla Tower +item.tm.teslaCoilCapacitor.desc.4=Capacitors are the same thing as batteries, right? item.tm.itemTeslaComponent.0.name=Electrum Tesla Windings item.tm.itemTeslaComponent.1.name=Superconductive Tesla Windings +item.tm.itemTeslaComponent.desc=Tesla bois need these! + +item.tm.teslaCover.0.name=Tesla Coil Cover +item.tm.teslaCover.1.name=Tesla Coil Cover Rich Edition +item.tm.teslaCover.desc.0=Tesla-Enables Machines! +item.tm.teslaCover.desc.1=Tesla-Enables Machines! (BUT LOUDER!!) +item.tm.teslaCover.desc.2=Yeet this broken item into some spicy water! +item.tm.teslaCover.desc.3=Use on top of a machine to enable Tesla capabilities +item.tm.teslaCover.desc.4=Who the hell uses cables anyway? + +item.tm.teslaStaff.name=Tesla Staff +item.tm.teslaStaff.desc=Power of the gods, at the whim of a mortal! #Death Messages death.attack.microwaving=%1$s was dehydrated by radiation. @@ -381,22 +440,77 @@ gt.blockcasingsNH.13.name=UXV Machine Casing gt.blockcasingsNH.14.name=OPV Machine Casing gt.blockcasingsNH.15.name=MAX Machine Casing +gt.blockhintTT.desc.0=Helps while building +gt.blockhintTT.0.name=Hint 1 dot +gt.blockhintTT.1.name=Hint 2 dot +gt.blockhintTT.2.name=Hint 3 dot +gt.blockhintTT.3.name=Hint 4 dot +gt.blockhintTT.4.name=Hint 5 dot +gt.blockhintTT.5.name=Hint 6 dot +gt.blockhintTT.6.name=Hint 7 dot +gt.blockhintTT.7.name=Hint 8 dot +gt.blockhintTT.8.name=Hint 9 dot +gt.blockhintTT.9.name=Hint 10 dot +gt.blockhintTT.10.name=Hint 11 dot +gt.blockhintTT.11.name=Hint 12 dot +gt.blockhintTT.desc.1=Placeholder for a certain group. +gt.blockhintTT.12.name=Hint general +gt.blockhintTT.desc.2=General placeholder. +gt.blockhintTT.13.name=Hint air +gt.blockhintTT.desc.3=Make sure it contains Air material. +gt.blockhintTT.14.name=Hint no air +gt.blockhintTT.desc.4=Make sure it does not contain Air material. +gt.blockhintTT.15.name=Hint error +gt.blockhintTT.desc.5=ERROR, what did u expect? + gt.blockcasingsTT.0.name=High Power Casing +gt.blockcasingsTT.0.desc.0=Well suited for high power applications. +gt.blockcasingsTT.0.desc.1=The power levels are rising! gt.blockcasingsTT.1.name=Computer Casing -gt.blockcasingsTT.2.name=Computer Heat Vent +gt.blockcasingsTT.1.desc.0=Nice and clean casing. +gt.blockcasingsTT.1.desc.1=Dust can break it!? +gt.3blockcasingsTT.2.name=Computer Heat Vent +gt.blockcasingsTT.2.desc.0=Air vent with a filter. +gt.blockcasingsTT.2.desc.1=Perfectly muffled sound! gt.blockcasingsTT.3.name=Advanced Computer Casing +gt.blockcasingsTT.3.desc.0=Contains high bandwidth bus +gt.blockcasingsTT.3.desc.1=couple thousand qubits wide. gt.blockcasingsTT.4.name=Molecular Casing +gt.blockcasingsTT.4.desc.0=Stops elemental things. +gt.blockcasingsTT.4.desc.1=Radiation and emotions too... gt.blockcasingsTT.5.name=Advanced Molecular Casing +gt.blockcasingsTT.5.desc.0=Cooling and stabilization. +gt.blockcasingsTT.5.desc.1=A comfortable machine bed. gt.blockcasingsTT.6.name=Containment Field Generator +gt.blockcasingsTT.6.desc.0=Creates a field that... +gt.blockcasingsTT.6.desc.1=can stop even force carriers. gt.blockcasingsTT.7.name=Molecular Coil +gt.blockcasingsTT.7.desc.0=Well it does things too... +gt.blockcasingsTT.7.desc.1=[Use this coil!] gt.blockcasingsTT.8.name=Hollow Casing +gt.blockcasingsTT.8.desc.0=Reinforced accelerator tunnel. +gt.blockcasingsTT.8.desc.1=Most advanced pipe ever. gt.blockcasingsTT.9.name=Spacetime Altering Casing +gt.blockcasingsTT.9.desc.0=c is no longer the limit. +gt.blockcasingsTT.9.desc.1=Wibbly wobbly timey wimey stuff. gt.blockcasingsTT.10.name=Teleportation Casing +gt.blockcasingsTT.10.desc.0=Remote connection. +gt.blockcasingsTT.10.desc.1=Better touch with a stick. gt.blockcasingsTT.11.name=Dimensional Bridge Generator +gt.blockcasingsTT.11.desc.0=Interdimensional Operations. +gt.blockcasingsTT.11.desc.1=Around the universe and other places too. gt.blockcasingsTT.12.name=Ultimate Molecular Casing +gt.blockcasingsTT.12.desc.0=Ultimate in every way. +gt.blockcasingsTT.12.desc.1=I don't know what it can't do. gt.blockcasingsTT.13.name=Ultimate Advanced Molecular Casing +gt.blockcasingsTT.13.desc.0=More Ultimate in every way. +gt.blockcasingsTT.13.desc.1=I don't know what I am doing! gt.blockcasingsTT.14.name=Ultimate Containment Field Generator +gt.blockcasingsTT.14.desc.0=Black Hole... +gt.blockcasingsTT.14.desc.1=Meh... gt.blockcasingsTT.15.name=Debug Sides +gt.blockcasingsTT.15.desc.0=Lazy man way of determining sides. +gt.blockcasingsTT.15.desc.1=0, 1, 2, 3, 4, 5, 6?! gt.blockcasingsBA0.0.name=Redstone Alloy Primary Tesla Windings gt.blockcasingsBA0.1.name=MV Superconductor Primary Tesla Windings @@ -404,9 +518,17 @@ gt.blockcasingsBA0.2.name=HV Superconductor Primary Tesla Windings gt.blockcasingsBA0.3.name=EV Superconductor Primary Tesla Windings gt.blockcasingsBA0.4.name=IV Superconductor Primary Tesla Windings gt.blockcasingsBA0.5.name=LuV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.0.desc.0=Handles up to +gt.blockcasingsBA0.0.desc.1=What one man calls God, another calls the laws of physics. gt.blockcasingsBA0.6.name=Tesla Base Casing +gt.blockcasingsBA0.6.desc.0=The base of a wondrous contraption +gt.blockcasingsBA0.6.desc.1=it's alive, IT'S ALIVE! gt.blockcasingsBA0.7.name=Tesla Toroid Casing +gt.blockcasingsBA0.7.desc.0=Made out of the finest tin foil! +gt.blockcasingsBA0.7.desc.1=Faraday suits might come later gt.blockcasingsBA0.8.name=Tesla Secondary Windings +gt.blockcasingsBA0.8.desc.0=Picks up power from a primary coil +gt.blockcasingsBA0.8.desc.1=Who wouldn't want a 32k epoxy multi? #Multiblocks gt.blockmachines.multimachine.em.transformer.name=Active Transformer @@ -606,7 +728,57 @@ gt.blockmachines.pipe.datastream.desc.3=Do not cross or split #Single blocks gt.blockmachines.machine.tt.ownerdetector.name=Owner detector +gt.blockmachines.machine.tt.ownerdetector.desc.0=Screwdrive to change mode +gt.blockmachines.machine.tt.ownerdetector.desc.1=Looks for his pa +gt.blockmachines.machine.tt.ownerdetector.desc.2=Emits signal when happy + gt.blockmachines.machine.tt.datareader.name=Data Reader +gt.blockmachines.machine.tt.datareader.desc.0=Reads Data Sticks and Orbs +gt.blockmachines.machine.tt.datareader.desc.1=Power it up and +gt.blockmachines.machine.tt.datareader.desc.2=Put the data storage in + +gt.blockmachines.machine.tt.buck.05.name=Insane Buck Converter +gt.blockmachines.machine.tt.buck.06.name=Ludicrous Buck Converter +gt.blockmachines.machine.tt.buck.07.name=ZPM Voltage Buck Converter +gt.blockmachines.machine.tt.buck.08.name=Ultimate Power Buck Converter +gt.blockmachines.machine.tt.buck.09.name=Highly Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.10.name=Extremely Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.11.name=Insanely Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.12.name=Mega Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.13.name=Extended Mega Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.desc.0=Electronic voltage regulator +gt.blockmachines.machine.tt.buck.desc.1=Adjustable step down transformer +gt.blockmachines.machine.tt.buck.desc.2=Switching power supply... + +gt.blockmachines.machine.tt.tesla.01.name=Basic Tesla Transceiver +gt.blockmachines.machine.tt.tesla.02.name=Advanced Tesla Transceiver +gt.blockmachines.machine.tt.tesla.03.name=Epyc Tesla Transceiver +gt.blockmachines.machine.tt.tesla.04.name=Ultimate Power Tesla Transceiver +gt.blockmachines.machine.tt.tesla.05.name=Insane Tesla Transceiver +gt.blockmachines.machine.tt.tesla.desc.0=Your Tesla I/O machine of choice +gt.blockmachines.machine.tt.tesla.desc.1=Lightning stoves for the rich + +#Debug blocks +gt.blockmachines.debug.tt.pollutor.name=Debug Pollution Generator +gt.blockmachines.debug.tt.pollutor.desc.0=Shit genny broke! +gt.blockmachines.debug.tt.pollutor.desc.1=Infinite Producer/Consumer +gt.blockmachines.debug.tt.pollutor.desc.2=Since i wanted one... +gt.blockmachines.debug.tt.data.name=Debug Data Hatch +gt.blockmachines.debug.tt.data.desc.0=Quantum Data Output +gt.blockmachines.debug.tt.data.desc.1=High speed fibre optics connector. +gt.blockmachines.debug.tt.data.desc.2=Must be painted to work +gt.blockmachines.debug.tt.maintenance.name=Debug Maintenance Hatch +gt.blockmachines.debug.tt.maintenance.desc.0=For maintaining Multiblocks +gt.blockmachines.debug.tt.maintenance.desc.1=Does fix everything but itself. +gt.blockmachines.debug.tt.maintenance.desc.2=Fixing is for plebs! +gt.blockmachines.debug.tt.genny.name=Debug Power Generator +gt.blockmachines.debug.tt.genny.desc.0=Power from nothing +gt.blockmachines.debug.tt.genny.desc.1=Infinite Producer/Consumer +gt.blockmachines.debug.tt.genny.desc.2=Since i wanted one... +gt.blockmachines.debug.tt.writer.name=Debug Structure Writer +gt.blockmachines.debug.tt.writer.desc.0=Scans Blocks Around +gt.blockmachines.debug.tt.writer.desc.1=Prints Multiblock NonTE structure check code +gt.blockmachines.debug.tt.writer.desc.2=ABC axises aligned to machine front #Keywords and phrases #Example: ID:3 @@ -643,6 +815,8 @@ tt.keyword.SafeVoid=SafeVoid tt.keyword.Parametrizer=Parametrizer tt.keyword.Value=Value tt.keyword.Input=Input +tt.keyword.input=input +tt.keyword.output=output tt.keyword.Status=Status tt.keyword.Content=Content tt.keyword.PacketHistory=PacketHistory @@ -668,6 +842,22 @@ tt.keyphrase.Content_Stack_Count=Content: Stack Count tt.keyphrase.Base_computation=Base computation tt.keyphrase.After_overclocking=After overclocking tt.keyphrase.Heat_Accumulated=Heat Accumulated +tt.keyphrase.Running_interdimensional_scan=Running interdimensional scan +tt.keyphrase.Running_local_dimension_scan=Running local dimension scan +tt.keyphrase.Overdrive_disengaged=Overdrive disengaged +tt.keyphrase.Overdrive_engaged=Overdrive engaged +tt.keyphrase.Hysteresis_high_set_to=Hysteresis high set to +tt.keyphrase.Hysteresis_low_set_to=Hysteresis low set to +tt.keyphrase.Tesla_radius_set_to=Tesla radius set to +tt.keyphrase.Sending_power=Sending power +tt.keyphrase.Receiving_power=Receiving power +tt.keyphrase.Stored_energy=Stored energy +tt.keyphrase.Stored_EU=Stored EU +tt.keyphrase.Average_IO=Average I/O +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 #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret -- cgit From 01088f97ac790a062308e193de1732f8775abc63 Mon Sep 17 00:00:00 2001 From: Bass Date: Thu, 14 Nov 2019 17:55:50 +0000 Subject: Fixed crash on Tesla tower removal nested the onRemoval() due to an occasional java.lang.NullPointerException: Ticking memory connection --- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index a95963f1a7..bd651b4d00 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -35,6 +35,7 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.*; +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.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -441,10 +442,16 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { - super.onRemoval(); - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - cap.getBaseMetaTileEntity().setActive(false); + try { + for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { + cap.getBaseMetaTileEntity().setActive(false); + } + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } } + super.onRemoval(); } @Override -- cgit From 0f741b633ca6ea38f27b1518f9465238b3fc30e6 Mon Sep 17 00:00:00 2001 From: Bass Date: Thu, 14 Nov 2019 17:55:50 +0000 Subject: Revert "Fixed crash on Tesla tower removal" This reverts commit 01088f97ac790a062308e193de1732f8775abc63. --- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index bd651b4d00..a95963f1a7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -35,7 +35,6 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.*; -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.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -442,16 +441,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { - try { - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - cap.getBaseMetaTileEntity().setActive(false); - } - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } super.onRemoval(); + for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { + cap.getBaseMetaTileEntity().setActive(false); + } } @Override -- cgit From 02e565d15a37f51daa9740cd5cd461d2fe72430e Mon Sep 17 00:00:00 2001 From: Bass Date: Thu, 14 Nov 2019 18:48:27 +0000 Subject: Actually fixed crash on Tesla tower removal --- .../metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index a95963f1a7..13b9e72070 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -35,6 +35,7 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.*; +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.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -441,6 +442,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { + for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { + try { + cap.getBaseMetaTileEntity().setActive(false); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } super.onRemoval(); for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { cap.getBaseMetaTileEntity().setActive(false); -- cgit From b6e12a2c46fba15f5205a1d0c2f85408d8e8b9be Mon Sep 17 00:00:00 2001 From: Спартак Date: Thu, 28 Nov 2019 17:24:09 +0600 Subject: Fix some recipes with molten materials --- .../dreamcraft/DreamCraftRecipeLoader.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 605ce17509..362c86ab08 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -258,17 +258,17 @@ public class DreamCraftRecipeLoader implements Runnable { //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); //Energy Hatches UV-UIV - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1000), CustomItemList.eM_energyMulti4_UV.get(1), 100, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), CustomItemList.eM_energyMulti4_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1000), CustomItemList.eM_energyMulti16_UV.get(1), 200, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UHV_UV").get(1), CustomItemList.eM_energyMulti16_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1000), CustomItemList.eM_energyMulti64_UV.get(1), 400, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1152), CustomItemList.eM_energyMulti4_UV.get(1), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), CustomItemList.eM_energyMulti4_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1152), CustomItemList.eM_energyMulti16_UV.get(1), 200, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UHV_UV").get(1), CustomItemList.eM_energyMulti16_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1152), CustomItemList.eM_energyMulti64_UV.get(1), 400, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_MAX.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2000), CustomItemList.eM_energyMulti4_UHV.get(1), 100, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti4_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2000), CustomItemList.eM_energyMulti16_UHV.get(1), 200, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti16_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2000), CustomItemList.eM_energyMulti64_UHV.get(1), 400, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_MAX.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2304), CustomItemList.eM_energyMulti4_UHV.get(1), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti4_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2304), CustomItemList.eM_energyMulti16_UHV.get(1), 200, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti16_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2304), CustomItemList.eM_energyMulti64_UHV.get(1), 400, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UEV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(4000), CustomItemList.eM_energyMulti4_UEV.get(1), 100, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_energyMulti16_UEV.get(1), 200, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_energyMulti64_UEV.get(1), 400, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UEV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(4608), CustomItemList.eM_energyMulti4_UEV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_energyMulti16_UEV.get(1), 200, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_energyMulti64_UEV.get(1), 400, 2000000); //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Energy_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); @@ -422,7 +422,7 @@ public class DreamCraftRecipeLoader implements Runnable { CustomItemList.DATApipe.get(2), }, new FluidStack[]{ Materials.UUMatter.getFluid(500), - Materials.Iridium.getMolten(1000), + Materials.Iridium.getMolten(1296), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1000) }, CustomItemList.holder_Hatch.get(1), 1200, 100000); @@ -1158,7 +1158,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Neutronium, 64), }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(3760), - Materials.Naquadria.getMolten(9000), + Materials.Naquadria.getMolten(9216), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) }, ItemList.ZPM3.get(1), 4000, 1600000); } -- cgit From 330ff68dafde0480a318870f9a7f7b73a8032eb4 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 4 Dec 2019 18:19:55 +0100 Subject: Just in case add null checc --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 11be32f9a5..0c37246de8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -305,8 +305,12 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private void makeStick2(){ String s = tRecipe.mOutput.getDisplayName(); if (getBaseMetaTileEntity().isServerSide()) { - s = lServerNames.get(tRecipe.mOutput.getDisplayName()); - if (s==null) { + if(lServerNames!=null) { + s = lServerNames.get(tRecipe.mOutput.getDisplayName()); + if (s == null) { + s = tRecipe.mOutput.getDisplayName(); + } + }else{ s = tRecipe.mOutput.getDisplayName(); } } -- cgit From 0bd5ec684f6974109d7c520471bd196f482d92ca Mon Sep 17 00:00:00 2001 From: Bass Date: Wed, 4 Dec 2019 18:25:44 +0000 Subject: tiny tesla fix --- .../metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 13b9e72070..9fb7193dd8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -442,19 +442,12 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { + super.onRemoval(); for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - try { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(false); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } } } - super.onRemoval(); - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - cap.getBaseMetaTileEntity().setActive(false); - } } @Override -- cgit From 32b65532b12ad3418e7ac29c5c3c6da254dd1f4e Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Tue, 10 Dec 2019 21:00:28 +0100 Subject: Ultimate battery( and really ultimate) recipes aren't consistent with previous batterys recipes. #5162 https://github.com/GTNewHorizons/NewHorizons/issues/5162 --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 362c86ab08..30b2b0e7ff 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1133,7 +1133,10 @@ public class DreamCraftRecipeLoader implements Runnable { //Batteries TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tritanium, 64L), - new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 4L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, ItemList.Energy_Cluster.get(8L), ItemList.Field_Generator_UV.get(2), ItemList.Circuit_Wafer_HPIC.get(64), @@ -1148,7 +1151,10 @@ public class DreamCraftRecipeLoader implements Runnable { TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.ZPM2.get(1L), 24000, 64, 200000, 6, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, ItemList.ZPM2.get(8), ItemList.Field_Generator_UHV.get(4), ItemList.Circuit_Wafer_UHPIC.get(64), -- cgit From cbb64b70caf4f234ddb40a825c4f74d23bb5a6d8 Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Tue, 10 Dec 2019 21:00:28 +0100 Subject: Ultimate battery( and really ultimate) recipes aren't consistent with previous batterys recipes. #5162 https://github.com/GTNewHorizons/NewHorizons/issues/5162 (cherry picked from commit 32b65532b12ad3418e7ac29c5c3c6da254dd1f4e) --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 362c86ab08..30b2b0e7ff 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1133,7 +1133,10 @@ public class DreamCraftRecipeLoader implements Runnable { //Batteries TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tritanium, 64L), - new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 4L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, ItemList.Energy_Cluster.get(8L), ItemList.Field_Generator_UV.get(2), ItemList.Circuit_Wafer_HPIC.get(64), @@ -1148,7 +1151,10 @@ public class DreamCraftRecipeLoader implements Runnable { TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.ZPM2.get(1L), 24000, 64, 200000, 6, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, ItemList.ZPM2.get(8), ItemList.Field_Generator_UHV.get(4), ItemList.Circuit_Wafer_UHPIC.get(64), -- cgit From da0ac91de49117f3c7242135a17a992b8c2f4644 Mon Sep 17 00:00:00 2001 From: "[Kiwi233]" <[huaxia0611@qq.com]> Date: Sat, 28 Dec 2019 13:35:09 +0800 Subject: Update zh_CN.lang --- src/main/resources/assets/tectech/lang/zh_CN.lang | 871 +++++++++++++++++++++- 1 file changed, 861 insertions(+), 10 deletions(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 5359f04e9b..16d32829f7 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -1,13 +1,864 @@ -itemGroup.TecTech=泛次元钛克科技黑洞研究所 -tile.quantumGlass.name=量子玻璃 +#Creative Tab Name +itemGroup.TecTech=泛银河泰克科技有限公司 + +#Blocks tile.quantumStuff.name=量子物质 -item.em.debugContainer.name=调试用 EM容器 -item.em.definitionContainer.name=EM配方指引 -item.em.debugBuilder.name=多方块机器蓝图 -item.em.parametrizerMemoryCard.name=参量机记忆卡 -death.attack.microwaving=%1$s 被辐射脱水 -death.attack.microwaving.player=%1$s 在与 %2$s 战斗中被辐射脱水 +tile.quantumGlass.name=量子玻璃 +tile.quantumGlass.desc.0=致密但透明 +tile.quantumGlass.desc.1=玻璃&优雅(Glassy & Classy) + +tile.reactorSim.name=反应堆模拟器 +tile.reactorSim.desc.0=裂变反应不确定度解析器9001 +tile.reactorSim.desc.1=爆炸,但没有那么多... + +#Items +item.em.programmer.name=AVR编程器 +item.em.programmer.desc.0=当前PC +item.em.programmer.desc.1=唤醒 +item.em.programmer.desc.2=激活 +item.em.programmer.desc.3=Debug +item.em.programmer.desc.4=延迟 + +item.em.debugContainer.name=调试元物质容器 +item.em.debugContainer.desc.0=包含 +item.em.debugContainer.desc.1=元物质的容器 +item.em.debugContainer.desc.2=右键元物质仓室 +item.em.debugContainer.desc.3=---意外终止--- + +item.em.definitionContainer.name=元物质配方提示 +item.em.definitionContainer.desc.0=需要包含 +item.em.definitionContainer.desc.1=配方提示 +item.em.definitionContainer.desc.2=---意外终止--- + +item.em.definitionScanStorage.name=元物质容器扫描 +item.em.definitionScanStorage.desc.0=包含扫描结果 +item.em.definitionScanStorage.desc.1=用于阅读 +item.em.definitionScanStorage.desc.2=存储元物质扫描数据 +item.em.definitionScanStorage.desc.3=---意外终止--- + +item.em.constructable.name=多方块机器蓝图 +item.em.constructable.desc.0=触发可构造界面 +item.em.constructable.desc.1=显示多方块结构细节, +item.em.constructable.desc.2=只可在多方块控制器上使用. +item.em.constructable.desc.3=(在创造模式下潜行右键可直接构造) +item.em.constructable.desc.4=数量影响等级/模式/类型 + +item.em.EuMeterGT.name=GT EU电表 +item.em.EuMeterGT.desc.0=测量EU相关的基本内容 +item.em.EuMeterGT.desc.1=只需右键方块. + +item.em.frontRotate.name=正面旋转扳手 +item.em.frontRotate.desc.0=触发正面旋转界面 +item.em.frontRotate.desc.1=仅旋转前面板, +item.em.frontRotate.desc.2=允许结构旋转. + +item.em.parametrizerMemoryCard.name=数据化储存卡 +item.em.parametrizerMemoryCard.desc.0=存储参数 +item.em.parametrizerMemoryCard.desc.1=在参数仪/控制器上使用以对其进行配置 +item.em.parametrizerMemoryCard.desc.2=在参数仪上使用以存储参数 +item.em.parametrizerMemoryCard.desc.3=潜行右键以锁定/解锁 + +item.tm.teslaCoilCapacitor.0.name=LV特斯拉电容 +item.tm.teslaCoilCapacitor.1.name=MV特斯拉电容 +item.tm.teslaCoilCapacitor.2.name=HV特斯拉电容 +item.tm.teslaCoilCapacitor.3.name=EV特斯拉电容 +item.tm.teslaCoilCapacitor.4.name=IV特斯拉电容 +item.tm.teslaCoilCapacitor.desc.0=存储量: +item.tm.teslaCoilCapacitor.desc.1=EU;充能速度: +item.tm.teslaCoilCapacitor.desc.2=把这个破碎的东西浸入某种辛辣的水中! +item.tm.teslaCoilCapacitor.desc.3=插入特斯拉电塔的电容仓中 +item.tm.teslaCoilCapacitor.desc.4=电容器就像电池一样,对吗? + +item.tm.itemTeslaComponent.0.name=琥珀金特斯拉绕组 +item.tm.itemTeslaComponent.1.name=超导特斯拉绕组 +item.tm.itemTeslaComponent.desc=特斯拉需要这些! + +item.tm.teslaCover.0.name=特斯拉线圈帽 +item.tm.teslaCover.1.name=加强特斯拉线圈帽 +item.tm.teslaCover.desc.0=特斯拉使能机器! +item.tm.teslaCover.desc.1=特斯拉使能机器! (但非常吵!!) +item.tm.teslaCover.desc.2=把这个破碎的东西浸入某种辛辣的水中! +item.tm.teslaCover.desc.3=对机器顶部右键使用,启用机器的特斯拉供电功能 +item.tm.teslaCover.desc.4=到底谁在用电缆? + +item.tm.teslaStaff.name=特斯拉权杖 +item.tm.teslaStaff.desc=狂妄之人窃取了众神的权柄! + +#Death Messages +death.attack.microwaving=%1$s被辐射脱水。 +death.attack.microwaving.player=%1$s在与%2$s的战斗中被辐射脱水。 +death.attack.elementalPollution=%1$s在错误的空洞中被汽化。 +death.attack.elementalPollution.player=%1$s在与%2$s的战斗中被错误的空洞汽化。 +death.attack.subspace=%1$s受到了降维打击。 +death.attack.subspace.player=%1$s在与%2$s的战斗中受到了降维打击。 + +#Machine hulls +gt.blockmachines.hull.tier.10.name=UEV机器外壳 +gt.blockmachines.hull.tier.11.name=UIV机器外壳 +gt.blockmachines.hull.tier.12.name=UMV机器外壳 +gt.blockmachines.hull.tier.13.name=UXV机器外壳 +gt.blockmachines.hull.tier.14.name=OPV机器外壳 +gt.blockmachines.hull.tier.15.name=MAX机器外壳 + +#Transformers +gt.blockmachines.wetransformer.tier.00.name=ULV高能变压器 +gt.blockmachines.wetransformer.tier.00.desc=LV -> ULV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.01.name=LV高能变压器 +gt.blockmachines.wetransformer.tier.01.desc=MV -> LV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.02.name=MV高能变压器 +gt.blockmachines.wetransformer.tier.02.desc=HV -> MV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.03.name=HV高能变压器 +gt.blockmachines.wetransformer.tier.03.desc=EV -> HV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.04.name=EV高能变压器 +gt.blockmachines.wetransformer.tier.04.desc=IV -> EV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.05.name=IV高能变压器 +gt.blockmachines.wetransformer.tier.05.desc=LuV -> IV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.06.name=LuV高能变压器 +gt.blockmachines.wetransformer.tier.06.desc=ZPM -> LuV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.07.name=ZPM高能变压器 +gt.blockmachines.wetransformer.tier.07.desc=UV -> ZPM (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.08.name=UV高能变压器 +gt.blockmachines.wetransformer.tier.08.desc=UHV -> UV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.09.name=UHV高能变压器 +gt.blockmachines.wetransformer.tier.09.desc=UEV -> UHV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.10.name=UEV高能变压器 +gt.blockmachines.wetransformer.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.11.name=UIV高能变压器 +gt.blockmachines.wetransformer.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.12.name=UMV高能变压器 +gt.blockmachines.wetransformer.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.13.name=UXV高能变压器 +gt.blockmachines.wetransformer.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.14.name=OpV高能变压器 +gt.blockmachines.wetransformer.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +gt.blockmachines.tt.transformer.tier.09.name=UHV变压器 +gt.blockmachines.tt.transformer.tier.09.desc=UEV -> UHV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.10.name=UEV变压器 +gt.blockmachines.tt.transformer.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.11.name=UIV变压器 +gt.blockmachines.tt.transformer.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.12.name=UMV变压器 +gt.blockmachines.tt.transformer.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.13.name=UXV变压器 +gt.blockmachines.tt.transformer.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.14.name=OpV变压器 +gt.blockmachines.tt.transformer.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +gt.blockmachines.transformer.ha.tier.09.name=UHV高电流变压器 +gt.blockmachines.transformer.ha.tier.09.desc=UEV -> UHV (用软锤右击以反转 +gt.blockmachines.transformer.ha.tier.10.name=UEV高电流变压器 +gt.blockmachines.transformer.ha.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.11.name=UIV高电流变压器 +gt.blockmachines.transformer.ha.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.12.name=UMV高电流变压器 +gt.blockmachines.transformer.ha.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.13.name=UXV高电流变压器 +gt.blockmachines.transformer.ha.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.14.name=OpV高电流变压器 +gt.blockmachines.transformer.ha.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +#Hatches +tt.base.emhatch.desc.0=最大元物质组数: +tt.base.emhatch.desc.1=最大容量: +tt.base.emhatch.desc.2=在这个仓室不处于多方块结构 +tt.base.emhatch.desc.3=中时,在后侧、上侧或下侧放 +tt.base.emhatch.desc.4=置溢流仓以提供过载保护。 +tt.base.emhatch.desc.5=使用量子隧道时,传输距离 +tt.base.emhatch.desc.6=可以沿直线拓展至最多15格 +tt.base.emhatch.desc.7=启用前必须涂色 + +gt.blockmachines.hatch.emmuffler.tier.08.name=UV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.09.name=UHV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.10.name=UEV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.11.name=UIV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.12.name=UMV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.13.name=UXV溢流仓 +gt.blockmachines.hatch.emmuffler.desc.0=清理过剩的元物质 +gt.blockmachines.hatch.emmuffler.desc.1=物质缓存 +gt.blockmachines.hatch.emmuffler.desc.2=清理速度 +gt.blockmachines.hatch.emmuffler.desc.3=请勿阻塞输出! + +gt.blockmachines.hatch.energymulti04.tier.05.name=4安IV能源仓 +gt.blockmachines.hatch.energymulti16.tier.05.name=16安IV能源仓 +gt.blockmachines.hatch.energymulti64.tier.05.name=64安IV能源仓 +gt.blockmachines.hatch.energymulti04.tier.06.name=4安LuV能源仓 +gt.blockmachines.hatch.energymulti16.tier.06.name=16安LuV能源仓 +gt.blockmachines.hatch.energymulti64.tier.06.name=64安LuV能源仓 +gt.blockmachines.hatch.energymulti04.tier.07.name=4安ZPM能源仓 +gt.blockmachines.hatch.energymulti16.tier.07.name=16安ZPM能源仓 +gt.blockmachines.hatch.energymulti64.tier.07.name=64安ZPM能源仓 +gt.blockmachines.hatch.energymulti04.tier.08.name=4安UV能源仓 +gt.blockmachines.hatch.energymulti16.tier.08.name=16安UV能源仓 +gt.blockmachines.hatch.energymulti64.tier.08.name=64安UV能源仓 +gt.blockmachines.hatch.energymulti04.tier.09.name=4安UHV能源仓 +gt.blockmachines.hatch.energymulti16.tier.09.name=16安UHV能源仓 +gt.blockmachines.hatch.energymulti64.tier.09.name=64安UHV能源仓 +gt.blockmachines.hatch.energymulti04.tier.10.name=4安UEV能源仓 +gt.blockmachines.hatch.energymulti16.tier.10.name=16安UEV能源仓 +gt.blockmachines.hatch.energymulti64.tier.10.name=64安UEV能源仓 +gt.blockmachines.hatch.energymulti04.tier.11.name=4安UIV能源仓 +gt.blockmachines.hatch.energymulti16.tier.11.name=16安UIV能源仓 +gt.blockmachines.hatch.energymulti64.tier.11.name=64安UIV能源仓 +gt.blockmachines.hatch.energymulti04.tier.12.name=4安UMV能源仓 +gt.blockmachines.hatch.energymulti16.tier.12.name=16安UMV能源仓 +gt.blockmachines.hatch.energymulti64.tier.12.name=64安UMV能源仓 +gt.blockmachines.hatch.energymulti04.tier.13.name=4安UXV能源仓 +gt.blockmachines.hatch.energymulti16.tier.13.name=16安UXV能源仓 +gt.blockmachines.hatch.energymulti64.tier.13.name=64安UXV能源仓 +gt.blockmachines.hatch.energymulti.desc.0=为多方块机器以高电流输入能源 +gt.blockmachines.hatch.energymulti.desc.1=输入电流 + +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel.tier.14.name=传奇激光靶仓 +gt.blockmachines.hatch.energytunnel.desc.0=多方块机器的能量输入端 +gt.blockmachines.hatch.energytunnel.desc.1=通量 + +gt.blockmachines.hatch.dynamomulti04.tier.05.name=4安IV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.05.name=16安IV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.05.name=64安IV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.06.name=4安LuV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.06.name=16安LuV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.06.name=64安LuV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.07.name=4安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.07.name=16安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.07.name=64安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.08.name=4安UV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.08.name=16安UV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.08.name=64安UV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.09.name=4安UHV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.09.name=16安UHV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.09.name=64安UHV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.10.name=4安UEV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.10.name=16安UEV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.10.name=64安UEV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.11.name=4安UIV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.11.name=16安UIV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.11.name=64安UIV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.12.name=4安UMV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.12.name=16安UMV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.12.name=64安UMV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.13.name=4安IV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.13.name=16安IV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安IV动力仓 +gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 +gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 + +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel.tier.14.name=传奇激光源仓 +gt.blockmachines.hatch.dynamotunnel.desc.0=多方块机器的能量输出端 +gt.blockmachines.hatch.dynamotunnel.desc.1=通量 + +gt.blockmachines.emin.tier.08.name=UV元物质输入仓 +gt.blockmachines.emin.tier.09.name=UHV元物质输入仓 +gt.blockmachines.emin.tier.10.name=UEV元物质输入仓 +gt.blockmachines.emin.tier.11.name=UIV元物质输入仓 +gt.blockmachines.emin.tier.12.name=UMV元物质输入仓 +gt.blockmachines.emin.tier.13.name=UXV元物质输入仓 +gt.blockmachines.emin.desc=多方块机器的元物质输入 + +gt.blockmachines.emout.tier.08.name=UV元物质输出仓 +gt.blockmachines.emout.tier.09.name=UHV元物质输出仓 +gt.blockmachines.emout.tier.10.name=UEV元物质输出仓 +gt.blockmachines.emout.tier.11.name=UIV元物质输出仓 +gt.blockmachines.emout.tier.12.name=UMV元物质输出仓 +gt.blockmachines.emout.tier.13.name=UXV元物质输出仓 +gt.blockmachines.emout.desc=多方块机器的元物质输出 + +#TODO change tier.05 to tier.04 +gt.blockmachines.hatch.param.tier.05.name=参数仪 +gt.blockmachines.hatch.param.tier.07.name=参数仪 X +gt.blockmachines.hatch.param.tier.10.name=参数仪 tXt +gt.blockmachines.hatch.param.desc.0=多方块机器的参数化 +gt.blockmachines.hatch.param.desc.1=E=mine*craft² + +gt.blockmachines.hatch.certain.tier.07.name=未定元解析器 +gt.blockmachines.hatch.certain.tier.10.name=未定元解析器 X +gt.blockmachines.hatch.certain.desc.0=你真的很确定吗? +gt.blockmachines.hatch.certain.desc.1=盒子里的薛定谔方程 + +gt.blockmachines.hatch.datain.tier.07.name=副光学连接端口 +gt.blockmachines.hatch.datain.desc.0=多方块机器的数据输入 +gt.blockmachines.hatch.datain.desc.1=高速光纤接口 +gt.blockmachines.hatch.datain.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.dataout.tier.07.name=主光学连接端口 +gt.blockmachines.hatch.dataout.desc.0=多方块机器的数据输出 +gt.blockmachines.hatch.dataout.desc.1=高速光纤接口 +gt.blockmachines.hatch.dataout.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.datainass.tier.07.name=装配线数据库接口 +gt.blockmachines.hatch.datainass.desc.0=多方块机器的数据输入 +gt.blockmachines.hatch.datainass.desc.1=高速光纤接口 +gt.blockmachines.hatch.datainass.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.dataoutass.tier.07.name=数据库主接口 +gt.blockmachines.hatch.dataoutass.desc.0=多方块机器的数据输出 +gt.blockmachines.hatch.dataoutass.desc.1=高速光纤接口 +gt.blockmachines.hatch.dataoutass.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.rack.tier.08.name=计算机箱 +gt.blockmachines.hatch.rack.desc.0=4插槽机箱 +gt.blockmachines.hatch.rack.desc.1=容纳计算机组件 +gt.blockmachines.hatch.holder.tier.09.name=物品固定容器 +gt.blockmachines.hatch.holder.desc.0=用于研究站 +gt.blockmachines.hatch.holder.desc.1=先进的固定机制! +gt.blockmachines.hatch.capacitor.tier.03.name=电容仓 +gt.blockmachines.hatch.capacitor.desc.0=用于特斯拉电塔 +gt.blockmachines.hatch.capacitor.desc.1=存储'䏍量! (就一会儿) 原文:store 'nergy'(for a while) + +#Casings +gt.blockcasingsNH.10.name=UEV机械方块 +gt.blockcasingsNH.11.name=UIV机械方块 +gt.blockcasingsNH.12.name=UMV机械方块 +gt.blockcasingsNH.13.name=UXV机械方块 +gt.blockcasingsNH.14.name=OPV机械方块 +gt.blockcasingsNH.15.name=MAX机械方块 + +gt.blockhintTT.desc.0=构造时的帮助 +gt.blockhintTT.0.name=提示方块:1号 +gt.blockhintTT.1.name=提示方块:2号 +gt.blockhintTT.2.name=提示方块:3号 +gt.blockhintTT.3.name=提示方块:4号 +gt.blockhintTT.4.name=提示方块:5号 +gt.blockhintTT.5.name=提示方块:6号 +gt.blockhintTT.6.name=提示方块:7号 +gt.blockhintTT.7.name=提示方块:8号 +gt.blockhintTT.8.name=提示方块:9号 +gt.blockhintTT.9.name=提示方块:10号 +gt.blockhintTT.10.name=提示方块:11号 +gt.blockhintTT.11.name=提示方块:12号 +gt.blockhintTT.desc.1=特定组的占位符. +gt.blockhintTT.12.name=提示方块:一般 +gt.blockhintTT.desc.2=一般占位符. +gt.blockhintTT.13.name=提示方块:空气 +gt.blockhintTT.desc.3=确保其中包含空气方块. +gt.blockhintTT.14.name=提示方块:非空气 +gt.blockhintTT.desc.4=确保其中不含空气方块. +gt.blockhintTT.15.name=提示方块:错误 +gt.blockhintTT.desc.5=错误,你希望做什么? + +gt.blockcasingsTT.0.name=超能机械方块 +gt.blockcasingsTT.0.desc.0=非常适合高能应用. +gt.blockcasingsTT.0.desc.1=能量等级正在上升! +gt.blockcasingsTT.1.name=电子计算机械方块 +gt.blockcasingsTT.1.desc.0=又好又干净的外壳. +gt.blockcasingsTT.1.desc.1=灰尘会破坏它!? +gt.3blockcasingsTT.2.name=计算机散热风扇 +gt.blockcasingsTT.2.desc.0=带过滤器的散热风扇. +gt.blockcasingsTT.2.desc.1=完美静音! +gt.blockcasingsTT.3.name=进阶电子计算机械方块 +gt.blockcasingsTT.3.desc.0=包含高带宽总线 +gt.blockcasingsTT.3.desc.1=带宽数千量子比特. +gt.blockcasingsTT.4.name=分子机械方块 +gt.blockcasingsTT.4.desc.0=阻止元物质. +gt.blockcasingsTT.4.desc.1=也阻止了辐射和情绪... +gt.blockcasingsTT.5.name=进阶分子机械方块 +gt.blockcasingsTT.5.desc.0=冷却并稳定. +gt.blockcasingsTT.5.desc.1=舒适的机器基础. +gt.blockcasingsTT.6.name=遏制场发生器 +gt.blockcasingsTT.6.desc.0=产生一个场... +gt.blockcasingsTT.6.desc.1=甚至可以阻止高能粒子. +gt.blockcasingsTT.7.name=分子线圈 +gt.blockcasingsTT.7.desc.0=好吧,它太... +gt.blockcasingsTT.7.desc.1=[用这个线圈!] +gt.blockcasingsTT.8.name=中空机械方块 +gt.blockcasingsTT.8.desc.0=强化加速器通道. +gt.blockcasingsTT.8.desc.1=有史以来最先进的管道. +gt.blockcasingsTT.9.name=时空扭曲机械方块 +gt.blockcasingsTT.9.desc.0=光速不再是限制. +gt.blockcasingsTT.9.desc.1=Wibbly wobbly timey wimey stuff.(欣赏原文吧,表示给跪了,大意是时空摇摆不定) +gt.blockcasingsTT.10.name=传输机械方块 +gt.blockcasingsTT.10.desc.0=远程连接. +gt.blockcasingsTT.10.desc.1=最好别用手碰它. +gt.blockcasingsTT.11.name=维度联络机械方块 +gt.blockcasingsTT.11.desc.0=多维运算. +gt.blockcasingsTT.11.desc.1=宇宙或别的地方. +gt.blockcasingsTT.12.name=终极分子机械方块 +gt.blockcasingsTT.12.desc.0=各方面的终极. +gt.blockcasingsTT.12.desc.1=我不知道它不能做什么. +gt.blockcasingsTT.13.name=究极分子机械方块 +gt.blockcasingsTT.13.desc.0=各方面的究极. +gt.blockcasingsTT.13.desc.1=我不知道自己在做什么! +gt.blockcasingsTT.14.name=终极遏制场发生器 +gt.blockcasingsTT.14.desc.0=黑洞... +gt.blockcasingsTT.14.desc.1=嗯... +gt.blockcasingsTT.15.name=[调试方块] +gt.blockcasingsTT.15.desc.0=懒人确定边的方式. +gt.blockcasingsTT.15.desc.1=0, 1, 2, 3, 4, 5, 6?! + +gt.blockcasingsBA0.0.name=红石合金初级特斯拉绕组 +gt.blockcasingsBA0.1.name=MV超导初级特斯拉绕组 +gt.blockcasingsBA0.2.name=HV超导初级特斯拉绕组 +gt.blockcasingsBA0.3.name=EV超导初级特斯拉绕组 +gt.blockcasingsBA0.4.name=IV超导初级特斯拉绕组 +gt.blockcasingsBA0.5.name=LuV超导初级特斯拉绕组 +gt.blockcasingsBA0.0.desc.0=最高电圧 +gt.blockcasingsBA0.0.desc.1=有的人称这为神迹,另一些人把这叫做物理. +gt.blockcasingsBA0.6.name=特斯拉基座机械方块 +gt.blockcasingsBA0.6.desc.0=一种奇妙机器的基础 +gt.blockcasingsBA0.6.desc.1=它是活的,它是活的! +gt.blockcasingsBA0.7.name=特斯拉线圈机械方块 +gt.blockcasingsBA0.7.desc.0=用最好的铝箔制成! +gt.blockcasingsBA0.7.desc.1=法拉第套装稍晚到来 +gt.blockcasingsBA0.8.name=特斯拉次级绕组 +gt.blockcasingsBA0.8.desc.0=从初级绕组获取能量 +gt.blockcasingsBA0.8.desc.1=谁不想要32k的环氧树脂? + +#Multiblocks +gt.blockmachines.multimachine.em.transformer.name=有源变压器 +gt.blockmachines.multimachine.em.transformer.hint=1 - 能源仓、动力仓或超能机械方块 +gt.blockmachines.multimachine.em.transformer.desc.0=变电站 +gt.blockmachines.multimachine.em.transformer.desc.1=任意电压间的相互转换! +gt.blockmachines.multimachine.em.transformer.desc.2=只有0.78125%的能量损失, HAYO! + +gt.blockmachines.multimachine.tm.microwave.name=微波发生仪 +gt.blockmachines.multimachine.tm.microwave.hint.0=1 - 基础仓室或洁净不锈钢机械方块 +gt.blockmachines.multimachine.tm.microwave.hint.1=也像个漏斗,所以给它个输出总线吧 +gt.blockmachines.multimachine.tm.microwave.desc.0=高频烤炉 +gt.blockmachines.multimachine.tm.microwave.desc.1=从生物到食物,只在转瞬之间! +gt.blockmachines.multimachine.tm.microwave.desc.2=我说用核弹...我的意思是把晚餐放进微波炉! +gt.blockmachines.multimachine.tm.microwave.cfgi.0=功率设置 +gt.blockmachines.multimachine.tm.microwave.cfgi.1=时间设置 +gt.blockmachines.multimachine.tm.microwave.cfgo.0=时间 +gt.blockmachines.multimachine.tm.microwave.cfgo.1=剩余时间 + +gt.blockmachines.multimachine.tm.teslaCoil.name=特斯拉电塔 +gt.blockmachines.multimachine.tm.teslaCoil.hint.0=1 - 基础仓室, 电容仓或特斯拉基座机械方块 +gt.blockmachines.multimachine.tm.teslaCoil.hint.1=2 - 钛框架 +gt.blockmachines.multimachine.tm.teslaCoil.desc.0=无线电源塔 +gt.blockmachines.multimachine.tm.teslaCoil.desc.1=讨厌的线缆不见啦! +gt.blockmachines.multimachine.tm.teslaCoil.desc.2=可能会影响生存几率 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0=迟滞低设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1=迟滞高设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.2=特斯拉电塔传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.3=特斯拉收发器传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.4=加强特斯拉线圈帽传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.5=输出电压设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.6=输出电流设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.7=最小扫描时间设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.8=过载设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.9=闲置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.0=特斯拉电塔传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.1=特斯拉收发器传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.2=加强特斯拉线圈帽传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3=输出电压显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4=输出电流显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.5=能量容量显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.6=已存储能量显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7=充能进度显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8=扫描时间显示 + +gt.blockmachines.multimachine.em.switch.name=QoS网络交换机 +gt.blockmachines.multimachine.em.switch.hint=1 - 基础仓室、光学连接端口或电子计算机机械方块 +gt.blockmachines.multimachine.em.switch.desc.0=用户控制的计算力路由 +gt.blockmachines.multimachine.em.switch.desc.1=服务质量是必须的 + +gt.blockmachines.multimachine.em.computer.name=量子计算机 +gt.blockmachines.multimachine.em.computer.hint.0=1 - 基础仓室、光学连接端口或电子计算机机械方块 +gt.blockmachines.multimachine.em.computer.hint.1=2 - 计算机箱或进阶电子计算机械方块 +gt.blockmachines.multimachine.em.computer.desc=你需要它来处理上面的这串数字 +gt.blockmachines.multimachine.em.computer.cfgi.0=超频比 +gt.blockmachines.multimachine.em.computer.cfgi.1=过压比 +gt.blockmachines.multimachine.em.computer.cfgo.0=当前最大热量 +gt.blockmachines.multimachine.em.computer.cfgo.1=生成算力 + +gt.blockmachines.multimachine.em.databank.name=数据库 +gt.blockmachines.multimachine.em.databank.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.databank.hint.1=2 - 数据访问仓、数据库主接口或电子计算机械方块 +gt.blockmachines.multimachine.em.databank.desc.0=远程装配数据传递 +gt.blockmachines.multimachine.em.databank.desc.1=直接应用于前部 + +gt.blockmachines.multimachine.em.junction.name=物质流枢纽 +gt.blockmachines.multimachine.em.junction.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.junction.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.junction.desc.0=中转物质流 +gt.blockmachines.multimachine.em.junction.desc.1=沿轴运动! + +gt.blockmachines.multimachine.em.mattertoem.name=物质量子化仪 +gt.blockmachines.multimachine.em.mattertoem.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.mattertoem.hint.1=2 - 元物质输出仓 +gt.blockmachines.multimachine.em.mattertoem.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.mattertoem.desc.0=方便地将常规物品转换为量子形态 +gt.blockmachines.multimachine.em.mattertoem.desc.1=使得它们更...不方便 + +gt.blockmachines.multimachine.em.emtomatter.name=物质反量子化仪 +gt.blockmachines.multimachine.em.emtomatter.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.emtomatter.hint.1=2 - 元物质输入仓 +gt.blockmachines.multimachine.em.emtomatter.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.emtomatter.desc.0=将量子转化回 +gt.blockmachines.multimachine.em.emtomatter.desc.1=它们的常规形态...但为什么要这么做? + +gt.blockmachines.multimachine.em.emtoessentia.name=源质反量子化仪 +gt.blockmachines.multimachine.em.emtoessentia.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.emtoessentia.hint.1=2 - 元物质输入仓 +gt.blockmachines.multimachine.em.emtoessentia.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.emtoessentia.hint.3=通用 - 某种源质的储存方块 +gt.blockmachines.multimachine.em.emtoessentia.desc.0=将量子转化回 +gt.blockmachines.multimachine.em.emtoessentia.desc.1=它们的常规形态...但为什么要这么做? + +gt.blockmachines.multimachine.em.essentiatoem.name=源质量子化仪 +gt.blockmachines.multimachine.em.essentiatoem.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.essentiatoem.hint.1=2 - 元物质输出仓 +gt.blockmachines.multimachine.em.essentiatoem.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.essentiatoem.hint.3=通用 - 某种源质的储存方块 +gt.blockmachines.multimachine.em.essentiatoem.desc.0=方便地将常规物品转换为量子形态 +gt.blockmachines.multimachine.em.essentiatoem.desc.1=使得它们更...不方便 + +gt.blockmachines.multimachine.em.scanner.name=元物质扫描仪 +gt.blockmachines.multimachine.em.scanner.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.scanner.hint.1=2 - 元物质输入仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.hint.2=3 - 元物质输出仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.hint.3=4 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.desc.0=它是如何存在的? +gt.blockmachines.multimachine.em.scanner.desc.1=我!不!知!道!(至少暂时是这样) + +gt.blockmachines.multimachine.em.research.name=研究站 +gt.blockmachines.multimachine.em.research.hint.0=1 - 基础仓室、光学连接端口或电子计算机械方块 +gt.blockmachines.multimachine.em.research.hint.1=2 - 物品固定容器 +gt.blockmachines.multimachine.em.research.desc.0=哲学家们甚至... +gt.blockmachines.multimachine.em.research.desc.1=从来不曾梦见它! + +gt.blockmachines.multimachine.em.collider.name=物质对撞机 +gt.blockmachines.multimachine.em.collider.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.collider.hint.1=2 - 元物质输入仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.2=3 - 元物质输出仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.3=4 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.4=通用 - 另一个控制器面向相反的方向 +gt.blockmachines.multimachine.em.collider.desc.0=以极高的速度使物质相碰撞 +gt.blockmachines.multimachine.em.collider.desc.1=比光*还快!!! +gt.blockmachines.multimachine.em.collider.mode.0=模式:聚变 +gt.blockmachines.multimachine.em.collider.mode.1=模式:对撞 +gt.blockmachines.multimachine.em.collider.mode.2=模式:未定义 +gt.blockmachines.multimachine.em.collider.mode.3=从属于其他控制器 + +gt.blockmachines.multimachine.em.infuser.name=能量注入仪 +gt.blockmachines.multimachine.em.infuser.hint=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.infuser.desc.0=急速的能量转移! +gt.blockmachines.multimachine.em.infuser.desc.1=瞬间满电! +gt.blockmachines.multimachine.em.infuser.desc.2=但坏掉的时候不会工作! +gt.blockmachines.multimachine.em.infuser.desc.3=以及你需要考虑一下损耗... + +gt.blockmachines.multimachine.em.processing.name=量子加工机 +gt.blockmachines.multimachine.em.processing.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.processing.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.processing.desc.0=从你最启用它开始... +gt.blockmachines.multimachine.em.processing.desc.1=为你处理量子物质 + +gt.blockmachines.multimachine.em.crafter.name=物质组装机 +gt.blockmachines.multimachine.em.crafter.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.crafter.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.crafter.desc.0=以最精确的方法制造物品。 +gt.blockmachines.multimachine.em.crafter.desc.1=(跨过普朗克尺度的过程) + +gt.blockmachines.multimachine.em.stabilizer.name=元物质稳定器 +gt.blockmachines.multimachine.em.stabilizer.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.stabilizer.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.stabilizer.desc.0=扭曲时间以稳定物质 +gt.blockmachines.multimachine.em.stabilizer.desc.1=Wibbly wobbly timey wimey stuff.(欣赏原文吧,表示给跪了,大意是时空摇摆不定) + +gt.blockmachines.multimachine.em.wormhole.name=虫洞 +gt.blockmachines.multimachine.em.wormhole.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.wormhole.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.wormhole.desc.0=它并没有充满虫子。 +gt.blockmachines.multimachine.em.wormhole.desc.1=它充满了反虫子!!! + +gt.blockmachines.multimachine.em.decay.name=衰变发生器 +gt.blockmachines.multimachine.em.decay.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.decay.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.decay.desc.0=它的周期太长了吗? +gt.blockmachines.multimachine.em.decay.desc.1=那么就用它的半衰期(3)代替! +gt.blockmachines.multimachine.em.decay.conf=分流器 + +gt.blockmachines.multimachine.em.annihilation.name=湮灭发电机 +gt.blockmachines.multimachine.em.annihilation.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.annihilation.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.annihilation.desc.0=物质和反物质并不是那么喜欢对方。 +gt.blockmachines.multimachine.em.annihilation.desc.1=质能转换! + +gt.blockmachines.multimachine.em.blackholegenerator.name=黑洞发生器 +gt.blockmachines.multimachine.em.blackholegenerator.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.blackholegenerator.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.blackholegenerator.desc.0=基于奇点的能量获取 +gt.blockmachines.multimachine.em.blackholegenerator.desc.1=极端不稳定!!! + +#Pipes +gt.blockmachines.pipe.elementalmatter.name=量子隧道 +gt.blockmachines.pipe.elementalmatter.desc.0=量子隧道设备. +gt.blockmachines.pipe.elementalmatter.desc.1=不是传送门!!! +gt.blockmachines.pipe.elementalmatter.desc.2=启用前必须涂色 +gt.blockmachines.pipe.elementalmatter.desc.3=请勿交叉、分流或转弯 + +gt.blockmachines.pipe.energystream.name=激光真空管 +gt.blockmachines.pipe.energystream.desc.0=激光隧道设备. +gt.blockmachines.pipe.energystream.desc.1=要有光!!! +gt.blockmachines.pipe.energystream.desc.2=启用前必须涂色 +gt.blockmachines.pipe.energystream.desc.3=请勿分流或转弯 + +gt.blockmachines.pipe.datastream.name=光缆 +gt.blockmachines.pipe.datastream.desc.0=高级数据传输设备 +gt.blockmachines.pipe.datastream.desc.1=请勿直视激光! +gt.blockmachines.pipe.datastream.desc.2=启用前必须涂色 +gt.blockmachines.pipe.datastream.desc.3=请勿交叉或分流 + +#Single blocks +gt.blockmachines.machine.tt.ownerdetector.name=所有者检测机 +gt.blockmachines.machine.tt.ownerdetector.desc.0=使用螺丝刀以变更模式 +gt.blockmachines.machine.tt.ownerdetector.desc.1=寻找他的PaPa +gt.blockmachines.machine.tt.ownerdetector.desc.2=高兴时发出信号 + +gt.blockmachines.machine.tt.datareader.name=数据读取机 +gt.blockmachines.machine.tt.datareader.desc.0=读取闪存和数据球 +gt.blockmachines.machine.tt.datareader.desc.1=给它通电,然后 +gt.blockmachines.machine.tt.datareader.desc.2=将数据存储物放进去 + +gt.blockmachines.machine.tt.buck.05.name=IV降压变压器 +gt.blockmachines.machine.tt.buck.06.name=LuV降压变压器 +gt.blockmachines.machine.tt.buck.07.name=ZPM降压变压器 +gt.blockmachines.machine.tt.buck.08.name=UV降压变压器 +gt.blockmachines.machine.tt.buck.09.name=UHV降压变压器 +gt.blockmachines.machine.tt.buck.10.name=UEV降压变压器 +gt.blockmachines.machine.tt.buck.11.name=UIV降压变压器 +gt.blockmachines.machine.tt.buck.12.name=UMV降压变压器 +gt.blockmachines.machine.tt.buck.13.name=UXV降压变压器 +gt.blockmachines.machine.tt.buck.desc.0=电压调节器 +gt.blockmachines.machine.tt.buck.desc.1=可调降压变压器 +gt.blockmachines.machine.tt.buck.desc.2=开关电源... + +gt.blockmachines.machine.tt.tesla.01.name=基础特斯拉收发器 +gt.blockmachines.machine.tt.tesla.02.name=进阶特斯拉收发器 +gt.blockmachines.machine.tt.tesla.03.name=霄龙特斯拉收发器 +gt.blockmachines.machine.tt.tesla.04.name=极限特斯拉收发器 +gt.blockmachines.machine.tt.tesla.05.name=疯狂特斯拉收发器 +gt.blockmachines.machine.tt.tesla.desc.0=你选择的特斯拉I/O机器 +gt.blockmachines.machine.tt.tesla.desc.1=富人的闪电洪炉 + +#Debug blocks +gt.blockmachines.debug.tt.pollutor.name=Debug污染生成机 +gt.blockmachines.debug.tt.pollutor.desc.0=该死的genny破产了! +gt.blockmachines.debug.tt.pollutor.desc.1=无限的生产者/消费者 +gt.blockmachines.debug.tt.pollutor.desc.2=我只是想要一个... +gt.blockmachines.debug.tt.data.name=Debug数据仓 +gt.blockmachines.debug.tt.data.desc.0=量子数据输出 +gt.blockmachines.debug.tt.data.desc.1=高速光纤接口 +gt.blockmachines.debug.tt.data.desc.2=启用前必须涂色 +gt.blockmachines.debug.tt.maintenance.name=Debug维护仓 +gt.blockmachines.debug.tt.maintenance.desc.0=用于维护多方块 +gt.blockmachines.debug.tt.maintenance.desc.1=它能修好一切,除了自己. +gt.blockmachines.debug.tt.maintenance.desc.2=为人民服务! +gt.blockmachines.debug.tt.genny.name=Debug发电机 +gt.blockmachines.debug.tt.genny.desc.0=凭空而生的能量 +gt.blockmachines.debug.tt.genny.desc.1=一个无限的能源生产/消耗设备 +gt.blockmachines.debug.tt.genny.desc.2=我只是想要一个... +gt.blockmachines.debug.tt.writer.name=Debug结构打印机 +gt.blockmachines.debug.tt.writer.desc.0=扫描周围的方块 +gt.blockmachines.debug.tt.writer.desc.1=打印多方块非实体的结构样式编码 +gt.blockmachines.debug.tt.writer.desc.2=ABC轴沿机器正面确定 + +#Keywords and phrases +#Example: ID:3 +tt.keyword.ID=ID +#Example: 32EU at 1A +tt.keyword.at= +#These are Thaumcraft aspects +tt.keyword.Air=风 +tt.keyword.Earth=地 +tt.keyword.Fire=火 +tt.keyword.Water=水 +tt.keyword.Order=秩序 +tt.keyword.Entropy=混沌 +tt.keyword.Primal=元始 +tt.keyword.Aspect=要素 +tt.keyword.CLASS=CLASS +tt.keyword.NAME=名字 +tt.keyword.CHARGE=充能 +tt.keyword.COLORLESS=无色 +tt.keyword.MASS=物质 +tt.keyword.BOOM=BOOM! +tt.keyword.Destination=目标 +tt.keyword.Weight=质量 +tt.keyword.Source=来源 +tt.keyword.Progress=过程 +tt.keyword.Computation=算力 +#Problemns as in maintanance issues +tt.keyword.Problems=故障 +tt.keyword.Efficiency=效率 +#Button that allows to pass power to other machines +tt.keyword.PowerPass=导能 +#Button that vents EM +tt.keyword.SafeVoid=安全罩 +tt.keyword.Parametrizer=参数仪 +tt.keyword.Value=值 +tt.keyword.Input=输入 +tt.keyword.input=输入 +tt.keyword.output=输出 +tt.keyword.Status=状态 +tt.keyword.Content=内含 +tt.keyword.PacketHistory=封包记录 + +tt.keyphrase.LIFE_TIME=寿命 +tt.keyphrase.CARRIES_COLOR=有色 +tt.keyphrase.提示方块:Details=提示细节 +tt.keyphrase.At_current_energy_level=在当前能级 +#Used when 0 Elemental Matter Stacks +tt.keyphrase.No_Stacks=空 +tt.keyphrase.Contains_EM=存储元物质 +tt.keyphrase.Contained_mass=存储物质 +tt.keyphrase.Mass_Disposal_speed=清理速度 +tt.keyphrase.Muffler_BOOM=溢流BOOM! +tt.keyphrase.Energy_Hatches=能源仓 +tt.keyphrase.Probably_uses=可能用到 +tt.keyphrase.Probably_makes=可能制作 +tt.keyphrase.Tier_Rating=等级 +tt.keyphrase.Amp_Rating=电流 +tt.keyphrase.Computation_Available=可用算力 +tt.keyphrase.Computation_Remaining=剩余算力 +tt.keyphrase.Content_Stack_Count=内含:堆数 +tt.keyphrase.Base_computation=基础算力 +tt.keyphrase.After_overclocking=超频后 +tt.keyphrase.Heat_Accumulated=热量累积 +tt.keyphrase.Running_interdimensional_scan=多维度扫描进行中 +tt.keyphrase.Running_local_dimension_scan=本维度扫描进行中 +tt.keyphrase.Overdrive_disengaged=过载未占用 +tt.keyphrase.Overdrive_engaged=过载已占用 +tt.keyphrase.Hysteresis_high_set_to=滞后高通设置为 +tt.keyphrase.Hysteresis_low_set_to=滞后低通设置为 +tt.keyphrase.Tesla_radius_set_to=特斯拉半径设置为 +tt.keyphrase.Sending_power=发送功率 +tt.keyphrase.Receiving_power=接收功率 +tt.keyphrase.Stored_energy=已存储能量 +tt.keyphrase.Stored_EU=已存储EU +tt.keyphrase.Average_IO=平均I/O +tt.keyphrase.Average_IO_(max)=电压I/O(最大) +tt.keyphrase.Average_IO_max=电压I/O 最大 +tt.keyphrase.Amperage_IO_(max)=电流I/O(最大) +tt.keyphrase.Side_capabilities=辅助功能 -death.attack.elementalPollution=%1$s 被蒸发了 -death.attack.elementalPollution.player=%1$s 在与 %2$s 战斗中被蒸发了 +#OpenTurrets compatibility +tile.turretHeadEM.name=元物质炮塔 +tile.turretBaseEM.name=元物质炮塔基座 -- cgit From 14445c59cc66af7b071c57a439f0c9575d129788 Mon Sep 17 00:00:00 2001 From: Kiwi <42833050+Kiwi233@users.noreply.github.com> Date: Sat, 28 Dec 2019 16:04:22 +0800 Subject: Update zh_CN.lang (#23) --- src/main/resources/assets/tectech/lang/zh_CN.lang | 871 +++++++++++++++++++++- 1 file changed, 861 insertions(+), 10 deletions(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 5359f04e9b..16d32829f7 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -1,13 +1,864 @@ -itemGroup.TecTech=泛次元钛克科技黑洞研究所 -tile.quantumGlass.name=量子玻璃 +#Creative Tab Name +itemGroup.TecTech=泛银河泰克科技有限公司 + +#Blocks tile.quantumStuff.name=量子物质 -item.em.debugContainer.name=调试用 EM容器 -item.em.definitionContainer.name=EM配方指引 -item.em.debugBuilder.name=多方块机器蓝图 -item.em.parametrizerMemoryCard.name=参量机记忆卡 -death.attack.microwaving=%1$s 被辐射脱水 -death.attack.microwaving.player=%1$s 在与 %2$s 战斗中被辐射脱水 +tile.quantumGlass.name=量子玻璃 +tile.quantumGlass.desc.0=致密但透明 +tile.quantumGlass.desc.1=玻璃&优雅(Glassy & Classy) + +tile.reactorSim.name=反应堆模拟器 +tile.reactorSim.desc.0=裂变反应不确定度解析器9001 +tile.reactorSim.desc.1=爆炸,但没有那么多... + +#Items +item.em.programmer.name=AVR编程器 +item.em.programmer.desc.0=当前PC +item.em.programmer.desc.1=唤醒 +item.em.programmer.desc.2=激活 +item.em.programmer.desc.3=Debug +item.em.programmer.desc.4=延迟 + +item.em.debugContainer.name=调试元物质容器 +item.em.debugContainer.desc.0=包含 +item.em.debugContainer.desc.1=元物质的容器 +item.em.debugContainer.desc.2=右键元物质仓室 +item.em.debugContainer.desc.3=---意外终止--- + +item.em.definitionContainer.name=元物质配方提示 +item.em.definitionContainer.desc.0=需要包含 +item.em.definitionContainer.desc.1=配方提示 +item.em.definitionContainer.desc.2=---意外终止--- + +item.em.definitionScanStorage.name=元物质容器扫描 +item.em.definitionScanStorage.desc.0=包含扫描结果 +item.em.definitionScanStorage.desc.1=用于阅读 +item.em.definitionScanStorage.desc.2=存储元物质扫描数据 +item.em.definitionScanStorage.desc.3=---意外终止--- + +item.em.constructable.name=多方块机器蓝图 +item.em.constructable.desc.0=触发可构造界面 +item.em.constructable.desc.1=显示多方块结构细节, +item.em.constructable.desc.2=只可在多方块控制器上使用. +item.em.constructable.desc.3=(在创造模式下潜行右键可直接构造) +item.em.constructable.desc.4=数量影响等级/模式/类型 + +item.em.EuMeterGT.name=GT EU电表 +item.em.EuMeterGT.desc.0=测量EU相关的基本内容 +item.em.EuMeterGT.desc.1=只需右键方块. + +item.em.frontRotate.name=正面旋转扳手 +item.em.frontRotate.desc.0=触发正面旋转界面 +item.em.frontRotate.desc.1=仅旋转前面板, +item.em.frontRotate.desc.2=允许结构旋转. + +item.em.parametrizerMemoryCard.name=数据化储存卡 +item.em.parametrizerMemoryCard.desc.0=存储参数 +item.em.parametrizerMemoryCard.desc.1=在参数仪/控制器上使用以对其进行配置 +item.em.parametrizerMemoryCard.desc.2=在参数仪上使用以存储参数 +item.em.parametrizerMemoryCard.desc.3=潜行右键以锁定/解锁 + +item.tm.teslaCoilCapacitor.0.name=LV特斯拉电容 +item.tm.teslaCoilCapacitor.1.name=MV特斯拉电容 +item.tm.teslaCoilCapacitor.2.name=HV特斯拉电容 +item.tm.teslaCoilCapacitor.3.name=EV特斯拉电容 +item.tm.teslaCoilCapacitor.4.name=IV特斯拉电容 +item.tm.teslaCoilCapacitor.desc.0=存储量: +item.tm.teslaCoilCapacitor.desc.1=EU;充能速度: +item.tm.teslaCoilCapacitor.desc.2=把这个破碎的东西浸入某种辛辣的水中! +item.tm.teslaCoilCapacitor.desc.3=插入特斯拉电塔的电容仓中 +item.tm.teslaCoilCapacitor.desc.4=电容器就像电池一样,对吗? + +item.tm.itemTeslaComponent.0.name=琥珀金特斯拉绕组 +item.tm.itemTeslaComponent.1.name=超导特斯拉绕组 +item.tm.itemTeslaComponent.desc=特斯拉需要这些! + +item.tm.teslaCover.0.name=特斯拉线圈帽 +item.tm.teslaCover.1.name=加强特斯拉线圈帽 +item.tm.teslaCover.desc.0=特斯拉使能机器! +item.tm.teslaCover.desc.1=特斯拉使能机器! (但非常吵!!) +item.tm.teslaCover.desc.2=把这个破碎的东西浸入某种辛辣的水中! +item.tm.teslaCover.desc.3=对机器顶部右键使用,启用机器的特斯拉供电功能 +item.tm.teslaCover.desc.4=到底谁在用电缆? + +item.tm.teslaStaff.name=特斯拉权杖 +item.tm.teslaStaff.desc=狂妄之人窃取了众神的权柄! + +#Death Messages +death.attack.microwaving=%1$s被辐射脱水。 +death.attack.microwaving.player=%1$s在与%2$s的战斗中被辐射脱水。 +death.attack.elementalPollution=%1$s在错误的空洞中被汽化。 +death.attack.elementalPollution.player=%1$s在与%2$s的战斗中被错误的空洞汽化。 +death.attack.subspace=%1$s受到了降维打击。 +death.attack.subspace.player=%1$s在与%2$s的战斗中受到了降维打击。 + +#Machine hulls +gt.blockmachines.hull.tier.10.name=UEV机器外壳 +gt.blockmachines.hull.tier.11.name=UIV机器外壳 +gt.blockmachines.hull.tier.12.name=UMV机器外壳 +gt.blockmachines.hull.tier.13.name=UXV机器外壳 +gt.blockmachines.hull.tier.14.name=OPV机器外壳 +gt.blockmachines.hull.tier.15.name=MAX机器外壳 + +#Transformers +gt.blockmachines.wetransformer.tier.00.name=ULV高能变压器 +gt.blockmachines.wetransformer.tier.00.desc=LV -> ULV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.01.name=LV高能变压器 +gt.blockmachines.wetransformer.tier.01.desc=MV -> LV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.02.name=MV高能变压器 +gt.blockmachines.wetransformer.tier.02.desc=HV -> MV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.03.name=HV高能变压器 +gt.blockmachines.wetransformer.tier.03.desc=EV -> HV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.04.name=EV高能变压器 +gt.blockmachines.wetransformer.tier.04.desc=IV -> EV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.05.name=IV高能变压器 +gt.blockmachines.wetransformer.tier.05.desc=LuV -> IV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.06.name=LuV高能变压器 +gt.blockmachines.wetransformer.tier.06.desc=ZPM -> LuV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.07.name=ZPM高能变压器 +gt.blockmachines.wetransformer.tier.07.desc=UV -> ZPM (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.08.name=UV高能变压器 +gt.blockmachines.wetransformer.tier.08.desc=UHV -> UV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.09.name=UHV高能变压器 +gt.blockmachines.wetransformer.tier.09.desc=UEV -> UHV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.10.name=UEV高能变压器 +gt.blockmachines.wetransformer.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.11.name=UIV高能变压器 +gt.blockmachines.wetransformer.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.12.name=UMV高能变压器 +gt.blockmachines.wetransformer.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.13.name=UXV高能变压器 +gt.blockmachines.wetransformer.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.14.name=OpV高能变压器 +gt.blockmachines.wetransformer.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +gt.blockmachines.tt.transformer.tier.09.name=UHV变压器 +gt.blockmachines.tt.transformer.tier.09.desc=UEV -> UHV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.10.name=UEV变压器 +gt.blockmachines.tt.transformer.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.11.name=UIV变压器 +gt.blockmachines.tt.transformer.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.12.name=UMV变压器 +gt.blockmachines.tt.transformer.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.13.name=UXV变压器 +gt.blockmachines.tt.transformer.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.14.name=OpV变压器 +gt.blockmachines.tt.transformer.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +gt.blockmachines.transformer.ha.tier.09.name=UHV高电流变压器 +gt.blockmachines.transformer.ha.tier.09.desc=UEV -> UHV (用软锤右击以反转 +gt.blockmachines.transformer.ha.tier.10.name=UEV高电流变压器 +gt.blockmachines.transformer.ha.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.11.name=UIV高电流变压器 +gt.blockmachines.transformer.ha.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.12.name=UMV高电流变压器 +gt.blockmachines.transformer.ha.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.13.name=UXV高电流变压器 +gt.blockmachines.transformer.ha.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.14.name=OpV高电流变压器 +gt.blockmachines.transformer.ha.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +#Hatches +tt.base.emhatch.desc.0=最大元物质组数: +tt.base.emhatch.desc.1=最大容量: +tt.base.emhatch.desc.2=在这个仓室不处于多方块结构 +tt.base.emhatch.desc.3=中时,在后侧、上侧或下侧放 +tt.base.emhatch.desc.4=置溢流仓以提供过载保护。 +tt.base.emhatch.desc.5=使用量子隧道时,传输距离 +tt.base.emhatch.desc.6=可以沿直线拓展至最多15格 +tt.base.emhatch.desc.7=启用前必须涂色 + +gt.blockmachines.hatch.emmuffler.tier.08.name=UV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.09.name=UHV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.10.name=UEV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.11.name=UIV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.12.name=UMV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.13.name=UXV溢流仓 +gt.blockmachines.hatch.emmuffler.desc.0=清理过剩的元物质 +gt.blockmachines.hatch.emmuffler.desc.1=物质缓存 +gt.blockmachines.hatch.emmuffler.desc.2=清理速度 +gt.blockmachines.hatch.emmuffler.desc.3=请勿阻塞输出! + +gt.blockmachines.hatch.energymulti04.tier.05.name=4安IV能源仓 +gt.blockmachines.hatch.energymulti16.tier.05.name=16安IV能源仓 +gt.blockmachines.hatch.energymulti64.tier.05.name=64安IV能源仓 +gt.blockmachines.hatch.energymulti04.tier.06.name=4安LuV能源仓 +gt.blockmachines.hatch.energymulti16.tier.06.name=16安LuV能源仓 +gt.blockmachines.hatch.energymulti64.tier.06.name=64安LuV能源仓 +gt.blockmachines.hatch.energymulti04.tier.07.name=4安ZPM能源仓 +gt.blockmachines.hatch.energymulti16.tier.07.name=16安ZPM能源仓 +gt.blockmachines.hatch.energymulti64.tier.07.name=64安ZPM能源仓 +gt.blockmachines.hatch.energymulti04.tier.08.name=4安UV能源仓 +gt.blockmachines.hatch.energymulti16.tier.08.name=16安UV能源仓 +gt.blockmachines.hatch.energymulti64.tier.08.name=64安UV能源仓 +gt.blockmachines.hatch.energymulti04.tier.09.name=4安UHV能源仓 +gt.blockmachines.hatch.energymulti16.tier.09.name=16安UHV能源仓 +gt.blockmachines.hatch.energymulti64.tier.09.name=64安UHV能源仓 +gt.blockmachines.hatch.energymulti04.tier.10.name=4安UEV能源仓 +gt.blockmachines.hatch.energymulti16.tier.10.name=16安UEV能源仓 +gt.blockmachines.hatch.energymulti64.tier.10.name=64安UEV能源仓 +gt.blockmachines.hatch.energymulti04.tier.11.name=4安UIV能源仓 +gt.blockmachines.hatch.energymulti16.tier.11.name=16安UIV能源仓 +gt.blockmachines.hatch.energymulti64.tier.11.name=64安UIV能源仓 +gt.blockmachines.hatch.energymulti04.tier.12.name=4安UMV能源仓 +gt.blockmachines.hatch.energymulti16.tier.12.name=16安UMV能源仓 +gt.blockmachines.hatch.energymulti64.tier.12.name=64安UMV能源仓 +gt.blockmachines.hatch.energymulti04.tier.13.name=4安UXV能源仓 +gt.blockmachines.hatch.energymulti16.tier.13.name=16安UXV能源仓 +gt.blockmachines.hatch.energymulti64.tier.13.name=64安UXV能源仓 +gt.blockmachines.hatch.energymulti.desc.0=为多方块机器以高电流输入能源 +gt.blockmachines.hatch.energymulti.desc.1=输入电流 + +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel.tier.14.name=传奇激光靶仓 +gt.blockmachines.hatch.energytunnel.desc.0=多方块机器的能量输入端 +gt.blockmachines.hatch.energytunnel.desc.1=通量 + +gt.blockmachines.hatch.dynamomulti04.tier.05.name=4安IV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.05.name=16安IV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.05.name=64安IV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.06.name=4安LuV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.06.name=16安LuV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.06.name=64安LuV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.07.name=4安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.07.name=16安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.07.name=64安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.08.name=4安UV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.08.name=16安UV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.08.name=64安UV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.09.name=4安UHV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.09.name=16安UHV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.09.name=64安UHV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.10.name=4安UEV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.10.name=16安UEV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.10.name=64安UEV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.11.name=4安UIV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.11.name=16安UIV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.11.name=64安UIV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.12.name=4安UMV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.12.name=16安UMV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.12.name=64安UMV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.13.name=4安IV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.13.name=16安IV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安IV动力仓 +gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 +gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 + +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel.tier.14.name=传奇激光源仓 +gt.blockmachines.hatch.dynamotunnel.desc.0=多方块机器的能量输出端 +gt.blockmachines.hatch.dynamotunnel.desc.1=通量 + +gt.blockmachines.emin.tier.08.name=UV元物质输入仓 +gt.blockmachines.emin.tier.09.name=UHV元物质输入仓 +gt.blockmachines.emin.tier.10.name=UEV元物质输入仓 +gt.blockmachines.emin.tier.11.name=UIV元物质输入仓 +gt.blockmachines.emin.tier.12.name=UMV元物质输入仓 +gt.blockmachines.emin.tier.13.name=UXV元物质输入仓 +gt.blockmachines.emin.desc=多方块机器的元物质输入 + +gt.blockmachines.emout.tier.08.name=UV元物质输出仓 +gt.blockmachines.emout.tier.09.name=UHV元物质输出仓 +gt.blockmachines.emout.tier.10.name=UEV元物质输出仓 +gt.blockmachines.emout.tier.11.name=UIV元物质输出仓 +gt.blockmachines.emout.tier.12.name=UMV元物质输出仓 +gt.blockmachines.emout.tier.13.name=UXV元物质输出仓 +gt.blockmachines.emout.desc=多方块机器的元物质输出 + +#TODO change tier.05 to tier.04 +gt.blockmachines.hatch.param.tier.05.name=参数仪 +gt.blockmachines.hatch.param.tier.07.name=参数仪 X +gt.blockmachines.hatch.param.tier.10.name=参数仪 tXt +gt.blockmachines.hatch.param.desc.0=多方块机器的参数化 +gt.blockmachines.hatch.param.desc.1=E=mine*craft² + +gt.blockmachines.hatch.certain.tier.07.name=未定元解析器 +gt.blockmachines.hatch.certain.tier.10.name=未定元解析器 X +gt.blockmachines.hatch.certain.desc.0=你真的很确定吗? +gt.blockmachines.hatch.certain.desc.1=盒子里的薛定谔方程 + +gt.blockmachines.hatch.datain.tier.07.name=副光学连接端口 +gt.blockmachines.hatch.datain.desc.0=多方块机器的数据输入 +gt.blockmachines.hatch.datain.desc.1=高速光纤接口 +gt.blockmachines.hatch.datain.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.dataout.tier.07.name=主光学连接端口 +gt.blockmachines.hatch.dataout.desc.0=多方块机器的数据输出 +gt.blockmachines.hatch.dataout.desc.1=高速光纤接口 +gt.blockmachines.hatch.dataout.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.datainass.tier.07.name=装配线数据库接口 +gt.blockmachines.hatch.datainass.desc.0=多方块机器的数据输入 +gt.blockmachines.hatch.datainass.desc.1=高速光纤接口 +gt.blockmachines.hatch.datainass.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.dataoutass.tier.07.name=数据库主接口 +gt.blockmachines.hatch.dataoutass.desc.0=多方块机器的数据输出 +gt.blockmachines.hatch.dataoutass.desc.1=高速光纤接口 +gt.blockmachines.hatch.dataoutass.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.rack.tier.08.name=计算机箱 +gt.blockmachines.hatch.rack.desc.0=4插槽机箱 +gt.blockmachines.hatch.rack.desc.1=容纳计算机组件 +gt.blockmachines.hatch.holder.tier.09.name=物品固定容器 +gt.blockmachines.hatch.holder.desc.0=用于研究站 +gt.blockmachines.hatch.holder.desc.1=先进的固定机制! +gt.blockmachines.hatch.capacitor.tier.03.name=电容仓 +gt.blockmachines.hatch.capacitor.desc.0=用于特斯拉电塔 +gt.blockmachines.hatch.capacitor.desc.1=存储'䏍量! (就一会儿) 原文:store 'nergy'(for a while) + +#Casings +gt.blockcasingsNH.10.name=UEV机械方块 +gt.blockcasingsNH.11.name=UIV机械方块 +gt.blockcasingsNH.12.name=UMV机械方块 +gt.blockcasingsNH.13.name=UXV机械方块 +gt.blockcasingsNH.14.name=OPV机械方块 +gt.blockcasingsNH.15.name=MAX机械方块 + +gt.blockhintTT.desc.0=构造时的帮助 +gt.blockhintTT.0.name=提示方块:1号 +gt.blockhintTT.1.name=提示方块:2号 +gt.blockhintTT.2.name=提示方块:3号 +gt.blockhintTT.3.name=提示方块:4号 +gt.blockhintTT.4.name=提示方块:5号 +gt.blockhintTT.5.name=提示方块:6号 +gt.blockhintTT.6.name=提示方块:7号 +gt.blockhintTT.7.name=提示方块:8号 +gt.blockhintTT.8.name=提示方块:9号 +gt.blockhintTT.9.name=提示方块:10号 +gt.blockhintTT.10.name=提示方块:11号 +gt.blockhintTT.11.name=提示方块:12号 +gt.blockhintTT.desc.1=特定组的占位符. +gt.blockhintTT.12.name=提示方块:一般 +gt.blockhintTT.desc.2=一般占位符. +gt.blockhintTT.13.name=提示方块:空气 +gt.blockhintTT.desc.3=确保其中包含空气方块. +gt.blockhintTT.14.name=提示方块:非空气 +gt.blockhintTT.desc.4=确保其中不含空气方块. +gt.blockhintTT.15.name=提示方块:错误 +gt.blockhintTT.desc.5=错误,你希望做什么? + +gt.blockcasingsTT.0.name=超能机械方块 +gt.blockcasingsTT.0.desc.0=非常适合高能应用. +gt.blockcasingsTT.0.desc.1=能量等级正在上升! +gt.blockcasingsTT.1.name=电子计算机械方块 +gt.blockcasingsTT.1.desc.0=又好又干净的外壳. +gt.blockcasingsTT.1.desc.1=灰尘会破坏它!? +gt.3blockcasingsTT.2.name=计算机散热风扇 +gt.blockcasingsTT.2.desc.0=带过滤器的散热风扇. +gt.blockcasingsTT.2.desc.1=完美静音! +gt.blockcasingsTT.3.name=进阶电子计算机械方块 +gt.blockcasingsTT.3.desc.0=包含高带宽总线 +gt.blockcasingsTT.3.desc.1=带宽数千量子比特. +gt.blockcasingsTT.4.name=分子机械方块 +gt.blockcasingsTT.4.desc.0=阻止元物质. +gt.blockcasingsTT.4.desc.1=也阻止了辐射和情绪... +gt.blockcasingsTT.5.name=进阶分子机械方块 +gt.blockcasingsTT.5.desc.0=冷却并稳定. +gt.blockcasingsTT.5.desc.1=舒适的机器基础. +gt.blockcasingsTT.6.name=遏制场发生器 +gt.blockcasingsTT.6.desc.0=产生一个场... +gt.blockcasingsTT.6.desc.1=甚至可以阻止高能粒子. +gt.blockcasingsTT.7.name=分子线圈 +gt.blockcasingsTT.7.desc.0=好吧,它太... +gt.blockcasingsTT.7.desc.1=[用这个线圈!] +gt.blockcasingsTT.8.name=中空机械方块 +gt.blockcasingsTT.8.desc.0=强化加速器通道. +gt.blockcasingsTT.8.desc.1=有史以来最先进的管道. +gt.blockcasingsTT.9.name=时空扭曲机械方块 +gt.blockcasingsTT.9.desc.0=光速不再是限制. +gt.blockcasingsTT.9.desc.1=Wibbly wobbly timey wimey stuff.(欣赏原文吧,表示给跪了,大意是时空摇摆不定) +gt.blockcasingsTT.10.name=传输机械方块 +gt.blockcasingsTT.10.desc.0=远程连接. +gt.blockcasingsTT.10.desc.1=最好别用手碰它. +gt.blockcasingsTT.11.name=维度联络机械方块 +gt.blockcasingsTT.11.desc.0=多维运算. +gt.blockcasingsTT.11.desc.1=宇宙或别的地方. +gt.blockcasingsTT.12.name=终极分子机械方块 +gt.blockcasingsTT.12.desc.0=各方面的终极. +gt.blockcasingsTT.12.desc.1=我不知道它不能做什么. +gt.blockcasingsTT.13.name=究极分子机械方块 +gt.blockcasingsTT.13.desc.0=各方面的究极. +gt.blockcasingsTT.13.desc.1=我不知道自己在做什么! +gt.blockcasingsTT.14.name=终极遏制场发生器 +gt.blockcasingsTT.14.desc.0=黑洞... +gt.blockcasingsTT.14.desc.1=嗯... +gt.blockcasingsTT.15.name=[调试方块] +gt.blockcasingsTT.15.desc.0=懒人确定边的方式. +gt.blockcasingsTT.15.desc.1=0, 1, 2, 3, 4, 5, 6?! + +gt.blockcasingsBA0.0.name=红石合金初级特斯拉绕组 +gt.blockcasingsBA0.1.name=MV超导初级特斯拉绕组 +gt.blockcasingsBA0.2.name=HV超导初级特斯拉绕组 +gt.blockcasingsBA0.3.name=EV超导初级特斯拉绕组 +gt.blockcasingsBA0.4.name=IV超导初级特斯拉绕组 +gt.blockcasingsBA0.5.name=LuV超导初级特斯拉绕组 +gt.blockcasingsBA0.0.desc.0=最高电圧 +gt.blockcasingsBA0.0.desc.1=有的人称这为神迹,另一些人把这叫做物理. +gt.blockcasingsBA0.6.name=特斯拉基座机械方块 +gt.blockcasingsBA0.6.desc.0=一种奇妙机器的基础 +gt.blockcasingsBA0.6.desc.1=它是活的,它是活的! +gt.blockcasingsBA0.7.name=特斯拉线圈机械方块 +gt.blockcasingsBA0.7.desc.0=用最好的铝箔制成! +gt.blockcasingsBA0.7.desc.1=法拉第套装稍晚到来 +gt.blockcasingsBA0.8.name=特斯拉次级绕组 +gt.blockcasingsBA0.8.desc.0=从初级绕组获取能量 +gt.blockcasingsBA0.8.desc.1=谁不想要32k的环氧树脂? + +#Multiblocks +gt.blockmachines.multimachine.em.transformer.name=有源变压器 +gt.blockmachines.multimachine.em.transformer.hint=1 - 能源仓、动力仓或超能机械方块 +gt.blockmachines.multimachine.em.transformer.desc.0=变电站 +gt.blockmachines.multimachine.em.transformer.desc.1=任意电压间的相互转换! +gt.blockmachines.multimachine.em.transformer.desc.2=只有0.78125%的能量损失, HAYO! + +gt.blockmachines.multimachine.tm.microwave.name=微波发生仪 +gt.blockmachines.multimachine.tm.microwave.hint.0=1 - 基础仓室或洁净不锈钢机械方块 +gt.blockmachines.multimachine.tm.microwave.hint.1=也像个漏斗,所以给它个输出总线吧 +gt.blockmachines.multimachine.tm.microwave.desc.0=高频烤炉 +gt.blockmachines.multimachine.tm.microwave.desc.1=从生物到食物,只在转瞬之间! +gt.blockmachines.multimachine.tm.microwave.desc.2=我说用核弹...我的意思是把晚餐放进微波炉! +gt.blockmachines.multimachine.tm.microwave.cfgi.0=功率设置 +gt.blockmachines.multimachine.tm.microwave.cfgi.1=时间设置 +gt.blockmachines.multimachine.tm.microwave.cfgo.0=时间 +gt.blockmachines.multimachine.tm.microwave.cfgo.1=剩余时间 + +gt.blockmachines.multimachine.tm.teslaCoil.name=特斯拉电塔 +gt.blockmachines.multimachine.tm.teslaCoil.hint.0=1 - 基础仓室, 电容仓或特斯拉基座机械方块 +gt.blockmachines.multimachine.tm.teslaCoil.hint.1=2 - 钛框架 +gt.blockmachines.multimachine.tm.teslaCoil.desc.0=无线电源塔 +gt.blockmachines.multimachine.tm.teslaCoil.desc.1=讨厌的线缆不见啦! +gt.blockmachines.multimachine.tm.teslaCoil.desc.2=可能会影响生存几率 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0=迟滞低设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1=迟滞高设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.2=特斯拉电塔传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.3=特斯拉收发器传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.4=加强特斯拉线圈帽传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.5=输出电压设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.6=输出电流设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.7=最小扫描时间设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.8=过载设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.9=闲置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.0=特斯拉电塔传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.1=特斯拉收发器传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.2=加强特斯拉线圈帽传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3=输出电压显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4=输出电流显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.5=能量容量显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.6=已存储能量显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7=充能进度显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8=扫描时间显示 + +gt.blockmachines.multimachine.em.switch.name=QoS网络交换机 +gt.blockmachines.multimachine.em.switch.hint=1 - 基础仓室、光学连接端口或电子计算机机械方块 +gt.blockmachines.multimachine.em.switch.desc.0=用户控制的计算力路由 +gt.blockmachines.multimachine.em.switch.desc.1=服务质量是必须的 + +gt.blockmachines.multimachine.em.computer.name=量子计算机 +gt.blockmachines.multimachine.em.computer.hint.0=1 - 基础仓室、光学连接端口或电子计算机机械方块 +gt.blockmachines.multimachine.em.computer.hint.1=2 - 计算机箱或进阶电子计算机械方块 +gt.blockmachines.multimachine.em.computer.desc=你需要它来处理上面的这串数字 +gt.blockmachines.multimachine.em.computer.cfgi.0=超频比 +gt.blockmachines.multimachine.em.computer.cfgi.1=过压比 +gt.blockmachines.multimachine.em.computer.cfgo.0=当前最大热量 +gt.blockmachines.multimachine.em.computer.cfgo.1=生成算力 + +gt.blockmachines.multimachine.em.databank.name=数据库 +gt.blockmachines.multimachine.em.databank.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.databank.hint.1=2 - 数据访问仓、数据库主接口或电子计算机械方块 +gt.blockmachines.multimachine.em.databank.desc.0=远程装配数据传递 +gt.blockmachines.multimachine.em.databank.desc.1=直接应用于前部 + +gt.blockmachines.multimachine.em.junction.name=物质流枢纽 +gt.blockmachines.multimachine.em.junction.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.junction.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.junction.desc.0=中转物质流 +gt.blockmachines.multimachine.em.junction.desc.1=沿轴运动! + +gt.blockmachines.multimachine.em.mattertoem.name=物质量子化仪 +gt.blockmachines.multimachine.em.mattertoem.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.mattertoem.hint.1=2 - 元物质输出仓 +gt.blockmachines.multimachine.em.mattertoem.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.mattertoem.desc.0=方便地将常规物品转换为量子形态 +gt.blockmachines.multimachine.em.mattertoem.desc.1=使得它们更...不方便 + +gt.blockmachines.multimachine.em.emtomatter.name=物质反量子化仪 +gt.blockmachines.multimachine.em.emtomatter.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.emtomatter.hint.1=2 - 元物质输入仓 +gt.blockmachines.multimachine.em.emtomatter.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.emtomatter.desc.0=将量子转化回 +gt.blockmachines.multimachine.em.emtomatter.desc.1=它们的常规形态...但为什么要这么做? + +gt.blockmachines.multimachine.em.emtoessentia.name=源质反量子化仪 +gt.blockmachines.multimachine.em.emtoessentia.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.emtoessentia.hint.1=2 - 元物质输入仓 +gt.blockmachines.multimachine.em.emtoessentia.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.emtoessentia.hint.3=通用 - 某种源质的储存方块 +gt.blockmachines.multimachine.em.emtoessentia.desc.0=将量子转化回 +gt.blockmachines.multimachine.em.emtoessentia.desc.1=它们的常规形态...但为什么要这么做? + +gt.blockmachines.multimachine.em.essentiatoem.name=源质量子化仪 +gt.blockmachines.multimachine.em.essentiatoem.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.essentiatoem.hint.1=2 - 元物质输出仓 +gt.blockmachines.multimachine.em.essentiatoem.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.essentiatoem.hint.3=通用 - 某种源质的储存方块 +gt.blockmachines.multimachine.em.essentiatoem.desc.0=方便地将常规物品转换为量子形态 +gt.blockmachines.multimachine.em.essentiatoem.desc.1=使得它们更...不方便 + +gt.blockmachines.multimachine.em.scanner.name=元物质扫描仪 +gt.blockmachines.multimachine.em.scanner.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.scanner.hint.1=2 - 元物质输入仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.hint.2=3 - 元物质输出仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.hint.3=4 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.desc.0=它是如何存在的? +gt.blockmachines.multimachine.em.scanner.desc.1=我!不!知!道!(至少暂时是这样) + +gt.blockmachines.multimachine.em.research.name=研究站 +gt.blockmachines.multimachine.em.research.hint.0=1 - 基础仓室、光学连接端口或电子计算机械方块 +gt.blockmachines.multimachine.em.research.hint.1=2 - 物品固定容器 +gt.blockmachines.multimachine.em.research.desc.0=哲学家们甚至... +gt.blockmachines.multimachine.em.research.desc.1=从来不曾梦见它! + +gt.blockmachines.multimachine.em.collider.name=物质对撞机 +gt.blockmachines.multimachine.em.collider.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.collider.hint.1=2 - 元物质输入仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.2=3 - 元物质输出仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.3=4 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.4=通用 - 另一个控制器面向相反的方向 +gt.blockmachines.multimachine.em.collider.desc.0=以极高的速度使物质相碰撞 +gt.blockmachines.multimachine.em.collider.desc.1=比光*还快!!! +gt.blockmachines.multimachine.em.collider.mode.0=模式:聚变 +gt.blockmachines.multimachine.em.collider.mode.1=模式:对撞 +gt.blockmachines.multimachine.em.collider.mode.2=模式:未定义 +gt.blockmachines.multimachine.em.collider.mode.3=从属于其他控制器 + +gt.blockmachines.multimachine.em.infuser.name=能量注入仪 +gt.blockmachines.multimachine.em.infuser.hint=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.infuser.desc.0=急速的能量转移! +gt.blockmachines.multimachine.em.infuser.desc.1=瞬间满电! +gt.blockmachines.multimachine.em.infuser.desc.2=但坏掉的时候不会工作! +gt.blockmachines.multimachine.em.infuser.desc.3=以及你需要考虑一下损耗... + +gt.blockmachines.multimachine.em.processing.name=量子加工机 +gt.blockmachines.multimachine.em.processing.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.processing.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.processing.desc.0=从你最启用它开始... +gt.blockmachines.multimachine.em.processing.desc.1=为你处理量子物质 + +gt.blockmachines.multimachine.em.crafter.name=物质组装机 +gt.blockmachines.multimachine.em.crafter.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.crafter.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.crafter.desc.0=以最精确的方法制造物品。 +gt.blockmachines.multimachine.em.crafter.desc.1=(跨过普朗克尺度的过程) + +gt.blockmachines.multimachine.em.stabilizer.name=元物质稳定器 +gt.blockmachines.multimachine.em.stabilizer.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.stabilizer.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.stabilizer.desc.0=扭曲时间以稳定物质 +gt.blockmachines.multimachine.em.stabilizer.desc.1=Wibbly wobbly timey wimey stuff.(欣赏原文吧,表示给跪了,大意是时空摇摆不定) + +gt.blockmachines.multimachine.em.wormhole.name=虫洞 +gt.blockmachines.multimachine.em.wormhole.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.wormhole.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.wormhole.desc.0=它并没有充满虫子。 +gt.blockmachines.multimachine.em.wormhole.desc.1=它充满了反虫子!!! + +gt.blockmachines.multimachine.em.decay.name=衰变发生器 +gt.blockmachines.multimachine.em.decay.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.decay.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.decay.desc.0=它的周期太长了吗? +gt.blockmachines.multimachine.em.decay.desc.1=那么就用它的半衰期(3)代替! +gt.blockmachines.multimachine.em.decay.conf=分流器 + +gt.blockmachines.multimachine.em.annihilation.name=湮灭发电机 +gt.blockmachines.multimachine.em.annihilation.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.annihilation.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.annihilation.desc.0=物质和反物质并不是那么喜欢对方。 +gt.blockmachines.multimachine.em.annihilation.desc.1=质能转换! + +gt.blockmachines.multimachine.em.blackholegenerator.name=黑洞发生器 +gt.blockmachines.multimachine.em.blackholegenerator.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.blackholegenerator.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.blackholegenerator.desc.0=基于奇点的能量获取 +gt.blockmachines.multimachine.em.blackholegenerator.desc.1=极端不稳定!!! + +#Pipes +gt.blockmachines.pipe.elementalmatter.name=量子隧道 +gt.blockmachines.pipe.elementalmatter.desc.0=量子隧道设备. +gt.blockmachines.pipe.elementalmatter.desc.1=不是传送门!!! +gt.blockmachines.pipe.elementalmatter.desc.2=启用前必须涂色 +gt.blockmachines.pipe.elementalmatter.desc.3=请勿交叉、分流或转弯 + +gt.blockmachines.pipe.energystream.name=激光真空管 +gt.blockmachines.pipe.energystream.desc.0=激光隧道设备. +gt.blockmachines.pipe.energystream.desc.1=要有光!!! +gt.blockmachines.pipe.energystream.desc.2=启用前必须涂色 +gt.blockmachines.pipe.energystream.desc.3=请勿分流或转弯 + +gt.blockmachines.pipe.datastream.name=光缆 +gt.blockmachines.pipe.datastream.desc.0=高级数据传输设备 +gt.blockmachines.pipe.datastream.desc.1=请勿直视激光! +gt.blockmachines.pipe.datastream.desc.2=启用前必须涂色 +gt.blockmachines.pipe.datastream.desc.3=请勿交叉或分流 + +#Single blocks +gt.blockmachines.machine.tt.ownerdetector.name=所有者检测机 +gt.blockmachines.machine.tt.ownerdetector.desc.0=使用螺丝刀以变更模式 +gt.blockmachines.machine.tt.ownerdetector.desc.1=寻找他的PaPa +gt.blockmachines.machine.tt.ownerdetector.desc.2=高兴时发出信号 + +gt.blockmachines.machine.tt.datareader.name=数据读取机 +gt.blockmachines.machine.tt.datareader.desc.0=读取闪存和数据球 +gt.blockmachines.machine.tt.datareader.desc.1=给它通电,然后 +gt.blockmachines.machine.tt.datareader.desc.2=将数据存储物放进去 + +gt.blockmachines.machine.tt.buck.05.name=IV降压变压器 +gt.blockmachines.machine.tt.buck.06.name=LuV降压变压器 +gt.blockmachines.machine.tt.buck.07.name=ZPM降压变压器 +gt.blockmachines.machine.tt.buck.08.name=UV降压变压器 +gt.blockmachines.machine.tt.buck.09.name=UHV降压变压器 +gt.blockmachines.machine.tt.buck.10.name=UEV降压变压器 +gt.blockmachines.machine.tt.buck.11.name=UIV降压变压器 +gt.blockmachines.machine.tt.buck.12.name=UMV降压变压器 +gt.blockmachines.machine.tt.buck.13.name=UXV降压变压器 +gt.blockmachines.machine.tt.buck.desc.0=电压调节器 +gt.blockmachines.machine.tt.buck.desc.1=可调降压变压器 +gt.blockmachines.machine.tt.buck.desc.2=开关电源... + +gt.blockmachines.machine.tt.tesla.01.name=基础特斯拉收发器 +gt.blockmachines.machine.tt.tesla.02.name=进阶特斯拉收发器 +gt.blockmachines.machine.tt.tesla.03.name=霄龙特斯拉收发器 +gt.blockmachines.machine.tt.tesla.04.name=极限特斯拉收发器 +gt.blockmachines.machine.tt.tesla.05.name=疯狂特斯拉收发器 +gt.blockmachines.machine.tt.tesla.desc.0=你选择的特斯拉I/O机器 +gt.blockmachines.machine.tt.tesla.desc.1=富人的闪电洪炉 + +#Debug blocks +gt.blockmachines.debug.tt.pollutor.name=Debug污染生成机 +gt.blockmachines.debug.tt.pollutor.desc.0=该死的genny破产了! +gt.blockmachines.debug.tt.pollutor.desc.1=无限的生产者/消费者 +gt.blockmachines.debug.tt.pollutor.desc.2=我只是想要一个... +gt.blockmachines.debug.tt.data.name=Debug数据仓 +gt.blockmachines.debug.tt.data.desc.0=量子数据输出 +gt.blockmachines.debug.tt.data.desc.1=高速光纤接口 +gt.blockmachines.debug.tt.data.desc.2=启用前必须涂色 +gt.blockmachines.debug.tt.maintenance.name=Debug维护仓 +gt.blockmachines.debug.tt.maintenance.desc.0=用于维护多方块 +gt.blockmachines.debug.tt.maintenance.desc.1=它能修好一切,除了自己. +gt.blockmachines.debug.tt.maintenance.desc.2=为人民服务! +gt.blockmachines.debug.tt.genny.name=Debug发电机 +gt.blockmachines.debug.tt.genny.desc.0=凭空而生的能量 +gt.blockmachines.debug.tt.genny.desc.1=一个无限的能源生产/消耗设备 +gt.blockmachines.debug.tt.genny.desc.2=我只是想要一个... +gt.blockmachines.debug.tt.writer.name=Debug结构打印机 +gt.blockmachines.debug.tt.writer.desc.0=扫描周围的方块 +gt.blockmachines.debug.tt.writer.desc.1=打印多方块非实体的结构样式编码 +gt.blockmachines.debug.tt.writer.desc.2=ABC轴沿机器正面确定 + +#Keywords and phrases +#Example: ID:3 +tt.keyword.ID=ID +#Example: 32EU at 1A +tt.keyword.at= +#These are Thaumcraft aspects +tt.keyword.Air=风 +tt.keyword.Earth=地 +tt.keyword.Fire=火 +tt.keyword.Water=水 +tt.keyword.Order=秩序 +tt.keyword.Entropy=混沌 +tt.keyword.Primal=元始 +tt.keyword.Aspect=要素 +tt.keyword.CLASS=CLASS +tt.keyword.NAME=名字 +tt.keyword.CHARGE=充能 +tt.keyword.COLORLESS=无色 +tt.keyword.MASS=物质 +tt.keyword.BOOM=BOOM! +tt.keyword.Destination=目标 +tt.keyword.Weight=质量 +tt.keyword.Source=来源 +tt.keyword.Progress=过程 +tt.keyword.Computation=算力 +#Problemns as in maintanance issues +tt.keyword.Problems=故障 +tt.keyword.Efficiency=效率 +#Button that allows to pass power to other machines +tt.keyword.PowerPass=导能 +#Button that vents EM +tt.keyword.SafeVoid=安全罩 +tt.keyword.Parametrizer=参数仪 +tt.keyword.Value=值 +tt.keyword.Input=输入 +tt.keyword.input=输入 +tt.keyword.output=输出 +tt.keyword.Status=状态 +tt.keyword.Content=内含 +tt.keyword.PacketHistory=封包记录 + +tt.keyphrase.LIFE_TIME=寿命 +tt.keyphrase.CARRIES_COLOR=有色 +tt.keyphrase.提示方块:Details=提示细节 +tt.keyphrase.At_current_energy_level=在当前能级 +#Used when 0 Elemental Matter Stacks +tt.keyphrase.No_Stacks=空 +tt.keyphrase.Contains_EM=存储元物质 +tt.keyphrase.Contained_mass=存储物质 +tt.keyphrase.Mass_Disposal_speed=清理速度 +tt.keyphrase.Muffler_BOOM=溢流BOOM! +tt.keyphrase.Energy_Hatches=能源仓 +tt.keyphrase.Probably_uses=可能用到 +tt.keyphrase.Probably_makes=可能制作 +tt.keyphrase.Tier_Rating=等级 +tt.keyphrase.Amp_Rating=电流 +tt.keyphrase.Computation_Available=可用算力 +tt.keyphrase.Computation_Remaining=剩余算力 +tt.keyphrase.Content_Stack_Count=内含:堆数 +tt.keyphrase.Base_computation=基础算力 +tt.keyphrase.After_overclocking=超频后 +tt.keyphrase.Heat_Accumulated=热量累积 +tt.keyphrase.Running_interdimensional_scan=多维度扫描进行中 +tt.keyphrase.Running_local_dimension_scan=本维度扫描进行中 +tt.keyphrase.Overdrive_disengaged=过载未占用 +tt.keyphrase.Overdrive_engaged=过载已占用 +tt.keyphrase.Hysteresis_high_set_to=滞后高通设置为 +tt.keyphrase.Hysteresis_low_set_to=滞后低通设置为 +tt.keyphrase.Tesla_radius_set_to=特斯拉半径设置为 +tt.keyphrase.Sending_power=发送功率 +tt.keyphrase.Receiving_power=接收功率 +tt.keyphrase.Stored_energy=已存储能量 +tt.keyphrase.Stored_EU=已存储EU +tt.keyphrase.Average_IO=平均I/O +tt.keyphrase.Average_IO_(max)=电压I/O(最大) +tt.keyphrase.Average_IO_max=电压I/O 最大 +tt.keyphrase.Amperage_IO_(max)=电流I/O(最大) +tt.keyphrase.Side_capabilities=辅助功能 -death.attack.elementalPollution=%1$s 被蒸发了 -death.attack.elementalPollution.player=%1$s 在与 %2$s 战斗中被蒸发了 +#OpenTurrets compatibility +tile.turretHeadEM.name=元物质炮塔 +tile.turretBaseEM.name=元物质炮塔基座 -- cgit From 51bcd0afb70ee185e89478177ddd2866abc22a27 Mon Sep 17 00:00:00 2001 From: Bass Date: Sat, 29 Feb 2020 09:46:31 +0000 Subject: Optical Connector Fix Quick issue patch for Kiwi233 Fixes Optical master connector and Optical slave connector having GUIs on right click --- .../metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main') 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 74564a7a57..6d0706971d 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 @@ -114,7 +114,6 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector Date: Sat, 29 Feb 2020 09:50:59 +0000 Subject: Update GT5u Version --- .../GT_MetaTileEntity_TM_proccessingStack.java | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java new file mode 100644 index 0000000000..9466d9df46 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -0,0 +1,142 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Reference; +import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; +import java.util.HashSet; + +import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.loader.MainLoader.microwaving; +import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; +import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static gregtech.api.GregTech_API.sBlockCasings4; +import static net.minecraft.util.StatCollector.translateToLocal; + +public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables + private boolean hasBeenPausedThisCycle = false; + //endregion + + //region structure + //use multi A energy inputs, use less power the longer it runs + private static final String[][] base = new String[][]{ + {" ",}, + {" 0 ",}, + {" ",}, + }; + private static final String[][] slice = new String[][]{ + {"111",}, + {"101",}, + {"111",}, + }; + private static final String[][] cap = new String[][]{ + {" ",}, + {" 0 ",}, + {" ",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasings4}; + private static final byte[] blockMeta = new byte[]{1}; + + private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; + private static final short[] casingTextures = new short[]{49}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; + private static final byte[] blockMetaFallback = new byte[]{1}; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.hint.0"), + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.hint.1"), + }; + //endregion + + public GT_MetaTileEntity_TM_proccessingStack(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_TM_proccessingStack(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TM_proccessingStack(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 0, 0); + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + return true; + } + + @Override + public void outputAfterRecipe_EM() { + + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.BASS_MARK, + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.0"), + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.1"), + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.2"), + }; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], aActive ? Textures.BlockIcons.CASING_BLOCKS[52] : Textures.BlockIcons.CASING_BLOCKS[53]}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + return true; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + //StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } +} \ No newline at end of file -- cgit From 8018005b583183b20afdba86250295d975467f83 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Fri, 27 Mar 2020 06:29:03 +0100 Subject: Block nerf (#24) * put Irontank mod to the withelist of BlockNerf * bump gt dependencie --- build.properties | 2 +- src/main/java/com/github/technus/tectech/loader/MainLoader.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/build.properties b/build.properties index a86b45bf9b..ce592885df 100644 --- a/build.properties +++ b/build.properties @@ -6,7 +6,7 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=408 +gregtech.jenkinsbuild=420 gregtech.version=5.09.33.32 cofhcore.version=[1.7.10]3.1.4-329-dev yamcore.version=0.5.79 diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index d7d23d7461..7e9a90961e 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -323,6 +323,7 @@ public final class MainLoader { "DraconicEvolution", "IC2NuclearControl", "IronChest", + "irontank", "opensecurity", "openmodularturrets", "Railcraft", -- cgit From b8237f536e3329a24d631be452f1211bd3138ca8 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Tue, 7 Apr 2020 06:21:00 +0200 Subject: Add recipe for IV-ZPM high amp energy hatches #25 (#26) * Add recipe for IV-ZPM high amp energy hatches #25 https://github.com/Technus/TecTech/issues/25 * bump version and gt dependencie to let jenkins build --- build.properties | 4 ++-- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/build.properties b/build.properties index ce592885df..bc29eb3bf9 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=420 -gregtech.version=5.09.33.32 +gregtech.jenkinsbuild=435 +gregtech.version=5.09.33.36 cofhcore.version=[1.7.10]3.1.4-329-dev yamcore.version=0.5.79 baubles.version=1.0.1.10 diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 30b2b0e7ff..8570f74bd8 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -257,7 +257,19 @@ public class DreamCraftRecipeLoader implements Runnable { //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); - //Energy Hatches UV-UIV + //Energy Hatches IV-UIV + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 4)}, Materials.Electrum.getMolten(288), CustomItemList.eM_energyMulti16_LuV.get(1), 200, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_ZPM_LuV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 6)}, Materials.Tungsten.getMolten(288), CustomItemList.eM_energyMulti64_LuV.get(1), 400, 7680); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2)}, Materials.Silver.getMolten(576), CustomItemList.eM_energyMulti4_ZPM.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), CustomItemList.eM_energyMulti4_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 4)}, Materials.Electrum.getMolten(576), CustomItemList.eM_energyMulti16_ZPM.get(1), 200, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UV_ZPM").get(1), CustomItemList.eM_energyMulti16_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 6)}, Materials.Tungsten.getMolten(576), CustomItemList.eM_energyMulti64_ZPM.get(1), 400, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1152), CustomItemList.eM_energyMulti4_UV.get(1), 100, 122880); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), CustomItemList.eM_energyMulti4_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1152), CustomItemList.eM_energyMulti16_UV.get(1), 200, 122880); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UHV_UV").get(1), CustomItemList.eM_energyMulti16_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1152), CustomItemList.eM_energyMulti64_UV.get(1), 400, 122880); -- cgit From 4166b36baafc19f12ca24c9974934361c1afbdc9 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 8 Apr 2020 00:11:30 +0200 Subject: Fix blocks --- build.gradle | 7 +++++++ src/main/java/com/github/technus/tectech/TecTech.java | 1 - .../java/com/github/technus/tectech/loader/MainLoader.java | 13 +++++++------ .../github/technus/tectech/mechanics/avr/SidedRedstone.java | 2 +- src/main/resources/META-INF/tectech_at.cfg | 2 ++ 5 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/META-INF/tectech_at.cfg (limited to 'src/main') diff --git a/build.gradle b/build.gradle index 7c1298fc49..6ec5f8e3e5 100644 --- a/build.gradle +++ b/build.gradle @@ -196,3 +196,10 @@ task signJar(dependsOn: 'reobf') { ) } } + +jar { + manifest + { + attributes "FMLAT": "tectech_at.cfg" + } +} diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 79defc0a1a..9694dadfd3 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -98,7 +98,6 @@ public class TecTech { public void Load(FMLInitializationEvent event) { hasCOFH = Loader.isModLoaded(Reference.COFHCORE); - if(configTecTech.DISABLE_MATERIAL_LOADING_FFS){ try { Field modifiersField = Field.class.getDeclaredField( "modifiers" ); diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 7e9a90961e..1bf95a1936 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -28,6 +28,7 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraftforge.fluids.Fluid; @@ -339,23 +340,23 @@ public final class MainLoader { for(Block block : GameData.getBlockRegistry().typeSafeIterable()) { GameRegistry.UniqueIdentifier uniqueIdentifier=GameRegistry.findUniqueIdentifierFor(block); if (uniqueIdentifier != null) { - if (modIDs.contains(uniqueIdentifier.modId)) {//Full Whitelisted Mods + if (block.blockHardness < 0 || modIDs.contains(uniqueIdentifier.modId)) { continue; } else if ("OpenBlocks".equals(uniqueIdentifier.modId)) { if ("grave".equals(uniqueIdentifier.name)) { continue; } - } else if ("TwilightForest".equals(uniqueIdentifier.modId)){ - if ("tile.TFShield".equals(uniqueIdentifier.name)){ + } else if ("TwilightForest".equals(uniqueIdentifier.modId)) { + if ("tile.TFShield".equals(uniqueIdentifier.name)) { block.setResistance(30); continue; - }else if ("tile.TFThorns".equals(uniqueIdentifier.name)){ + } else if ("tile.TFThorns".equals(uniqueIdentifier.name)) { block.setResistance(10); continue; - }else if ("tile.TFTowerTranslucent".equals(uniqueIdentifier.name)){ + } else if ("tile.TFTowerTranslucent".equals(uniqueIdentifier.name)) { block.setResistance(30); continue; - }else if ("tile.TFDeadrock".equals(uniqueIdentifier.name)) { + } else if ("tile.TFDeadrock".equals(uniqueIdentifier.name)) { block.setResistance(5); continue; } else { diff --git a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java b/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java index fd351631f3..26b83eb1f1 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java +++ b/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java @@ -4,7 +4,7 @@ import com.github.technus.avrClone.AvrCore; import com.github.technus.avrClone.registerPackages.*; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -public class SidedRedstone extends RegisterPackageSync { +public class SidedRedstone extends RegisterPackageSync { public static final RSINT RSINT =new RSINT(); public SidedRedstone(int offset) { diff --git a/src/main/resources/META-INF/tectech_at.cfg b/src/main/resources/META-INF/tectech_at.cfg new file mode 100644 index 0000000000..e09e575a7d --- /dev/null +++ b/src/main/resources/META-INF/tectech_at.cfg @@ -0,0 +1,2 @@ +public net.minecraft.block.Block field_149781_w #blockResistance +public net.minecraft.block.Block field_149782_v #blockHardness \ No newline at end of file -- cgit From d6b7758cce68d65b41fe0810d02a7b5874789cde Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Wed, 8 Apr 2020 17:38:08 +0200 Subject: Add recipe for IV-ZPM high amp energy hatches #25 https://github.com/Technus/TecTech/issues/25 --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 8570f74bd8..75a943b76b 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -258,13 +258,13 @@ public class DreamCraftRecipeLoader implements Runnable { //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); //Energy Hatches IV-UIV - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 4)}, Materials.Electrum.getMolten(288), CustomItemList.eM_energyMulti16_LuV.get(1), 200, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_ZPM_LuV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 6)}, Materials.Tungsten.getMolten(288), CustomItemList.eM_energyMulti64_LuV.get(1), 400, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 4)}, Materials.Electrum.getMolten(288), CustomItemList.eM_energyMulti16_LuV.get(1), 200, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_ZPM_LuV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 6)}, Materials.Tungsten.getMolten(288), CustomItemList.eM_energyMulti64_LuV.get(1), 400, 7680); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2)}, Materials.Silver.getMolten(576), CustomItemList.eM_energyMulti4_ZPM.get(1), 100, 30720); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), CustomItemList.eM_energyMulti4_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 4)}, Materials.Electrum.getMolten(576), CustomItemList.eM_energyMulti16_ZPM.get(1), 200, 30720); -- cgit From f08ea99cff1357e831fd3f3ca03804ca0dbd06fa Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Wed, 8 Apr 2020 17:38:34 +0200 Subject: Add recipe for IV-ZPM high amp energy hatches #25 https://github.com/Technus/TecTech/issues/25 --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 75a943b76b..08faa16d51 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -260,7 +260,7 @@ public class DreamCraftRecipeLoader implements Runnable { //Energy Hatches IV-UIV GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 4)}, Materials.Electrum.getMolten(288), CustomItemList.eM_energyMulti16_LuV.get(1), 200, 7680); -- cgit From dc0fe8c01b9056467f1d155a9189d11d08584da2 Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Wed, 8 Apr 2020 17:59:59 +0200 Subject: Add recipe for IV-ZPM high amp energy hatches #25 https://github.com/Technus/TecTech/issues/25 --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 08faa16d51..86468de1b2 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -259,7 +259,7 @@ public class DreamCraftRecipeLoader implements Runnable { //Energy Hatches IV-UIV GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); -- cgit From 92b772fe4dc5f111e1d23bc4d0cc5a0c8029b777 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 14 Apr 2020 13:45:14 +0200 Subject: Refactor to internal texture arrays. --- AVRcore | 2 +- build.properties | 4 ++-- .../spartakcore/SpartakCoreRecipeLoader.java | 5 ----- .../technus/tectech/loader/ElementalLoader.java | 2 +- .../github/technus/tectech/loader/MainLoader.java | 1 - .../technus/tectech/loader/NetworkDispatcher.java | 6 +++--- .../tectech/loader/thing/MachineLoader.java | 1 - .../tectech/mechanics/avr/SidedRedstone.java | 5 ++++- .../definitions/complex/dHadronDefinition.java | 1 - .../tectech/thing/casing/GT_Item_CasingsTT.java | 3 ++- .../item/ElementalDefinitionContainer_EM.java | 2 +- .../item/ElementalDefinitionScanStorage_EM.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Param.java | 5 ++++- .../hatch/gui/GT_GUIContainer_Param.java | 2 +- .../hatch/gui/GT_GUIContainer_ParamAdv.java | 2 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 6 +++--- .../GT_MetaTileEntity_TM_proccessingStack.java | 24 ++++++--------------- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 1 - .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 7 +++--- .../multi/em_machine/Behaviour_Centrifuge.java | 4 ++-- .../Behaviour_ElectromagneticSeparator.java | 4 ++-- .../single/GT_MetaTileEntity_BuckConverter.java | 6 ++---- .../single/GT_MetaTileEntity_DataReader.java | 11 +++++----- .../single/GT_MetaTileEntity_DebugPollutor.java | 4 ++-- .../GT_MetaTileEntity_DebugPowerGenerator.java | 6 ++---- .../GT_MetaTileEntity_DebugStructureWriter.java | 3 ++- .../single/GT_MetaTileEntity_MicroController.java | 11 +++++----- .../single/GT_MetaTileEntity_OwnerDetector.java | 4 ++-- .../single/GT_MetaTileEntity_TT_Transformer.java | 25 +++++++++++----------- .../single/GT_MetaTileEntity_TeslaCoil.java | 9 ++++---- 30 files changed, 77 insertions(+), 91 deletions(-) (limited to 'src/main') diff --git a/AVRcore b/AVRcore index ad1b22c95d..27bf45ba7b 160000 --- a/AVRcore +++ b/AVRcore @@ -1 +1 @@ -Subproject commit ad1b22c95df78dde1abccb15d8bf442c3d9f7cbc +Subproject commit 27bf45ba7b08a0e3751b3e119e73441430bda49f diff --git a/build.properties b/build.properties index dc9a4492a5..fb3a817233 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=442 -gregtech.version=5.09.33.36 +gregtech.jenkinsbuild=452 +gregtech.version=5.09.33.38 cofhcore.version=[1.7.10]3.1.4-329-dev yamcore.version=0.5.79 baubles.version=1.0.1.10 diff --git a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java index 778fbad919..3fabfd67b2 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java @@ -7,13 +7,10 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviou import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_ElectromagneticSeparator; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Recycler; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; - -import cpw.mods.fml.common.Loader; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.interfaces.IItemContainer; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; @@ -22,8 +19,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import java.lang.reflect.Method; - import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault; /** diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index 79ad5dc98c..b481b82646 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -4,8 +4,8 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defin import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.iaeaNuclide; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.iaeaNuclide; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*; /** diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 1bf95a1936..a2384eac61 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -28,7 +28,6 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java index 71478f3ad8..88b237c003 100644 --- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java +++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.loader; -import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; -import com.github.technus.tectech.thing.metaTileEntity.pipe.PipeActivityMessage; -import com.github.technus.tectech.thing.metaTileEntity.RotationMessage; import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import com.github.technus.tectech.mechanics.data.RendererMessage; +import com.github.technus.tectech.thing.metaTileEntity.RotationMessage; +import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; +import com.github.technus.tectech.thing.metaTileEntity.pipe.PipeActivityMessage; import static com.github.technus.tectech.Reference.MODID; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 2c0b59632c..9f87428bb5 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -16,7 +16,6 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.CommonValues.VOLTAGE_NAMES; import static com.github.technus.tectech.thing.CustomItemList.*; /** diff --git a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java b/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java index 26b83eb1f1..715988d26f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java +++ b/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java @@ -1,7 +1,10 @@ package com.github.technus.tectech.mechanics.avr; import com.github.technus.avrClone.AvrCore; -import com.github.technus.avrClone.registerPackages.*; +import com.github.technus.avrClone.registerPackages.IInterrupt; +import com.github.technus.avrClone.registerPackages.IRegister; +import com.github.technus.avrClone.registerPackages.IRegisterBit; +import com.github.technus.avrClone.registerPackages.RegisterPackageSync; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public class SidedRedstone extends RegisterPackageSync { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 404f116adf..04a1eab490 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -21,7 +21,6 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import java.util.TreeMap; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java index 9778b1f846..23e9c7026f 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java @@ -8,7 +8,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.*; +import static com.github.technus.tectech.CommonValues.COSMIC_MARK; +import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 87c4409171..5cb84505bd 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.Util; +import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; 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 f9aafa1f7f..7e7c2eb625 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 @@ -2,8 +2,8 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.Util; +import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; 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 b94836657d..7bcc796e9d 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 @@ -2,7 +2,10 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Util; -import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.*; +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; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamAdv; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; 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 52f0832cb2..b094cd2d93 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,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.Util; +import com.github.technus.tectech.font.TecTechFontRender; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; 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 ca92f0496e..45e4f1fb65 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,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.Util; +import com.github.technus.tectech.font.TecTechFontRender; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 60a642ee95..881f802d19 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -206,11 +206,11 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], aActive ? Textures.BlockIcons.CASING_BLOCKS[52] : Textures.BlockIcons.CASING_BLOCKS[53]}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], aActive ? Textures.BlockIcons.casingTexturePages[0][52] : Textures.BlockIcons.casingTexturePages[0][53]}; } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49]}; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 9466d9df46..d35304dfca 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,32 +1,22 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Reference; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; -import java.util.ArrayList; -import java.util.HashSet; - -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.loader.MainLoader.microwaving; -import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static gregtech.api.GregTech_API.sBlockCasings4; import static net.minecraft.util.StatCollector.translateToLocal; @@ -118,11 +108,11 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], aActive ? Textures.BlockIcons.CASING_BLOCKS[52] : Textures.BlockIcons.CASING_BLOCKS[53]}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], aActive ? Textures.BlockIcons.casingTexturePages[0][52] : Textures.BlockIcons.casingTexturePages[0][53]}; } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49]}; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 9fb7193dd8..d083c58ff3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -35,7 +35,6 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.*; -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.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; 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 54f438aa9f..0e00a3180f 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 @@ -4,14 +4,14 @@ import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.Util; import com.github.technus.tectech.Vec3pos; +import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; -import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.RotationMessage; -import com.github.technus.tectech.loader.NetworkDispatcher; +import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -39,7 +39,8 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import static com.github.technus.tectech.CommonValues.*; -import static com.github.technus.tectech.Util.*; +import static com.github.technus.tectech.Util.StructureCheckerExtreme; +import static com.github.technus.tectech.Util.getTier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index ef8c0e7c3d..63177d40ae 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -4,10 +4,10 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 4b1c5f3cf6..08a79e5c90 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -4,10 +4,10 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; 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 b65601185b..d4335e3c5a 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 @@ -20,9 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_POWER_TT; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_BuckConverter extends GT_MetaTileEntity_TieredMachineBlock { @@ -54,7 +52,7 @@ public class GT_MetaTileEntity_BuckConverter extends GT_MetaTileEntity_TieredMac @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1], aSide == aFacing ? (aActive?BUCK_ACTIVE:BUCK) : + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide == aFacing ? (aActive?BUCK_ACTIVE:BUCK) : (aSide==GT_Utility.getOppositeSide(aFacing)? OVERLAYS_ENERGY_IN_POWER_TT[mTier]: (aActive ? OVERLAYS_ENERGY_OUT_POWER_TT[mTier] : OVERLAYS_ENERGY_IN_POWER_TT[mTier]))}; 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 4ad9e05b89..c98db2b985 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 @@ -33,6 +33,7 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -69,16 +70,16 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if(aBaseMetaTileEntity.getWorld()==null){ if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } if(aSide==mMainFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; }else if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } @Override 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 183b999c3b..e092eb7c38 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 @@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -57,7 +57,7 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? aActive? new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEM): new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEMidle) : POLLUTOR}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide != aFacing ? aActive? new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEM): new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEMidle) : POLLUTOR}; } @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 a666510666..0da48dfbac 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 @@ -19,9 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_POWER_TT; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -56,7 +54,7 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? aActive? OVERLAYS_ENERGY_OUT_POWER_TT[mTier]: OVERLAYS_ENERGY_IN_POWER_TT[mTier] : GENNY}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide != aFacing ? aActive? OVERLAYS_ENERGY_OUT_POWER_TT[mTier]: OVERLAYS_ENERGY_IN_POWER_TT[mTier] : GENNY}; } @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 cdfdee7899..171e051c5c 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 @@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.Util.StructureWriter; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -56,7 +57,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : MARK}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide != aFacing ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : MARK}; } @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 ef5426a272..79f753aa02 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 @@ -21,6 +21,7 @@ import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader.READER_OFFLINE; import static com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader.READER_ONLINE; @@ -168,16 +169,16 @@ public class GT_MetaTileEntity_MicroController extends GT_MetaTileEntity_TieredM public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if(aBaseMetaTileEntity.getWorld()==null){ if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } if(aSide==aBaseMetaTileEntity.getFrontFacing()){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; }else if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } @Override 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 28a5cf50b5..c22219e6d9 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 @@ -20,9 +20,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import org.luaj.vm2.ast.Str; import static com.github.technus.tectech.CommonValues.RECIPE_AT; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -59,7 +59,7 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? OWNER_ONLINE : OWNER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? OWNER_ONLINE : OWNER_OFFLINE}; } @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 09ab5fe508..2302d1a42b 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 @@ -2,7 +2,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Util; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -31,18 +30,18 @@ public class GT_MetaTileEntity_TT_Transformer extends GT_MetaTileEntity_Transfor public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[12][17][]; for (byte b = -1; b < 16; b++) { - rTextures[0][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; - rTextures[1][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; - rTextures[2][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; - rTextures[3][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; - rTextures[4][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; - rTextures[5][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; - rTextures[6][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; - rTextures[7][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; - rTextures[8][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; - rTextures[9][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; - rTextures[10][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; - rTextures[11][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; + rTextures[0][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; + rTextures[1][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; + rTextures[2][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; + rTextures[3][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; + rTextures[4][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; + rTextures[5][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; + rTextures[6][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; + rTextures[7][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; + rTextures[8][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; + rTextures[9][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; + rTextures[10][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; + rTextures[11][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; } return rTextures; } 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 351ca3a18a..48db8725df 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 @@ -10,7 +10,6 @@ import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -30,7 +29,7 @@ import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.entriesSortedByValues; import static com.github.technus.tectech.Util.map; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.TESLA_TRANSCEIVER_TOP_BA; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; import static java.lang.Math.round; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -177,9 +176,9 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; ++i) { - rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1]}; - rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], TESLA_TRANSCEIVER_TOP_BA}; - rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], this.mInventory.length == 16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[this.mTier] : (this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier])}; + rTextures[0][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1]}; + rTextures[1][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], TESLA_TRANSCEIVER_TOP_BA}; + rTextures[2][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], this.mInventory.length == 16 ? OVERLAYS_ENERGY_OUT_POWER_TT[this.mTier] : (this.mInventory.length > 4 ? OVERLAYS_ENERGY_OUT_MULTI_TT[this.mTier] : OVERLAYS_ENERGY_OUT_TT[this.mTier])}; } return rTextures; -- cgit From a5c8713f445c70cc764ad21b021b8242e01c6719 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Apr 2020 13:27:11 +0200 Subject: Should load more reliably... --- .../metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java index 97565e155e..e54f4f3354 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java @@ -166,7 +166,7 @@ public class GT_MetaTileEntity_Hatch_InputDataItems extends GT_MetaTileEntity_Ha @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - NBTTagCompound stacksTag=new NBTTagCompound(); + NBTTagCompound stacksTag= aNBT.getCompoundTag("data_stacks"); int count=stacksTag.getInteger("count"); if(count>0){ ArrayList stacks=new ArrayList<>(); -- cgit From de69e9a10db3d406ad26c004d60f98160ddd3382 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Apr 2020 13:56:54 +0200 Subject: Null check this stuff --- .../metaTileEntity/single/GT_MetaTileEntity_DataReader.java | 12 +++++------- .../single/gui/GT_GUIContainer_DataReader.java | 12 ++++++------ 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/main') 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 c98db2b985..a56172c7f4 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 @@ -26,9 +26,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Reference.MODID; @@ -93,8 +91,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine return DID_NOT_FIND_RECIPE; } ItemStack input=getInputAt(0); - ArrayList renders=getRenders(new Util.ItemStack_NoNBT(input)); - for(IDataRender render:renders){ + for(IDataRender render:getRenders(new Util.ItemStack_NoNBT(input))){ if(render.canRender(input,mTier)){ mOutputItems[0]=input.copy(); input.stackSize-=1; @@ -186,8 +183,9 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine renders.add(render); } - public static ArrayList getRenders(Util.ItemStack_NoNBT stack){ - return RENDER_REGISTRY.get(stack); + public static List getRenders(Util.ItemStack_NoNBT stack){ + ArrayList iDataRenders = RENDER_REGISTRY.get(stack); + return iDataRenders==null?Collections.emptyList():iDataRenders; } public interface IDataRender { 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 eb2c2e4112..e0e3cdd6b8 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 @@ -115,8 +115,8 @@ 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) { - ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing)); - for (GT_MetaTileEntity_DataReader.IDataRender render : renders) { + for (GT_MetaTileEntity_DataReader.IDataRender render : + GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing))) { if (render.canRender(thing, mTier)) { if (!GT_Utility.areStacksEqual(stack, thing, false)) { render.initRender(thing); @@ -133,8 +133,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine if(stack==null){ return false; } - ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack)); - for (GT_MetaTileEntity_DataReader.IDataRender render : renders) { + for (GT_MetaTileEntity_DataReader.IDataRender render : + GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack))) { if (render.canRender(stack, mTier)) { render.renderForeground(stack, mouseX, mouseY, this, fontRendererObj); return true; @@ -147,8 +147,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine if(stack==null){ return false; } - ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack)); - for (GT_MetaTileEntity_DataReader.IDataRender render : renders) { + for (GT_MetaTileEntity_DataReader.IDataRender render : + GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack))) { if (render.canRender(stack, mTier)) { render.renderTooltips(stack, mouseX, mouseY, this); return true; -- cgit From 281015aaf5a3b65dece68f12b559926b8f41d3c9 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Apr 2020 22:53:04 +0200 Subject: Fix pipes, implement ExtendedFacing, bump version --- build.properties | 2 +- .../com/github/technus/tectech/CommonValues.java | 43 - .../java/com/github/technus/tectech/Converter.java | 59 - .../java/com/github/technus/tectech/TecTech.java | 1 + src/main/java/com/github/technus/tectech/Util.java | 1640 -------------------- .../java/com/github/technus/tectech/Vec3pos.java | 50 - src/main/java/com/github/technus/tectech/XSTR.java | 278 ---- .../dreamcraft/NoDreamCraftMachineLoader.java | 2 +- .../openComputers/AvrArchitecture.java | 2 +- .../blocks/turretbases/TurretBaseItemEM.java | 2 +- .../blocks/turretheads/TurretHeadItemEM.java | 2 +- .../definitions/dComplexAspectDefinition.java | 2 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 10 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 10 +- .../github/technus/tectech/loader/MainLoader.java | 4 +- .../technus/tectech/loader/NetworkDispatcher.java | 8 +- .../tectech/loader/recipe/BloodyRecipeLoader.java | 34 +- .../tectech/loader/thing/MachineLoader.java | 2 +- .../technus/tectech/loader/thing/ThingsLoader.java | 4 +- .../mechanics/alignment/AlignmentLimits.java | 183 +++ .../mechanics/alignment/AlignmentMessage.java | 140 ++ .../tectech/mechanics/alignment/IAlignment.java | 173 +++ .../mechanics/alignment/IAlignmentLimits.java | 19 + .../mechanics/alignment/IntegerAxisSwap.java | 67 + .../mechanics/alignment/enumerable/Direction.java | 34 + .../alignment/enumerable/ExtendedFacing.java | 324 ++++ .../mechanics/alignment/enumerable/Flip.java | 76 + .../mechanics/alignment/enumerable/Rotation.java | 76 + .../tectech/mechanics/anomaly/AnomalyHandler.java | 2 +- .../tectech/mechanics/commands/ConvertFloat.java | 2 +- .../tectech/mechanics/commands/ConvertInteger.java | 2 +- .../mechanics/constructible/IConstructable.java | 15 + .../tectech/mechanics/data/ChunkDataMessage.java | 2 +- .../tectech/mechanics/data/PlayerPersistence.java | 2 +- .../mechanics/dataTransport/DataPacket.java | 22 +- .../mechanics/dataTransport/QuantumDataPacket.java | 4 +- .../core/stacks/cElementalInstanceStack.java | 2 +- .../core/templates/cElementalPrimitive.java | 2 +- .../definitions/complex/dAtomDefinition.java | 6 +- .../definitions/complex/dHadronDefinition.java | 2 +- .../definitions/complex/iaeaNuclide.java | 2 +- .../tectech/mechanics/pipe/IActivePipe.java | 9 + .../mechanics/pipe/IConnectsToDataPipe.java | 14 + .../mechanics/pipe/IConnectsToElementalPipe.java | 8 + .../mechanics/pipe/IConnectsToEnergyTunnel.java | 8 + .../mechanics/pipe/PipeActivityMessage.java | 133 ++ .../tectech/thing/block/QuantumGlassItem.java | 2 +- .../tectech/thing/block/ReactorSimItem.java | 2 +- .../tectech/thing/casing/GT_Item_CasingsBA0.java | 2 +- .../tectech/thing/casing/GT_Item_CasingsTT.java | 4 +- .../tectech/thing/casing/GT_Item_HintTT.java | 2 +- .../thing/item/ConstructableTriggerItem.java | 6 +- .../item/DebugElementalInstanceContainer_EM.java | 4 +- .../item/ElementalDefinitionContainer_EM.java | 4 +- .../item/ElementalDefinitionScanStorage_EM.java | 4 +- .../technus/tectech/thing/item/EuMeterGT.java | 2 +- .../thing/item/FrontRotationTriggerItem.java | 20 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 4 +- .../tectech/thing/item/TeslaCoilCapacitor.java | 4 +- .../tectech/thing/item/TeslaCoilComponent.java | 2 +- .../technus/tectech/thing/item/TeslaCoilCover.java | 2 +- .../technus/tectech/thing/item/TeslaStaff.java | 2 +- .../thing/metaTileEntity/IConstructable.java | 15 - .../thing/metaTileEntity/IFrontRotation.java | 11 - .../thing/metaTileEntity/RotationMessage.java | 139 -- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 8 +- .../GT_MetaTileEntity_Hatch_CreativeData.java | 8 +- ...T_MetaTileEntity_Hatch_CreativeMaintenance.java | 4 +- .../GT_MetaTileEntity_Hatch_DataConnector.java | 8 +- .../hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java | 6 +- .../GT_MetaTileEntity_Hatch_DynamoTunnel.java | 10 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 6 +- .../hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java | 6 +- .../GT_MetaTileEntity_Hatch_EnergyTunnel.java | 21 +- .../hatch/GT_MetaTileEntity_Hatch_Holder.java | 4 +- .../hatch/GT_MetaTileEntity_Hatch_InputData.java | 6 +- .../GT_MetaTileEntity_Hatch_InputDataItems.java | 8 +- .../GT_MetaTileEntity_Hatch_InputElemental.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_OutputData.java | 6 +- .../GT_MetaTileEntity_Hatch_OutputDataItems.java | 6 +- .../GT_MetaTileEntity_Hatch_OutputElemental.java | 2 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 8 +- .../hatch/GT_MetaTileEntity_Hatch_Param.java | 4 +- .../hatch/GT_MetaTileEntity_Hatch_ParamText.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Rack.java | 8 +- .../hatch/GT_MetaTileEntity_Hatch_Uncertainty.java | 4 +- .../hatch/TextParametersMessage.java | 2 +- .../hatch/gui/GT_Container_Param.java | 2 +- .../hatch/gui/GT_Container_ParamAdv.java | 2 +- .../hatch/gui/GT_Container_ParamText.java | 2 +- .../hatch/gui/GT_GUIContainer_Param.java | 2 +- .../hatch/gui/GT_GUIContainer_ParamAdv.java | 2 +- .../hatch/gui/GT_GUIContainer_ParamText.java | 2 +- .../multi/GT_MetaTileEntity_EM_annihilation.java | 12 +- .../multi/GT_MetaTileEntity_EM_bhg.java | 14 +- .../multi/GT_MetaTileEntity_EM_collider.java | 16 +- .../multi/GT_MetaTileEntity_EM_computer.java | 28 +- .../multi/GT_MetaTileEntity_EM_crafting.java | 12 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 14 +- .../multi/GT_MetaTileEntity_EM_decay.java | 14 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 10 +- .../multi/GT_MetaTileEntity_EM_infuser.java | 8 +- .../multi/GT_MetaTileEntity_EM_junction.java | 10 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 12 +- .../multi/GT_MetaTileEntity_EM_research.java | 16 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 14 +- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 8 +- .../multi/GT_MetaTileEntity_EM_switch.java | 18 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 12 +- .../multi/GT_MetaTileEntity_EM_wormhole.java | 12 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 36 +- .../GT_MetaTileEntity_TM_proccessingStack.java | 8 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 114 +- .../multi/base/GT_Container_MultiMachineEM.java | 2 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 429 +---- .../render/TT_RenderedExtendedFacingTexture.java | 893 +++++++++++ .../multi/base/render/TT_RenderedTexture.java | 769 --------- .../multi/em_machine/Behaviour_Centrifuge.java | 2 +- .../Behaviour_ElectromagneticSeparator.java | 2 +- .../multi/em_machine/Behaviour_Recycler.java | 2 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 10 +- .../pipe/GT_MetaTileEntity_Pipe_Data.java | 40 +- .../pipe/GT_MetaTileEntity_Pipe_EM.java | 40 +- .../pipe/GT_MetaTileEntity_Pipe_Energy.java | 40 +- .../thing/metaTileEntity/pipe/IActivePipe.java | 9 - .../metaTileEntity/pipe/IConnectsToDataPipe.java | 14 - .../pipe/IConnectsToElementalPipe.java | 8 - .../pipe/IConnectsToEnergyTunnel.java | 8 - .../metaTileEntity/pipe/PipeActivityMessage.java | 133 -- .../single/GT_MetaTileEntity_BuckConverter.java | 4 +- .../single/GT_MetaTileEntity_DataReader.java | 6 +- .../single/GT_MetaTileEntity_DebugPollutor.java | 4 +- .../GT_MetaTileEntity_DebugPowerGenerator.java | 4 +- .../GT_MetaTileEntity_DebugStructureWriter.java | 6 +- .../single/GT_MetaTileEntity_MicroController.java | 2 +- .../single/GT_MetaTileEntity_OwnerDetector.java | 6 +- .../single/GT_MetaTileEntity_TT_Transformer.java | 4 +- .../single/GT_MetaTileEntity_TeslaCoil.java | 16 +- .../single/GT_MetaTileEntity_WetTransformer.java | 4 +- .../single/gui/GT_Container_DebugPollutor.java | 2 +- .../single/gui/GT_GUIContainer_BuckConverter.java | 4 +- .../single/gui/GT_GUIContainer_DataReader.java | 2 +- .../gui/GT_GUIContainer_DebugPowerGenerator.java | 4 +- .../github/technus/tectech/util/CommonValues.java | 43 + .../com/github/technus/tectech/util/Converter.java | 59 + .../java/com/github/technus/tectech/util/Util.java | 1104 +++++++++++++ .../com/github/technus/tectech/util/Vec3Impl.java | 146 ++ .../java/com/github/technus/tectech/util/XSTR.java | 278 ++++ 148 files changed, 4317 insertions(+), 4036 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/CommonValues.java delete mode 100644 src/main/java/com/github/technus/tectech/Converter.java delete mode 100644 src/main/java/com/github/technus/tectech/Util.java delete mode 100644 src/main/java/com/github/technus/tectech/Vec3pos.java delete mode 100644 src/main/java/com/github/technus/tectech/XSTR.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/pipe/IActivePipe.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToDataPipe.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToEnergyTunnel.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/pipe/PipeActivityMessage.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/IConstructable.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/IFrontRotation.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedTexture.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IActivePipe.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToDataPipe.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToElementalPipe.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToEnergyTunnel.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/PipeActivityMessage.java create mode 100644 src/main/java/com/github/technus/tectech/util/CommonValues.java create mode 100644 src/main/java/com/github/technus/tectech/util/Converter.java create mode 100644 src/main/java/com/github/technus/tectech/util/Util.java create mode 100644 src/main/java/com/github/technus/tectech/util/Vec3Impl.java create mode 100644 src/main/java/com/github/technus/tectech/util/XSTR.java (limited to 'src/main') diff --git a/build.properties b/build.properties index cfc5423a3c..a4d2ac1760 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614 -tectech.version=3.7.5 +tectech.version=3.8.0 ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 diff --git a/src/main/java/com/github/technus/tectech/CommonValues.java b/src/main/java/com/github/technus/tectech/CommonValues.java deleted file mode 100644 index 9564643fbe..0000000000 --- a/src/main/java/com/github/technus/tectech/CommonValues.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech; - -import net.minecraft.util.EnumChatFormatting; - -/** - * Created by danie_000 on 11.01.2017. - */ -public final class CommonValues { - public static final String TEC_MARK_GENERAL = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Interdimensional"; - public static final String TEC_MARK_EM = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Elemental Matter"; - public static final String BASS_MARK = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Theta Movement"; - public static final String COSMIC_MARK = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Cosmic";//TODO get a better name than cosmic for *UNDEFINED* thing - - public static final byte DECAY_AT = 0;// hatches compute decays - public static final byte MULTI_PURGE_1_AT = 2;// multiblocks clean their hatches 1 - public static final byte MOVE_AT = 4;// move stuff around - public static final byte RECIPE_AT = 6;// move stuff around - public static final byte MULTI_PURGE_2_AT = 8;// multiblocks clean their hatches 2 - public static final byte OVERFLOW_AT = 10;// then hatches clean themselves - // - in case some hatches are not in multiblock structure - public static final byte MULTI_CHECK_AT = 12;// multiblock checks it's state - public static final byte DISPERSE_AT = 14;// overflow hatches perform disperse - public static final byte TRANSFER_AT = 16; - - public static final long[] AatV = new long[]{268435455,67108863,16777215,4194303,1048575,262143,65535,16383,4095,1023,255,63,15,3,1,1}; - public static final String[] VOLTAGE_NAMES = new String[]{"Ultra Low Voltage", "Low Voltage", "Medium Voltage", "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", "Ultimate High Voltage", "Ultimate Extreme Voltage", "Ultimate Insane Voltage", "Ultimate Mega Voltage", "Ultimate Extended Mega Voltage", "Overpowered Voltage", "Maximum Voltage"}; - public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UMV", "UXV", "OpV", "MAX"}; - public static final long[] V = new long[]{8L, 32L, 128L, 512L, 2048L, 8192L, 32768L, 131072L, 524288L, 2097152L, 8388608L, 33554432L, 134217728L, 536870912L, 1073741824L, Integer.MAX_VALUE - 7}; - - private CommonValues() {} -} diff --git a/src/main/java/com/github/technus/tectech/Converter.java b/src/main/java/com/github/technus/tectech/Converter.java deleted file mode 100644 index 5d1f5c802e..0000000000 --- a/src/main/java/com/github/technus/tectech/Converter.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.technus.tectech; - -import java.io.*; - -public final class Converter { - private Converter() {} - - public static void writeInts(int [] array,ByteArrayOutputStream byteArrayOutputStream) { - try { - DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); - for (int i = 0; i < array.length; i++) { - dataOutputStream.writeInt(array[i]); - } - dataOutputStream.flush(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static void readInts(ByteArrayInputStream byteArrayInputStream,int[] array) { - try { - DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream); - for (int i = 0; i < array.length; i++) { - array[i] = dataInputStream.readInt(); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static byte[] writeInts(int[] array) { - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(array.length * 4); - DataOutputStream dos = new DataOutputStream(bos); - for (int i = 0; i < array.length; i++) { - dos.writeInt(array[i]); - } - - return bos.toByteArray(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static int[] readInts(byte[] array) { - try { - ByteArrayInputStream bis = new ByteArrayInputStream(array); - DataInputStream dataInputStream = new DataInputStream(bis); - int size = array.length / Integer.BYTES; - int[] res = new int[size]; - for (int i = 0; i < size; i++) { - res[i] = dataInputStream.readInt(); - } - return res; - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 9694dadfd3..47a3b576b1 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -12,6 +12,7 @@ import com.github.technus.tectech.mechanics.data.PlayerPersistence; import com.github.technus.tectech.mechanics.elementalMatter.core.commands.GiveEM; import com.github.technus.tectech.mechanics.elementalMatter.core.commands.ListEM; import com.github.technus.tectech.proxy.CommonProxy; +import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java deleted file mode 100644 index 5bd3ff59a9..0000000000 --- a/src/main/java/com/github/technus/tectech/Util.java +++ /dev/null @@ -1,1640 +0,0 @@ -package com.github.technus.tectech; - -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -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.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -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.tileentity.TileEntity; -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.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static gregtech.api.enums.GT_Values.E; -import static java.nio.charset.Charset.forName; - -/** - * 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; - } - - //region junk - /* - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean StructureChecker(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - - int x, y, z, a, b, c, pointer; - int - baseX=aBaseMetaTileEntity.getXCoord(), - baseZ=aBaseMetaTileEntity.getZCoord(), - baseY=aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - a += block - '@'; - } else if (block < '+')//used to mark THINGS - { - a++; - } else if (block=='.') { - a++; - } else { - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(x, y, z).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(x, y, z).getMaterial() == Material.air) { - return false; - } - break; - default: //check for block (countable) - pointer = block - '0'; - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(x, y, z) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMeta[pointer]); - } - return false; - } - } - } else if (forceCheck) { - return false; - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean StructureCheckerAdvanced( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - Method adder, - String[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - - IGregTechTileEntity igt; - IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); - - int x, y, z, a, b, c, pointer; - int baseX=aBaseMetaTileEntity.getXCoord(), - baseZ=aBaseMetaTileEntity.getZCoord(), - baseY=aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } else if (block > '@') //characters allow to skip check A-1 skip, B-2 skips etc. - { - a += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block=='.') { - a++; - } else { - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(x, y, z).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(x, y, z).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(x, y, z) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMeta[pointer]); - } - return false; - } - } else if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(x, y, z); - try { - if (igt == null || !(boolean) adder.invoke(imt, addingMethods[pointer], igt, casingTextures[pointer])) { - if (world.getBlock(x, y, z) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } catch (InvocationTargetException | IllegalAccessException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return false; - } - } - } - } else if (forceCheck) { - return false; - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - */ - //endregion - - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean StructureCheckerExtreme( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - IFrontRotation frontRotation, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - int facingAndRotation = aBaseMetaTileEntity.getFrontFacing() + (frontRotation == null ? 0 : (frontRotation.getFrontRotation() << 3)); - - IGregTechTileEntity igt; - IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); - - int x, y, z, a, b, c, pointer; - int baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. - a += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.') { - a++; - } else { - //get x y z from rotation - switch (facingAndRotation) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 12: - x = baseX + c; - y = baseY - a; - z = baseZ + b; - break; - case 20: - x = baseX + c; - z = baseZ - a; - y = baseY - b; - break; - case 28: - x = baseX + c; - y = baseY + a; - z = baseZ - b; - break; - - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 11: - y = baseY - a; - z = baseZ - c; - x = baseX + b; - break; - case 19: - x = baseX - a; - z = baseZ - c; - y = baseY - b; - break; - case 27: - y = baseY + a; - z = baseZ - c; - x = baseX - b; - break; - - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 13: - x = baseX - c; - y = baseY - a; - z = baseZ - b; - break; - case 21: - x = baseX - c; - z = baseZ + a; - y = baseY - b; - break; - case 29: - x = baseX - c; - y = baseY + a; - z = baseZ + b; - break; - - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - case 10: - y = baseY - a; - z = baseZ + c; - x = baseX - b; - break; - case 18: - x = baseX + a; - z = baseZ + c; - y = baseY - b; - break; - case 26: - y = baseY + a; - z = baseZ + c; - x = baseX + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ - b; - y = baseY - c; - break;//similar to 3 - case 9: - z = baseZ + a; - x = baseX + b; - y = baseY - c; - break;//similar to 3 - case 17: - x = baseX - a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 25: - z = baseZ - a; - x = baseX - b; - y = baseY - c; - break;//similar to 3 - - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - case 8: - z = baseZ + a; - x = baseX - b; - y = baseY + c; - break; - case 16: - x = baseX + a; - z = baseZ + b; - y = baseY + c; - break; - case 24: - z = baseZ - a; - x = baseX + b; - y = baseY + c; - break; - default: - if (DEBUG_MODE) { - TecTech.LOGGER.info("facing = " + facingAndRotation); - } - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(x, y, z).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(x, y, z).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(x, y, z) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMeta[pointer]); - } - return false; - } - } else //noinspection ConstantConditions - if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(x, y, z); - if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { - if (world.getBlock(x, y, z) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } - } - } else if (forceCheck) { - return false; - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), null, - facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, IFrontRotation frontRotation, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), frontRotation, - facing, hintsOnly); - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, int facing, boolean hintsOnly) { - return StructureBuilderExtreme(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, tileEntity, null, facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, IFrontRotation frontRotation, int facing, boolean hintsOnly) { - if (!tileEntity.hasWorldObj()) { - return false; - } - World world = tileEntity.getWorldObj(); - if (!world.isRemote && hintsOnly) { - return false; - } - - //TE Rotation - - int x, y, z, a, b, c, pointer; - int - baseX = tileEntity.xCoord, - baseZ = tileEntity.zCoord, - baseY = tileEntity.yCoord; - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - if (frontRotation != null) { - facing += frontRotation.getFrontRotation() << 3; - } - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } - if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - a += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.')// this TE - { - a++; - } else { - //get x y z from rotation - switch (facing) { - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 12: - x = baseX + c; - y = baseY - a; - z = baseZ + b; - break; - case 20: - x = baseX + c; - z = baseZ - a; - y = baseY - b; - break; - case 28: - x = baseX + c; - y = baseY + a; - z = baseZ - b; - break; - - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 11: - y = baseY - a; - z = baseZ - c; - x = baseX + b; - break; - case 19: - x = baseX - a; - z = baseZ - c; - y = baseY - b; - break; - case 27: - y = baseY + a; - z = baseZ - c; - x = baseX - b; - break; - - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 13: - x = baseX - c; - y = baseY - a; - z = baseZ - b; - break; - case 21: - x = baseX - c; - z = baseZ + a; - y = baseY - b; - break; - case 29: - x = baseX - c; - y = baseY + a; - z = baseZ + b; - break; - - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - case 10: - y = baseY - a; - z = baseZ + c; - x = baseX - b; - break; - case 18: - x = baseX + a; - z = baseZ + c; - y = baseY - b; - break; - case 26: - y = baseY + a; - z = baseZ + c; - x = baseX + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ - b; - y = baseY - c; - break;//similar to 3 - case 9: - z = baseZ + a; - x = baseX + b; - y = baseY - c; - break;//similar to 3 - case 17: - x = baseX - a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 25: - z = baseZ - a; - x = baseX - b; - y = baseY - c; - break;//similar to 3 - - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - case 8: - z = baseZ + a; - x = baseX - b; - y = baseY + c; - break; - case 16: - x = baseX + a; - z = baseZ + b; - y = baseY + c; - break; - case 24: - z = baseZ - a; - x = baseX + b; - y = baseY + c; - break; - default: - if (DEBUG_MODE) { - TecTech.LOGGER.info("facing = " + facing); - } - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded - if (hintsOnly) { - switch (block) { - case '-'://must be air - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 13); - break; - case '+'://must not be air - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 14); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - if (world.getBlock(x, y, z) != blockType[pointer] || world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { - TecTech.proxy.hint_particle(world, x, y, z, blockType[pointer], blockMeta[pointer]); - } - } else if ((pointer = block - ' ') >= 0) { - if (pointer >= 0 && pointer < 12) { - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, pointer); - } else { - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 12); - } - } else { - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 15); - } - } - } else { - switch (block) { - case '-'://must be air - world.setBlock(x, y, z, Blocks.air, 0, 2); - break; - case '+'://must not be air - world.setBlock(x, y, z, TT_Container_Casings.sBlockCasingsTT, 14, 2); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - world.setBlock(x, y, z, blockType[pointer], blockMeta[pointer], 2); - } else if (block - ' ' < 0) { - world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 15, 2); - } //else { - //switch(pointer){ - // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: - // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; - // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); - //} - //} - } - } - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - - - public static String[] StructureWriter(IGregTechTileEntity aBaseMetaTileEntity, - int horizontalOffset, int verticalOffset, int depthOffset, - int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return new String[]{"Not at Client m8"}; - } - - ItemStack[] array = new ItemStack[10]; - - int x, y, z, a, b, c; - int - baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - #1 - count block types - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return new String[]{"Invalid position"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { - boolean err = true; - ItemStack is = new ItemStack(block, 1, meta); - for (int i = 0; i < array.length; i++) { - if (array[i] == null) { - array[i] = is; - err = false; - break; - } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { - err = false; - break; - } - } - if (err) { - return new String[]{"Too much different blocks"}; - } - } - - a++;//block in horizontal layer - } - b--;//horizontal layer - } - c++;//depth - } - - List output = new ArrayList<>(); - - output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); - output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); - output.add(""); - - output.add("ID[]: Name[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getDisplayName()); - } - } - output.add(""); - output.add("ID[]: Block[] BlockMetaID[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); - } - } - output.add(""); - output.add("String[][]"); - //perform your duties - #2 - write strings - output.add("{"); - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - StringBuilder addMe = new StringBuilder().append('{'); - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - StringBuilder line = new StringBuilder(); - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (a == 0 && b == 0 && c == 0) { - line.append('.'); - } else if (block.getMaterial() == Material.air) { - line.append('-'); - } else if (block.hasTileEntity(meta)) { - line.append('*'); - } else { - ItemStack stack = new ItemStack(block, 1, meta); - String str = "?";//OH YEAH NPEs - for (int i = 0; i < array.length; i++) { - if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { - str = Integer.toString(i); - break; - } - } - line.append(str); - } - a++;//block in horizontal layer - } - if (ignoreAir) { - StringBuilder builder = new StringBuilder(); - char temp = '@'; - for (char ch : line.toString().toCharArray()) { - if (ch == '-') { - temp += 1; - if (temp == '~') { - builder.append('~'); - temp = '@'; - } - } else { - if (temp > '@') { - builder.append(temp); - temp = '@'; - } - builder.append(ch); - } - } - while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { - builder.deleteCharAt(builder.length() - 1); - } - if (builder.length() == 0) { - builder.append("E,"); - } else { - builder.insert(0, '"'); - builder.append('"').append(','); - } - addMe.append(builder); - } else { - if (line.length() == 0) { - line.append("E,"); - } else { - line.insert(0, '"'); - line.append('"').append(','); - } - addMe.append(line); - } - b--;//horizontal layer - } - //region less verbose - addMe.append('}').append(','); - String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); - Matcher matcher = matchE_.matcher(builtStr); - while (matcher.find()) { - byte lenEE = (byte) (matcher.group(1).length() >> 1); - builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); - //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); - } - //endregion - output.add(builtStr); - c++;//depth - } - output.add("}"); - return output.toArray(new String[0]); - } - - private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); - - 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(forName("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); - } -} diff --git a/src/main/java/com/github/technus/tectech/Vec3pos.java b/src/main/java/com/github/technus/tectech/Vec3pos.java deleted file mode 100644 index eb694813da..0000000000 --- a/src/main/java/com/github/technus/tectech/Vec3pos.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -/** - * Created by Tec on 05.04.2017. - */ -public class Vec3pos implements Comparable { - public final int x, z; - public final short y; - - public Vec3pos(int x, short y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Vec3pos(IGregTechTileEntity te) { - x = te.getXCoord(); - y = te.getYCoord(); - z = te.getZCoord(); - } - - @Override - public int compareTo(Vec3pos o) { - int tmp=y-o.y; - if (tmp!=0) { - return tmp; - } - tmp=x-o.x; - if (tmp!=0) { - return tmp; - } - return z-o.z; - } - - @Override - public boolean equals(Object obj) { - if(obj instanceof Vec3pos){ - Vec3pos v=(Vec3pos) obj; - return x==v.x && z==v.z && y==v.y; - } - return false; - } - - @Override - public int hashCode() { - return x*524288+z*256+y; - } -} diff --git a/src/main/java/com/github/technus/tectech/XSTR.java b/src/main/java/com/github/technus/tectech/XSTR.java deleted file mode 100644 index f5ff457fe1..0000000000 --- a/src/main/java/com/github/technus/tectech/XSTR.java +++ /dev/null @@ -1,278 +0,0 @@ -package com.github.technus.tectech; -/* - A subclass of java.util.random that implements the Xorshift random number - generator -

- - it is 30% faster than the generator from Java's library - it produces - random sequences of higher quality than java.util.Random - this class also - provides a clone() function -

- Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); - //pull a random number -

- To use the class in legacy code, you may also instantiate an XSRandom object - and assign it to a java.util.Random object: java.util.Random rand = new - XSRandom(); -

- for an explanation of the algorithm, see - http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html - - @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs - * http://www.elmenreich.tk - *

- * This code is released under the GNU Lesser General Public License Version 3 - * http://www.gnu.org/licenses/lgpl-3.0.txt - */ - -import java.util.Random; -import java.util.concurrent.atomic.AtomicLong; - -/** - * XSTR - Xorshift ThermiteRandom - * Modified by Bogdan-G - * 03.06.2016 - * version 0.0.4 - */ -public class XSTR extends Random { - - private static final long serialVersionUID = 6208727693524452904L; - private long seed; - private static final long GAMMA = 0x9e3779b97f4a7c15L; - private static final int PROBE_INCREMENT = 0x9e3779b9; - private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; - private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) - private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) - private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); - public static final XSTR XSTR_INSTANCE=new XSTR(){ - @Override - public synchronized void setSeed(long seed) { - if(!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) { - throw new NoSuchMethodError("This is meant to be shared!, leave seed state alone!"); - } - } - }; - - /* - MODIFIED BY: Robotia - Modification: Implemented Random class seed generator - */ - - /** - * Creates a new pseudo random number generator. The seed is initialized to - * the current time, as if by - * setSeed(System.currentTimeMillis());. - */ - public XSTR() { - this(seedUniquifier() ^ System.nanoTime()); - } - - private static long seedUniquifier() { - // L'Ecuyer, "Tables of Linear Congruential Generators of - // Different Sizes and Good Lattice Structure", 1999 - while (true) { - long current = seedUniquifier.get(); - long next = current * 181783497276652981L; - if (seedUniquifier.compareAndSet(current, next)) { - return next; - } - } - } - - /** - * Creates a new pseudo random number generator, starting with the specified - * seed, using setSeed(seed);. - * - * @param seed the initial seed - */ - public XSTR(long seed) { - this.seed = seed; - } - - @Override - public boolean nextBoolean() { - return next(1) != 0; - } - - @Override - public double nextDouble() { - return (((long) next(26) << 27) + next(27)) * DOUBLE_UNIT; - } - - /** - * Returns the current state of the seed, can be used to clone the object - * - * @return the current seed - */ - public synchronized long getSeed() { - return seed; - } - - /** - * Sets the seed for this pseudo random number generator. As described - * above, two instances of the same random class, starting with the same - * seed, produce the same results, if the same methods are called. - * - * @param seed the new seed - */ - @Override - public synchronized void setSeed(long seed) { - this.seed = seed; - } - - /** - * @return Returns an XSRandom object with the same state as the original - */ - @Override - public XSTR clone() { - return new XSTR(getSeed()); - } - - /** - * Implementation of George Marsaglia's elegant Xorshift random generator - * 30% faster and better quality than the built-in java.util.random see also - * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml - * - * @param nbits will shift nbits bits - * @return next seed - */ - @Override - public int next(int nbits) { - long x = seed; - x ^= x << 21; - x ^= x >>> 35; - x ^= x << 4; - seed = x; - x &= (1L << nbits) - 1; - return (int) x; - } - - private boolean haveNextNextGaussian = false; - private double nextNextGaussian = 0; - - @Override - public synchronized double nextGaussian() { - // See Knuth, ACP, Section 3.4.1 Algorithm C. - if (haveNextNextGaussian) { - haveNextNextGaussian = false; - return nextNextGaussian; - } else { - double v1, v2, vs; - do { - v1 = 2 * nextDouble() - 1; // between -1 and 1 - v2 = 2 * nextDouble() - 1; // between -1 and 1 - vs = v1 * v1 + v2 * v2; - } while (vs >= 1 || vs == 0); - double multiplier = StrictMath.sqrt(-2 * StrictMath.log(vs) / vs); - nextNextGaussian = v2 * multiplier; - haveNextNextGaussian = true; - return v1 * multiplier; - } - } - - /** - * Returns a pseudorandom, uniformly distributed {@code int} value between 0 - * (inclusive) and the specified value (exclusive), drawn from this random - * number generator's sequence. The general contract of {@code nextInt} is - * that one {@code int} value in the specified range is pseudorandomly - * generated and returned. All {@code bound} possible {@code int} values are - * produced with (approximately) equal probability. The method - * {@code nextInt(int bound)} is implemented by class {@code Random} as if - * by: - *

 {@code
-     * public int nextInt(int bound) {
-     *   if (bound <= 0)
-     *     throw new IllegalArgumentException("bound must be positive");
-     *
-     *   if ((bound & -bound) == bound)  // i.e., bound is a power of 2
-     *     return (int)((bound * (long)next(31)) >> 31);
-     *
-     *   int bits, val;
-     *   do {
-     *       bits = next(31);
-     *       val = bits % bound;
-     *   } while (bits - val + (bound-1) < 0);
-     *   return val;
-     * }}
- * - *

The hedge "approx - * imately" is used in the foregoing description only because the next - * method is only approximately an unbiased source of independently chosen - * bits. If it were a perfect source of randomly chosen bits, then the - * algorithm shown would choose {@code int} values from the stated range - * with perfect uniformity. - *

- * The algorithm is slightly tricky. It rejects values that would result in - * an uneven distribution (due to the fact that 2^31 is not divisible by n). - * The probability of a value being rejected depends on n. The worst case is - * n=2^30+1, for which the probability of a reject is 1/2, and the expected - * number of iterations before the loop terminates is 2. - *

- * The algorithm treats the case where n is a power of two specially: it - * returns the correct number of high-order bits from the underlying - * pseudo-random number generator. In the absence of special treatment, the - * correct number of low-order bits would be returned. Linear - * congruential pseudo-random number generators such as the one implemented - * by this class are known to have short periods in the sequence of values - * of their low-order bits. Thus, this special case greatly increases the - * length of the sequence of values returned by successive calls to this - * method if n is a small power of two. - * - * @param bound the upper bound (exclusive). Must be positive. - * @return the next pseudorandom, uniformly distributed {@code int} value - * between zero (inclusive) and {@code bound} (exclusive) from this random - * number generator's sequence - * @throws IllegalArgumentException if bound is not positive - * @since 1.2 - */ - @Override - public int nextInt(int bound) { - //if (bound <= 0) { - //throw new RuntimeException("BadBound"); - //} - - /*int r = next(31); - int m = bound - 1; - if ((bound & m) == 0) // i.e., bound is a power of 2 - { - r = (int) ((bound * (long) r) >> 31); - } else { - for (int u = r; - u - (r = u % bound) + m < 0; - u = next(31)) - ; - } - return r;*/ - //speedup, new nextInt ~+40% - long last = seed ^ seed << 21; - last ^= last >>> 35; - last ^= last << 4; - seed = last; - int out = (int) last % bound; - return out < 0 ? -out : out; - } - - @Override - public int nextInt() { - return next(32); - } - - @Override - public float nextFloat() { - return next(24) * FLOAT_UNIT; - } - - @Override - public long nextLong() { - // it's okay that the bottom word remains signed. - return ((long) next(32) << 32) + next(32); - } - - @Override - public void nextBytes(byte[] bytes_arr) { - for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) { - for (int rndba = nextInt(), nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); nba-- > 0; rndba >>= Byte.SIZE) { - bytes_arr[iba++] = (byte) rndba; - } - } - } -} \ No newline at end of file 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 adf5d37876..798ffec36c 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; +import com.github.technus.tectech.util.Util; 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; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java index fcbb65d609..2842a71df3 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java @@ -8,7 +8,7 @@ import com.github.technus.avrClone.instructions.exceptions.DelayEvent; 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.Converter; +import com.github.technus.tectech.util.Converter; import com.github.technus.tectech.TecTech; import li.cil.oc.Settings; import li.cil.oc.api.Driver; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java index 97fc8132a2..ed4b72f094 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretbases; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java index 422b931df5..f4ad25f053 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java @@ -10,7 +10,7 @@ import openmodularturrets.handler.ConfigHandler; import java.text.DecimalFormat; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; import static net.minecraft.util.StatCollector.translateToLocal; /** diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java index 8961215354..070a05d7e9 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 4074f2d6db..ab6b723e09 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -23,8 +23,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -139,7 +139,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 0caf4be6d6..309d029b8e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -23,8 +23,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index a2384eac61..f7bec9adc0 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -38,7 +38,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import static com.github.technus.tectech.CommonValues.*; +import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.TecTech.*; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; @@ -126,7 +126,7 @@ public final class MainLoader { progressBarPostLoad.step("Dreamcraft Compatibility"); if(Loader.isModLoaded(Reference.DREAMCRAFT)){ try { - Class clazz = Class.forName("com.dreammaster.gthandler.casings.GT_Container_CasingsNH"); + Class clazz = Class.forName("com.dreammaster.gthandler.casings.GT_Container_CasingsNH"); TT_Container_Casings.sBlockCasingsNH = (Block)clazz.getField("sBlockCasingsNH").get(null); if(TT_Container_Casings.sBlockCasingsNH==null){ diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java index 88b237c003..7d35a216f0 100644 --- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java +++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java @@ -3,9 +3,9 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import com.github.technus.tectech.mechanics.data.RendererMessage; -import com.github.technus.tectech.thing.metaTileEntity.RotationMessage; +import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; -import com.github.technus.tectech.thing.metaTileEntity.pipe.PipeActivityMessage; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; import static com.github.technus.tectech.Reference.MODID; @@ -23,8 +23,8 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher registerMessage(PipeActivityMessage.ServerHandler.class, PipeActivityMessage.PipeActivityQuery.class); registerMessage(PipeActivityMessage.ClientHandler.class, PipeActivityMessage.PipeActivityData.class); - registerMessage(RotationMessage.ServerHandler.class, RotationMessage.RotationQuery.class); - registerMessage(RotationMessage.ClientHandler.class, RotationMessage.RotationData.class); + registerMessage(AlignmentMessage.ServerHandler.class, AlignmentMessage.AlignmentQuery.class); + registerMessage(AlignmentMessage.ClientHandler.class, AlignmentMessage.AlignmentData.class); registerMessage(ChunkDataMessage.ServerHandler.class, ChunkDataMessage.ChunkDataQuery.class); registerMessage(ChunkDataMessage.ClientHandler.class, ChunkDataMessage.ChunkDataData.class); diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java index a1d400ed54..70f64d3719 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java @@ -165,32 +165,32 @@ public class BloodyRecipeLoader implements Runnable { GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_0.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.RedstoneAlloy)}); + 'W', OrePrefixes.wireGt02.get(Materials.Tin)}); //Tesla Primary Coils T1 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_1.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorMV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Copper)}); //Tesla Primary Coils T2 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_2.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorHV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Silver)}); //Tesla Primary Coils T3 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_3.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorEV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Aluminium)}); //Tesla Primary Coils T4 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_4.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorIV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Platinum)}); //Tesla Primary Coils T5 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_5.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorLuV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Superconductor)}); //endregion @@ -1114,7 +1114,7 @@ public class BloodyRecipeLoader implements Runnable { }, Materials.Epoxid.getMolten(288), CustomItemList.teslaComponent.getWithDamage(1, 0), 320, 30); //Tesla Winding Components Ultimate GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ - GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorLuV, 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.NickelZincFerrite, 8), }, Materials.Epoxid.getMolten(576), CustomItemList.teslaComponent.getWithDamage(1, 1), 320, 7680); @@ -1125,35 +1125,35 @@ public class BloodyRecipeLoader implements Runnable { //LV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Tin, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 4), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 4), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 8), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 8), }, Materials.Epoxid.getMolten(72), CustomItemList.teslaCapacitor.getWithDamage(1, 0), 320, 30); //MV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Copper, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 6), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 6), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 12), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 12), }, Materials.Epoxid.getMolten(144), CustomItemList.teslaCapacitor.getWithDamage(1, 1), 320, 120); //HV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Gold, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 8), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 8), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 16), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 16), }, Materials.Epoxid.getMolten(216), CustomItemList.teslaCapacitor.getWithDamage(1, 2), 320, 480); //EV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Aluminium, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 10), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 10), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 20), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 20), }, Materials.Epoxid.getMolten(288), CustomItemList.teslaCapacitor.getWithDamage(1, 3), 320, 1920); //IV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Tungsten, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 12), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 12), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 24), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 24), }, Materials.Epoxid.getMolten(360), CustomItemList.teslaCapacitor.getWithDamage(1, 4), 320, 7680); @@ -1208,19 +1208,19 @@ public class BloodyRecipeLoader implements Runnable { //LV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 0), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 4), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 4), 300, 2); //MV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 1), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 6), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 6), 300, 2); //HV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 2), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 8), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 8), 300, 2); //EV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 3), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 10), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 10), 300, 2); //IV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 12), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 12), 300, 2); //endregion diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 9f87428bb5..9dd71df9eb 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -15,7 +15,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; /** diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index 4596e8a2c8..7b432dbcb4 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -24,11 +24,11 @@ public class ThingsLoader implements Runnable { if(Textures.BlockIcons.casingTexturePages[tectechTexturePage1]==null) { Textures.BlockIcons.casingTexturePages[tectechTexturePage1] = new ITexture[128]; } + TecTech.LOGGER.info("Added texture page if was null"); if(!Loader.isModLoaded(Reference.DREAMCRAFT)){ - TecTech.LOGGER.info("Adding basic casings"); TT_Container_Casings.sBlockCasingsNH = new GT_Block_CasingsNH(); + TecTech.LOGGER.info("Adding basic casings"); } - TecTech.LOGGER.info("Added texture page if was null"); TT_Container_Casings.sBlockCasingsTT = new GT_Block_CasingsTT(); TecTech.LOGGER.info("Elemental Casing registered"); TT_Container_Casings.sBlockCasingsBA0 = new GT_Block_CasingsBA0(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java new file mode 100644 index 0000000000..26a6d80dd8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java @@ -0,0 +1,183 @@ +package com.github.technus.tectech.mechanics.alignment; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Random; +import java.util.function.Function; + +import static com.github.technus.tectech.mechanics.alignment.IAlignment.STATES_COUNT; + +public class AlignmentLimits implements IAlignmentLimits { + + protected final boolean[] validStates=new boolean[STATES_COUNT]; + + public AlignmentLimits() { + allowAll(); + } + + AlignmentLimits allowAll(){ + Arrays.fill(validStates,true); + return this; + } + + AlignmentLimits denyAll(){ + Arrays.fill(validStates,false); + return this; + } + + AlignmentLimits randomAll(Random random){ + for (int i = 0; i < validStates.length; i++) { + validStates[i]=random.nextBoolean(); + } + return this; + } + + AlignmentLimits deny(ExtendedFacing... deny){ + if(deny!=null){ + for (ExtendedFacing extendedFacing : deny) { + validStates[extendedFacing.getIndex()]=false; + } + } + return this; + } + + AlignmentLimits allow(ExtendedFacing... allow){ + if(allow!=null){ + for (ExtendedFacing extendedFacing : allow) { + validStates[extendedFacing.getIndex()]=false; + } + } + return this; + } + + AlignmentLimits deny(ForgeDirection... deny){ + if(deny!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (ForgeDirection direction : deny) { + if (value.getDirection() == direction) { + validStates[value.getIndex()] = false; + break; + } + } + } + } + return this; + } + + AlignmentLimits allow(ForgeDirection... allow){ + if(allow!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (ForgeDirection direction : allow) { + if (value.getDirection() == direction) { + validStates[value.getIndex()] = true; + break; + } + } + } + } + return this; + } + + AlignmentLimits deny(Rotation... deny){ + if(deny!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Rotation rotation : deny) { + if (value.getRotation() == rotation) { + validStates[value.getIndex()] = false; + break; + } + } + } + } + return this; + } + + AlignmentLimits allow(Rotation... allow){ + if(allow!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Rotation rotation : allow) { + if (value.getRotation() == rotation) { + validStates[value.getIndex()] = true; + break; + } + } + } + } + return this; + } + + AlignmentLimits deny(Flip... deny){ + if(deny!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Flip flip : deny) { + if (value.getFlip() == flip) { + validStates[value.getIndex()] = false; + break; + } + } + } + } + return this; + } + + AlignmentLimits allow(Flip... allow){ + if(allow!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Flip flip : allow) { + if (value.getFlip() == flip) { + validStates[value.getIndex()] = true; + break; + } + } + } + } + return this; + } + + AlignmentLimits predicateApply(Function> predicate){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + predicate.apply(value).ifPresent(bool->validStates[value.getIndex()]=bool); + } + return this; + } + + AlignmentLimits ensureDuplicates(){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + if(validStates[value.getIndex()]){ + validStates[value.getDuplicate().getIndex()]=true; + } + } + return this; + } + + /** + * Prefers rotation over flip, so both flip will get translated to opposite rotation and no flip + * @param flip the preferred flip to be used Horizontal or vertical + * @return this + */ + AlignmentLimits ensureNoDuplicates(Flip flip){ + if(flip==Flip.BOTH||flip==Flip.NONE){ + throw new IllegalArgumentException("Preffered Flip must be Horizontal or Vertical"); + } + flip=flip.getOpposite(); + for (ExtendedFacing value : ExtendedFacing.VALUES) { + if(validStates[value.getIndex()]){ + if(value.getFlip()==Flip.BOTH || value.getFlip()==flip){ + validStates[value.getIndex()]=false; + validStates[value.getDuplicate().getIndex()]=true; + } + } + } + return this; + } + + @Override + public boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip) { + return validStates[IAlignment.getAlignmentIndex(direction,rotation,flip)]; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java new file mode 100644 index 0000000000..07a3e02c1f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java @@ -0,0 +1,140 @@ +package com.github.technus.tectech.mechanics.alignment; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import cpw.mods.fml.common.network.ByteBufUtils; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; +import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; + +public class AlignmentMessage implements IMessage { + int mPosX; + int mPosY; + int mPosZ; + int mPosD; + int mAlign; + + public AlignmentMessage() { + } + + private AlignmentMessage(GT_MetaTileEntity_MultiblockBase_EM metaTile) { + IGregTechTileEntity base=metaTile.getBaseMetaTileEntity(); + mPosX=base.getXCoord(); + mPosY=base.getYCoord(); + mPosZ=base.getZCoord(); + mPosD=base.getWorld().provider.dimensionId; + mAlign =metaTile.getExtendedFacing().getIndex(); + } + + private AlignmentMessage(World world, int x, int y, int z, IAlignment front) { + mPosX=x; + mPosY=y; + mPosZ=z; + mPosD=world.provider.dimensionId; + mAlign =front.getExtendedFacing().getIndex(); + } + + @Override + public void fromBytes(ByteBuf pBuffer) { + NBTTagCompound tTag = ByteBufUtils.readTag(pBuffer); + mPosX = tTag.getInteger("posx"); + mPosY = tTag.getInteger("posy"); + mPosZ = tTag.getInteger("posz"); + mPosD = tTag.getInteger("posd"); + mAlign = tTag.getInteger("rotf"); + } + + @Override + public void toBytes(ByteBuf pBuffer) { + NBTTagCompound tFXTag = new NBTTagCompound(); + tFXTag.setInteger("posx", mPosX); + tFXTag.setInteger("posy", mPosY); + tFXTag.setInteger("posz", mPosZ); + tFXTag.setInteger("posd", mPosD); + tFXTag.setInteger("rotf", mAlign); + + ByteBufUtils.writeTag(pBuffer, tFXTag); + } + + public static class AlignmentQuery extends AlignmentMessage { + public AlignmentQuery() { + } + + public AlignmentQuery(GT_MetaTileEntity_MultiblockBase_EM metaTile) { + super(metaTile); + } + + public AlignmentQuery(World world, int x, int y, int z, IAlignment front) { + super(world,x,y,z,front); + } + } + + public static class AlignmentData extends AlignmentMessage { + public AlignmentData() { + } + + private AlignmentData(AlignmentQuery query){ + mPosX=query.mPosX; + mPosY=query.mPosY; + mPosZ=query.mPosZ; + mPosD=query.mPosD; + mAlign =query.mAlign; + } + + public AlignmentData(GT_MetaTileEntity_MultiblockBase_EM metaTile) { + super(metaTile); + } + + public AlignmentData(World world, int x, int y, int z, IAlignment front) { + super(world,x,y,z,front); + } + } + + public static class ClientHandler extends AbstractClientMessageHandler { + @Override + public IMessage handleClientMessage(EntityPlayer pPlayer, AlignmentData pMessage, MessageContext pCtx) { + if(pPlayer.worldObj.provider.dimensionId==pMessage.mPosD){ + TileEntity te=pPlayer.worldObj.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ); + if(te instanceof IGregTechTileEntity){ + IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); + if(meta instanceof IAlignment){ + ((IAlignment) meta).setExtendedFacing(ExtendedFacing.byIndex(pMessage.mAlign)); + } + }else if (te instanceof IAlignment){ + ((IAlignment) te).setExtendedFacing(ExtendedFacing.byIndex(pMessage.mAlign)); + } + } + return null; + } + } + + public static class ServerHandler extends AbstractServerMessageHandler { + @Override + public IMessage handleServerMessage(EntityPlayer pPlayer, AlignmentQuery pMessage, MessageContext pCtx) { + World world= DimensionManager.getWorld(pMessage.mPosD); + if(world!=null) { + TileEntity te = world.getTileEntity(pMessage.mPosX, pMessage.mPosY, pMessage.mPosZ); + if (te instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); + if (meta instanceof IAlignment) { + pMessage.mAlign =((IAlignment) meta).getExtendedFacing().getIndex(); + return new AlignmentData(pMessage); + } + } else if (te instanceof IAlignment) { + pMessage.mAlign =((IAlignment) te).getExtendedFacing().getIndex(); + return new AlignmentData(pMessage); + } + } + return null; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java new file mode 100644 index 0000000000..d7b48f8865 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java @@ -0,0 +1,173 @@ +package com.github.technus.tectech.mechanics.alignment; + +import com.github.technus.tectech.mechanics.alignment.enumerable.Direction; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.Arrays; + +public interface IAlignment extends IAlignmentLimits { + int DIRECTIONS_COUNT= Direction.VALUES.length; + int ROTATIONS_COUNT= Rotation.VALUES.length; + int FLIPS_COUNT= Flip.VALUES.length; + int STATES_COUNT = ExtendedFacing.VALUES.length; + + static int getAlignmentIndex(ForgeDirection direction, Rotation rotation, Flip flip){ + return (direction.ordinal()*ROTATIONS_COUNT+rotation.getIndex())*FLIPS_COUNT+flip.getIndex(); + } + + default ForgeDirection getDirection(){ + return getExtendedFacing().getDirection(); + } + + default void setDirection(ForgeDirection direction){ + setExtendedFacing(getExtendedFacing().with(direction)); + } + + default Rotation getRotation(){ + return getExtendedFacing().getRotation(); + } + + default void setRotation(Rotation rotation){ + setExtendedFacing(getExtendedFacing().with(rotation)); + } + + default Flip getFlip(){ + return getExtendedFacing().getFlip(); + } + + default void setFlip(Flip flip){ + setExtendedFacing(getExtendedFacing().with(flip)); + } + + ExtendedFacing getExtendedFacing(); + + void setExtendedFacing(ExtendedFacing alignment); + + IAlignmentLimits getAlignmentLimits(); + + void setAlignmentLimits(IAlignmentLimits limits); + + default boolean toolSetDirection(ForgeDirection direction){ + if(direction==null || direction==ForgeDirection.UNKNOWN){ + for (int i = 0,j=getDirection().ordinal()+1, valuesLength = Direction.VALUES.length; i < valuesLength; i++) { + if(toolSetDirection(Direction.VALUES[j%valuesLength].getForgeDirection())){ + return true; + } + } + }else { + for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) { + if(checkedSetExtendedFacing(extendedFacing)){ + return true; + } + } + } + return false; + } + + default boolean checkedSetDirection(ForgeDirection direction){ + if (isNewDirectionValid(direction)){ + setDirection(direction); + return true; + } + return false; + } + + default boolean toolSetRotation(Rotation rotation) { + if(rotation==null){ + int flips = Flip.VALUES.length; + int rotations = Rotation.VALUES.length; + for (int ii = 0,jj=getFlip().ordinal(); ii < flips; ii++) { + for (int i = 0,j=getRotation().ordinal()+1; i < rotations; i++) { + if(checkedSetExtendedFacing(ExtendedFacing.of(getDirection(),Rotation.VALUES[j%rotations],Flip.VALUES[jj%flips]))){ + return true; + } + } + } + return false; + }else { + return checkedSetRotation(rotation); + } + } + + default boolean checkedSetRotation(Rotation rotation){ + if (isNewRotationValid(rotation)){ + setRotation(rotation); + return true; + } + return false; + } + + default boolean toolSetFlip(Flip flip){ + if(flip==null){ + for (int i = 0,j=getFlip().ordinal()+1, valuesLength = Flip.VALUES.length; i < valuesLength; i++) { + if(toolSetFlip(Flip.VALUES[j%valuesLength])){ + return true; + } + } + return false; + }else { + return checkedSetFlip(flip); + } + } + + default boolean checkedSetFlip(Flip flip){ + if (isNewFlipValid(flip)){ + setFlip(flip); + return true; + } + return false; + } + + default boolean toolSetExtendedFacing(ExtendedFacing extendedFacing){ + if(extendedFacing==null){ + for (int i = 0,j=getExtendedFacing().ordinal()+1, valuesLength = ExtendedFacing.VALUES.length; i < valuesLength; i++) { + if(toolSetExtendedFacing(ExtendedFacing.VALUES[j%valuesLength])){ + return true; + } + } + return false; + }else { + return checkedSetExtendedFacing(extendedFacing); + } + } + + default boolean checkedSetExtendedFacing(ExtendedFacing alignment){ + if (isNewExtendedFacingValid(alignment)){ + setExtendedFacing(alignment); + return true; + } + return false; + } + + default boolean isNewDirectionValid(ForgeDirection direction) { + return isNewExtendedFacingValid(direction,getRotation(),getFlip()); + } + + default boolean isNewRotationValid(Rotation rotation){ + return isNewExtendedFacingValid(getDirection(),rotation,getFlip()); + } + + default boolean isNewFlipValid(Flip flip){ + return isNewExtendedFacingValid(getDirection(),getRotation(),flip); + } + + default boolean isExtendedFacingValid() { + return isNewExtendedFacingValid(getDirection(),getRotation(),getFlip()); + } + + @Override + default boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip){ + return getAlignmentLimits().isNewExtendedFacingValid(direction, rotation, flip); + } + + @Override + default boolean isNewExtendedFacingValid(ExtendedFacing alignment){ + return getAlignmentLimits().isNewExtendedFacingValid( + alignment.getDirection(), + alignment.getRotation(), + alignment.getFlip()); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java new file mode 100644 index 0000000000..68b4d84dab --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.mechanics.alignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IAlignmentLimits { + + IAlignmentLimits UNLIMITED= (direction, rotation, flip) -> true; + + boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip); + + default boolean isNewExtendedFacingValid(ExtendedFacing alignment){ + return isNewExtendedFacingValid( + alignment.getDirection(), + alignment.getRotation(), + alignment.getFlip()); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java new file mode 100644 index 0000000000..40cb6c3220 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java @@ -0,0 +1,67 @@ +package com.github.technus.tectech.mechanics.alignment; + +import com.github.technus.tectech.util.Vec3Impl; +import net.minecraftforge.common.util.ForgeDirection; + +import static com.github.technus.tectech.mechanics.alignment.enumerable.Direction.getAxisVector; +import static java.lang.Math.abs; + +public class IntegerAxisSwap { + private final Vec3Impl forFirstAxis; + private final Vec3Impl forSecondAxis; + private final Vec3Impl forThirdAxis; + + public IntegerAxisSwap(ForgeDirection forFirstAxis, ForgeDirection forSecondAxis, ForgeDirection forThirdAxis) { + this.forFirstAxis = getAxisVector(forFirstAxis); + this.forSecondAxis = getAxisVector(forSecondAxis); + this.forThirdAxis = getAxisVector(forThirdAxis); + if(abs(this.forFirstAxis.get0())+abs(this.forSecondAxis.get0())+abs(this.forThirdAxis.get0())!=1 || + abs(this.forFirstAxis.get1())+abs(this.forSecondAxis.get1())+abs(this.forThirdAxis.get1())!=1 || + abs(this.forFirstAxis.get2())+abs(this.forSecondAxis.get2())+abs(this.forThirdAxis.get2())!=1){ + throw new IllegalArgumentException("Axis are overlapping/missing! "+ + forFirstAxis.name()+" "+ + forSecondAxis.name()+" "+ + forThirdAxis.name()); + } + } + + public Vec3Impl translate(Vec3Impl point){ + return new Vec3Impl( + forFirstAxis.get0()*point.get0() +forFirstAxis.get1()*point.get1() +forFirstAxis.get2()*point.get2(), + forSecondAxis.get0()*point.get0()+forSecondAxis.get1()*point.get1()+forSecondAxis.get2()*point.get2(), + forThirdAxis.get0()*point.get0() +forThirdAxis.get1()*point.get1() +forThirdAxis.get2()*point.get2() + ); + } + + public Vec3Impl inverseTranslate(Vec3Impl point){ + return new Vec3Impl( + forFirstAxis.get0()*point.get0()+forSecondAxis.get0()*point.get1()+forThirdAxis.get0()*point.get2(), + forFirstAxis.get1()*point.get0()+forSecondAxis.get1()*point.get1()+forThirdAxis.get1()*point.get2(), + forFirstAxis.get2()*point.get0()+forSecondAxis.get2()*point.get1()+forThirdAxis.get2()*point.get2() + ); + } + + public void translate(int[] point,int[] out){ + out[0]=forFirstAxis.get0()*point[0] +forFirstAxis.get1()*point[1] +forFirstAxis.get2()*point[2]; + out[1]=forSecondAxis.get0()*point[0]+forSecondAxis.get1()*point[1]+forSecondAxis.get2()*point[2]; + out[2]=forThirdAxis.get0()*point[0] +forThirdAxis.get1()*point[1] +forThirdAxis.get2()*point[2]; + } + + public void inverseTranslate(int[] point,int[] out){ + out[0]=forFirstAxis.get0()*point[0]+forSecondAxis.get0()*point[1]+forThirdAxis.get0()*point[2]; + out[1]=forFirstAxis.get1()*point[0]+forSecondAxis.get1()*point[1]+forThirdAxis.get1()*point[2]; + out[2]=forFirstAxis.get2()*point[0]+forSecondAxis.get2()*point[1]+forThirdAxis.get2()*point[2]; + } + + public void translate(double[] point,double[] out){ + out[0]=forFirstAxis.get0()*point[0] +forFirstAxis.get1()*point[1] +forFirstAxis.get2()*point[2]; + out[1]=forSecondAxis.get0()*point[0]+forSecondAxis.get1()*point[1]+forSecondAxis.get2()*point[2]; + out[2]=forThirdAxis.get0()*point[0] +forThirdAxis.get1()*point[1] +forThirdAxis.get2()*point[2]; + } + + public void inverseTranslate(double[] point,double[] out){ + out[0]=forFirstAxis.get0()*point[0]+forSecondAxis.get0()*point[1]+forThirdAxis.get0()*point[2]; + out[1]=forFirstAxis.get1()*point[0]+forSecondAxis.get1()*point[1]+forThirdAxis.get1()*point[2]; + out[2]=forFirstAxis.get2()*point[0]+forSecondAxis.get2()*point[1]+forThirdAxis.get2()*point[2]; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java new file mode 100644 index 0000000000..cc3971fedb --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java @@ -0,0 +1,34 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import com.github.technus.tectech.util.Vec3Impl; +import net.minecraftforge.common.util.ForgeDirection; + +public enum Direction { + DOWN(ForgeDirection.DOWN), + UP(ForgeDirection.UP), + NORTH(ForgeDirection.NORTH), + SOUTH(ForgeDirection.SOUTH), + WEST(ForgeDirection.WEST), + EAST(ForgeDirection.EAST); + + private final ForgeDirection forgeDirection; + private final Vec3Impl axisVector; + public static final Direction[] VALUES=values(); + + Direction(ForgeDirection forgeDirection) { + this.forgeDirection = forgeDirection; + axisVector=new Vec3Impl(forgeDirection.offsetX,forgeDirection.offsetY,forgeDirection.offsetZ); + } + + public ForgeDirection getForgeDirection() { + return forgeDirection; + } + + public Vec3Impl getAxisVector() { + return axisVector; + } + + public static Vec3Impl getAxisVector(ForgeDirection forgeDirection){ + return VALUES[forgeDirection.ordinal()].axisVector; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java new file mode 100644 index 0000000000..68cc50a5ee --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -0,0 +1,324 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.IntegerAxisSwap; +import com.github.technus.tectech.util.Vec3Impl; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.*; + +import static com.github.technus.tectech.mechanics.alignment.IAlignment.FLIPS_COUNT; +import static com.github.technus.tectech.mechanics.alignment.IAlignment.ROTATIONS_COUNT; +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.reducing; +import static java.util.stream.Collectors.toMap; + +public enum ExtendedFacing { + DOWN_NORMAL_NONE("down normal none"), + DOWN_NORMAL_HORIZONTAL("down normal horizontal"), + DOWN_NORMAL_VERTICAL("down normal vertical"), + DOWN_NORMAL_BOTH("down normal both"), + DOWN_CLOCKWISE_NONE("down clockwise none"), + DOWN_CLOCKWISE_HORIZONTAL("down clockwise horizontal"), + DOWN_CLOCKWISE_VERTICAL("down clockwise vertical"), + DOWN_CLOCKWISE_BOTH("down clockwise both"), + DOWN_UPSIDE_DOWN_NONE("down upside down none"), + DOWN_UPSIDE_DOWN_HORIZONTAL("down upside down horizontal"), + DOWN_UPSIDE_DOWN_VERTICAL("down upside down vertical"), + DOWN_UPSIDE_DOWN_BOTH("down upside down both"), + DOWN_COUNTER_CLOCKWISE_NONE("down counter clockwise none"), + DOWN_COUNTER_CLOCKWISE_HORIZONTAL("down counter clockwise horizontal"), + DOWN_COUNTER_CLOCKWISE_VERTICAL("down counter clockwise vertical"), + DOWN_COUNTER_CLOCKWISE_BOTH("down counter clockwise both"), + UP_NORMAL_NONE("up normal none"), + UP_NORMAL_HORIZONTAL("up normal horizontal"), + UP_NORMAL_VERTICAL("up normal vertical"), + UP_NORMAL_BOTH("up normal both"), + UP_CLOCKWISE_NONE("up clockwise none"), + UP_CLOCKWISE_HORIZONTAL("up clockwise horizontal"), + UP_CLOCKWISE_VERTICAL("up clockwise vertical"), + UP_CLOCKWISE_BOTH("up clockwise both"), + UP_UPSIDE_DOWN_NONE("up upside down none"), + UP_UPSIDE_DOWN_HORIZONTAL("up upside down horizontal"), + UP_UPSIDE_DOWN_VERTICAL("up upside down vertical"), + UP_UPSIDE_DOWN_BOTH("up upside down both"), + UP_COUNTER_CLOCKWISE_NONE("up counter clockwise none"), + UP_COUNTER_CLOCKWISE_HORIZONTAL("up counter clockwise horizontal"), + UP_COUNTER_CLOCKWISE_VERTICAL("up counter clockwise vertical"), + UP_COUNTER_CLOCKWISE_BOTH("up counter clockwise both"), + NORTH_NORMAL_NONE("north normal none"), + NORTH_NORMAL_HORIZONTAL("north normal horizontal"), + NORTH_NORMAL_VERTICAL("north normal vertical"), + NORTH_NORMAL_BOTH("north normal both"), + NORTH_CLOCKWISE_NONE("north clockwise none"), + NORTH_CLOCKWISE_HORIZONTAL("north clockwise horizontal"), + NORTH_CLOCKWISE_VERTICAL("north clockwise vertical"), + NORTH_CLOCKWISE_BOTH("north clockwise both"), + NORTH_UPSIDE_DOWN_NONE("north upside down none"), + NORTH_UPSIDE_DOWN_HORIZONTAL("north upside down horizontal"), + NORTH_UPSIDE_DOWN_VERTICAL("north upside down vertical"), + NORTH_UPSIDE_DOWN_BOTH("north upside down both"), + NORTH_COUNTER_CLOCKWISE_NONE("north counter clockwise none"), + NORTH_COUNTER_CLOCKWISE_HORIZONTAL("north counter clockwise horizontal"), + NORTH_COUNTER_CLOCKWISE_VERTICAL("north counter clockwise vertical"), + NORTH_COUNTER_CLOCKWISE_BOTH("north counter clockwise both"), + SOUTH_NORMAL_NONE("south normal none"), + SOUTH_NORMAL_HORIZONTAL("south normal horizontal"), + SOUTH_NORMAL_VERTICAL("south normal vertical"), + SOUTH_NORMAL_BOTH("south normal both"), + SOUTH_CLOCKWISE_NONE("south clockwise none"), + SOUTH_CLOCKWISE_HORIZONTAL("south clockwise horizontal"), + SOUTH_CLOCKWISE_VERTICAL("south clockwise vertical"), + SOUTH_CLOCKWISE_BOTH("south clockwise both"), + SOUTH_UPSIDE_DOWN_NONE("south upside down none"), + SOUTH_UPSIDE_DOWN_HORIZONTAL("south upside down horizontal"), + SOUTH_UPSIDE_DOWN_VERTICAL("south upside down vertical"), + SOUTH_UPSIDE_DOWN_BOTH("south upside down both"), + SOUTH_COUNTER_CLOCKWISE_NONE("south counter clockwise none"), + SOUTH_COUNTER_CLOCKWISE_HORIZONTAL("south counter clockwise horizontal"), + SOUTH_COUNTER_CLOCKWISE_VERTICAL("south counter clockwise vertical"), + SOUTH_COUNTER_CLOCKWISE_BOTH("south counter clockwise both"), + WEST_NORMAL_NONE("west normal none"), + WEST_NORMAL_HORIZONTAL("west normal horizontal"), + WEST_NORMAL_VERTICAL("west normal vertical"), + WEST_NORMAL_BOTH("west normal both"), + WEST_CLOCKWISE_NONE("west clockwise none"), + WEST_CLOCKWISE_HORIZONTAL("west clockwise horizontal"), + WEST_CLOCKWISE_VERTICAL("west clockwise vertical"), + WEST_CLOCKWISE_BOTH("west clockwise both"), + WEST_UPSIDE_DOWN_NONE("west upside down none"), + WEST_UPSIDE_DOWN_HORIZONTAL("west upside down horizontal"), + WEST_UPSIDE_DOWN_VERTICAL("west upside down vertical"), + WEST_UPSIDE_DOWN_BOTH("west upside down both"), + WEST_COUNTER_CLOCKWISE_NONE("west counter clockwise none"), + WEST_COUNTER_CLOCKWISE_HORIZONTAL("west counter clockwise horizontal"), + WEST_COUNTER_CLOCKWISE_VERTICAL("west counter clockwise vertical"), + WEST_COUNTER_CLOCKWISE_BOTH("west counter clockwise both"), + EAST_NORMAL_NONE("east normal none"), + EAST_NORMAL_HORIZONTAL("east normal horizontal"), + EAST_NORMAL_VERTICAL("east normal vertical"), + EAST_NORMAL_BOTH("east normal both"), + EAST_CLOCKWISE_NONE("east clockwise none"), + EAST_CLOCKWISE_HORIZONTAL("east clockwise horizontal"), + EAST_CLOCKWISE_VERTICAL("east clockwise vertical"), + EAST_CLOCKWISE_BOTH("east clockwise both"), + EAST_UPSIDE_DOWN_NONE("east upside down none"), + EAST_UPSIDE_DOWN_HORIZONTAL("east upside down horizontal"), + EAST_UPSIDE_DOWN_VERTICAL("east upside down vertical"), + EAST_UPSIDE_DOWN_BOTH("east upside down both"), + EAST_COUNTER_CLOCKWISE_NONE("east counter clockwise none"), + EAST_COUNTER_CLOCKWISE_HORIZONTAL("east counter clockwise horizontal"), + EAST_COUNTER_CLOCKWISE_VERTICAL("east counter clockwise vertical"), + EAST_COUNTER_CLOCKWISE_BOTH("east counter clockwise both"); + + public static final ExtendedFacing DEFAULT=NORTH_NORMAL_NONE; + public static final ExtendedFacing[] VALUES = values(); + public static final Map> FOR_FACING=new HashMap<>(); + static { + stream(values()).forEach(extendedFacing -> + FOR_FACING.compute(extendedFacing.direction,((forgeDirection, extendedFacings) -> { + if(extendedFacings==null){ + extendedFacings = new ArrayList<>(); + } + extendedFacings.add(extendedFacing); + return extendedFacings; + }))); + } + private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(ExtendedFacing::getName2, (extendedFacing) -> extendedFacing)); + + private final ForgeDirection direction; + private final Rotation rotation; + private final Flip flip; + + private final String name; + private final IntegerAxisSwap integerAxisSwap; + + ExtendedFacing(String name) { + this.name = name; + direction= Direction.VALUES[ordinal()/(ROTATIONS_COUNT*FLIPS_COUNT)].getForgeDirection(); + rotation=Rotation.VALUES[ordinal()/FLIPS_COUNT-direction.ordinal()*ROTATIONS_COUNT]; + flip=Flip.VALUES[ordinal()%FLIPS_COUNT]; + ForgeDirection a,b,c; + switch (direction){ + case DOWN: + a= ForgeDirection.WEST; + b= ForgeDirection.NORTH; + c= ForgeDirection.UP; + break; + case UP: + a= ForgeDirection.EAST; + b= ForgeDirection.NORTH; + c= ForgeDirection.DOWN; + break; + case NORTH: + a= ForgeDirection.WEST; + b= ForgeDirection.UP; + c= ForgeDirection.SOUTH; + break; + case SOUTH: + a= ForgeDirection.EAST; + b= ForgeDirection.UP; + c= ForgeDirection.NORTH; + break; + case WEST: + a= ForgeDirection.SOUTH; + b= ForgeDirection.UP; + c= ForgeDirection.EAST; + break; + case EAST: + a= ForgeDirection.NORTH; + b= ForgeDirection.UP; + c= ForgeDirection.WEST; + break; + default:throw new RuntimeException("Is impossible..."); + } + switch (flip){//This duplicates some axis swaps since flip boolean would do, but seems more convenient to use + case HORIZONTAL: + a=a.getOpposite(); + break; + case BOTH: + a=a.getOpposite(); + case VERTICAL: + b=b.getOpposite(); + break; + case NONE: break; + default:throw new RuntimeException("Even more impossible..."); + } + switch (rotation) { + case COUNTER_CLOCKWISE: { + ForgeDirection _a=a; + a =b; + b =_a.getOpposite(); + break; + } + case UPSIDE_DOWN: + a=a.getOpposite(); + b=b.getOpposite(); + break; + case CLOCKWISE: { + ForgeDirection _a=a; + a =b.getOpposite(); + b =_a; + break; + } + case NORMAL: break; + default: + throw new RuntimeException("More impossible..."); + } + integerAxisSwap =new IntegerAxisSwap(a,b,c); + } + + public static ExtendedFacing of(ForgeDirection direction, Rotation rotation, Flip flip){ + if(direction==ForgeDirection.UNKNOWN){ + return VALUES[IAlignment.getAlignmentIndex(ForgeDirection.NORTH, rotation, flip)]; + } + return VALUES[IAlignment.getAlignmentIndex(direction, rotation, flip)]; + } + + public static ExtendedFacing of(ForgeDirection direction){ + if(direction==ForgeDirection.UNKNOWN){ + return DEFAULT; + } + return VALUES[IAlignment.getAlignmentIndex(direction, Rotation.NORMAL, Flip.NONE)]; + } + + public ExtendedFacing with(ForgeDirection direction){ + return of(direction,rotation,flip); + } + + public ExtendedFacing with(Rotation rotation){ + return of(direction,rotation,flip); + } + + public ExtendedFacing with(Flip flip){ + return of(direction,rotation,flip); + } + + public ExtendedFacing getOppositeDirection() { + return of(direction.getOpposite(),rotation,flip); + } + + public ExtendedFacing getOppositeRotation() { + return of(direction,rotation.getOpposite(),flip); + } + + public ExtendedFacing getOppositeFlip() { + return of(direction,rotation,flip.getOpposite()); + } + + /** + * Gets the same effective facing achieved by different rot/flip combo + * @return same effective facing, but different enum value + */ + public ExtendedFacing getDuplicate(){ + return of(direction,rotation.getOpposite(),flip.getOpposite()); + } + + public int getIndex(){ + return ordinal(); + } + + public String getName2() { + return this.name; + } + + public static ExtendedFacing byName(String name) { + return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); + } + + public static ExtendedFacing byIndex(int index) { + return VALUES[abs(index % VALUES.length)]; + } + + public static ExtendedFacing random(Random rand) { + return VALUES[rand.nextInt(VALUES.length)]; + } + + public ForgeDirection getDirection() { + return direction; + } + + public Rotation getRotation() { + return rotation; + } + + public Flip getFlip() { + return flip; + } + + /** + * Translates relative to front facing offset to world offset + * @param abcOffset A,B,C offset (facing relative L-->R,U-->D,F-->B) + * @return X,Y,Z offset in world + */ + public Vec3Impl getWorldOffset(Vec3Impl abcOffset) { + return integerAxisSwap.inverseTranslate(abcOffset); + } + public void getWorldOffset(int[] point,int[] out){ + integerAxisSwap.inverseTranslate(point,out); + } + public void getWorldOffset(double[] point,double[] out){ + integerAxisSwap.inverseTranslate(point,out); + } + + + /** + * Translates world offset to relative front facing offset + * @param xyzOffset X,Y,Z offset in world + * @return A,B,C offset (facing relative L-->R,U-->D,F-->B) + */ + public Vec3Impl getOffsetABC(Vec3Impl xyzOffset){ + return integerAxisSwap.translate(xyzOffset); + } + public void getOffsetABC(int[] point,int[] out){ + integerAxisSwap.translate(point,out); + } + public void getOffsetABC(double[] point,double[] out){ + integerAxisSwap.translate(point,out); + } + + public IntegerAxisSwap getIntegerAxisSwap() { + return integerAxisSwap; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java new file mode 100644 index 0000000000..4b1dff70ec --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java @@ -0,0 +1,76 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import javax.annotation.Nonnull; +import java.util.Locale; +import java.util.Map; +import java.util.Random; + +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toMap; + +public enum Flip { + NONE(3, "none"), + HORIZONTAL(2, "horizontal"), + VERTICAL(1, "vertical"), + BOTH(0, "both"); + + private final int opposite; + private final String name; + + public static final Flip[] VALUES = values(); + private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(Flip::getName2, (flip) -> flip)); + + Flip(int oppositeIn, String nameIn) { + this.opposite = oppositeIn; + this.name = nameIn; + } + + public int getIndex(){ + return ordinal(); + } + + public Flip getOpposite() { + return VALUES[opposite]; + } + + public String getName2() { + return this.name; + } + + public static Flip byName(String name) { + return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); + } + + public static Flip byIndex(int index) { + return VALUES[abs(index % VALUES.length)]; + } + + public static Flip random(@Nonnull Random rand) { + return VALUES[rand.nextInt(VALUES.length)]; + } + + public String toString() { + return this.name; + } + + public String getName() { + return this.name; + } + + public boolean isNotFlipped(){ + return this==NONE; + } + + public boolean isBothFlipped(){ + return this==BOTH; + } + + public boolean isHorizontallyFlipped() { + return this==HORIZONTAL || isBothFlipped(); + } + + public boolean isVerticallyFliped() { + return this==VERTICAL || isBothFlipped(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java new file mode 100644 index 0000000000..5d41f54a11 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java @@ -0,0 +1,76 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import javax.annotation.Nonnull; +import java.util.Locale; +import java.util.Map; +import java.util.Random; + +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toMap; + +public enum Rotation { + NORMAL(2, "normal"), + CLOCKWISE(3, "clockwise"), + UPSIDE_DOWN(0, "upside down"), + COUNTER_CLOCKWISE(1, "counter clockwise"); + + private final int opposite; + private final String name; + + public static final Rotation[] VALUES = values(); + private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(Rotation::getName2, (rotation) -> rotation)); + + Rotation(int oppositeIn, String nameIn) { + this.opposite = oppositeIn; + this.name = nameIn; + } + + public int getIndex(){ + return ordinal(); + } + + public Rotation getOpposite() { + return VALUES[opposite]; + } + + public String getName2() { + return this.name; + } + + public static Rotation byName(String name) { + return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); + } + + public static Rotation byIndex(int index) { + return VALUES[abs(index % VALUES.length)]; + } + + public static Rotation random(@Nonnull Random rand) { + return VALUES[rand.nextInt(VALUES.length)]; + } + + public String toString() { + return this.name; + } + + public String getName() { + return this.name; + } + + public boolean isNotRotated(){ + return this==NORMAL; + } + + public boolean isClockwise(){ + return this==CLOCKWISE; + } + + public boolean isCounterClockwise(){ + return this==COUNTER_CLOCKWISE; + } + + public boolean isUpsideDown(){ + return this==UPSIDE_DOWN; + } +} 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 2a770ea332..a3fa341697 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; 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 61fa56f93a..5885226f6f 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; +import com.github.technus.tectech.util.Util; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; 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 c9767560c3..41edd66684 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; +import com.github.technus.tectech.util.Util; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java new file mode 100644 index 0000000000..fdfa2904fb --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java @@ -0,0 +1,15 @@ +package com.github.technus.tectech.mechanics.constructible; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Created by Tec on 24.03.2017. + */ +public interface IConstructable { + void construct(int stackSize, boolean hintsOnly); + + @SideOnly(Side.CLIENT) + String[] getStructureDescription(int stackSize); +} + 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 0a086384bc..6094d08ba4 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; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; 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 0a829de3e9..f69bccc871 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; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java index 82234e4c75..990a48ac70 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.Vec3pos; +import com.github.technus.tectech.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; import java.util.Collections; @@ -12,7 +12,7 @@ import java.util.Set; */ public abstract class DataPacket{ private static final byte MAX_HISTORY = 64; - private Set trace = new LinkedHashSet<>(); + private Set trace = new LinkedHashSet<>(); protected T content; @@ -23,9 +23,9 @@ public abstract class DataPacket{ protected DataPacket(NBTTagCompound nbt) { content = contentFromNBT(nbt.getCompoundTag("qContent")); for (int i = 0; i < nbt.getByte("qHistory"); i++) { - trace.add(new Vec3pos( + trace.add(new Vec3Impl( nbt.getInteger("qX" + i), - nbt.getShort("qY" + i), + nbt.getInteger("qY" + i), nbt.getInteger("qZ" + i) )); } @@ -39,10 +39,10 @@ public abstract class DataPacket{ } nbt.setByte("qHistory", (byte) trace.size()); int i = 0; - for (Vec3pos v : trace) { - nbt.setInteger("qX" + i, v.x); - nbt.setShort("qY" + i, v.y); - nbt.setInteger("qZ" + i, v.z); + for (Vec3Impl v : trace) { + nbt.setInteger("qX" + i, v.get0()); + nbt.setInteger("qY" + i, v.get1()); + nbt.setInteger("qZ" + i, v.get2()); i++; } return nbt; @@ -54,7 +54,7 @@ public abstract class DataPacket{ protected abstract T unifyContentWith(T content); - public final boolean contains(Vec3pos v) { + public final boolean contains(Vec3Impl v) { return trace.contains(v); } @@ -64,7 +64,7 @@ public abstract class DataPacket{ public abstract boolean extraCheck(); - protected final DataPacket unifyTrace(Vec3pos... positions) { + protected final DataPacket unifyTrace(Vec3Impl... positions) { Collections.addAll(trace,positions); return (check() && extraCheck()) ? this : null; } @@ -85,7 +85,7 @@ public abstract class DataPacket{ return null; } - public final T contentIfNotInTrace(Vec3pos pos) { + public final T contentIfNotInTrace(Vec3Impl pos) { if (trace.contains(pos)) { return null; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java index 9661d8d315..268de6f71c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.Vec3pos; +import com.github.technus.tectech.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; public class QuantumDataPacket extends DataPacket { @@ -34,7 +34,7 @@ public class QuantumDataPacket extends DataPacket { return this.content+content; } - public QuantumDataPacket unifyTraceWith(Vec3pos... positions) { + public QuantumDataPacket unifyTraceWith(Vec3Impl... positions) { return (QuantumDataPacket) super.unifyTrace(positions); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index ba3c8f909c..c108d8c8ae 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java index 24033ba945..701682cdaa 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java @@ -15,7 +15,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.Util.areBitsSet; +import static com.github.technus.tectech.util.Util.areBitsSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index ea8f6bc201..205851c61b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.XSTR; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.XSTR; import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; @@ -25,7 +25,7 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.*; -import static com.github.technus.tectech.XSTR.XSTR_INSTANCE; +import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 04a1eab490..96ee5cc3db 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java index 8b54bdd306..87a71b684f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import java.io.BufferedReader; import java.io.InputStreamReader; diff --git a/src/main/java/com/github/technus/tectech/mechanics/pipe/IActivePipe.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IActivePipe.java new file mode 100644 index 0000000000..4f244c804b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IActivePipe.java @@ -0,0 +1,9 @@ +package com.github.technus.tectech.mechanics.pipe; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; + +public interface IActivePipe extends IMetaTileEntity { + void setActive(boolean active); + boolean getActive(); + void markUsed(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToDataPipe.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToDataPipe.java new file mode 100644 index 0000000000..a775321df2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToDataPipe.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.mechanics.pipe; + +/** + * Created by Tec on 26.02.2017. + */ +public interface IConnectsToDataPipe { + boolean canConnectData(byte side); + + IConnectsToDataPipe getNext(IConnectsToDataPipe source); + + boolean isDataInputFacing(byte side); + + byte getColorization(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java new file mode 100644 index 0000000000..ea444a0678 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.mechanics.pipe; + +/** + * Created by Tec on 26.02.2017. + */ +public interface IConnectsToElementalPipe { + boolean canConnect(byte side); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToEnergyTunnel.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToEnergyTunnel.java new file mode 100644 index 0000000000..3a1d24305e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToEnergyTunnel.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.mechanics.pipe; + +/** + * Created by Tec on 26.02.2017. + */ +public interface IConnectsToEnergyTunnel { + boolean canConnect(byte side); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/pipe/PipeActivityMessage.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/PipeActivityMessage.java new file mode 100644 index 0000000000..abde23f33e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/PipeActivityMessage.java @@ -0,0 +1,133 @@ +package com.github.technus.tectech.mechanics.pipe; + +import cpw.mods.fml.common.network.ByteBufUtils; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; +import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; + +public class PipeActivityMessage implements IMessage { + int mPosX; + int mPosY; + int mPosZ; + int mPosD; + int mActive; + + public PipeActivityMessage() { + } + + private PipeActivityMessage(IActivePipe metaTile) { + IGregTechTileEntity base=metaTile.getBaseMetaTileEntity(); + mPosX=base.getXCoord(); + mPosY=base.getYCoord(); + mPosZ=base.getZCoord(); + mPosD=base.getWorld().provider.dimensionId; + mActive=metaTile.getActive()?1:0; + } + + private PipeActivityMessage(World world, int x, int y, int z, boolean active) { + mPosX=x; + mPosY=y; + mPosZ=z; + mPosD=world.provider.dimensionId; + mActive=active?1:0; + } + + @Override + public void fromBytes(ByteBuf pBuffer) { + NBTTagCompound tTag = ByteBufUtils.readTag(pBuffer); + mPosX = tTag.getInteger("posx"); + mPosY = tTag.getInteger("posy"); + mPosZ = tTag.getInteger("posz"); + mPosD = tTag.getInteger("posd"); + mActive = tTag.getInteger("active"); + } + + @Override + public void toBytes(ByteBuf pBuffer) { + NBTTagCompound tFXTag = new NBTTagCompound(); + tFXTag.setInteger("posx", mPosX); + tFXTag.setInteger("posy", mPosY); + tFXTag.setInteger("posz", mPosZ); + tFXTag.setInteger("posd", mPosD); + tFXTag.setInteger("active", mActive); + + ByteBufUtils.writeTag(pBuffer, tFXTag); + } + + public static class PipeActivityQuery extends PipeActivityMessage { + public PipeActivityQuery() { + } + + public PipeActivityQuery(IActivePipe metaTile) { + super(metaTile); + } + + public PipeActivityQuery(World world, int x,int y,int z, boolean active) { + super(world,x,y,z,active); + } + } + + public static class PipeActivityData extends PipeActivityMessage { + public PipeActivityData() { + } + + private PipeActivityData(PipeActivityQuery query){ + mPosX=query.mPosX; + mPosY=query.mPosY; + mPosZ=query.mPosZ; + mPosD=query.mPosD; + mActive=query.mActive; + } + + public PipeActivityData(IActivePipe metaTile) { + super(metaTile); + } + + public PipeActivityData(World world, int x,int y,int z, boolean active) { + super(world,x,y,z,active); + } + } + + public static class ClientHandler extends AbstractClientMessageHandler { + @Override + public IMessage handleClientMessage(EntityPlayer pPlayer, PipeActivityData pMessage, MessageContext pCtx) { + if(pPlayer.worldObj.provider.dimensionId==pMessage.mPosD){ + TileEntity te=pPlayer.worldObj.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ); + if(te instanceof IGregTechTileEntity){ + IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); + if(meta instanceof IActivePipe){ + ((IActivePipe) meta).setActive(pMessage.mActive==1); + } + } + } + return null; + } + } + + public static class ServerHandler extends AbstractServerMessageHandler { + @Override + public IMessage handleServerMessage(EntityPlayer pPlayer, PipeActivityQuery pMessage, MessageContext pCtx) { + World world= DimensionManager.getWorld(pMessage.mPosD); + if(world!=null) { + TileEntity te = world.getTileEntity(pMessage.mPosX, pMessage.mPosY, pMessage.mPosZ); + if (te instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); + if (meta instanceof IActivePipe) { + pMessage.mActive=((IActivePipe) meta).getActive()?1:0; + return new PipeActivityData(pMessage); + } + } + } + return null; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java index 05cbca7990..3f42bdbbc4 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java @@ -8,7 +8,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; import static net.minecraft.util.StatCollector.translateToLocal; /** diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java index 14cb682c6f..d659a05005 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java @@ -8,7 +8,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_GENERAL; import static net.minecraft.util.StatCollector.translateToLocal; /** diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java index 31ad485306..56fdfd22bb 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java @@ -8,7 +8,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.*; +import static com.github.technus.tectech.util.CommonValues.*; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract { diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java index 23e9c7026f..5c93841d9a 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java @@ -8,8 +8,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.COSMIC_MARK; -import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; +import static com.github.technus.tectech.util.CommonValues.COSMIC_MARK; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; import static net.minecraft.util.StatCollector.translateToLocal; /** diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java index 186510ff14..426e7d569b 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java @@ -8,7 +8,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_GENERAL; import static net.minecraft.util.StatCollector.translateToLocal; /** diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index c578f322f6..4af6b53658 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.util.Util.StructureBuilder; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; import static gregtech.api.GregTech_API.sBlockCasings1; import static net.minecraft.util.StatCollector.translateToLocal; 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 6ebfce328e..b23a580bbf 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; 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 5cb84505bd..fa1c25cbf5 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; 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 7e7c2eb625..c951229c92 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java index 8f113c008b..8e3d770da1 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java +++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index e678dbd6cb..efcfcfb7a3 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -42,12 +42,20 @@ public final class FrontRotationTriggerItem extends Item { if (aPlayer instanceof EntityPlayerMP) { if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IFrontRotation) { - ((IFrontRotation) metaTE).rotateAroundFrontPlane(!aPlayer.isSneaking()); + if (metaTE instanceof IAlignment) { + if(aPlayer.isSneaking()){ + ((IAlignment) metaTE).toolSetFlip(null); + }else { + ((IAlignment) metaTE).toolSetRotation(null); + } return true; } - } else if (tTileEntity instanceof IFrontRotation) { - ((IFrontRotation) tTileEntity).rotateAroundFrontPlane(!aPlayer.isSneaking()); + } else if (tTileEntity instanceof IAlignment) { + if(aPlayer.isSneaking()){ + ((IAlignment) tTileEntity).toolSetFlip(null); + }else { + ((IAlignment) tTileEntity).toolSetRotation(null); + } return true; } } 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 e64ab1eaa6..1d1da74a7a 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.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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; diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java index 8767982898..6e7e8c426d 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,7 +14,7 @@ import net.minecraft.util.IIcon; import java.util.List; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaCapacitor; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java index 2ba984c9cc..cc77b7a26c 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java index cf08c03f38..20417ebe71 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java index 03afa1b66b..9d998953e8 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Utility; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IConstructable.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IConstructable.java deleted file mode 100644 index 096eab8f58..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IConstructable.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Created by Tec on 24.03.2017. - */ -public interface IConstructable { - void construct(int stackSize, boolean hintsOnly); - - @SideOnly(Side.CLIENT) - String[] getStructureDescription(int stackSize); -} - diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IFrontRotation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IFrontRotation.java deleted file mode 100644 index 7ac296e41f..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IFrontRotation.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity; - -public interface IFrontRotation { - boolean isFrontRotationValid(byte frontRotation, byte frontFacing); - - void rotateAroundFrontPlane(boolean direction); - - void forceSetRotationDoRender(byte frontRotation); - - byte getFrontRotation(); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java deleted file mode 100644 index 92b38e68ea..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity; - -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; -import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; - -public class RotationMessage implements IMessage { - int mPosX; - int mPosY; - int mPosZ; - int mPosD; - int mRotF; - - public RotationMessage() { - } - - private RotationMessage(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - IGregTechTileEntity base=metaTile.getBaseMetaTileEntity(); - mPosX=base.getXCoord(); - mPosY=base.getYCoord(); - mPosZ=base.getZCoord(); - mPosD=base.getWorld().provider.dimensionId; - mRotF=metaTile.getFrontRotation(); - } - - private RotationMessage(World world, int x,int y,int z, IFrontRotation front) { - mPosX=x; - mPosY=y; - mPosZ=z; - mPosD=world.provider.dimensionId; - mRotF=front.getFrontRotation(); - } - - @Override - public void fromBytes(ByteBuf pBuffer) { - NBTTagCompound tTag = ByteBufUtils.readTag(pBuffer); - mPosX = tTag.getInteger("posx"); - mPosY = tTag.getInteger("posy"); - mPosZ = tTag.getInteger("posz"); - mPosD = tTag.getInteger("posd"); - mRotF = tTag.getInteger("rotf"); - } - - @Override - public void toBytes(ByteBuf pBuffer) { - NBTTagCompound tFXTag = new NBTTagCompound(); - tFXTag.setInteger("posx", mPosX); - tFXTag.setInteger("posy", mPosY); - tFXTag.setInteger("posz", mPosZ); - tFXTag.setInteger("posd", mPosD); - tFXTag.setInteger("rotf", mRotF); - - ByteBufUtils.writeTag(pBuffer, tFXTag); - } - - public static class RotationQuery extends RotationMessage{ - public RotationQuery() { - } - - public RotationQuery(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - super(metaTile); - } - - public RotationQuery(World world, int x,int y,int z, IFrontRotation front) { - super(world,x,y,z,front); - } - } - - public static class RotationData extends RotationMessage{ - public RotationData() { - } - - private RotationData(RotationQuery query){ - mPosX=query.mPosX; - mPosY=query.mPosY; - mPosZ=query.mPosZ; - mPosD=query.mPosD; - mRotF=query.mRotF; - } - - public RotationData(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - super(metaTile); - } - - public RotationData(World world, int x,int y,int z, IFrontRotation front) { - super(world,x,y,z,front); - } - } - - public static class ClientHandler extends AbstractClientMessageHandler { - @Override - public IMessage handleClientMessage(EntityPlayer pPlayer, RotationData pMessage, MessageContext pCtx) { - if(pPlayer.worldObj.provider.dimensionId==pMessage.mPosD){ - TileEntity te=pPlayer.worldObj.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ); - if(te instanceof IGregTechTileEntity){ - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if(meta instanceof IFrontRotation){ - ((IFrontRotation) meta).forceSetRotationDoRender((byte)pMessage.mRotF); - } - }else if (te instanceof IFrontRotation){ - ((IFrontRotation) te).forceSetRotationDoRender((byte)pMessage.mRotF); - } - } - return null; - } - } - - public static class ServerHandler extends AbstractServerMessageHandler { - @Override - public IMessage handleServerMessage(EntityPlayer pPlayer, RotationQuery pMessage, MessageContext pCtx) { - World world= DimensionManager.getWorld(pMessage.mPosD); - if(world!=null) { - TileEntity te = world.getTileEntity(pMessage.mPosX, pMessage.mPosY, pMessage.mPosZ); - if (te instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (meta instanceof IFrontRotation) { - pMessage.mRotF=((IFrontRotation) meta).getFrontRotation(); - return new RotationData(pMessage); - } - } else if (te instanceof IFrontRotation) { - pMessage.mRotF=((IFrontRotation) te).getFrontRotation(); - return new RotationData(pMessage); - } - } - return null; - } - } -} \ No newline at end of file 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 4527a9d6ff..b4e8f03a74 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 @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +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; +import com.github.technus.tectech.util.Util; 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; @@ -23,8 +23,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.getUniqueIdentifier; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.getUniqueIdentifier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static net.minecraft.util.StatCollector.translateToLocal; 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 3d18550d09..815f8006c4 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,10 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -13,7 +13,7 @@ import gregtech.api.util.GT_Utility; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.MOVE_AT; +import static com.github.technus.tectech.util.CommonValues.MOVE_AT; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 6f5a9b377c..4e719f8ec8 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.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; 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 6d0706971d..6cbf1e801b 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,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.DataPacket; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -21,7 +21,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.MOVE_AT; +import static com.github.technus.tectech.util.CommonValues.MOVE_AT; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static net.minecraft.util.StatCollector.translateToLocalFormatted; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java index aeaa54d241..bbc11f10fe 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -9,7 +9,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java index 60a663e0c7..fb3487bc09 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Energy; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToEnergyTunnel; +import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -13,8 +13,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.TRANSFER_AT; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.TRANSFER_AT; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 682c7536bf..d0b9411773 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToElementalPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -23,7 +23,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.*; +import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java index 9a16aa1339..4410372d47 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java index 6034e51a98..2407f2ab0a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java @@ -1,18 +1,17 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToEnergyTunnel; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.TRANSFER_AT; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.TRANSFER_AT; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -39,16 +38,6 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc return new ITexture[]{aBaseTexture, OVERLAYS_ENERGY_IN_LASER_TT[mTier]}; } - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - @Override public boolean isSimpleMachine() { return true; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java index c7b0eb983e..3bbd6b9d54 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Holder; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Holder; import cpw.mods.fml.relauncher.Side; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java index c628a92cb4..386a08b790 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java index e54f4f3354..f270971f4d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -20,7 +20,7 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.MOVE_AT; +import static com.github.technus.tectech.util.CommonValues.MOVE_AT; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DataConnector.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java index cfa15b4cf3..b0f71aab24 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java index 083a8ee1f1..87a9c93785 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java @@ -1,10 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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 d98675d0f2..385de4343c 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,10 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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 d826daf355..a1e4f5a8a5 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; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; 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 362ba9f3c5..ad7f1fe159 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 @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -28,8 +28,8 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.Locale; -import static com.github.technus.tectech.CommonValues.DISPERSE_AT; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.DISPERSE_AT; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; 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 7bcc796e9d..7b8a488e57 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.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java index 09f11710da..bc4562307b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_ParamText; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamText; 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 47d7037946..d9d5f90593 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 @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +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; +import com.github.technus.tectech.util.Util; 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; @@ -28,8 +28,8 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.CommonValues.MULTI_CHECK_AT; -import static com.github.technus.tectech.Util.getUniqueIdentifier; +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.loader.TecTechConfig.DEBUG_MODE; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; 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 80b7185ba4..d723dd908c 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 @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; 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; 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 d206143700..b0b53f6c79 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; +import com.github.technus.tectech.util.Util; 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; 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 cb189538d8..da067078c9 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; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java index b3b720732d..c8fa85996a 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; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java index 7b6f97981f..9c0e08948f 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; +import com.github.technus.tectech.util.Util; 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; 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 b094cd2d93..7eb71651bb 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,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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 45e4f1fb65..4346118619 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,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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 2b17563db0..50e608294e 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,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.Util; +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; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 21e020be01..d52a3c23f7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,7 +17,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -97,14 +97,14 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 79ae424bcb..74ebae9f57 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,7 +17,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -291,7 +291,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @@ -299,9 +299,9 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public void construct(int stackSize, boolean hintsOnly) { if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } else { - StructureBuilderExtreme(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 2b0b0f8465..d37fcfdc4b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -13,10 +13,10 @@ import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex. import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -33,7 +33,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -592,9 +592,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { if (aFacing % 2 == 0) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } else { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; } } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; @@ -682,9 +682,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } } if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } else { - StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } } 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 edb581179e..1afbdf66e0 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 @@ -1,16 +1,16 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.Vec3pos; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.Vec3Impl; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -28,8 +28,8 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -224,7 +224,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { if (!eOutputData.isEmpty()) { - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); QuantumDataPacket pack = new QuantumDataPacket(eAvailableData / eOutputData.size()).unifyTraceWith(pos); if (pack == null) { return; @@ -265,7 +265,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3]}; } @@ -337,16 +337,16 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void construct(int stackSize, boolean hintsOnly) { IGregTechTileEntity igt = getBaseMetaTileEntity(); - StructureBuilderExtreme(front, blockType, blockMeta, 1, 2, 0, igt, this, hintsOnly); - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, -1, igt, this, hintsOnly); + StructureBuilderExtreme(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); + StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); byte offset = -2; for (int rackSlices = Math.min(stackSize, 12); rackSlices > 0; rackSlices--) { - StructureBuilderExtreme(slice, blockType, blockMeta, 1, 2, offset--, igt, this, hintsOnly); + StructureBuilderExtreme(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); } - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, offset--, igt, this, hintsOnly); - StructureBuilderExtreme(terminator, blockType, blockMeta, 1, 2, offset, igt, this, hintsOnly); + StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + StructureBuilderExtreme(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 263a46a9d3..3083f36721 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,7 +17,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -99,14 +99,14 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index f18fe57b6f..57ab6d770d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,16 +1,16 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -27,8 +27,8 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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.GT_Block_CasingsTT.texturePage; @@ -138,7 +138,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; } @@ -171,7 +171,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 90879f1b60..ffea7781ee 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -26,8 +26,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.VN; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.VN; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -214,7 +214,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @@ -244,7 +244,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 27b770c88b..cb13abf358 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.iExchangeInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -24,8 +24,8 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; @@ -149,7 +149,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 4e8e8d27ec..23a36f0edb 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -1,10 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -183,7 +183,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index aba87eaf6b..448f0a5563 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; @@ -12,8 +12,8 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -170,7 +170,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 4d65b67ed0..4696164979 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 @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; @@ -11,7 +11,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; @@ -28,9 +28,9 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.Util.isInputEqual; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.isInputEqual; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; @@ -198,7 +198,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 93111e1f60..e9bb65c19f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.recipe.TT_recipe; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -35,9 +35,9 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; import java.util.LinkedHashMap; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.CommonValues.VN; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +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.StructureBuilderExtreme; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -394,7 +394,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3]}; } @@ -553,7 +553,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 e03ea94928..be869b2ba9 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 @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.enums.ItemList; @@ -32,10 +32,10 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.CommonValues.VN; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.Util.areBitsSet; +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.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.areBitsSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; @@ -514,7 +514,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index b159827012..9c88c4ecf3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -11,7 +11,7 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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 net.minecraft.util.StatCollector.translateToLocal; @@ -70,7 +70,7 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 795349c50c..47949ea36e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.Vec3pos; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,8 +20,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -128,7 +128,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } } - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); QuantumDataPacket pack = new QuantumDataPacket(0L).unifyTraceWith(pos); if (pack == null) { return; @@ -191,7 +191,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; } @@ -217,7 +217,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 1a3bebf59b..81fd5eb6ad 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,7 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -118,7 +118,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0]}; } @@ -150,7 +150,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 034fdca334..1f9d88e4fd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,7 +17,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -98,14 +98,14 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; } @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 881f802d19..497efd6f71 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,10 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.Vec3Impl; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -23,11 +24,12 @@ import net.minecraft.util.EnumChatFormatting; import java.util.ArrayList; import java.util.HashSet; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.MainLoader.microwaving; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static gregtech.api.GregTech_API.sBlockCasings4; +import static net.minecraft.util.AxisAlignedBB.getBoundingBox; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -124,16 +126,14 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock timerValue.set(timerValue.get() + 1); remainingTime.set(timerSetting.get() - timerValue.get()); IGregTechTileEntity mte = getBaseMetaTileEntity(); - int[] xyzOffsets = getTranslatedOffsets(0, -1, 2); - double xPos = mte.getXCoord() + 0.5f + xyzOffsets[0]; - double yPos = mte.getYCoord() + 0.5f + xyzOffsets[1]; - double zPos = mte.getZCoord() + 0.5f + xyzOffsets[2]; - AxisAlignedBB aabb = getBoundingBox(-2, -2, -2, 2, 2, 2).offset(xPos, yPos, zPos); - xyzOffsets = getTranslatedOffsets(0, -4, 0); - double[] xyzExpansion = getTranslatedOffsets(1.5, 0, 1.5); - for (int i = 0; i < 3; i++) {//gets ABS from translated to get expansion values - if (xyzExpansion[i] < 0) xyzExpansion[i] = -xyzExpansion[i]; - } + Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 2)); + double xPos = mte.getXCoord() + 0.5f + xyzOffsets.get0(); + double yPos = mte.getYCoord() + 0.5f + xyzOffsets.get1(); + double zPos = mte.getZCoord() + 0.5f + xyzOffsets.get2(); + AxisAlignedBB aabb = getBoundingBox(-2, -2, -2, 2, 2, 2) + .offset(xPos, yPos, zPos); + xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -4, 0)); + Vec3Impl xyzExpansion = getExtendedFacing().getWorldOffset(new Vec3Impl(1, 0, 1)).abs(); int power = (int) powerSetting.get(); int damagingFactor = Math.min(power >> 6, 8) + @@ -169,8 +169,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } } } - aabb.offset(xyzOffsets[0], xyzOffsets[1], xyzOffsets[2]); - aabb = aabb.expand(xyzExpansion[0], xyzExpansion[1], xyzExpansion[2]); + aabb.offset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); + aabb = aabb.expand(xyzExpansion.get0()*1.5, xyzExpansion.get1()*1.5, xyzExpansion.get2()*1.5); inside = false; damagingFactor >>= 1; } while (damagingFactor > 0); @@ -206,7 +206,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedExtendedFacingTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], aActive ? Textures.BlockIcons.casingTexturePages[0][52] : Textures.BlockIcons.casingTexturePages[0][53]}; } @@ -246,7 +246,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index d35304dfca..bf18a545ef 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -108,7 +108,7 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedExtendedFacingTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], aActive ? Textures.BlockIcons.casingTexturePages[0][52] : Textures.BlockIcons.casingTexturePages[0][53]}; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index d083c58ff3..85ccc5d881 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -1,20 +1,21 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.RendererMessage; import com.github.technus.tectech.mechanics.data.ThaumSpark; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TeslaCoil; +import com.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -28,17 +29,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; +import java.util.*; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.*; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static gregtech.api.enums.GT_Values.E; +import static java.lang.Math.max; +import static java.lang.Math.min; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { @@ -72,9 +72,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private byte oldOrientation = -1; //Coordinate Arrays - private int[][] scanPosOffsets = new int[10][3]; - private int[] posZap = new int[3];//Power Transfer Origin - public int[] posTop = new int[3];//Lightning Origin + private final Vec3Impl[] scanPosOffsets = new Vec3Impl[10]; + private Vec3Impl posZap = Vec3Impl.NULL_VECTOR;//Power Transfer Origin + public Vec3Impl posTop = Vec3Impl.NULL_VECTOR;//Lightning Origin //endregion //region structure @@ -249,15 +249,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return 1F; } - private void scanForTransmissionTargets(int[] coordsMin, int[] coordsMax) { + private void scanForTransmissionTargets(Vec3Impl coordsMin, Vec3Impl coordsMax) { //This makes sure the minimums are actually smaller than the maximums - int xMin = coordsMin[0] < coordsMax[0] ? coordsMin[0] : coordsMax[0]; - int yMin = coordsMin[1] < coordsMax[1] ? coordsMin[1] : coordsMax[1]; - int zMin = coordsMin[2] < coordsMax[2] ? coordsMin[2] : coordsMax[2]; + int xMin = min(coordsMin.get0(), coordsMax.get0()); + int yMin = min(coordsMin.get1(), coordsMax.get1()); + int zMin = min(coordsMin.get2(), coordsMax.get2()); //And vice versa - int xMax = coordsMin[0] > coordsMax[0] ? coordsMin[0] : coordsMax[0]; - int yMax = coordsMin[1] > coordsMax[1] ? coordsMin[1] : coordsMax[1]; - int zMax = coordsMin[2] > coordsMax[2] ? coordsMin[2] : coordsMax[2]; + int xMax = max(coordsMin.get0(), coordsMax.get0()); + int yMax = max(coordsMin.get1(), coordsMax.get1()); + int zMax = max(coordsMin.get2(), coordsMax.get2()); for (int xPos = xMin; xPos <= xMax; xPos++) { for (int yPos = yMin; yPos <= yMax; yPos++) { @@ -266,12 +266,13 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock continue; } IGregTechTileEntity node = getBaseMetaTileEntity().getIGregTechTileEntityOffset(xPos, yPos, zPos); - if (node == null) { - continue; - } - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil || nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive() || (node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil)) { - eTeslaMap.put(node, (int) Math.ceil(Math.sqrt(Math.pow(xPos, 2) + Math.pow(yPos, 2) + Math.pow(zPos, 2)))); + if (node != null) { + IMetaTileEntity nodeInside = node.getMetaTileEntity(); + if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil || + nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive() || + (node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil)) { + eTeslaMap.put(node, (int) Math.ceil(Math.sqrt(Math.pow(xPos, 2) + Math.pow(yPos, 2) + Math.pow(zPos, 2)))); + } } } } @@ -280,13 +281,13 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { - byte xR = (byte) (node.getXCoord() - posTop[0]); - byte yR = (byte) (node.getYCoord() - posTop[1]); - byte zR = (byte) (node.getZCoord() - posTop[2]); + byte xR = (byte) (node.getXCoord() - posTop.get0()); + byte yR = (byte) (node.getYCoord() - posTop.get1()); + byte zR = (byte) (node.getZCoord() - posTop.get2()); int wID = mte.getWorld().provider.dimensionId; - sparkList.add(new ThaumSpark(posTop[0], posTop[1], posTop[2], xR, yR, zR, wID)); + sparkList.add(new ThaumSpark(posTop.get0(), posTop.get1(), posTop.get2(), xR, yR, zR, wID)); } @Override @@ -303,9 +304,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } eCapacitorHatches.clear(); - int[] xyzOffsets; - xyzOffsets = getTranslatedOffsets(0, -1, 1); - mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets[0], xyzOffsets[1], xyzOffsets[2]); + Vec3Impl xyzOffsets; + + xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); + mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { @@ -315,37 +317,31 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } //Only recalculate offsets on orientation or rotation change - if (oldRotation != getFrontRotation() || oldOrientation != iGregTechTileEntity.getFrontFacing()) { - oldRotation = getFrontRotation(); + if (oldRotation != getExtendedFacing().ordinal() || oldOrientation != iGregTechTileEntity.getFrontFacing()) { + oldRotation = (byte) getExtendedFacing().ordinal(); oldOrientation = iGregTechTileEntity.getFrontFacing(); //Calculate coordinates of the middle bottom - xyzOffsets = getTranslatedOffsets(0, 0, 2); - posZap[0] = iGregTechTileEntity.getXCoord() + xyzOffsets[0]; - posZap[1] = iGregTechTileEntity.getYCoord() + xyzOffsets[1]; - posZap[2] = iGregTechTileEntity.getZCoord() + xyzOffsets[2]; + posZap = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(getBaseMetaTileEntity()); //Calculate coordinates of the top sphere - xyzOffsets = getTranslatedOffsets(0, -14, 2); - posTop[0] = iGregTechTileEntity.getXCoord() + xyzOffsets[0]; - posTop[1] = iGregTechTileEntity.getYCoord() + xyzOffsets[1]; - posTop[2] = iGregTechTileEntity.getZCoord() + xyzOffsets[2]; + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(getBaseMetaTileEntity()); //Calculate offsets for scanning - scanPosOffsets[0] = getTranslatedOffsets(40, 0, 43); - scanPosOffsets[1] = getTranslatedOffsets(-40, -4, -37); + scanPosOffsets[0] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, 0, 43)); + scanPosOffsets[1] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -4, -37)); - scanPosOffsets[2] = getTranslatedOffsets(40, -5, 43); - scanPosOffsets[3] = getTranslatedOffsets(-40, -8, -37); + scanPosOffsets[2] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -5, 43)); + scanPosOffsets[3] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -8, -37)); - scanPosOffsets[4] = getTranslatedOffsets(40, -9, 43); - scanPosOffsets[5] = getTranslatedOffsets(-40, -12, -37); + scanPosOffsets[4] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -9, 43)); + scanPosOffsets[5] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -12, -37)); - scanPosOffsets[6] = getTranslatedOffsets(40, -13, 43); - scanPosOffsets[7] = getTranslatedOffsets(-40, -16, -37); + scanPosOffsets[6] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -13, 43)); + scanPosOffsets[7] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -16, -37)); - scanPosOffsets[8] = getTranslatedOffsets(40, -17, 43); - scanPosOffsets[9] = getTranslatedOffsets(-40, -20, -37); + scanPosOffsets[8] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -17, 43)); + scanPosOffsets[9] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -20, -37)); } return true; } @@ -434,7 +430,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6]}; } @@ -612,9 +608,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock int tY = node.getYCoord(); int tZ = node.getZCoord(); - int tXN = posZap[0]; - int tYN = posZap[1]; - int tZN = posZap[2]; + int tXN = posZap.get0(); + int tYN = posZap.get1(); + int tZN = posZap.get2(); int tOffset = (int) Math.ceil(Math.sqrt(Math.pow(tX - tXN, 2) + Math.pow(tY - tYN, 2) + Math.pow(tZ - tZN, 2))); teslaCoil.eTeslaMap.put(mte, tOffset); @@ -649,7 +645,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //Power Limit Settings long outputVoltage; if (outputVoltageSetting.get() > 0) { - outputVoltage = Math.min(outputVoltageMax, (long) outputVoltageSetting.get()); + outputVoltage = min(outputVoltageMax, (long) outputVoltageSetting.get()); } else { outputVoltage = outputVoltageMax; } @@ -657,7 +653,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock long outputCurrent; if (outputCurrentSetting.get() > 0) { - outputCurrent = Math.min(outputCurrentMax, (long) outputCurrentSetting.get()); + outputCurrent = min(outputCurrentMax, (long) outputCurrentSetting.get()); } else { outputCurrent = outputCurrentMax; } @@ -826,7 +822,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMetas[(stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMetas[(stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 c42c15bd8d..8086b70691 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; +import com.github.technus.tectech.util.Util; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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 0e00a3180f..52bdd3574f 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 @@ -2,17 +2,19 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.Vec3pos; +import com.github.technus.tectech.mechanics.alignment.*; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.Vec3Impl; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; -import com.github.technus.tectech.thing.metaTileEntity.RotationMessage; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -31,23 +33,23 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.*; -import static com.github.technus.tectech.Util.StructureCheckerExtreme; -import static com.github.technus.tectech.Util.getTier; +import static com.github.technus.tectech.util.CommonValues.*; +import static com.github.technus.tectech.util.Util.StructureCheckerExtreme; +import static com.github.technus.tectech.util.Util.getTier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; /** * Created by danie_000 on 27.10.2016. */ -public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase implements IFrontRotation { +public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase implements IAlignment { //region Client side variables (static - one per class) //Front icon holders - static so it is default one for my blocks @@ -130,8 +132,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private boolean explodedThisTick = false; //front rotation val - private byte frontRotation = 0; - + private IAlignmentLimits alignmentLimits = AlignmentLimits.UNLIMITED; + private ExtendedFacing extendedFacing = ExtendedFacing.DEFAULT; //endregion protected GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { @@ -149,345 +151,46 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //region SUPER STRUCT - @Override - public boolean isFrontRotationValid(byte frontRotation, byte frontFacing) { - return true; - } - - public boolean isFacingValid_EM(byte aFacing) { - return true; + public ExtendedFacing getExtendedFacing() { + return extendedFacing; } @Override - public void rotateAroundFrontPlane(boolean direction) { - if (direction) { - frontRotation++; - if (frontRotation > 3) frontRotation = 0; - } else { - frontRotation--; - if (frontRotation < 0) frontRotation = 3; - } - if (isFrontRotationValid(frontRotation, getBaseMetaTileEntity().getFrontFacing())) { - updateRotationOnClients(); - } else { - rotateAroundFrontPlane(direction); + public void setExtendedFacing(ExtendedFacing alignment) { + if(extendedFacing!=alignment){ + extendedFacing=alignment; + IGregTechTileEntity base = getBaseMetaTileEntity(); + if (getBaseMetaTileEntity().isServerSide()) { + NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), + base.getWorld().provider.dimensionId, + base.getXCoord(), base.getYCoord(), base.getZCoord(), 512); + }else{ + base.issueTextureUpdate(); + } } } - /** - * Gets AABB based on abc and not xyz, without offsetting to controller position!!! - * - * @param minA - * @param minB - * @param minC - * @param maxA - * @param maxB - * @param maxC - * @return - */ - public final AxisAlignedBB getBoundingBox(double minA, double minB, double minC, double maxA, double maxB, double maxC) { - double[] offSetsMin = getTranslatedOffsets(minA, minB, minC); - double[] offSetsMax = getTranslatedOffsets(maxA, maxB, maxC); - for (int i = 0; i < 3; i++) { - if (offSetsMax[i] < offSetsMin[i]) { - double temp = offSetsMax[i]; - offSetsMax[i] = offSetsMin[i]; - offSetsMin[i] = temp; - } - } - return AxisAlignedBB.getBoundingBox( - offSetsMin[0], offSetsMin[1], offSetsMin[2], - offSetsMax[0], offSetsMax[1], offSetsMax[2] - ); + @Override + public IAlignmentLimits getAlignmentLimits() { + return alignmentLimits; } - /** - * Translates relative axis coordinates abc to absolute axis coordinates xyz - * abc from the CONTROLLER! - * - * @param a - * @param b - * @param c - * @return - */ - public final double[] getTranslatedOffsets(double a, double b, double c) { - double[] result = new double[3]; - switch (getBaseMetaTileEntity().getFrontFacing() + (frontRotation << 3)) { - case 4: - result[0] = c; - result[2] = a; - result[1] = -b; - break; - case 12: - result[0] = c; - result[1] = -a; - result[2] = -b; - break; - case 20: - result[0] = c; - result[2] = -a; - result[1] = b; - break; - case 28: - result[0] = c; - result[1] = a; - result[2] = b; - break; - - case 3: - result[0] = a; - result[2] = -c; - result[1] = -b; - break; - case 11: - result[1] = -a; - result[2] = -c; - result[0] = -b; - break; - case 19: - result[0] = -a; - result[2] = -c; - result[1] = b; - break; - case 27: - result[1] = a; - result[2] = -c; - result[0] = b; - break; - - case 5: - result[0] = -c; - result[2] = -a; - result[1] = -b; - break; - case 13: - result[0] = -c; - result[1] = -a; - result[2] = b; - break; - case 21: - result[0] = -c; - result[2] = a; - result[1] = b; - break; - case 29: - result[0] = -c; - result[1] = a; - result[2] = -b; - break; - - case 2: - result[0] = -a; - result[2] = c; - result[1] = -b; - break; - case 10: - result[1] = -a; - result[2] = c; - result[0] = b; - break; - case 18: - result[0] = a; - result[2] = c; - result[1] = b; - break; - case 26: - result[1] = a; - result[2] = c; - result[0] = -b; - break; - //Things get odd if the block faces up or down... - case 1: - result[0] = a; - result[2] = b; - result[1] = -c; - break;//similar to 3 - case 9: - result[2] = a; - result[0] = -b; - result[1] = -c; - break;//similar to 3 - case 17: - result[0] = -a; - result[2] = -b; - result[1] = -c; - break;//similar to 3 - case 25: - result[2] = -a; - result[0] = b; - result[1] = -c; - break;//similar to 3 - - case 0: - result[0] = -a; - result[2] = b; - result[1] = c; - break;//similar to 2 - case 8: - result[2] = a; - result[0] = b; - result[1] = c; - break; - case 16: - result[0] = a; - result[2] = -b; - result[1] = c; - break; - case 24: - result[2] = -a; - result[0] = -b; - result[0] = -b; - result[1] = +c; - break; - } - return result; + @Override + public void setAlignmentLimits(IAlignmentLimits limits) { + alignmentLimits=limits; } - public final int[] getTranslatedOffsets(int a, int b, int c) { - int[] result = new int[3]; - switch (getBaseMetaTileEntity().getFrontFacing() + (frontRotation << 3)) { - case 4: - result[0] = c; - result[2] = a; - result[1] = -b; - break; - case 12: - result[0] = c; - result[1] = -a; - result[2] = -b; - break; - case 20: - result[0] = c; - result[2] = -a; - result[1] = b; - break; - case 28: - result[0] = c; - result[1] = a; - result[2] = b; - break; - - case 3: - result[0] = a; - result[2] = -c; - result[1] = -b; - break; - case 11: - result[1] = -a; - result[2] = -c; - result[0] = -b; - break; - case 19: - result[0] = -a; - result[2] = -c; - result[1] = b; - break; - case 27: - result[1] = a; - result[2] = -c; - result[0] = b; - break; - - case 5: - result[0] = -c; - result[2] = -a; - result[1] = -b; - break; - case 13: - result[0] = -c; - result[1] = -a; - result[2] = b; - break; - case 21: - result[0] = -c; - result[2] = a; - result[1] = b; - break; - case 29: - result[0] = -c; - result[1] = a; - result[2] = -b; - break; - - case 2: - result[0] = -a; - result[2] = c; - result[1] = -b; - break; - case 10: - result[1] = -a; - result[2] = c; - result[0] = b; - break; - case 18: - result[0] = a; - result[2] = c; - result[1] = b; - break; - case 26: - result[1] = a; - result[2] = c; - result[0] = -b; - break; - //Things get odd if the block faces up or down... - case 1: - result[0] = a; - result[2] = b; - result[1] = -c; - break;//similar to 3 - case 9: - result[2] = a; - result[0] = -b; - result[1] = -c; - break;//similar to 3 - case 17: - result[0] = -a; - result[2] = -b; - result[1] = -c; - break;//similar to 3 - case 25: - result[2] = -a; - result[0] = b; - result[1] = -c; - break;//similar to 3 - - case 0: - result[0] = -a; - result[2] = b; - result[1] = c; - break;//similar to 2 - case 8: - result[2] = a; - result[0] = b; - result[1] = c; - break; - case 16: - result[0] = a; - result[2] = -b; - result[1] = c; - break; - case 24: - result[2] = -a; - result[0] = -b; - result[0] = -b; - result[1] = +c; - break; - } - return result; + @Override + public boolean isFacingValid(byte aFacing) { + return getAlignmentLimits() + .isNewExtendedFacingValid(getExtendedFacing().with(ForgeDirection.getOrientation(aFacing))); } - //can be used to check structures of multi-blocks larger than one chunk, but... - //ALL THE HATCHES AND THE CONTROLLER SHOULD BE IN ONE CHUNK OR IN LOADED CHUNKS - //@Deprecated - //public final boolean structureCheck_EM( - // String[][] structure,//0-9 casing, +- air no air, a-z ignore - // Block[] blockType,//use numbers 0-9 for casing types - // byte[] blockMeta,//use numbers 0-9 for casing types - // int horizontalOffset, int verticalOffset, int depthOffset) { - // return StructureChecker(structure, blockType, blockMeta, - // horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), !mMachine); - //} + @Override + public void onFacingChange() { + toolSetDirection(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing())); + } public final boolean structureCheck_EM( String[][] structure,//0-9 casing, +- air no air, a-z ignore @@ -499,7 +202,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt byte[] blockMetaFallback,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset) { return StructureCheckerExtreme(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, - horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), this, !mMachine); + horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), getExtendedFacing(), !mMachine); } //endregion @@ -729,7 +432,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; } @@ -904,7 +607,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ protected long getAvailableData_EM() { long result = 0; - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) { if (in.q != null) { Long value = in.q.contentIfNotInTrace(pos); @@ -976,7 +679,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt aNBT.setByte("eCertainM", eCertainMode); aNBT.setByte("eCertainS", eCertainStatus); aNBT.setByte("eMinRepair", minRepairStatus); - aNBT.setByte("eRotation", frontRotation); + aNBT.setByte("eRotation", (byte)extendedFacing.getRotation().getIndex()); + aNBT.setByte("eFlip", (byte)extendedFacing.getFlip().getIndex()); aNBT.setBoolean("eParam", eParameters); aNBT.setBoolean("ePass", ePowerPass); aNBT.setBoolean("eVoid", eSafeVoid); @@ -1066,7 +770,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt eCertainMode = aNBT.getByte("eCertainM"); eCertainStatus = aNBT.getByte("eCertainS"); minRepairStatus = aNBT.getByte("eMinRepair"); - frontRotation = aNBT.getByte("eRotation"); + extendedFacing=ExtendedFacing.of( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), + Rotation.byIndex(aNBT.getByte("eRotation")), + Flip.byIndex(aNBT.getByte("eFlip"))); eParameters = aNBT.getBoolean("eParam"); ePowerPass = aNBT.getBoolean("ePass"); eSafeVoid = aNBT.getBoolean("eVoid"); @@ -1265,40 +972,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region internal - @Override - public final byte getFrontRotation() { - return frontRotation; - } - - @Override - public final void forceSetRotationDoRender(byte rotation) { - frontRotation = rotation; - IGregTechTileEntity base = getBaseMetaTileEntity(); - if (base.isClientSide()) { - base.issueTextureUpdate(); - } - } - - protected final void updateRotationOnClients() { - if (getBaseMetaTileEntity().isServerSide()) { - IGregTechTileEntity base = getBaseMetaTileEntity(); - NetworkDispatcher.INSTANCE.sendToAllAround(new RotationMessage.RotationData(this), - base.getWorld().provider.dimensionId, - base.getXCoord(), - base.getYCoord(), - base.getZCoord(), - 256); - } - } - - @Override - public final boolean isFacingValid(byte aFacing) { - if (!isFrontRotationValid(frontRotation, aFacing)) { - rotateAroundFrontPlane(false); - } - return isFacingValid_EM(aFacing); - } - /** * internal check machine * @@ -1380,7 +1053,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { isFacingValid(aBaseMetaTileEntity.getFrontFacing()); if (getBaseMetaTileEntity().isClientSide()) { - NetworkDispatcher.INSTANCE.sendToServer(new RotationMessage.RotationQuery(this)); + NetworkDispatcher.INSTANCE.sendToServer(new AlignmentMessage.AlignmentQuery(this)); } onFirstTick_EM(aBaseMetaTileEntity); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java new file mode 100644 index 0000000000..4ecea706cc --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java @@ -0,0 +1,893 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; + +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import gregtech.api.enums.Dyes; +import gregtech.api.interfaces.IColorModulationContainer; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class TT_RenderedExtendedFacingTexture implements ITexture,IColorModulationContainer { + private final IIconContainer mIconContainer; + private final boolean mAllowAlpha; + /** + * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! + *

+ * Just set this variable to another different Array instead. + * Otherwise some colored things will get Problems. + */ + public short[] mRGBa; + + public TT_RenderedExtendedFacingTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { + if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ TT_RenderedTexture"); + mIconContainer = aIcon; + mAllowAlpha = aAllowAlpha; + mRGBa = aRGBa; + } + + public TT_RenderedExtendedFacingTexture(IIconContainer aIcon, short[] aRGBa) { + this(aIcon, aRGBa, true); + } + + public TT_RenderedExtendedFacingTexture(IIconContainer aIcon) { + this(aIcon, Dyes._NULL.mRGBa); + } + + @Override + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); + renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorRGBA(153, 153, 153, 255); + renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); + } + } + + @Override + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); + renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorRGBA(153, 153, 153, 255); + renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); + } + } + + @Override + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); + renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorRGBA(255, 255, 255, 255); + renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); + } + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); + renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorRGBA(255, 255, 255, 255); + renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); + } + } + + @Override + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); + renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorRGBA(204, 204, 204, 255); + renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); + } + } + + @Override + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); + renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorRGBA(204, 204, 204, 255); + renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); + } + } + + + /** + * Renders the given texture to the bottom face of the block. Args: block, x, y, z, texture + */ + public void renderFaceYNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { + Tessellator tessellator = Tessellator.instance; + + if (aRenderer.hasOverrideBlockTexture()) { + icon = aRenderer.overrideBlockTexture; + } + + double d3 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d5 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + double d6 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + d3 = icon.getMaxU(); + d4 = icon.getMinU(); + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } + } + + double d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + switch (rotation.getRotation().ordinal()) { + case 3: + d3 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + break; + case 1: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + break; + case 2: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + break; + } + + double d11 = x + aRenderer.renderMinX; + double d12 = x + aRenderer.renderMaxX; + double d13 = y + aRenderer.renderMinY; + double d14 = z + aRenderer.renderMinZ; + double d15 = z + aRenderer.renderMaxZ; + + if (aRenderer.renderFromInside) { + d11 = x + aRenderer.renderMaxX; + d12 = x + aRenderer.renderMinX; + } + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(d11, d13, d15, d8, d10); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(d11, d13, d14, d3, d5); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(d12, d13, d14, d7, d9); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + tessellator.addVertexWithUV(d12, d13, d15, d4, d6); + } else { + tessellator.addVertexWithUV(d11, d13, d15, d8, d10); + tessellator.addVertexWithUV(d11, d13, d14, d3, d5); + tessellator.addVertexWithUV(d12, d13, d14, d7, d9); + tessellator.addVertexWithUV(d12, d13, d15, d4, d6); + } + } + + /** + * Renders the given texture to the top face of the block. Args: block, x, y, z, texture + */ + public void renderFaceYPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { + Tessellator tessellator = Tessellator.instance; + + if (aRenderer.hasOverrideBlockTexture()) { + icon = aRenderer.overrideBlockTexture; + } + + double d3 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + double d5 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + double d6 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + d3 = icon.getMinU(); + d4 = icon.getMaxU(); + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } + } + + double d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + switch (rotation.getRotation().ordinal()) { + case 1: + d3 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + break; + case 3: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + break; + case 2: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + break; + } + + double d11 = x + aRenderer.renderMinX; + double d12 = x + aRenderer.renderMaxX; + double d13 = y + aRenderer.renderMaxY; + double d14 = z + aRenderer.renderMinZ; + double d15 = z + aRenderer.renderMaxZ; + + if (aRenderer.renderFromInside) { + d11 = x + aRenderer.renderMaxX; + d12 = x + aRenderer.renderMinX; + } + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(d12, d13, d15, d4, d6); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(d12, d13, d14, d7, d9); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(d11, d13, d14, d3, d5); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + tessellator.addVertexWithUV(d11, d13, d15, d8, d10); + } else { + tessellator.addVertexWithUV(d12, d13, d15, d4, d6); + tessellator.addVertexWithUV(d12, d13, d14, d7, d9); + tessellator.addVertexWithUV(d11, d13, d14, d3, d5); + tessellator.addVertexWithUV(d11, d13, d15, d8, d10); + } + } + + /** + * Renders the given texture to the north (z-negative) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceZNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { + Tessellator tessellator = Tessellator.instance; + + if (aRenderer.hasOverrideBlockTexture()) { + icon = aRenderer.overrideBlockTexture; + } + + double d3 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + + if (aRenderer.field_152631_f) { + d4 = icon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); + d3 = icon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); + } + + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + + double d7; + + if (aRenderer.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + d3 = icon.getMinU(); + d4 = icon.getMaxU(); + } + + if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + switch (rotation.getRotation().ordinal()) { + case 3: + d3 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + break; + case 1: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + break; + case 2: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + break; + } + + double d11 = x + aRenderer.renderMinX; + double d12 = x + aRenderer.renderMaxX; + double d13 = y + aRenderer.renderMinY; + double d14 = y + aRenderer.renderMaxY; + double d15 = z + aRenderer.renderMinZ; + + if (aRenderer.renderFromInside) { + d11 = x + aRenderer.renderMaxX; + d12 = x + aRenderer.renderMinX; + } + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(d11, d14, d15, d7, d9); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(d12, d14, d15, d3, d5); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(d12, d13, d15, d8, d10); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + tessellator.addVertexWithUV(d11, d13, d15, d4, d6); + } else { + tessellator.addVertexWithUV(d11, d14, d15, d7, d9); + tessellator.addVertexWithUV(d12, d14, d15, d3, d5); + tessellator.addVertexWithUV(d12, d13, d15, d8, d10); + tessellator.addVertexWithUV(d11, d13, d15, d4, d6); + } + } + + /** + * Renders the given texture to the south (z-positive) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceZPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { + Tessellator tessellator = Tessellator.instance; + + if (aRenderer.hasOverrideBlockTexture()) { + icon = aRenderer.overrideBlockTexture; + } + + double d3 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d7; + + if (aRenderer.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + d3 = icon.getMinU(); + d4 = icon.getMaxU(); + } + + if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + switch (rotation.getRotation().ordinal()) { + case 1: + d3 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + break; + case 3: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + break; + case 2: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + break; + } + + double d11 = x + aRenderer.renderMinX; + double d12 = x + aRenderer.renderMaxX; + double d13 = y + aRenderer.renderMinY; + double d14 = y + aRenderer.renderMaxY; + double d15 = z + aRenderer.renderMaxZ; + + if (aRenderer.renderFromInside) { + d11 = x + aRenderer.renderMaxX; + d12 = x + aRenderer.renderMinX; + } + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(d11, d14, d15, d3, d5); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(d11, d13, d15, d8, d10); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(d12, d13, d15, d4, d6); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + tessellator.addVertexWithUV(d12, d14, d15, d7, d9); + } else { + tessellator.addVertexWithUV(d11, d14, d15, d3, d5); + tessellator.addVertexWithUV(d11, d13, d15, d8, d10); + tessellator.addVertexWithUV(d12, d13, d15, d4, d6); + tessellator.addVertexWithUV(d12, d14, d15, d7, d9); + } + } + + /** + * Renders the given texture to the west (x-negative) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceXNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { + Tessellator tessellator = Tessellator.instance; + + if (aRenderer.hasOverrideBlockTexture()) { + icon = aRenderer.overrideBlockTexture; + } + + double d3 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d7; + + if (aRenderer.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + d3 = icon.getMinU(); + d4 = icon.getMaxU(); + } + + if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + switch (rotation.getRotation().ordinal()) { + case 1: + d3 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + break; + case 3: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + break; + case 2: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + break; + } + + double d11 = x + aRenderer.renderMinX; + double d12 = y + aRenderer.renderMinY; + double d13 = y + aRenderer.renderMaxY; + double d14 = z + aRenderer.renderMinZ; + double d15 = z + aRenderer.renderMaxZ; + + if (aRenderer.renderFromInside) { + d14 = z + aRenderer.renderMaxZ; + d15 = z + aRenderer.renderMinZ; + } + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(d11, d13, d15, d7, d9); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(d11, d13, d14, d3, d5); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(d11, d12, d14, d8, d10); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + tessellator.addVertexWithUV(d11, d12, d15, d4, d6); + } else { + tessellator.addVertexWithUV(d11, d13, d15, d7, d9); + tessellator.addVertexWithUV(d11, d13, d14, d3, d5); + tessellator.addVertexWithUV(d11, d12, d14, d8, d10); + tessellator.addVertexWithUV(d11, d12, d15, d4, d6); + } + } + + /** + * Renders the given texture to the east (x-positive) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceXPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { + Tessellator tessellator = Tessellator.instance; + + if (aRenderer.hasOverrideBlockTexture()) { + icon = aRenderer.overrideBlockTexture; + } + + double d3 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + + if (aRenderer.field_152631_f) { + d4 = icon.getInterpolatedU((1.0D - aRenderer.renderMinZ) * 16.0D); + d3 = icon.getInterpolatedU((1.0D - aRenderer.renderMaxZ) * 16.0D); + } + + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d7; + + if (aRenderer.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + d3 = icon.getMinU(); + d4 = icon.getMaxU(); + } + + if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + switch (rotation.getRotation().ordinal()) { + case 3: + d3 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + break; + case 1: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + break; + case 2: + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + break; + } + + double d11 = x + aRenderer.renderMaxX; + double d12 = y + aRenderer.renderMinY; + double d13 = y + aRenderer.renderMaxY; + double d14 = z + aRenderer.renderMinZ; + double d15 = z + aRenderer.renderMaxZ; + + if (aRenderer.renderFromInside) { + d14 = z + aRenderer.renderMaxZ; + d15 = z + aRenderer.renderMinZ; + } + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(d11, d12, d15, d8, d10); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(d11, d12, d14, d4, d6); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(d11, d13, d14, d7, d9); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + tessellator.addVertexWithUV(d11, d13, d15, d3, d5); + } else { + tessellator.addVertexWithUV(d11, d12, d15, d8, d10); + tessellator.addVertexWithUV(d11, d12, d14, d4, d6); + tessellator.addVertexWithUV(d11, d13, d14, d7, d9); + tessellator.addVertexWithUV(d11, d13, d15, d3, d5); + } + } + + @Override + public short[] getRGBA() { + return mRGBa; + } + + @Override + public boolean isValidTexture() { + return mIconContainer != null; + } + + private static ExtendedFacing getExtendedFacing(int x, int y, int z) { + World w = Minecraft.getMinecraft().theWorld; + if (w != null) { + TileEntity te = w.getTileEntity(x, y, z); + if (te instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); + if (meta instanceof IAlignment) { + return ((IAlignment) meta).getExtendedFacing(); + }else{ + return ExtendedFacing.of(ForgeDirection.getOrientation(meta.getBaseMetaTileEntity().getFrontFacing())); + } + } + } + return ExtendedFacing.DEFAULT; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedTexture.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedTexture.java deleted file mode 100644 index 39a12f1f86..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedTexture.java +++ /dev/null @@ -1,769 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; - -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; -import gregtech.api.enums.Dyes; -import gregtech.api.interfaces.IColorModulationContainer; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class TT_RenderedTexture implements ITexture,IColorModulationContainer { - private final IIconContainer mIconContainer; - private final boolean mAllowAlpha; - /** - * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! - *

- * Just set this variable to another different Array instead. - * Otherwise some colored things will get Problems. - */ - public short[] mRGBa; - - public TT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { - if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ TT_RenderedTexture"); - mIconContainer = aIcon; - mAllowAlpha = aAllowAlpha; - mRGBa = aRGBa; - } - - public TT_RenderedTexture(IIconContainer aIcon, short[] aRGBa) { - this(aIcon, aRGBa, true); - } - - public TT_RenderedTexture(IIconContainer aIcon) { - this(aIcon, Dyes._NULL.mRGBa); - } - - @Override - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); - renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); - renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); - } - } - - @Override - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); - renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); - renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); - } - } - - @Override - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); - renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); - renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); - } - } - - @Override - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); - renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); - renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); - } - } - - @Override - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); - renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); - renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); - } - } - - @Override - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); - renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); - renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); - } - } - - - /** - * Renders the given texture to the bottom face of the block. Args: block, x, y, z, texture - */ - public void renderFaceYNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { - Tessellator tessellator = Tessellator.instance; - - if (aRenderer.hasOverrideBlockTexture()) { - icon = aRenderer.overrideBlockTexture; - } - - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d5 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - double d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMaxU(); - d4 = (double) icon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); - } - - double d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - switch (rotation) { - case 3: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - break; - case 1: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - break; - case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - break; - } - - double d11 = x + aRenderer.renderMinX; - double d12 = x + aRenderer.renderMaxX; - double d13 = y + aRenderer.renderMinY; - double d14 = z + aRenderer.renderMinZ; - double d15 = z + aRenderer.renderMaxZ; - - if (aRenderer.renderFromInside) { - d11 = x + aRenderer.renderMaxX; - d12 = x + aRenderer.renderMinX; - } - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(d11, d13, d15, d8, d10); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(d11, d13, d14, d3, d5); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(d12, d13, d14, d7, d9); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - tessellator.addVertexWithUV(d12, d13, d15, d4, d6); - } else { - tessellator.addVertexWithUV(d11, d13, d15, d8, d10); - tessellator.addVertexWithUV(d11, d13, d14, d3, d5); - tessellator.addVertexWithUV(d12, d13, d14, d7, d9); - tessellator.addVertexWithUV(d12, d13, d15, d4, d6); - } - } - - /** - * Renders the given texture to the top face of the block. Args: block, x, y, z, texture - */ - public void renderFaceYPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { - Tessellator tessellator = Tessellator.instance; - - if (aRenderer.hasOverrideBlockTexture()) { - icon = aRenderer.overrideBlockTexture; - } - - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - double d5 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - double d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = (double) icon.getMinV(); - - d6 = (double) icon.getMaxV(); - } - - double d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - switch (rotation) { - case 1: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - break; - case 3: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - break; - case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - break; - } - - double d11 = x + aRenderer.renderMinX; - double d12 = x + aRenderer.renderMaxX; - double d13 = y + aRenderer.renderMaxY; - double d14 = z + aRenderer.renderMinZ; - double d15 = z + aRenderer.renderMaxZ; - - if (aRenderer.renderFromInside) { - d11 = x + aRenderer.renderMaxX; - d12 = x + aRenderer.renderMinX; - } - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(d12, d13, d15, d4, d6); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(d12, d13, d14, d7, d9); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(d11, d13, d14, d3, d5); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - tessellator.addVertexWithUV(d11, d13, d15, d8, d10); - } else { - tessellator.addVertexWithUV(d12, d13, d15, d4, d6); - tessellator.addVertexWithUV(d12, d13, d14, d7, d9); - tessellator.addVertexWithUV(d11, d13, d14, d3, d5); - tessellator.addVertexWithUV(d11, d13, d15, d8, d10); - } - } - - /** - * Renders the given texture to the north (z-negative) face of the block. Args: block, x, y, z, texture - */ - public void renderFaceZNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { - Tessellator tessellator = Tessellator.instance; - - if (aRenderer.hasOverrideBlockTexture()) { - icon = aRenderer.overrideBlockTexture; - } - - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - - if (aRenderer.field_152631_f) { - d4 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); - d3 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); - } - - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); - double d7; - - if (aRenderer.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); - } - - if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - switch (rotation) { - case 3: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - break; - case 1: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - break; - case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - break; - } - - double d11 = x + aRenderer.renderMinX; - double d12 = x + aRenderer.renderMaxX; - double d13 = y + aRenderer.renderMinY; - double d14 = y + aRenderer.renderMaxY; - double d15 = z + aRenderer.renderMinZ; - - if (aRenderer.renderFromInside) { - d11 = x + aRenderer.renderMaxX; - d12 = x + aRenderer.renderMinX; - } - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(d11, d14, d15, d7, d9); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(d12, d14, d15, d3, d5); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(d12, d13, d15, d8, d10); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - tessellator.addVertexWithUV(d11, d13, d15, d4, d6); - } else { - tessellator.addVertexWithUV(d11, d14, d15, d7, d9); - tessellator.addVertexWithUV(d12, d14, d15, d3, d5); - tessellator.addVertexWithUV(d12, d13, d15, d8, d10); - tessellator.addVertexWithUV(d11, d13, d15, d4, d6); - } - } - - /** - * Renders the given texture to the south (z-positive) face of the block. Args: block, x, y, z, texture - */ - public void renderFaceZPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { - Tessellator tessellator = Tessellator.instance; - - if (aRenderer.hasOverrideBlockTexture()) { - icon = aRenderer.overrideBlockTexture; - } - - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); - double d7; - - if (aRenderer.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); - } - - if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - switch (rotation) { - case 1: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - break; - case 3: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - break; - case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - break; - } - - double d11 = x + aRenderer.renderMinX; - double d12 = x + aRenderer.renderMaxX; - double d13 = y + aRenderer.renderMinY; - double d14 = y + aRenderer.renderMaxY; - double d15 = z + aRenderer.renderMaxZ; - - if (aRenderer.renderFromInside) { - d11 = x + aRenderer.renderMaxX; - d12 = x + aRenderer.renderMinX; - } - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(d11, d14, d15, d3, d5); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(d11, d13, d15, d8, d10); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(d12, d13, d15, d4, d6); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - tessellator.addVertexWithUV(d12, d14, d15, d7, d9); - } else { - tessellator.addVertexWithUV(d11, d14, d15, d3, d5); - tessellator.addVertexWithUV(d11, d13, d15, d8, d10); - tessellator.addVertexWithUV(d12, d13, d15, d4, d6); - tessellator.addVertexWithUV(d12, d14, d15, d7, d9); - } - } - - /** - * Renders the given texture to the west (x-negative) face of the block. Args: block, x, y, z, texture - */ - public void renderFaceXNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { - Tessellator tessellator = Tessellator.instance; - - if (aRenderer.hasOverrideBlockTexture()) { - icon = aRenderer.overrideBlockTexture; - } - - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); - double d7; - - if (aRenderer.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); - } - - if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - switch (rotation) { - case 1: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - break; - case 3: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - break; - case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - break; - } - - double d11 = x + aRenderer.renderMinX; - double d12 = y + aRenderer.renderMinY; - double d13 = y + aRenderer.renderMaxY; - double d14 = z + aRenderer.renderMinZ; - double d15 = z + aRenderer.renderMaxZ; - - if (aRenderer.renderFromInside) { - d14 = z + aRenderer.renderMaxZ; - d15 = z + aRenderer.renderMinZ; - } - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(d11, d13, d15, d7, d9); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(d11, d13, d14, d3, d5); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(d11, d12, d14, d8, d10); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - tessellator.addVertexWithUV(d11, d12, d15, d4, d6); - } else { - tessellator.addVertexWithUV(d11, d13, d15, d7, d9); - tessellator.addVertexWithUV(d11, d13, d14, d3, d5); - tessellator.addVertexWithUV(d11, d12, d14, d8, d10); - tessellator.addVertexWithUV(d11, d12, d15, d4, d6); - } - } - - /** - * Renders the given texture to the east (x-positive) face of the block. Args: block, x, y, z, texture - */ - public void renderFaceXPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { - Tessellator tessellator = Tessellator.instance; - - if (aRenderer.hasOverrideBlockTexture()) { - icon = aRenderer.overrideBlockTexture; - } - - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); - - if (aRenderer.field_152631_f) { - d4 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMinZ) * 16.0D); - d3 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMaxZ) * 16.0D); - } - - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); - double d7; - - if (aRenderer.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); - } - - if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - switch (rotation) { - case 3: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - break; - case 1: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - break; - case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - break; - } - - double d11 = x + aRenderer.renderMaxX; - double d12 = y + aRenderer.renderMinY; - double d13 = y + aRenderer.renderMaxY; - double d14 = z + aRenderer.renderMinZ; - double d15 = z + aRenderer.renderMaxZ; - - if (aRenderer.renderFromInside) { - d14 = z + aRenderer.renderMaxZ; - d15 = z + aRenderer.renderMinZ; - } - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(d11, d12, d15, d8, d10); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(d11, d12, d14, d4, d6); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(d11, d13, d14, d7, d9); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - tessellator.addVertexWithUV(d11, d13, d15, d3, d5); - } else { - tessellator.addVertexWithUV(d11, d12, d15, d8, d10); - tessellator.addVertexWithUV(d11, d12, d14, d4, d6); - tessellator.addVertexWithUV(d11, d13, d14, d7, d9); - tessellator.addVertexWithUV(d11, d13, d15, d3, d5); - } - } - - @Override - public short[] getRGBA() { - return mRGBa; - } - - @Override - public boolean isValidTexture() { - return mIconContainer != null; - } - - private static byte getRotation(int x, int y, int z) { - World w = Minecraft.getMinecraft().theWorld; - if (w != null) { - TileEntity te = w.getTileEntity(x, y, z); - if (te instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (meta instanceof IFrontRotation) { - return ((IFrontRotation) meta).getFrontRotation(); - } - } - } - return 0; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 63177d40ae..9612426598 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 08a79e5c90..c79087d051 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -9,7 +9,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; /** diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index 8187759445..b81dd885a5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -4,7 +4,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; /** * Created by danie_000 on 24.12.2017. 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 d45fbc31d7..dce8f56ce9 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 @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.constructible.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -21,7 +21,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -350,7 +350,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java index 59ad1b927e..7aabff1af4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java @@ -1,6 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.pipe; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.pipe.IActivePipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.relauncher.Side; @@ -31,7 +34,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 26.02.2017. */ -public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConnectsToDataPipe,IActivePipe { +public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConnectsToDataPipe, IActivePipe { private static Textures.BlockIcons.CustomIcon EMpipe; private static Textures.BlockIcons.CustomIcon EMbar,EMbarActive; public byte connectionCount = 0; @@ -118,25 +121,16 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if ((aTick & 31) == 31) { + if(TecTech.RANDOM.nextInt(15)==0) { + NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), + aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + 256); + } if(active){ - if(TecTech.RANDOM.nextInt(15)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } active=false; - }else if(getActive()){ - if(TecTech.RANDOM.nextInt(15)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } } mConnections = 0; connectionCount = 0; @@ -275,9 +269,11 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn } @Override - public void setActive(boolean active) { - this.active=active; - getBaseMetaTileEntity().issueTextureUpdate(); + public void setActive(boolean state) { + if(state!=active) { + active = state; + getBaseMetaTileEntity().issueTextureUpdate(); + } } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java index 98e0feccd1..55a7f23b6a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java @@ -1,6 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.pipe; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.pipe.IActivePipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.relauncher.Side; @@ -32,7 +35,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 26.02.2017. */ -public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnectsToElementalPipe,IActivePipe { +public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnectsToElementalPipe, IActivePipe { private static Textures.BlockIcons.CustomIcon EMpipe; static Textures.BlockIcons.CustomIcon EMcandy,EMCandyActive; public byte connectionCount = 0; @@ -119,25 +122,16 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnec public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if ((aTick & 31) == 31) { + if(TecTech.RANDOM.nextInt(15)==0) { + NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), + aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + 256); + } if(active){ - if(TecTech.RANDOM.nextInt(7)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } active=false; - }else if(getActive()){ - if(TecTech.RANDOM.nextInt(7)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } } mConnections = 0; connectionCount = 0; @@ -240,9 +234,11 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnec } @Override - public void setActive(boolean active) { - this.active=active; - getBaseMetaTileEntity().issueTextureUpdate(); + public void setActive(boolean state) { + if(state!=active) { + active = state; + getBaseMetaTileEntity().issueTextureUpdate(); + } } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java index ce315fcd86..ef767dacdd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java @@ -1,6 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.pipe; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.pipe.IActivePipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.relauncher.Side; @@ -31,11 +34,11 @@ import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEn import static gregtech.api.enums.Dyes.MACHINE_METAL; import static net.minecraft.util.StatCollector.translateToLocal; -public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements IConnectsToEnergyTunnel,IActivePipe { +public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements IConnectsToEnergyTunnel, IActivePipe { private static Textures.BlockIcons.CustomIcon EMpipe; public byte connectionCount = 0; - private boolean active; + private boolean active,lastActive; public GT_MetaTileEntity_Pipe_Energy(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 0); @@ -115,25 +118,16 @@ public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements ICo public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if ((aTick & 31) == 31) { + if(TecTech.RANDOM.nextInt(15)==0) { + NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), + aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + 256); + } if(active){ - if(TecTech.RANDOM.nextInt(31)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } active=false; - }else if(getActive()){ - if(TecTech.RANDOM.nextInt(31)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } } mConnections = 0; connectionCount = 0; @@ -180,8 +174,10 @@ public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements ICo @Override public void setActive(boolean state){ - this.active=state; - getBaseMetaTileEntity().issueTextureUpdate(); + if(state!=active) { + active = state; + getBaseMetaTileEntity().issueTextureUpdate(); + } } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IActivePipe.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IActivePipe.java deleted file mode 100644 index 5552992e56..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IActivePipe.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; - -public interface IActivePipe extends IMetaTileEntity { - void setActive(boolean active); - boolean getActive(); - void markUsed(); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToDataPipe.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToDataPipe.java deleted file mode 100644 index def0795ba3..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToDataPipe.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; - -/** - * Created by Tec on 26.02.2017. - */ -public interface IConnectsToDataPipe { - boolean canConnectData(byte side); - - IConnectsToDataPipe getNext(IConnectsToDataPipe source); - - boolean isDataInputFacing(byte side); - - byte getColorization(); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToElementalPipe.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToElementalPipe.java deleted file mode 100644 index 5841d3d010..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToElementalPipe.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; - -/** - * Created by Tec on 26.02.2017. - */ -public interface IConnectsToElementalPipe { - boolean canConnect(byte side); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToEnergyTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToEnergyTunnel.java deleted file mode 100644 index 4a720d067e..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToEnergyTunnel.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; - -/** - * Created by Tec on 26.02.2017. - */ -public interface IConnectsToEnergyTunnel { - boolean canConnect(byte side); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/PipeActivityMessage.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/PipeActivityMessage.java deleted file mode 100644 index e7183b8838..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/PipeActivityMessage.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; - -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; -import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; - -public class PipeActivityMessage implements IMessage { - int mPosX; - int mPosY; - int mPosZ; - int mPosD; - int mActive; - - public PipeActivityMessage() { - } - - private PipeActivityMessage(IActivePipe metaTile) { - IGregTechTileEntity base=metaTile.getBaseMetaTileEntity(); - mPosX=base.getXCoord(); - mPosY=base.getYCoord(); - mPosZ=base.getZCoord(); - mPosD=base.getWorld().provider.dimensionId; - mActive=metaTile.getActive()?1:0; - } - - private PipeActivityMessage(World world, int x, int y, int z, boolean active) { - mPosX=x; - mPosY=y; - mPosZ=z; - mPosD=world.provider.dimensionId; - mActive=active?1:0; - } - - @Override - public void fromBytes(ByteBuf pBuffer) { - NBTTagCompound tTag = ByteBufUtils.readTag(pBuffer); - mPosX = tTag.getInteger("posx"); - mPosY = tTag.getInteger("posy"); - mPosZ = tTag.getInteger("posz"); - mPosD = tTag.getInteger("posd"); - mActive = tTag.getInteger("active"); - } - - @Override - public void toBytes(ByteBuf pBuffer) { - NBTTagCompound tFXTag = new NBTTagCompound(); - tFXTag.setInteger("posx", mPosX); - tFXTag.setInteger("posy", mPosY); - tFXTag.setInteger("posz", mPosZ); - tFXTag.setInteger("posd", mPosD); - tFXTag.setInteger("active", mActive); - - ByteBufUtils.writeTag(pBuffer, tFXTag); - } - - public static class PipeActivityQuery extends PipeActivityMessage { - public PipeActivityQuery() { - } - - public PipeActivityQuery(IActivePipe metaTile) { - super(metaTile); - } - - public PipeActivityQuery(World world, int x,int y,int z, boolean active) { - super(world,x,y,z,active); - } - } - - public static class PipeActivityData extends PipeActivityMessage { - public PipeActivityData() { - } - - private PipeActivityData(PipeActivityQuery query){ - mPosX=query.mPosX; - mPosY=query.mPosY; - mPosZ=query.mPosZ; - mPosD=query.mPosD; - mActive=query.mActive; - } - - public PipeActivityData(IActivePipe metaTile) { - super(metaTile); - } - - public PipeActivityData(World world, int x,int y,int z, boolean active) { - super(world,x,y,z,active); - } - } - - public static class ClientHandler extends AbstractClientMessageHandler { - @Override - public IMessage handleClientMessage(EntityPlayer pPlayer, PipeActivityData pMessage, MessageContext pCtx) { - if(pPlayer.worldObj.provider.dimensionId==pMessage.mPosD){ - TileEntity te=pPlayer.worldObj.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ); - if(te instanceof IGregTechTileEntity){ - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if(meta instanceof IActivePipe){ - ((IActivePipe) meta).setActive((byte)pMessage.mActive==1); - } - } - } - return null; - } - } - - public static class ServerHandler extends AbstractServerMessageHandler { - @Override - public IMessage handleServerMessage(EntityPlayer pPlayer, PipeActivityQuery pMessage, MessageContext pCtx) { - World world= DimensionManager.getWorld(pMessage.mPosD); - if(world!=null) { - TileEntity te = world.getTileEntity(pMessage.mPosX, pMessage.mPosY, pMessage.mPosZ); - if (te instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (meta instanceof IActivePipe) { - pMessage.mActive=((IActivePipe) meta).getActive()?1:0; - return new PipeActivityData(pMessage); - } - } - } - return null; - } - } -} \ No newline at end of file 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 d4335e3c5a..737046729f 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.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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; 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 a56172c7f4..d942786916 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.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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; @@ -28,10 +28,10 @@ import net.minecraftforge.fluids.FluidStack; import java.util.*; -import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; +import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 e092eb7c38..6fef2efbe9 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 @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; 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; 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 0da48dfbac..931da27e6c 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.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; 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; 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 171e051c5c..f40752bcf5 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 @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; 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 cpw.mods.fml.relauncher.Side; @@ -20,7 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureWriter; +import static com.github.technus.tectech.util.Util.StructureWriter; import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; 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 79f753aa02..9bac9df2f3 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; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.avr.SidedRedstone; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; 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 c22219e6d9..03ec9efd89 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 @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -21,7 +21,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.RECIPE_AT; +import static com.github.technus.tectech.util.CommonValues.RECIPE_AT; import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; 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 2302d1a42b..61f2259c5c 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.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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 48db8725df..0c282ac94f 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 @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.RendererMessage; import com.github.technus.tectech.mechanics.data.ThaumSpark; @@ -26,9 +26,9 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.entriesSortedByValues; -import static com.github.technus.tectech.Util.map; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.entriesSortedByValues; +import static com.github.technus.tectech.util.Util.map; import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; import static java.lang.Math.round; import static net.minecraft.util.StatCollector.translateToLocal; @@ -206,9 +206,9 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB IMetaTileEntity nodeInside = node.getMetaTileEntity(); if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil) { GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - xR = (byte) (nodeTesla.posTop[0] - x); - yR = (byte) (nodeTesla.posTop[1] - y); - zR = (byte) (nodeTesla.posTop[2] - z); + xR = (byte) (nodeTesla.posTop.get0() - x); + yR = (byte) (nodeTesla.posTop.get1() - y); + zR = (byte) (nodeTesla.posTop.get2() - z); } else { xR = (byte) (node.getXCoord() - x); yR = (byte) (node.getYCoord() - y); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java index 02f84bd7c3..ca937f813c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_WetTransformer extends GT_MetaTileEntity_TT_Transformer { 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 ebeb266c64..b40a9126b7 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; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPollutor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 946006c8fa..6b6b778d40 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,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static com.github.technus.tectech.CommonValues.VN; +import static com.github.technus.tectech.util.CommonValues.VN; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_BuckConverter extends GT_GUIContainerMetaTile_Machine { 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 e0e3cdd6b8..bde5b90048 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; +import com.github.technus.tectech.util.Util; 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; 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 ad3839e80a..ee6e952040 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,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static com.github.technus.tectech.CommonValues.VN; +import static com.github.technus.tectech.util.CommonValues.VN; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_DebugPowerGenerator extends GT_GUIContainerMetaTile_Machine { diff --git a/src/main/java/com/github/technus/tectech/util/CommonValues.java b/src/main/java/com/github/technus/tectech/util/CommonValues.java new file mode 100644 index 0000000000..f5d5ce6900 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/CommonValues.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.util; + +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 11.01.2017. + */ +public final class CommonValues { + public static final String TEC_MARK_GENERAL = + EnumChatFormatting.BLUE + "Tec" + + EnumChatFormatting.DARK_BLUE + "Tech" + + EnumChatFormatting.BLUE + ": Interdimensional"; + public static final String TEC_MARK_EM = + EnumChatFormatting.BLUE + "Tec" + + EnumChatFormatting.DARK_BLUE + "Tech" + + EnumChatFormatting.BLUE + ": Elemental Matter"; + public static final String BASS_MARK = + EnumChatFormatting.BLUE + "Tec" + + EnumChatFormatting.DARK_BLUE + "Tech" + + EnumChatFormatting.BLUE + ": Theta Movement"; + public static final String COSMIC_MARK = + EnumChatFormatting.BLUE + "Tec" + + EnumChatFormatting.DARK_BLUE + "Tech" + + EnumChatFormatting.BLUE + ": Cosmic";//TODO get a better name than cosmic for *UNDEFINED* thing + + public static final byte DECAY_AT = 0;// hatches compute decays + public static final byte MULTI_PURGE_1_AT = 2;// multiblocks clean their hatches 1 + public static final byte MOVE_AT = 4;// move stuff around + public static final byte RECIPE_AT = 6;// move stuff around + public static final byte MULTI_PURGE_2_AT = 8;// multiblocks clean their hatches 2 + public static final byte OVERFLOW_AT = 10;// then hatches clean themselves + // - in case some hatches are not in multiblock structure + public static final byte MULTI_CHECK_AT = 12;// multiblock checks it's state + public static final byte DISPERSE_AT = 14;// overflow hatches perform disperse + public static final byte TRANSFER_AT = 16; + + public static final long[] AatV = new long[]{268435455,67108863,16777215,4194303,1048575,262143,65535,16383,4095,1023,255,63,15,3,1,1}; + public static final String[] VOLTAGE_NAMES = new String[]{"Ultra Low Voltage", "Low Voltage", "Medium Voltage", "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", "Ultimate High Voltage", "Ultimate Extreme Voltage", "Ultimate Insane Voltage", "Ultimate Mega Voltage", "Ultimate Extended Mega Voltage", "Overpowered Voltage", "Maximum Voltage"}; + public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UMV", "UXV", "OpV", "MAX"}; + public static final long[] V = new long[]{8L, 32L, 128L, 512L, 2048L, 8192L, 32768L, 131072L, 524288L, 2097152L, 8388608L, 33554432L, 134217728L, 536870912L, 1073741824L, Integer.MAX_VALUE - 7}; + + private CommonValues() {} +} diff --git a/src/main/java/com/github/technus/tectech/util/Converter.java b/src/main/java/com/github/technus/tectech/util/Converter.java new file mode 100644 index 0000000000..799d98a4d6 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/Converter.java @@ -0,0 +1,59 @@ +package com.github.technus.tectech.util; + +import java.io.*; + +public final class Converter { + private Converter() {} + + public static void writeInts(int [] array,ByteArrayOutputStream byteArrayOutputStream) { + try { + DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); + for (int i = 0; i < array.length; i++) { + dataOutputStream.writeInt(array[i]); + } + dataOutputStream.flush(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static void readInts(ByteArrayInputStream byteArrayInputStream,int[] array) { + try { + DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream); + for (int i = 0; i < array.length; i++) { + array[i] = dataInputStream.readInt(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static byte[] writeInts(int[] array) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(array.length * 4); + DataOutputStream dos = new DataOutputStream(bos); + for (int i = 0; i < array.length; i++) { + dos.writeInt(array[i]); + } + + return bos.toByteArray(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static int[] readInts(byte[] array) { + try { + ByteArrayInputStream bis = new ByteArrayInputStream(array); + DataInputStream dataInputStream = new DataInputStream(bis); + int size = array.length / Integer.BYTES; + int[] res = new int[size]; + for (int i = 0; i < size; i++) { + res[i] = dataInputStream.readInt(); + } + return res; + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java new file mode 100644 index 0000000000..cd055528b1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -0,0 +1,1104 @@ +package com.github.technus.tectech.util; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +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.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +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.tileentity.TileEntity; +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.common.util.ForgeDirection; +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.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static gregtech.api.enums.GT_Values.E; +import static java.nio.charset.Charset.forName; + +/** + * 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; + } + + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller + //This only checks for REGULAR BLOCKS! + public static boolean StructureCheckerExtreme( + String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + IHatchAdder[] addingMethods, + short[] casingTextures, + Block[] blockTypeFallback,//use numbers 0-9 for casing types + byte[] blockMetaFallback,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity aBaseMetaTileEntity, + ExtendedFacing extendedFacing, + boolean forceCheck) { + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return false; + } + //TE Rotation + if(extendedFacing==null){ + extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); + } + + IGregTechTileEntity igt; + IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); + + int xyz[]=new int[3]; + int abc[]=new int[3]; + int pointer; + int baseX = aBaseMetaTileEntity.getXCoord(), + baseZ = aBaseMetaTileEntity.getZCoord(), + baseY = aBaseMetaTileEntity.getYCoord(); + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + //yPos - absolute height of checked block + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] -= block; + break; + } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.') { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc,xyz); + xyz[0]+=baseX; + xyz[1]+=baseY; + xyz[2]+=baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos + switch (block) { + case '-'://must be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { + return false; + } + break; + case '+'://must not be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { + return false; + } + break; + default://check for block (countable) + if ((pointer = block - '0') >= 0) { + //countable air -> net.minecraft.block.BlockAir + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); + } + return false; + } + } else //noinspection ConstantConditions + if ((pointer = block - ' ') >= 0) { + igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); + if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); + } + return false; + } + } + } + } + } else if (forceCheck) { + return false; + } + abc[0]++;//block in horizontal layer + } + } + abc[1]--;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity aBaseMetaTileEntity, boolean hintsOnly) { + byte facing = aBaseMetaTileEntity.getFrontFacing(); + return StructureBuilderExtreme(structure, blockType, blockMeta, + horizontalOffset, verticalOffset, depthOffset, + aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), null, + facing, hintsOnly); + } + + public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity aBaseMetaTileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + byte facing = aBaseMetaTileEntity.getFrontFacing(); + return StructureBuilderExtreme(structure, blockType, blockMeta, + horizontalOffset, verticalOffset, depthOffset, + aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), extendedFacing, + facing, hintsOnly); + } + + public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + TileEntity tileEntity, int facing, boolean hintsOnly) { + return StructureBuilderExtreme(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, tileEntity, null, facing, hintsOnly); + } + + public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + TileEntity tileEntity, ExtendedFacing extendedFacing, int simpleFacing, boolean hintsOnly) { + if (!tileEntity.hasWorldObj()) { + return false; + } + World world = tileEntity.getWorldObj(); + if (!world.isRemote && hintsOnly) { + return false; + } + + //TE Rotation + + + int xyz[]=new int[3]; + int abc[]=new int[3]; + int pointer; + int + baseX = tileEntity.xCoord, + baseZ = tileEntity.zCoord, + baseY = tileEntity.yCoord; + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + if (extendedFacing == null) { + extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(simpleFacing)); + } + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] -= block; + break; + } + if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. + { + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.')// this TE + { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc,xyz); + xyz[0]+=baseX; + xyz[1]+=baseY; + xyz[2]+=baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded + if (hintsOnly) { + switch (block) { + case '-'://must be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); + break; + case '+'://must not be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); + } + } else if ((pointer = block - ' ') >= 0) { + if (pointer >= 0 && pointer < 12) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); + } + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); + } + } + } else { + switch (block) { + case '-'://must be air + world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); + break; + case '+'://must not be air + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); + } else if (block - ' ' < 0) { + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15, 2); + } //else { + //switch(pointer){ + // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: + // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; + // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); + //} + //} + } + } + } + abc[0]++;//block in horizontal layer + } + } + abc[1]--;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + + public static String[] StructureWriter(IGregTechTileEntity aBaseMetaTileEntity, + int horizontalOffset, int verticalOffset, int depthOffset, + int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { + //TE Rotation + byte facing = aBaseMetaTileEntity.getFrontFacing(); + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return new String[]{"Not at Client m8"}; + } + + ItemStack[] array = new ItemStack[10]; + + int x, y, z, a, b, c; + int + baseX = aBaseMetaTileEntity.getXCoord(), + baseZ = aBaseMetaTileEntity.getZCoord(), + baseY = aBaseMetaTileEntity.getYCoord(); + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + //yPos - absolute height of checked block + + //perform your duties - #1 - count block types + c = -depthOffset; + for (int cz = 0; cz < depthSize; cz++) {//front to back + b = verticalOffset; + for (int by = 0; by < verticalSize; by++) {//top to bottom + a = -horizontalOffset; + for (int az = 0; az < horizontalSize; az++) {//left to right + //get x y z from rotation + switch (facing) {//translation + case 4: + x = baseX + c; + z = baseZ + a; + y = baseY + b; + break; + case 3: + x = baseX + a; + z = baseZ - c; + y = baseY + b; + break; + case 5: + x = baseX - c; + z = baseZ - a; + y = baseY + b; + break; + case 2: + x = baseX - a; + z = baseZ + c; + y = baseY + b; + break; + //Things get odd if the block faces up or down... + case 1: + x = baseX + a; + z = baseZ + b; + y = baseY - c; + break;//similar to 3 + case 0: + x = baseX - a; + z = baseZ - b; + y = baseY + c; + break;//similar to 2 + default: + return new String[]{"Invalid rotation"}; + } + + //that must be here since in some cases other axis (b,c) controls y + if (y < 0 || y >= 256) { + return new String[]{"Invalid position"}; + } + + //Check block + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { + boolean err = true; + ItemStack is = new ItemStack(block, 1, meta); + for (int i = 0; i < array.length; i++) { + if (array[i] == null) { + array[i] = is; + err = false; + break; + } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { + err = false; + break; + } + } + if (err) { + return new String[]{"Too much different blocks"}; + } + } + + a++;//block in horizontal layer + } + b--;//horizontal layer + } + c++;//depth + } + + List output = new ArrayList<>(); + + output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); + output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); + output.add(""); + + output.add("ID[]: Name[]"); + output.add(""); + for (int i = 0; i < array.length; i++) { + if (array[i] != null) { + output.add(i + ": " + array[i].getDisplayName()); + } + } + output.add(""); + output.add("ID[]: Block[] BlockMetaID[]"); + output.add(""); + for (int i = 0; i < array.length; i++) { + if (array[i] != null) { + output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); + } + } + output.add(""); + output.add("String[][]"); + //perform your duties - #2 - write strings + output.add("{"); + c = -depthOffset; + for (int cz = 0; cz < depthSize; cz++) {//front to back + b = verticalOffset; + StringBuilder addMe = new StringBuilder().append('{'); + for (int by = 0; by < verticalSize; by++) {//top to bottom + a = -horizontalOffset; + StringBuilder line = new StringBuilder(); + for (int az = 0; az < horizontalSize; az++) {//left to right + //get x y z from rotation + switch (facing) {//translation + case 4: + x = baseX + c; + z = baseZ + a; + y = baseY + b; + break; + case 3: + x = baseX + a; + z = baseZ - c; + y = baseY + b; + break; + case 5: + x = baseX - c; + z = baseZ - a; + y = baseY + b; + break; + case 2: + x = baseX - a; + z = baseZ + c; + y = baseY + b; + break; + //Things get odd if the block faces up or down... + case 1: + x = baseX + a; + z = baseZ + b; + y = baseY - c; + break;//similar to 3 + case 0: + x = baseX - a; + z = baseZ - b; + y = baseY + c; + break;//similar to 2 + default: + return new String[]{"Invalid rotation"}; + } + + //Check block + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if (a == 0 && b == 0 && c == 0) { + line.append('.'); + } else if (block.getMaterial() == Material.air) { + line.append('-'); + } else if (block.hasTileEntity(meta)) { + line.append('*'); + } else { + ItemStack stack = new ItemStack(block, 1, meta); + String str = "?";//OH YEAH NPEs + for (int i = 0; i < array.length; i++) { + if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { + str = Integer.toString(i); + break; + } + } + line.append(str); + } + a++;//block in horizontal layer + } + if (ignoreAir) { + StringBuilder builder = new StringBuilder(); + char temp = '@'; + for (char ch : line.toString().toCharArray()) { + if (ch == '-') { + temp += 1; + if (temp == '~') { + builder.append('~'); + temp = '@'; + } + } else { + if (temp > '@') { + builder.append(temp); + temp = '@'; + } + builder.append(ch); + } + } + while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { + builder.deleteCharAt(builder.length() - 1); + } + if (builder.length() == 0) { + builder.append("E,"); + } else { + builder.insert(0, '"'); + builder.append('"').append(','); + } + addMe.append(builder); + } else { + if (line.length() == 0) { + line.append("E,"); + } else { + line.insert(0, '"'); + line.append('"').append(','); + } + addMe.append(line); + } + b--;//horizontal layer + } + //region less verbose + addMe.append('}').append(','); + String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); + Matcher matcher = matchE_.matcher(builtStr); + while (matcher.find()) { + byte lenEE = (byte) (matcher.group(1).length() >> 1); + builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); + //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); + } + //endregion + output.add(builtStr); + c++;//depth + } + output.add("}"); + return output.toArray(new String[0]); + } + + private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); + + 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(forName("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); + } +} diff --git a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java new file mode 100644 index 0000000000..84e6497560 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java @@ -0,0 +1,146 @@ +package com.github.technus.tectech.util; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.dispenser.IPosition; +import net.minecraftforge.common.util.ForgeDirection; + +public class Vec3Impl implements Comparable { + public static final Vec3Impl NULL_VECTOR = new Vec3Impl(0, 0, 0); + private final int val0; + private final int val1; + private final int val2; + + public Vec3Impl(int in0, int in1, int in2) { + this.val0 = in0; + this.val1 = in1; + this.val2 = in2; + } + + public Vec3Impl(IGregTechTileEntity baseMetaTileEntity) { + this(baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord()); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } else if (o instanceof Vec3Impl) { + Vec3Impl vec3i = (Vec3Impl)o; + return val0 == vec3i.val0 && val1 == vec3i.val1 && val2 == vec3i.val2; + } + return false; + } + + public int hashCode() { + return (val1 + val2 * 31) * 31 + val0; + } + + public int compareTo(Vec3Impl o) { + return val1 == o.val1 ? val2 == o.val2 ? val0 - o.val0 : val2 - o.val2 : val1 - o.val1; + } + + /** + * Gets the coordinate. + */ + public int get(int index) { + switch (index){ + case 0: return val0; + case 1: return val1; + case 2: return val2; + default: return 0; + } + } + + /** + * Gets the X coordinate. + */ + public int get0() { + return this.val0; + } + + /** + * Gets the Y coordinate. + */ + public int get1() { + return this.val1; + } + + /** + * Gets the Z coordinate. + */ + public int get2() { + return this.val2; + } + + public Vec3Impl offset(ForgeDirection facing, int n) { + return n == 0 ? this : new Vec3Impl(val0 + facing.offsetX * n, val1 + facing.offsetY * n, val2 + facing.offsetZ * n); + } + + public Vec3Impl add(IGregTechTileEntity tileEntity) { + return new Vec3Impl(val0 + tileEntity.getXCoord(), val1 + tileEntity.getYCoord(), val2 + tileEntity.getZCoord()); + } + + public Vec3Impl sub(IGregTechTileEntity tileEntity) { + return new Vec3Impl(val0 - tileEntity.getXCoord(), val1 - tileEntity.getYCoord(), val2 - tileEntity.getZCoord()); + } + + public Vec3Impl add(Vec3Impl pos) { + return new Vec3Impl(val0 + pos.val0, val1 + pos.val1, val2 + pos.val2); + } + + public Vec3Impl sub(Vec3Impl pos) { + return new Vec3Impl(val0 - pos.val0, val1 - pos.val1, val2 - pos.val2); + } + + public Vec3Impl add(int pos0,int pos1,int pos2) { + return new Vec3Impl(val0 + pos0, val1 + pos1, val2 + pos2); + } + + public Vec3Impl sub(int pos0,int pos1,int pos2) { + return new Vec3Impl(val0 - pos0, val1 - pos1, val2 - pos2); + } + + public Vec3Impl crossProduct(Vec3Impl vec) { + return new Vec3Impl(val1 * vec.val2 - val2 * vec.val1, val2 * vec.val0 - val0 * vec.val2, + val0 * vec.val1 - val1 * vec.val0); + } + + public boolean withinDistance(Vec3Impl to, double distance) { + return this.distanceSq(to.val0, to.val1, to.val2, false) < distance * distance; + } + + public boolean withinDistance(IPosition to, double distance) { + return this.distanceSq(to.getX(), to.getY(), to.getZ(), true) < distance * distance; + } + + public double distanceSq(Vec3Impl to) { + return this.distanceSq(to.val0, to.val1, to.val2, true); + } + + public double distanceSq(IPosition to, boolean useCenter) { + return this.distanceSq(to.getX(), to.getY(), to.getZ(), useCenter); + } + + public double distanceSq(double x, double y, double z, boolean useCenter) { + double d0 = useCenter ? 0.5D : 0.0D; + double d1 = (double)val0 + d0 - x; + double d2 = (double)val1 + d0 - y; + double d3 = (double)val2 + d0 - z; + return d1 * d1 + d2 * d2 + d3 * d3; + } + + public int manhattanDistance(Vec3Impl to) { + float f = (float)Math.abs(to.val0 - val0); + float f1 = (float)Math.abs(to.val1 - val1); + float f2 = (float)Math.abs(to.val2 - val2); + return (int)(f + f1 + f2); + } + + @Override + public String toString() { + return "Vec3[" + val0 + ", " + val1 + ", " + val2 + "]"; + } + + public Vec3Impl abs() { + return new Vec3Impl(Math.abs(val0),Math.abs(val1),Math.abs(val2)); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/util/XSTR.java b/src/main/java/com/github/technus/tectech/util/XSTR.java new file mode 100644 index 0000000000..31c9b6a65c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/XSTR.java @@ -0,0 +1,278 @@ +package com.github.technus.tectech.util; +/* + A subclass of java.util.random that implements the Xorshift random number + generator +

+ - it is 30% faster than the generator from Java's library - it produces + random sequences of higher quality than java.util.Random - this class also + provides a clone() function +

+ Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); + //pull a random number +

+ To use the class in legacy code, you may also instantiate an XSRandom object + and assign it to a java.util.Random object: java.util.Random rand = new + XSRandom(); +

+ for an explanation of the algorithm, see + http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html + + @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs + * http://www.elmenreich.tk + *

+ * This code is released under the GNU Lesser General Public License Version 3 + * http://www.gnu.org/licenses/lgpl-3.0.txt + */ + +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; + +/** + * XSTR - Xorshift ThermiteRandom + * Modified by Bogdan-G + * 03.06.2016 + * version 0.0.4 + */ +public class XSTR extends Random { + + private static final long serialVersionUID = 6208727693524452904L; + private long seed; + private static final long GAMMA = 0x9e3779b97f4a7c15L; + private static final int PROBE_INCREMENT = 0x9e3779b9; + private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); + public static final XSTR XSTR_INSTANCE=new XSTR(){ + @Override + public synchronized void setSeed(long seed) { + if(!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) { + throw new NoSuchMethodError("This is meant to be shared!, leave seed state alone!"); + } + } + }; + + /* + MODIFIED BY: Robotia + Modification: Implemented Random class seed generator + */ + + /** + * Creates a new pseudo random number generator. The seed is initialized to + * the current time, as if by + * setSeed(System.currentTimeMillis());. + */ + public XSTR() { + this(seedUniquifier() ^ System.nanoTime()); + } + + private static long seedUniquifier() { + // L'Ecuyer, "Tables of Linear Congruential Generators of + // Different Sizes and Good Lattice Structure", 1999 + while (true) { + long current = seedUniquifier.get(); + long next = current * 181783497276652981L; + if (seedUniquifier.compareAndSet(current, next)) { + return next; + } + } + } + + /** + * Creates a new pseudo random number generator, starting with the specified + * seed, using setSeed(seed);. + * + * @param seed the initial seed + */ + public XSTR(long seed) { + this.seed = seed; + } + + @Override + public boolean nextBoolean() { + return next(1) != 0; + } + + @Override + public double nextDouble() { + return (((long) next(26) << 27) + next(27)) * DOUBLE_UNIT; + } + + /** + * Returns the current state of the seed, can be used to clone the object + * + * @return the current seed + */ + public synchronized long getSeed() { + return seed; + } + + /** + * Sets the seed for this pseudo random number generator. As described + * above, two instances of the same random class, starting with the same + * seed, produce the same results, if the same methods are called. + * + * @param seed the new seed + */ + @Override + public synchronized void setSeed(long seed) { + this.seed = seed; + } + + /** + * @return Returns an XSRandom object with the same state as the original + */ + @Override + public XSTR clone() { + return new XSTR(getSeed()); + } + + /** + * Implementation of George Marsaglia's elegant Xorshift random generator + * 30% faster and better quality than the built-in java.util.random see also + * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml + * + * @param nbits will shift nbits bits + * @return next seed + */ + @Override + public int next(int nbits) { + long x = seed; + x ^= x << 21; + x ^= x >>> 35; + x ^= x << 4; + seed = x; + x &= (1L << nbits) - 1; + return (int) x; + } + + private boolean haveNextNextGaussian = false; + private double nextNextGaussian = 0; + + @Override + public synchronized double nextGaussian() { + // See Knuth, ACP, Section 3.4.1 Algorithm C. + if (haveNextNextGaussian) { + haveNextNextGaussian = false; + return nextNextGaussian; + } else { + double v1, v2, vs; + do { + v1 = 2 * nextDouble() - 1; // between -1 and 1 + v2 = 2 * nextDouble() - 1; // between -1 and 1 + vs = v1 * v1 + v2 * v2; + } while (vs >= 1 || vs == 0); + double multiplier = StrictMath.sqrt(-2 * StrictMath.log(vs) / vs); + nextNextGaussian = v2 * multiplier; + haveNextNextGaussian = true; + return v1 * multiplier; + } + } + + /** + * Returns a pseudorandom, uniformly distributed {@code int} value between 0 + * (inclusive) and the specified value (exclusive), drawn from this random + * number generator's sequence. The general contract of {@code nextInt} is + * that one {@code int} value in the specified range is pseudorandomly + * generated and returned. All {@code bound} possible {@code int} values are + * produced with (approximately) equal probability. The method + * {@code nextInt(int bound)} is implemented by class {@code Random} as if + * by: + *

 {@code
+     * public int nextInt(int bound) {
+     *   if (bound <= 0)
+     *     throw new IllegalArgumentException("bound must be positive");
+     *
+     *   if ((bound & -bound) == bound)  // i.e., bound is a power of 2
+     *     return (int)((bound * (long)next(31)) >> 31);
+     *
+     *   int bits, val;
+     *   do {
+     *       bits = next(31);
+     *       val = bits % bound;
+     *   } while (bits - val + (bound-1) < 0);
+     *   return val;
+     * }}
+ * + *

The hedge "approx + * imately" is used in the foregoing description only because the next + * method is only approximately an unbiased source of independently chosen + * bits. If it were a perfect source of randomly chosen bits, then the + * algorithm shown would choose {@code int} values from the stated range + * with perfect uniformity. + *

+ * The algorithm is slightly tricky. It rejects values that would result in + * an uneven distribution (due to the fact that 2^31 is not divisible by n). + * The probability of a value being rejected depends on n. The worst case is + * n=2^30+1, for which the probability of a reject is 1/2, and the expected + * number of iterations before the loop terminates is 2. + *

+ * The algorithm treats the case where n is a power of two specially: it + * returns the correct number of high-order bits from the underlying + * pseudo-random number generator. In the absence of special treatment, the + * correct number of low-order bits would be returned. Linear + * congruential pseudo-random number generators such as the one implemented + * by this class are known to have short periods in the sequence of values + * of their low-order bits. Thus, this special case greatly increases the + * length of the sequence of values returned by successive calls to this + * method if n is a small power of two. + * + * @param bound the upper bound (exclusive). Must be positive. + * @return the next pseudorandom, uniformly distributed {@code int} value + * between zero (inclusive) and {@code bound} (exclusive) from this random + * number generator's sequence + * @throws IllegalArgumentException if bound is not positive + * @since 1.2 + */ + @Override + public int nextInt(int bound) { + //if (bound <= 0) { + //throw new RuntimeException("BadBound"); + //} + + /*int r = next(31); + int m = bound - 1; + if ((bound & m) == 0) // i.e., bound is a power of 2 + { + r = (int) ((bound * (long) r) >> 31); + } else { + for (int u = r; + u - (r = u % bound) + m < 0; + u = next(31)) + ; + } + return r;*/ + //speedup, new nextInt ~+40% + long last = seed ^ seed << 21; + last ^= last >>> 35; + last ^= last << 4; + seed = last; + int out = (int) last % bound; + return out < 0 ? -out : out; + } + + @Override + public int nextInt() { + return next(32); + } + + @Override + public float nextFloat() { + return next(24) * FLOAT_UNIT; + } + + @Override + public long nextLong() { + // it's okay that the bottom word remains signed. + return ((long) next(32) << 32) + next(32); + } + + @Override + public void nextBytes(byte[] bytes_arr) { + for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) { + for (int rndba = nextInt(), nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); nba-- > 0; rndba >>= Byte.SIZE) { + bytes_arr[iba++] = (byte) rndba; + } + } + } +} \ No newline at end of file -- cgit From 5d3a02a84779d1381620bc27dc3807726ffcf46d Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Apr 2020 23:16:28 +0200 Subject: Idk why but ok --- .../tectech/mechanics/alignment/IntegerAxisSwap.java | 17 +++++++++++++++++ .../mechanics/alignment/enumerable/ExtendedFacing.java | 7 +++++++ 2 files changed, 24 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java index 40cb6c3220..1c44164731 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.mechanics.alignment; import com.github.technus.tectech.util.Vec3Impl; +import net.minecraft.util.Vec3; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.mechanics.alignment.enumerable.Direction.getAxisVector; @@ -40,6 +41,22 @@ public class IntegerAxisSwap { forFirstAxis.get2()*point.get0()+forSecondAxis.get2()*point.get1()+forThirdAxis.get2()*point.get2() ); } + + public Vec3 translate(Vec3 point){ + return Vec3.createVectorHelper( + forFirstAxis.get0()*point.xCoord +forFirstAxis.get1()*point.yCoord +forFirstAxis.get2()*point.zCoord, + forSecondAxis.get0()*point.xCoord+forSecondAxis.get1()*point.yCoord+forSecondAxis.get2()*point.zCoord, + forThirdAxis.get0()*point.xCoord +forThirdAxis.get1()*point.yCoord +forThirdAxis.get2()*point.zCoord + ); + } + + public Vec3 inverseTranslate(Vec3 point){ + return Vec3.createVectorHelper( + forFirstAxis.get0()*point.xCoord+forSecondAxis.get0()*point.yCoord+forThirdAxis.get0()*point.zCoord, + forFirstAxis.get1()*point.xCoord+forSecondAxis.get1()*point.yCoord+forThirdAxis.get1()*point.zCoord, + forFirstAxis.get2()*point.xCoord+forSecondAxis.get2()*point.yCoord+forThirdAxis.get2()*point.zCoord + ); + } public void translate(int[] point,int[] out){ out[0]=forFirstAxis.get0()*point[0] +forFirstAxis.get1()*point[1] +forFirstAxis.get2()*point[2]; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java index 68cc50a5ee..5c8c902484 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.alignment.enumerable; import com.github.technus.tectech.mechanics.alignment.IAlignment; import com.github.technus.tectech.mechanics.alignment.IntegerAxisSwap; import com.github.technus.tectech.util.Vec3Impl; +import net.minecraft.util.Vec3; import net.minecraftforge.common.util.ForgeDirection; import java.util.*; @@ -292,6 +293,9 @@ public enum ExtendedFacing { * @param abcOffset A,B,C offset (facing relative L-->R,U-->D,F-->B) * @return X,Y,Z offset in world */ + public Vec3 getWorldOffset(Vec3 abcOffset) { + return integerAxisSwap.inverseTranslate(abcOffset); + } public Vec3Impl getWorldOffset(Vec3Impl abcOffset) { return integerAxisSwap.inverseTranslate(abcOffset); } @@ -308,6 +312,9 @@ public enum ExtendedFacing { * @param xyzOffset X,Y,Z offset in world * @return A,B,C offset (facing relative L-->R,U-->D,F-->B) */ + public Vec3 getOffsetABC(Vec3 xyzOffset){ + return integerAxisSwap.translate(xyzOffset); + } public Vec3Impl getOffsetABC(Vec3Impl xyzOffset){ return integerAxisSwap.translate(xyzOffset); } -- cgit From 1fbd3db52ce5e81ffdf563f4c498001b49ba2cbc Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 20 Apr 2020 06:53:12 +0200 Subject: Refactor to provider and add another helper method for compatiblility --- .../tectech/mechanics/alignment/IAlignment.java | 32 ++++++++++++++++------ .../mechanics/alignment/IAlignmentProvider.java | 5 ++++ .../thing/item/FrontRotationTriggerItem.java | 15 ++++++---- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 3 +- .../render/TT_RenderedExtendedFacingTexture.java | 8 ++++-- 5 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java index d7b48f8865..a2a6301070 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java @@ -8,12 +8,25 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.Arrays; -public interface IAlignment extends IAlignmentLimits { +public interface IAlignment extends IAlignmentLimits,IAlignmentProvider { int DIRECTIONS_COUNT= Direction.VALUES.length; int ROTATIONS_COUNT= Rotation.VALUES.length; int FLIPS_COUNT= Flip.VALUES.length; int STATES_COUNT = ExtendedFacing.VALUES.length; + ExtendedFacing getExtendedFacing(); + + void setExtendedFacing(ExtendedFacing alignment); + + IAlignmentLimits getAlignmentLimits(); + + void setAlignmentLimits(IAlignmentLimits limits); + + @Override + default IAlignment getAlignment(){ + return this; + } + static int getAlignmentIndex(ForgeDirection direction, Rotation rotation, Flip flip){ return (direction.ordinal()*ROTATIONS_COUNT+rotation.getIndex())*FLIPS_COUNT+flip.getIndex(); } @@ -42,14 +55,6 @@ public interface IAlignment extends IAlignmentLimits { setExtendedFacing(getExtendedFacing().with(flip)); } - ExtendedFacing getExtendedFacing(); - - void setExtendedFacing(ExtendedFacing alignment); - - IAlignmentLimits getAlignmentLimits(); - - void setAlignmentLimits(IAlignmentLimits limits); - default boolean toolSetDirection(ForgeDirection direction){ if(direction==null || direction==ForgeDirection.UNKNOWN){ for (int i = 0,j=getDirection().ordinal()+1, valuesLength = Direction.VALUES.length; i < valuesLength; i++) { @@ -75,6 +80,15 @@ public interface IAlignment extends IAlignmentLimits { return false; } + default boolean canSetToDirectionAny(ForgeDirection direction){ + for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) { + if(isNewExtendedFacingValid(extendedFacing)){ + return true; + } + } + return false; + } + default boolean toolSetRotation(Rotation rotation) { if(rotation==null){ int flips = Flip.VALUES.length; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java new file mode 100644 index 0000000000..07dc972aac --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java @@ -0,0 +1,5 @@ +package com.github.technus.tectech.mechanics.alignment; + +public interface IAlignmentProvider { + IAlignment getAlignment(); +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index efcfcfb7a3..5edc238a91 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.IAlignmentProvider; import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -42,19 +43,21 @@ public final class FrontRotationTriggerItem extends Item { if (aPlayer instanceof EntityPlayerMP) { if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IAlignment) { + if (metaTE instanceof IAlignmentProvider) { + IAlignment alignment = ((IAlignmentProvider) metaTE).getAlignment(); if(aPlayer.isSneaking()){ - ((IAlignment) metaTE).toolSetFlip(null); + alignment.toolSetFlip(null); }else { - ((IAlignment) metaTE).toolSetRotation(null); + alignment.toolSetRotation(null); } return true; } - } else if (tTileEntity instanceof IAlignment) { + } else if (tTileEntity instanceof IAlignmentProvider) { + IAlignment alignment = ((IAlignmentProvider) tTileEntity).getAlignment(); if(aPlayer.isSneaking()){ - ((IAlignment) tTileEntity).toolSetFlip(null); + alignment.toolSetFlip(null); }else { - ((IAlignment) tTileEntity).toolSetRotation(null); + alignment.toolSetRotation(null); } return true; } 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 52bdd3574f..50e2aa575b 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 @@ -183,8 +183,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public boolean isFacingValid(byte aFacing) { - return getAlignmentLimits() - .isNewExtendedFacingValid(getExtendedFacing().with(ForgeDirection.getOrientation(aFacing))); + return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing)); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java index 4ecea706cc..44fa12ebb8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; -import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.IAlignmentProvider; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; @@ -881,11 +881,13 @@ public class TT_RenderedExtendedFacingTexture implements ITexture,IColorModulati TileEntity te = w.getTileEntity(x, y, z); if (te instanceof IGregTechTileEntity) { IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (meta instanceof IAlignment) { - return ((IAlignment) meta).getExtendedFacing(); + if (meta instanceof IAlignmentProvider) { + return ((IAlignmentProvider) meta).getAlignment().getExtendedFacing(); }else{ return ExtendedFacing.of(ForgeDirection.getOrientation(meta.getBaseMetaTileEntity().getFrontFacing())); } + } else if (te instanceof IAlignmentProvider) { + return ((IAlignmentProvider) te).getAlignment().getExtendedFacing(); } } return ExtendedFacing.DEFAULT; -- cgit From 1c8a7217e61057acb29279a987eff4cafb1a5d78 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 20 Apr 2020 06:58:16 +0200 Subject: Cleanup util --- src/main/java/com/github/technus/tectech/util/Util.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java index cd055528b1..7e6e177e77 100644 --- a/src/main/java/com/github/technus/tectech/util/Util.java +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -40,6 +40,7 @@ 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.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -190,10 +191,9 @@ public final class Util { } IGregTechTileEntity igt; - IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); - int xyz[]=new int[3]; - int abc[]=new int[3]; + int[] xyz =new int[3]; + int[] abc =new int[3]; int pointer; int baseX = aBaseMetaTileEntity.getXCoord(), baseZ = aBaseMetaTileEntity.getZCoord(), @@ -336,10 +336,8 @@ public final class Util { } //TE Rotation - - - int xyz[]=new int[3]; - int abc[]=new int[3]; + int[] xyz =new int[3]; + int[] abc =new int[3]; int pointer; int baseX = tileEntity.xCoord, @@ -1045,7 +1043,7 @@ public final class Util { 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(forName("UTF-8"))).toString(); + 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); } -- cgit From 9360d6afe97e029001f411d819f6d80dafdc95a3 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 20 Apr 2020 17:19:19 +0200 Subject: Revoctor Structure util to new package, fix typo --- Baubles-1.7.10-1.0.1.10.jar | Bin 0 -> 95415 bytes EnderCore-1.7.10-0.2.0.39_beta.jar | Bin 0 -> 467824 bytes EnderIO-1.7.10-2.3.0.429_beta.jar | Bin 0 -> 4756103 bytes GalacticraftCore-Dev-1.7-3.0.12.504.jar | Bin 0 -> 10419213 bytes libs/AsieLib-1.7.10-0.4.9-deobf.jar | Bin 0 -> 154691 bytes libs/Computronics-1.7.10-1.6.6-deobf.jar | Bin 0 -> 1143582 bytes libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar | Bin 0 -> 3425453 bytes libs/Galacticraft-API-1.7-3.0.12.504.jar | Bin 0 -> 119588 bytes libs/MicdoodleCore-1.7-3.0.12.504.jar | Bin 0 -> 64945 bytes libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar | Bin 0 -> 1461467 bytes .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 8 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 8 +- .../tectech/loader/ConstructableLoader.java | 47 ++ .../mechanics/constructable/IConstructable.java | 16 + .../constructable/IMultiblockInfoContainer.java | 30 ++ .../tectech/mechanics/constructable/Structure.java | 526 +++++++++++++++++++++ .../mechanics/constructible/IConstructable.java | 15 - .../thing/item/ConstructableTriggerItem.java | 115 ++--- .../multi/GT_MetaTileEntity_EM_annihilation.java | 8 +- .../multi/GT_MetaTileEntity_EM_bhg.java | 12 +- .../multi/GT_MetaTileEntity_EM_collider.java | 12 +- .../multi/GT_MetaTileEntity_EM_computer.java | 18 +- .../multi/GT_MetaTileEntity_EM_crafting.java | 8 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 8 +- .../multi/GT_MetaTileEntity_EM_decay.java | 8 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 8 +- .../multi/GT_MetaTileEntity_EM_infuser.java | 8 +- .../multi/GT_MetaTileEntity_EM_junction.java | 8 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 8 +- .../multi/GT_MetaTileEntity_EM_research.java | 8 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 8 +- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 8 +- .../multi/GT_MetaTileEntity_EM_switch.java | 8 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 8 +- .../multi/GT_MetaTileEntity_EM_wormhole.java | 8 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 8 +- .../GT_MetaTileEntity_TM_proccessingStack.java | 4 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 7 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 8 +- .../GT_MetaTileEntity_DebugStructureWriter.java | 6 +- .../java/com/github/technus/tectech/util/Util.java | 522 -------------------- 42 files changed, 772 insertions(+), 706 deletions(-) create mode 100644 Baubles-1.7.10-1.0.1.10.jar create mode 100644 EnderCore-1.7.10-0.2.0.39_beta.jar create mode 100644 EnderIO-1.7.10-2.3.0.429_beta.jar create mode 100644 GalacticraftCore-Dev-1.7-3.0.12.504.jar create mode 100644 libs/AsieLib-1.7.10-0.4.9-deobf.jar create mode 100644 libs/Computronics-1.7.10-1.6.6-deobf.jar create mode 100644 libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar create mode 100644 libs/Galacticraft-API-1.7-3.0.12.504.jar create mode 100644 libs/MicdoodleCore-1.7-3.0.12.504.jar create mode 100644 libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar create mode 100644 src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java (limited to 'src/main') diff --git a/Baubles-1.7.10-1.0.1.10.jar b/Baubles-1.7.10-1.0.1.10.jar new file mode 100644 index 0000000000..40f23088c7 Binary files /dev/null and b/Baubles-1.7.10-1.0.1.10.jar differ diff --git a/EnderCore-1.7.10-0.2.0.39_beta.jar b/EnderCore-1.7.10-0.2.0.39_beta.jar new file mode 100644 index 0000000000..1fdf703497 Binary files /dev/null and b/EnderCore-1.7.10-0.2.0.39_beta.jar differ diff --git a/EnderIO-1.7.10-2.3.0.429_beta.jar b/EnderIO-1.7.10-2.3.0.429_beta.jar new file mode 100644 index 0000000000..9be1d55c41 Binary files /dev/null and b/EnderIO-1.7.10-2.3.0.429_beta.jar differ diff --git a/GalacticraftCore-Dev-1.7-3.0.12.504.jar b/GalacticraftCore-Dev-1.7-3.0.12.504.jar new file mode 100644 index 0000000000..329f7ae19b Binary files /dev/null and b/GalacticraftCore-Dev-1.7-3.0.12.504.jar differ diff --git a/libs/AsieLib-1.7.10-0.4.9-deobf.jar b/libs/AsieLib-1.7.10-0.4.9-deobf.jar new file mode 100644 index 0000000000..78d4f64b4a Binary files /dev/null and b/libs/AsieLib-1.7.10-0.4.9-deobf.jar differ diff --git a/libs/Computronics-1.7.10-1.6.6-deobf.jar b/libs/Computronics-1.7.10-1.6.6-deobf.jar new file mode 100644 index 0000000000..e6f5b07a69 Binary files /dev/null and b/libs/Computronics-1.7.10-1.6.6-deobf.jar differ diff --git a/libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar b/libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar new file mode 100644 index 0000000000..b579b93cc6 Binary files /dev/null and b/libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar differ diff --git a/libs/Galacticraft-API-1.7-3.0.12.504.jar b/libs/Galacticraft-API-1.7-3.0.12.504.jar new file mode 100644 index 0000000000..6935478027 Binary files /dev/null and b/libs/Galacticraft-API-1.7-3.0.12.504.jar differ diff --git a/libs/MicdoodleCore-1.7-3.0.12.504.jar b/libs/MicdoodleCore-1.7-3.0.12.504.jar new file mode 100644 index 0000000000..b678294b0d Binary files /dev/null and b/libs/MicdoodleCore-1.7-3.0.12.504.jar differ diff --git a/libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar b/libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar new file mode 100644 index 0000000000..0361359748 Binary files /dev/null and b/libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar differ diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index ab6b723e09..eb9b97deee 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -24,7 +25,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -123,7 +123,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; @@ -139,7 +139,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 309d029b8e..0259aec7a7 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -24,7 +25,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -127,7 +127,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java new file mode 100644 index 0000000000..2dc56754f8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.loader; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; +import com.github.technus.tectech.mechanics.constructable.Structure; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; + +import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.*; +import static gregtech.api.GregTech_API.sBlockCasings1; + +public class ConstructableLoader implements Runnable { + + @Override + public void run() { + registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace .class, new IMultiblockInfoContainer() { + //region Structure + private final String[][] shape = new String[][]{ + {"000","\"\"\"","\"\"\""," . ",}, + {"0!0","\"A\"","\"A\""," ",}, + {"000","\"\"\"","\"\"\""," ",}, + }; + private final Block[] blockType = new Block[]{sBlockCasings1}; + private final byte[] blockMeta = new byte[]{11}; + private final String[] desc=new String[]{ + EnumChatFormatting.AQUA+"Hint Details:", + "1 - Classic Hatches or Heat Proof Casing", + "2 - Muffler Hatch", + "3 - Coil blocks" + }; + //endregion + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide) { + Structure.builder(shape, blockType, blockMeta, 1, 3, 0, tileEntity, aSide, hintsOnly); + } + + @Override + public String[] getDescription(int stackSize) { + return desc; + } + }); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java new file mode 100644 index 0000000000..d7c3c86098 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.constructable; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.ItemStack; + +/** + * Created by Tec on 24.03.2017. + */ +public interface IConstructable { + void construct(ItemStack stackSize, boolean hintsOnly); + + @SideOnly(Side.CLIENT) + String[] getStructureDescription(int stackSize); +} + diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java new file mode 100644 index 0000000000..29769fafb8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java @@ -0,0 +1,30 @@ +package com.github.technus.tectech.mechanics.constructable; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import java.util.HashMap; + +/** + * To implement IConstructable on not own TileEntities + */ +public interface IMultiblockInfoContainer { + HashMap MULTIBLOCK_MAP = new HashMap<>(); + + static void registerTileClass(Class clazz, IMultiblockInfoContainer info){ + MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); + } + + static void registerMetaClass(Class clazz, IMultiblockInfoContainer info){ + MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); + } + + void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide); + + @SideOnly(Side.CLIENT) + String[] getDescription(int stackSize); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java new file mode 100644 index 0000000000..00ffb32525 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java @@ -0,0 +1,526 @@ +package com.github.technus.tectech.mechanics.constructable; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static gregtech.api.enums.GT_Values.E; + +public class Structure { + private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); + + private Structure(){} + + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller + //This only checks for REGULAR BLOCKS! + public static boolean checker( + String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + IHatchAdder[] addingMethods, + short[] casingTextures, + Block[] blockTypeFallback,//use numbers 0-9 for casing types + byte[] blockMetaFallback,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity aBaseMetaTileEntity, + ExtendedFacing extendedFacing, + boolean forceCheck) { + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return false; + } + //TE Rotation + if(extendedFacing==null){ + extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); + } + + IGregTechTileEntity igt; + + int[] xyz =new int[3]; + int[] abc =new int[3]; + int pointer; + int baseX = aBaseMetaTileEntity.getXCoord(), + baseZ = aBaseMetaTileEntity.getZCoord(), + baseY = aBaseMetaTileEntity.getYCoord(); + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + //yPos - absolute height of checked block + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] -= block; + break; + } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.') { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc,xyz); + xyz[0]+=baseX; + xyz[1]+=baseY; + xyz[2]+=baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos + switch (block) { + case '-'://must be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { + return false; + } + break; + case '+'://must not be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { + return false; + } + break; + default://check for block (countable) + if ((pointer = block - '0') >= 0) { + //countable air -> net.minecraft.block.BlockAir + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); + } + return false; + } + } else //noinspection ConstantConditions + if ((pointer = block - ' ') >= 0) { + igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); + if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); + } + return false; + } + } + } + } + } else if (forceCheck) { + return false; + } + abc[0]++;//block in horizontal layer + } + } + abc[1]--;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, + tileEntity.getWorld(),tileEntity.getXCoord(),tileEntity.getYCoord(),tileEntity.getZCoord(), + extendedFacing, hintsOnly); + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + TileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, + tileEntity.getWorldObj(),tileEntity.xCoord,tileEntity.yCoord,tileEntity.zCoord, + extendedFacing, hintsOnly); + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + World world,int baseX,int baseZ,int baseY, ExtendedFacing extendedFacing, boolean hintsOnly) { + if (world==null || (!world.isRemote && hintsOnly)) { + return false; + } + + //TE Rotation + int[] xyz =new int[3]; + int[] abc =new int[3]; + int pointer; + + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] -= block; + break; + } + if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. + { + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.')// this TE + { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc,xyz); + xyz[0]+=baseX; + xyz[1]+=baseY; + xyz[2]+=baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded + if (hintsOnly) { + switch (block) { + case '-'://must be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); + break; + case '+'://must not be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); + } + } else if ((pointer = block - ' ') >= 0) { + if (pointer >= 0 && pointer < 12) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); + } + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); + } + } + } else { + switch (block) { + case '-'://must be air + world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); + break; + case '+'://must not be air + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); + } else if (block - ' ' < 0) { + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15, 2); + } //else { + //switch(pointer){ + // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: + // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; + // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); + //} + //} + } + } + } + abc[0]++;//block in horizontal layer + } + } + abc[1]--;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + + public static String[] writer(IGregTechTileEntity aBaseMetaTileEntity, + int horizontalOffset, int verticalOffset, int depthOffset, + int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { + //TE Rotation + byte facing = aBaseMetaTileEntity.getFrontFacing(); + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return new String[]{"Not at Client m8"}; + } + + ItemStack[] array = new ItemStack[10]; + + int x, y, z, a, b, c; + int + baseX = aBaseMetaTileEntity.getXCoord(), + baseZ = aBaseMetaTileEntity.getZCoord(), + baseY = aBaseMetaTileEntity.getYCoord(); + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + //yPos - absolute height of checked block + + //perform your duties - #1 - count block types + c = -depthOffset; + for (int cz = 0; cz < depthSize; cz++) {//front to back + b = verticalOffset; + for (int by = 0; by < verticalSize; by++) {//top to bottom + a = -horizontalOffset; + for (int az = 0; az < horizontalSize; az++) {//left to right + //get x y z from rotation + switch (facing) {//translation + case 4: + x = baseX + c; + z = baseZ + a; + y = baseY + b; + break; + case 3: + x = baseX + a; + z = baseZ - c; + y = baseY + b; + break; + case 5: + x = baseX - c; + z = baseZ - a; + y = baseY + b; + break; + case 2: + x = baseX - a; + z = baseZ + c; + y = baseY + b; + break; + //Things get odd if the block faces up or down... + case 1: + x = baseX + a; + z = baseZ + b; + y = baseY - c; + break;//similar to 3 + case 0: + x = baseX - a; + z = baseZ - b; + y = baseY + c; + break;//similar to 2 + default: + return new String[]{"Invalid rotation"}; + } + + //that must be here since in some cases other axis (b,c) controls y + if (y < 0 || y >= 256) { + return new String[]{"Invalid position"}; + } + + //Check block + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { + boolean err = true; + ItemStack is = new ItemStack(block, 1, meta); + for (int i = 0; i < array.length; i++) { + if (array[i] == null) { + array[i] = is; + err = false; + break; + } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { + err = false; + break; + } + } + if (err) { + return new String[]{"Too much different blocks"}; + } + } + + a++;//block in horizontal layer + } + b--;//horizontal layer + } + c++;//depth + } + + List output = new ArrayList<>(); + + output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); + output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); + output.add(""); + + output.add("ID[]: Name[]"); + output.add(""); + for (int i = 0; i < array.length; i++) { + if (array[i] != null) { + output.add(i + ": " + array[i].getDisplayName()); + } + } + output.add(""); + output.add("ID[]: Block[] BlockMetaID[]"); + output.add(""); + for (int i = 0; i < array.length; i++) { + if (array[i] != null) { + output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); + } + } + output.add(""); + output.add("String[][]"); + //perform your duties - #2 - write strings + output.add("{"); + c = -depthOffset; + for (int cz = 0; cz < depthSize; cz++) {//front to back + b = verticalOffset; + StringBuilder addMe = new StringBuilder().append('{'); + for (int by = 0; by < verticalSize; by++) {//top to bottom + a = -horizontalOffset; + StringBuilder line = new StringBuilder(); + for (int az = 0; az < horizontalSize; az++) {//left to right + //get x y z from rotation + switch (facing) {//translation + case 4: + x = baseX + c; + z = baseZ + a; + y = baseY + b; + break; + case 3: + x = baseX + a; + z = baseZ - c; + y = baseY + b; + break; + case 5: + x = baseX - c; + z = baseZ - a; + y = baseY + b; + break; + case 2: + x = baseX - a; + z = baseZ + c; + y = baseY + b; + break; + //Things get odd if the block faces up or down... + case 1: + x = baseX + a; + z = baseZ + b; + y = baseY - c; + break;//similar to 3 + case 0: + x = baseX - a; + z = baseZ - b; + y = baseY + c; + break;//similar to 2 + default: + return new String[]{"Invalid rotation"}; + } + + //Check block + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if (a == 0 && b == 0 && c == 0) { + line.append('.'); + } else if (block.getMaterial() == Material.air) { + line.append('-'); + } else if (block.hasTileEntity(meta)) { + line.append('*'); + } else { + ItemStack stack = new ItemStack(block, 1, meta); + String str = "?";//OH YEAH NPEs + for (int i = 0; i < array.length; i++) { + if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { + str = Integer.toString(i); + break; + } + } + line.append(str); + } + a++;//block in horizontal layer + } + if (ignoreAir) { + StringBuilder builder = new StringBuilder(); + char temp = '@'; + for (char ch : line.toString().toCharArray()) { + if (ch == '-') { + temp += 1; + if (temp == '~') { + builder.append('~'); + temp = '@'; + } + } else { + if (temp > '@') { + builder.append(temp); + temp = '@'; + } + builder.append(ch); + } + } + while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { + builder.deleteCharAt(builder.length() - 1); + } + if (builder.length() == 0) { + builder.append("E,"); + } else { + builder.insert(0, '"'); + builder.append('"').append(','); + } + addMe.append(builder); + } else { + if (line.length() == 0) { + line.append("E,"); + } else { + line.insert(0, '"'); + line.append('"').append(','); + } + addMe.append(line); + } + b--;//horizontal layer + } + //region less verbose + addMe.append('}').append(','); + String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); + Matcher matcher = matchE_.matcher(builtStr); + while (matcher.find()) { + byte lenEE = (byte) (matcher.group(1).length() >> 1); + builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); + //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); + } + //endregion + output.add(builtStr); + c++;//depth + } + output.add("}"); + return output.toArray(new String[0]); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java deleted file mode 100644 index fdfa2904fb..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.technus.tectech.mechanics.constructible; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Created by Tec on 24.03.2017. - */ -public interface IConstructable { - void construct(int stackSize, boolean hintsOnly); - - @SideOnly(Side.CLIENT) - String[] getStructureDescription(int stackSize); -} - diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 4af6b53658..7b7d1983fa 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -1,15 +1,15 @@ package com.github.technus.tectech.thing.item; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; -import net.minecraft.block.Block; +import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; @@ -18,14 +18,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.util.Util.StructureBuilder; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static gregtech.api.GregTech_API.sBlockCasings1; +import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.MULTIBLOCK_MAP; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -34,8 +33,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; public final class ConstructableTriggerItem extends Item { public static ConstructableTriggerItem INSTANCE; - private static HashMap multiblockMap= new HashMap<>(); - private ConstructableTriggerItem() { setUnlocalizedName("em.constructable"); setTextureName(MODID + ":itemConstructable"); @@ -54,14 +51,28 @@ public final class ConstructableTriggerItem extends Item { if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack.stackSize, false); - } else if (multiblockMap.containsKey(metaTE.getClass().getCanonicalName())) { - multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, ((IGregTechTileEntity) tTileEntity).getFrontFacing()); + ((IConstructable) metaTE).construct(aStack, false); + } else if (MULTIBLOCK_MAP.containsKey(metaTE.getClass().getCanonicalName())) { + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, ( + (IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } } } else if (tTileEntity instanceof IConstructable) { - ((IConstructable) tTileEntity).construct(aStack.stackSize, false); - } else if (multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())) { - multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, aSide); + ((IConstructable) tTileEntity).construct(aStack, false); + } else if (MULTIBLOCK_MAP.containsKey(tTileEntity.getClass().getCanonicalName())) { + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); + } } } return true; @@ -70,21 +81,35 @@ public final class ConstructableTriggerItem extends Item { if(tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack.stackSize, true); + ((IConstructable) metaTE).construct(aStack, true); TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); return false; - } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ - multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize,true,tTileEntity,((IGregTechTileEntity) tTileEntity).getFrontFacing()); - TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + } else if(MULTIBLOCK_MAP.containsKey(metaTE.getClass().getCanonicalName())){ + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, ( + (IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } + TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); return false; } } else if(tTileEntity instanceof IConstructable){ - ((IConstructable) tTileEntity).construct(aStack.stackSize,true); + ((IConstructable) tTileEntity).construct(aStack,true); TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); return false; - } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ - multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize,true,tTileEntity, aSide); - TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + } else if(MULTIBLOCK_MAP.containsKey(tTileEntity.getClass().getCanonicalName())){ + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); + } + TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); return false; } //} else { @@ -122,47 +147,5 @@ public final class ConstructableTriggerItem extends Item { public static void run() { INSTANCE = new ConstructableTriggerItem(); GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - - registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { - //region Structure - private final String[][] shape = new String[][]{ - {"000","\"\"\"","\"\"\""," . ",}, - {"0!0","\"A\"","\"A\""," ",}, - {"000","\"\"\"","\"\"\""," ",}, - }; - private final Block[] blockType = new Block[]{sBlockCasings1}; - private final byte[] blockMeta = new byte[]{11}; - private final String[] desc=new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or Heat Proof Casing", - "2 - Muffler Hatch", - "3 - Coil blocks" - }; - //endregion - - @Override - public void construct(int stackSize, boolean hintsOnly, TileEntity tileEntity, int aSide) { - StructureBuilder(shape, blockType, blockMeta, 1, 3, 0, tileEntity, aSide, hintsOnly); - } - - @Override - public String[] getDescription(int stackSize) { - return desc; - } - }); - } - - public interface IMultiblockInfoContainer { - void construct(int stackSize, boolean hintsOnly, TileEntity tileEntity, int aSide); - @SideOnly(Side.CLIENT) - String[] getDescription(int stackSize); - } - - public static void registerTileClass(Class clazz, IMultiblockInfoContainer info){ - multiblockMap.put(clazz.getCanonicalName(),info); - } - - public static void registerMetaClass(Class clazz, IMultiblockInfoContainer info){ - multiblockMap.put(clazz.getCanonicalName(),info); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index d52a3c23f7..4333d4c8c9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -103,8 +103,8 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 74ebae9f57..c5aaa1d66f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -297,11 +297,11 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E } @Override - public void construct(int stackSize, boolean hintsOnly) { - if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + if ((stackSize.stackSize & 1) == 1) { + Structure.builder(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } else { - StructureBuilderExtreme(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + Structure.builder(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index d37fcfdc4b..fe676910ee 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; @@ -13,7 +14,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex. import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -33,7 +34,6 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -665,7 +665,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; @@ -681,10 +681,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + if ((stackSize.stackSize & 1) == 1) { + Structure.builder(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } else { - StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + Structure.builder(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } } 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 1afbdf66e0..433b8b4950 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 @@ -1,11 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; 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.Vec3Impl; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; @@ -29,7 +30,6 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -335,18 +335,18 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity igt = getBaseMetaTileEntity(); - StructureBuilderExtreme(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); + Structure.builder(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); + Structure.builder(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); byte offset = -2; - for (int rackSlices = Math.min(stackSize, 12); rackSlices > 0; rackSlices--) { - StructureBuilderExtreme(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + for (int rackSlices = Math.min(stackSize.stackSize, 12); rackSlices > 0; rackSlices--) { + Structure.builder(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); } - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); - StructureBuilderExtreme(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); + Structure.builder(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + Structure.builder(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 3083f36721..7a71f36d3b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -105,8 +105,8 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 57ab6d770d..647bbf4a3b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; @@ -28,7 +29,6 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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.GT_Block_CasingsTT.texturePage; @@ -170,8 +170,8 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index ffea7781ee..be28a3d0c8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; @@ -27,7 +28,6 @@ import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.util.CommonValues.VN; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -243,8 +243,8 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index cb13abf358..fed03d1845 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElem import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.iExchangeInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -25,7 +26,6 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; @@ -148,8 +148,8 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 23a36f0edb..aed3025d4f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -1,10 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -22,7 +23,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -182,8 +182,8 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 448f0a5563..8a76ee6ff1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,7 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; @@ -13,7 +14,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -169,8 +169,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 4696164979..6315a2f295 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 @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; @@ -11,7 +12,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; @@ -29,7 +30,6 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.util.Util.isInputEqual; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; @@ -197,8 +197,8 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index e9bb65c19f..2a739cb6c7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.recipe.TT_recipe; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -37,7 +38,6 @@ import java.util.LinkedHashMap; 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.StructureBuilderExtreme; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -552,8 +552,8 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 be869b2ba9..48479b9d71 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 @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; @@ -11,7 +12,7 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.enums.ItemList; @@ -34,7 +35,6 @@ import org.apache.commons.lang3.reflect.FieldUtils; 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.StructureBuilderExtreme; import static com.github.technus.tectech.util.Util.areBitsSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; @@ -513,8 +513,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 9c88c4ecf3..ece01f7489 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -11,7 +12,6 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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 net.minecraft.util.StatCollector.translateToLocal; @@ -69,8 +69,8 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 47949ea36e..39f9441cb7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; @@ -21,7 +22,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -216,8 +216,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 81fd5eb6ad..c2e759e96c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -20,7 +21,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -149,8 +149,8 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 1f9d88e4fd..2b2ebdd1a4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -104,8 +104,8 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 497efd6f71..9c40d6ebc9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; 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.Vec3Impl; @@ -24,7 +25,6 @@ import net.minecraft.util.EnumChatFormatting; import java.util.ArrayList; import java.util.HashSet; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.MainLoader.microwaving; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -245,8 +245,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index bf18a545ef..678f211744 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -121,7 +121,7 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { //StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 85ccc5d881..327b54e561 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.data.RendererMessage; import com.github.technus.tectech.mechanics.data.ThaumSpark; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; @@ -821,8 +822,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMetas[(stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 50e2aa575b..2f23aae431 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 @@ -6,6 +6,7 @@ import com.github.technus.tectech.mechanics.alignment.*; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.util.Vec3Impl; import com.github.technus.tectech.loader.NetworkDispatcher; @@ -41,7 +42,6 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.*; -import static com.github.technus.tectech.util.Util.StructureCheckerExtreme; import static com.github.technus.tectech.util.Util.getTier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -200,7 +200,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset) { - return StructureCheckerExtreme(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, + return Structure.checker(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), getExtendedFacing(), !mMachine); } 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 dce8f56ce9..f6f3ec9a63 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 @@ -1,12 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; +import com.github.technus.tectech.mechanics.constructable.Structure; 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.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -21,7 +22,6 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -349,8 +349,8 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @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 f40752bcf5..194d357b1c 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 @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; @@ -20,7 +21,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureWriter; import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -107,7 +107,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isAllowedToWork()) { - result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); + result = Structure.writer(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); for (String s : result) { TecTech.LOGGER.info(s); } @@ -117,7 +117,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); + result = Structure.writer(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); for (String s : result) { TecTech.LOGGER.info(s); } diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java index 7e6e177e77..b81506d27c 100644 --- a/src/main/java/com/github/technus/tectech/util/Util.java +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -167,528 +167,6 @@ public final class Util { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean StructureCheckerExtreme( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - ExtendedFacing extendedFacing, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - if(extendedFacing==null){ - extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); - } - - IGregTechTileEntity igt; - - int[] xyz =new int[3]; - int[] abc =new int[3]; - int pointer; - int baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - abc[1] -= block; - break; - } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.') { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc,xyz); - xyz[0]+=baseX; - xyz[1]+=baseY; - xyz[2]+=baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); - } - return false; - } - } else //noinspection ConstantConditions - if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); - if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } - } - } else if (forceCheck) { - return false; - } - abc[0]++;//block in horizontal layer - } - } - abc[1]--;//horizontal layer - } - abc[2]++;//depth - } - return true; - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), null, - facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), extendedFacing, - facing, hintsOnly); - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, int facing, boolean hintsOnly) { - return StructureBuilderExtreme(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, tileEntity, null, facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, ExtendedFacing extendedFacing, int simpleFacing, boolean hintsOnly) { - if (!tileEntity.hasWorldObj()) { - return false; - } - World world = tileEntity.getWorldObj(); - if (!world.isRemote && hintsOnly) { - return false; - } - - //TE Rotation - int[] xyz =new int[3]; - int[] abc =new int[3]; - int pointer; - int - baseX = tileEntity.xCoord, - baseZ = tileEntity.zCoord, - baseY = tileEntity.yCoord; - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - if (extendedFacing == null) { - extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(simpleFacing)); - } - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - abc[1] -= block; - break; - } - if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.')// this TE - { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc,xyz); - xyz[0]+=baseX; - xyz[1]+=baseY; - xyz[2]+=baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded - if (hintsOnly) { - switch (block) { - case '-'://must be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); - break; - case '+'://must not be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); - } - } else if ((pointer = block - ' ') >= 0) { - if (pointer >= 0 && pointer < 12) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); - } - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); - } - } - } else { - switch (block) { - case '-'://must be air - world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); - break; - case '+'://must not be air - world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); - } else if (block - ' ' < 0) { - world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15, 2); - } //else { - //switch(pointer){ - // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: - // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; - // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); - //} - //} - } - } - } - abc[0]++;//block in horizontal layer - } - } - abc[1]--;//horizontal layer - } - abc[2]++;//depth - } - return true; - } - - - public static String[] StructureWriter(IGregTechTileEntity aBaseMetaTileEntity, - int horizontalOffset, int verticalOffset, int depthOffset, - int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return new String[]{"Not at Client m8"}; - } - - ItemStack[] array = new ItemStack[10]; - - int x, y, z, a, b, c; - int - baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - #1 - count block types - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return new String[]{"Invalid position"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { - boolean err = true; - ItemStack is = new ItemStack(block, 1, meta); - for (int i = 0; i < array.length; i++) { - if (array[i] == null) { - array[i] = is; - err = false; - break; - } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { - err = false; - break; - } - } - if (err) { - return new String[]{"Too much different blocks"}; - } - } - - a++;//block in horizontal layer - } - b--;//horizontal layer - } - c++;//depth - } - - List output = new ArrayList<>(); - - output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); - output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); - output.add(""); - - output.add("ID[]: Name[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getDisplayName()); - } - } - output.add(""); - output.add("ID[]: Block[] BlockMetaID[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); - } - } - output.add(""); - output.add("String[][]"); - //perform your duties - #2 - write strings - output.add("{"); - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - StringBuilder addMe = new StringBuilder().append('{'); - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - StringBuilder line = new StringBuilder(); - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (a == 0 && b == 0 && c == 0) { - line.append('.'); - } else if (block.getMaterial() == Material.air) { - line.append('-'); - } else if (block.hasTileEntity(meta)) { - line.append('*'); - } else { - ItemStack stack = new ItemStack(block, 1, meta); - String str = "?";//OH YEAH NPEs - for (int i = 0; i < array.length; i++) { - if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { - str = Integer.toString(i); - break; - } - } - line.append(str); - } - a++;//block in horizontal layer - } - if (ignoreAir) { - StringBuilder builder = new StringBuilder(); - char temp = '@'; - for (char ch : line.toString().toCharArray()) { - if (ch == '-') { - temp += 1; - if (temp == '~') { - builder.append('~'); - temp = '@'; - } - } else { - if (temp > '@') { - builder.append(temp); - temp = '@'; - } - builder.append(ch); - } - } - while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { - builder.deleteCharAt(builder.length() - 1); - } - if (builder.length() == 0) { - builder.append("E,"); - } else { - builder.insert(0, '"'); - builder.append('"').append(','); - } - addMe.append(builder); - } else { - if (line.length() == 0) { - line.append("E,"); - } else { - line.insert(0, '"'); - line.append('"').append(','); - } - addMe.append(line); - } - b--;//horizontal layer - } - //region less verbose - addMe.append('}').append(','); - String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); - Matcher matcher = matchE_.matcher(builtStr); - while (matcher.find()) { - byte lenEE = (byte) (matcher.group(1).length() >> 1); - builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); - //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); - } - //endregion - output.add(builtStr); - c++;//depth - } - output.add("}"); - return output.toArray(new String[0]); - } - - private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); - public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { if (!GregTech_API.sPostloadFinished) { return false; -- cgit From dbf60f779468c195fd094e1f3057b09753979262 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 20 Apr 2020 17:21:26 +0200 Subject: run this loader --- src/main/java/com/github/technus/tectech/loader/MainLoader.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index f7bec9adc0..f8fbcda2da 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -121,7 +121,7 @@ public final class MainLoader { } public static void postLoad() { - ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 5); + ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 6); progressBarPostLoad.step("Dreamcraft Compatibility"); if(Loader.isModLoaded(Reference.DREAMCRAFT)){ @@ -157,6 +157,10 @@ public final class MainLoader { fixBlocks(); TecTech.LOGGER.info("Blocks nerf done"); + progressBarPostLoad.step("Initialize more constructable stuff"); + new ConstructableLoader().run(); + TecTech.LOGGER.info("Constructable initialized"); + ProgressManager.pop(progressBarPostLoad); } -- cgit From 8f03f87dcf3ee70ff9d1cd6e7d496a4aab9fc0c1 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 20 Apr 2020 17:44:52 +0200 Subject: that spacebar... --- .../java/com/github/technus/tectech/loader/ConstructableLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java index 2dc56754f8..93752cc02f 100644 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -16,7 +16,7 @@ public class ConstructableLoader implements Runnable { @Override public void run() { - registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace .class, new IMultiblockInfoContainer() { + registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { //region Structure private final String[][] shape = new String[][]{ {"000","\"\"\"","\"\"\""," . ",}, -- cgit From 06ba23f08d8a1694c102a4ccd44a562a95a3f76f Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Sat, 25 Apr 2020 07:49:42 +0200 Subject: compat for new advanced smd parts (#27) If you just edit DreamCraft recipe loader you can push yourself @Dream-Master --- build.properties | 4 +- .../dreamcraft/DreamCraftRecipeLoader.java | 52 +++++++++++----------- 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/main') diff --git a/build.properties b/build.properties index 8dd601eb38..c75d05a3da 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=512 -gregtech.version=5.09.33.41 +gregtech.jenkinsbuild=520 +gregtech.version=5.09.33.42-Test cofhcore.version=[1.7.10]3.1.4-329-dev yamcore.version=0.5.79 baubles.version=1.0.1.10 diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 86468de1b2..b863e35901 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -971,10 +971,10 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 2), ItemList.Circuit_Wetwaresupercomputer.get(2L), ItemList.ZPM_Coil.get(16L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_CapacitorASMD.get(16L), + ItemList.Circuit_Parts_ResistorASMD.get(16L), + ItemList.Circuit_Parts_TransistorASMD.get(16L), + ItemList.Circuit_Parts_DiodeASMD.get(16L), ItemList.Circuit_Chip_Ram.get(48L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, (Materials.AnySyntheticRubber), 64L), @@ -989,10 +989,10 @@ public class DreamCraftRecipeLoader implements Runnable { 48000, 128, 500000, 8, new ItemStack[]{ ItemList.Circuit_Board_Bio_Ultra.get(2L), ItemList.Circuit_Biowarecomputer.get(2L), - ItemList.Circuit_Parts_TransistorSMD.get(16L), - ItemList.Circuit_Parts_ResistorSMD.get(16L), - ItemList.Circuit_Parts_CapacitorSMD.get(16L), - ItemList.Circuit_Parts_DiodeSMD.get(48L), + ItemList.Circuit_Parts_TransistorASMD.get(16L), + ItemList.Circuit_Parts_ResistorASMD.get(16L), + ItemList.Circuit_Parts_CapacitorASMD.get(16L), + ItemList.Circuit_Parts_DiodeASMD.get(16L), ItemList.Circuit_Chip_NOR.get(32L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.NiobiumTitanium, 32L), @@ -1009,10 +1009,10 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 4L), ItemList.Circuit_Biowaresupercomputer.get(2L), ItemList.UV_Coil.get(16L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_CapacitorASMD.get(24L), + ItemList.Circuit_Parts_ResistorASMD.get(24L), + ItemList.Circuit_Parts_TransistorASMD.get(24L), + ItemList.Circuit_Parts_DiodeASMD.get(24L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 64), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), @@ -1028,10 +1028,10 @@ public class DreamCraftRecipeLoader implements Runnable { 192000, 512, 2000000, 32, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 8), ItemList.Circuit_Biomainframe.get(2L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_CapacitorASMD.get(32L), + ItemList.Circuit_Parts_ResistorASMD.get(32L), + ItemList.Circuit_Parts_TransistorASMD.get(32L), + ItemList.Circuit_Parts_DiodeASMD.get(32L), ItemList.Circuit_Chip_Ram.get(64L), ItemList.Circuit_Chip_NPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Draconium, 64), @@ -1050,10 +1050,10 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Board_Bio_Ultra.get(1L), getItemContainer("PicoWafer").get(4L), getItemContainer("NanoCircuit").get(2L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_TransistorASMD.get(484L), + ItemList.Circuit_Parts_ResistorASMD.get(48L), + ItemList.Circuit_Parts_CapacitorASMD.get(48L), + ItemList.Circuit_Parts_DiodeASMD.get(48L), ItemList.Circuit_Chip_PPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NiobiumTitanium, 16), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Osmium, 32), @@ -1069,10 +1069,10 @@ public class DreamCraftRecipeLoader implements Runnable { 720000, 2048, 8000000, 128, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 16), getItemContainer("PikoCircuit").get(8L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), + ItemList.Circuit_Parts_CapacitorASMD.get(64L), + ItemList.Circuit_Parts_DiodeASMD.get(64L), + ItemList.Circuit_Parts_TransistorASMD.get(64L), + ItemList.Circuit_Parts_ResistorASMD.get(64L), ItemList.Circuit_Chip_QPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NiobiumTitanium, 64), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Indium, 64), @@ -1153,7 +1153,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Field_Generator_UV.get(2), ItemList.Circuit_Wafer_HPIC.get(64), ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Parts_DiodeSMD.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(32), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 32), }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880), @@ -1172,7 +1172,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Wafer_UHPIC.get(64), ItemList.Circuit_Wafer_UHPIC.get(64), ItemList.Circuit_Wafer_SoC2.get(32), - ItemList.Circuit_Parts_DiodeSMD.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Neutronium, 64), }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(3760), -- cgit From 43ca64a9e686b84d56225d1d5a08b81e637549b6 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 25 Apr 2020 23:12:49 +0200 Subject: new structure api --- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 6 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 6 +- .../tectech/loader/ConstructableLoader.java | 4 +- .../alignment/enumerable/ExtendedFacing.java | 17 +- .../mechanics/constructable/IConstructable.java | 2 +- .../constructable/IMultiblockInfoContainer.java | 2 +- .../tectech/mechanics/constructable/Structure.java | 526 --------------------- .../tectech/mechanics/structure/IBlockAdder.java | 14 + .../mechanics/structure/IBlockPosConsumer.java | 7 + .../tectech/mechanics/structure/IHatchAdder.java | 14 + .../mechanics/structure/IStructureDefinition.java | 137 ++++++ .../mechanics/structure/IStructureElement.java | 47 ++ .../structure/IStructureElementProvider.java | 5 + .../mechanics/structure/IStructureFallback.java | 40 ++ .../structure/IStructureFallbackProvider.java | 40 ++ .../mechanics/structure/IStructureNavigate.java | 23 + .../tectech/mechanics/structure/ITileAdder.java | 12 + .../tectech/mechanics/structure/Structure.java | 265 +++++++++++ .../mechanics/structure/StructureDefinition.java | 170 +++++++ .../mechanics/structure/StructureUtility.java | 473 ++++++++++++++++++ .../thing/item/ConstructableTriggerItem.java | 13 +- .../multi/GT_MetaTileEntity_EM_annihilation.java | 6 +- .../multi/GT_MetaTileEntity_EM_bhg.java | 6 +- .../multi/GT_MetaTileEntity_EM_collider.java | 5 +- .../multi/GT_MetaTileEntity_EM_computer.java | 5 +- .../multi/GT_MetaTileEntity_EM_crafting.java | 6 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 6 +- .../multi/GT_MetaTileEntity_EM_decay.java | 5 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 6 +- .../multi/GT_MetaTileEntity_EM_infuser.java | 6 +- .../multi/GT_MetaTileEntity_EM_junction.java | 5 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 6 +- .../multi/GT_MetaTileEntity_EM_research.java | 6 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 5 +- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 6 +- .../multi/GT_MetaTileEntity_EM_switch.java | 5 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 41 +- .../multi/GT_MetaTileEntity_EM_wormhole.java | 6 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 5 +- .../GT_MetaTileEntity_TM_proccessingStack.java | 4 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 5 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 25 +- .../metaTileEntity/multi/base/IHatchAdder.java | 8 - .../em_machine/GT_MetaTileEntity_EM_machine.java | 5 +- .../GT_MetaTileEntity_DebugStructureWriter.java | 35 +- .../java/com/github/technus/tectech/util/Util.java | 16 - .../com/github/technus/tectech/util/Vec3Impl.java | 28 +- 47 files changed, 1409 insertions(+), 676 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index eb9b97deee..df5054ab4a 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 0259aec7a7..d48c345e8e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -147,7 +147,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java index 93752cc02f..665889dc1f 100644 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -39,7 +39,7 @@ public class ConstructableLoader implements Runnable { } @Override - public String[] getDescription(int stackSize) { + public String[] getDescription(ItemStack stackSize) { return desc; } }); diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java index 5c8c902484..2a93bcc540 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -12,7 +12,6 @@ import static com.github.technus.tectech.mechanics.alignment.IAlignment.FLIPS_CO import static com.github.technus.tectech.mechanics.alignment.IAlignment.ROTATIONS_COUNT; import static java.lang.Math.abs; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.reducing; import static java.util.stream.Collectors.toMap; public enum ExtendedFacing { @@ -144,32 +143,32 @@ public enum ExtendedFacing { switch (direction){ case DOWN: a= ForgeDirection.WEST; - b= ForgeDirection.NORTH; + b= ForgeDirection.SOUTH; c= ForgeDirection.UP; break; case UP: a= ForgeDirection.EAST; - b= ForgeDirection.NORTH; + b= ForgeDirection.SOUTH; c= ForgeDirection.DOWN; break; case NORTH: a= ForgeDirection.WEST; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.SOUTH; break; case SOUTH: a= ForgeDirection.EAST; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.NORTH; break; case WEST: a= ForgeDirection.SOUTH; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.EAST; break; case EAST: a= ForgeDirection.NORTH; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.WEST; break; default:throw new RuntimeException("Is impossible..."); @@ -187,7 +186,7 @@ public enum ExtendedFacing { default:throw new RuntimeException("Even more impossible..."); } switch (rotation) { - case COUNTER_CLOCKWISE: { + case CLOCKWISE: { ForgeDirection _a=a; a =b; b =_a.getOpposite(); @@ -197,7 +196,7 @@ public enum ExtendedFacing { a=a.getOpposite(); b=b.getOpposite(); break; - case CLOCKWISE: { + case COUNTER_CLOCKWISE: { ForgeDirection _a=a; a =b.getOpposite(); b =_a; diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java index d7c3c86098..1de0381f1f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java @@ -11,6 +11,6 @@ public interface IConstructable { void construct(ItemStack stackSize, boolean hintsOnly); @SideOnly(Side.CLIENT) - String[] getStructureDescription(int stackSize); + String[] getStructureDescription(ItemStack stackSize); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java index 29769fafb8..2506342f72 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java @@ -26,5 +26,5 @@ public interface IMultiblockInfoContainer { void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide); @SideOnly(Side.CLIENT) - String[] getDescription(int stackSize); + String[] getDescription(ItemStack stackSize); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java deleted file mode 100644 index 00ffb32525..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java +++ /dev/null @@ -1,526 +0,0 @@ -package com.github.technus.tectech.mechanics.constructable; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static gregtech.api.enums.GT_Values.E; - -public class Structure { - private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); - - private Structure(){} - - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean checker( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - ExtendedFacing extendedFacing, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - if(extendedFacing==null){ - extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); - } - - IGregTechTileEntity igt; - - int[] xyz =new int[3]; - int[] abc =new int[3]; - int pointer; - int baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - abc[1] -= block; - break; - } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.') { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc,xyz); - xyz[0]+=baseX; - xyz[1]+=baseY; - xyz[2]+=baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); - } - return false; - } - } else //noinspection ConstantConditions - if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); - if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } - } - } else if (forceCheck) { - return false; - } - abc[0]++;//block in horizontal layer - } - } - abc[1]--;//horizontal layer - } - abc[2]++;//depth - } - return true; - } - - public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, - tileEntity.getWorld(),tileEntity.getXCoord(),tileEntity.getYCoord(),tileEntity.getZCoord(), - extendedFacing, hintsOnly); - } - - public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, - tileEntity.getWorldObj(),tileEntity.xCoord,tileEntity.yCoord,tileEntity.zCoord, - extendedFacing, hintsOnly); - } - - public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - World world,int baseX,int baseZ,int baseY, ExtendedFacing extendedFacing, boolean hintsOnly) { - if (world==null || (!world.isRemote && hintsOnly)) { - return false; - } - - //TE Rotation - int[] xyz =new int[3]; - int[] abc =new int[3]; - int pointer; - - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - abc[1] -= block; - break; - } - if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.')// this TE - { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc,xyz); - xyz[0]+=baseX; - xyz[1]+=baseY; - xyz[2]+=baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded - if (hintsOnly) { - switch (block) { - case '-'://must be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); - break; - case '+'://must not be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); - } - } else if ((pointer = block - ' ') >= 0) { - if (pointer >= 0 && pointer < 12) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); - } - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); - } - } - } else { - switch (block) { - case '-'://must be air - world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); - break; - case '+'://must not be air - world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); - } else if (block - ' ' < 0) { - world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15, 2); - } //else { - //switch(pointer){ - // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: - // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; - // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); - //} - //} - } - } - } - abc[0]++;//block in horizontal layer - } - } - abc[1]--;//horizontal layer - } - abc[2]++;//depth - } - return true; - } - - - public static String[] writer(IGregTechTileEntity aBaseMetaTileEntity, - int horizontalOffset, int verticalOffset, int depthOffset, - int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return new String[]{"Not at Client m8"}; - } - - ItemStack[] array = new ItemStack[10]; - - int x, y, z, a, b, c; - int - baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - #1 - count block types - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return new String[]{"Invalid position"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { - boolean err = true; - ItemStack is = new ItemStack(block, 1, meta); - for (int i = 0; i < array.length; i++) { - if (array[i] == null) { - array[i] = is; - err = false; - break; - } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { - err = false; - break; - } - } - if (err) { - return new String[]{"Too much different blocks"}; - } - } - - a++;//block in horizontal layer - } - b--;//horizontal layer - } - c++;//depth - } - - List output = new ArrayList<>(); - - output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); - output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); - output.add(""); - - output.add("ID[]: Name[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getDisplayName()); - } - } - output.add(""); - output.add("ID[]: Block[] BlockMetaID[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); - } - } - output.add(""); - output.add("String[][]"); - //perform your duties - #2 - write strings - output.add("{"); - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - StringBuilder addMe = new StringBuilder().append('{'); - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - StringBuilder line = new StringBuilder(); - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (a == 0 && b == 0 && c == 0) { - line.append('.'); - } else if (block.getMaterial() == Material.air) { - line.append('-'); - } else if (block.hasTileEntity(meta)) { - line.append('*'); - } else { - ItemStack stack = new ItemStack(block, 1, meta); - String str = "?";//OH YEAH NPEs - for (int i = 0; i < array.length; i++) { - if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { - str = Integer.toString(i); - break; - } - } - line.append(str); - } - a++;//block in horizontal layer - } - if (ignoreAir) { - StringBuilder builder = new StringBuilder(); - char temp = '@'; - for (char ch : line.toString().toCharArray()) { - if (ch == '-') { - temp += 1; - if (temp == '~') { - builder.append('~'); - temp = '@'; - } - } else { - if (temp > '@') { - builder.append(temp); - temp = '@'; - } - builder.append(ch); - } - } - while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { - builder.deleteCharAt(builder.length() - 1); - } - if (builder.length() == 0) { - builder.append("E,"); - } else { - builder.insert(0, '"'); - builder.append('"').append(','); - } - addMe.append(builder); - } else { - if (line.length() == 0) { - line.append("E,"); - } else { - line.insert(0, '"'); - line.append('"').append(','); - } - addMe.append(line); - } - b--;//horizontal layer - } - //region less verbose - addMe.append('}').append(','); - String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); - Matcher matcher = matchE_.matcher(builtStr); - while (matcher.find()) { - byte lenEE = (byte) (matcher.group(1).length() >> 1); - builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); - //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); - } - //endregion - output.add(builtStr); - c++;//depth - } - output.add("}"); - return output.toArray(new String[0]); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java new file mode 100644 index 0000000000..3dda99fed2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.mechanics.structure; + + +import net.minecraft.block.Block; + +public interface IBlockAdder { + /** + * Callback on block added + * @param block block attempted to add + * @param meta meta of block attempted to add + * @return is structure still valid + */ + boolean apply(Block block, Integer meta); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java new file mode 100644 index 0000000000..c3ea2d3e3f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java @@ -0,0 +1,7 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.world.World; + +public interface IBlockPosConsumer { + void consume(World world, int x, int y, int z); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java new file mode 100644 index 0000000000..10d4c398ec --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.mechanics.structure; + + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public interface IHatchAdder { + /** + * Callback to add hatch + * @param iGregTechTileEntity hatch + * @param aShort requested texture index, or null if not... + * @return managed to add hatch (structure still valid) + */ + boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java new file mode 100644 index 0000000000..656151dc86 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -0,0 +1,137 @@ +package com.github.technus.tectech.mechanics.structure; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import net.minecraft.world.World; + +public interface IStructureDefinition { + /** + * Used internally + * @param name same name as for other methods here + * @return the array of elements to process + */ + IStructureElementProvider[] getElementsFor(String name); + + default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean forceCheckAllBlocks){ + return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,false,forceCheckAllBlocks); + } + + default boolean hints(T object,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC) { + return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,true,null); + } + + default boolean build(T object,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC) { + return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,false,null); + } + + default boolean buildOrHints(T object,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean hintsOnly){ + return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,hintsOnly,null); + } + + static boolean iterate(T object, IStructureElementProvider[] elements, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){ + if(world.isRemote ^ hintsOnly){ + return false; + } + + //change base position to base offset + basePositionA=-basePositionA; + basePositionB=-basePositionB; + basePositionC=-basePositionC; + + int[] abc = new int[]{basePositionA,basePositionB,basePositionC}; + int[] xyz = new int[3]; + + if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){ + if(checkBlocksIfNotNullForceCheckAllIfTrue){ + for (IStructureElementProvider elementProvider : elements) { + IStructureElement element=elementProvider.getStructureElement(object); + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + return false; + } + }else { + return false; + } + + abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); + abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); + abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + } + } else { + for (IStructureElementProvider elementProvider : elements) { + IStructureElement element=elementProvider.getStructureElement(object); + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + return false; + } + } + + abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); + abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); + abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + } + } + }else { + if(hintsOnly) { + for (IStructureElementProvider elementProvider : elements) { + IStructureElement element=elementProvider.getStructureElement(object); + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + element.spawnHint(object, world, xyz[0], xyz[1], xyz[2]); + } + + abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); + abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); + abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + } + } else { + for (IStructureElementProvider elementProvider : elements) { + IStructureElement element=elementProvider.getStructureElement(object); + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + element.placeBlock(object, world, xyz[0], xyz[1], xyz[2]); + } + + abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); + abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); + abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + } + } + } + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java new file mode 100644 index 0000000000..d33eac4119 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureElement extends IStructureElementProvider { + boolean check(T t,World world,int x,int y,int z); + + default boolean spawnHint(T t,World world,int x,int y,int z){ + return false; + } + + default boolean placeBlock(T t,World world,int x,int y,int z){ + return false; + } + + default int getStepA(){ + return 1; + } + + default int getStepB(){ + return 0; + } + + default int getStepC(){ + return 0; + } + + default boolean resetA(){ + return false; + } + + default boolean resetB(){ + return false; + } + + default boolean resetC(){ + return false; + } + + @Override + default IStructureElement getStructureElement(T object){ + return this; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java new file mode 100644 index 0000000000..b38c2164c3 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java @@ -0,0 +1,5 @@ +package com.github.technus.tectech.mechanics.structure; + +public interface IStructureElementProvider { + IStructureElement getStructureElement(T object); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java new file mode 100644 index 0000000000..354aaf60e9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java @@ -0,0 +1,40 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureFallback extends IStructureElement { + IStructureElement[] fallbacks(); + + @Override + default boolean check(T t, World world, int x, int y, int z){ + for (IStructureElement fallback : fallbacks()) { + if (fallback.check(t, world, x, y, z)) { + return true; + } + } + return false; + } + + @Override + default boolean spawnHint(T t, World world, int x, int y, int z) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.spawnHint(t, world, x, y, z)) { + return true; + } + } + return false; + } + + @Override + default boolean placeBlock(T t, World world, int x, int y, int z) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.placeBlock(t, world, x, y, z)) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java new file mode 100644 index 0000000000..c0c24eaec4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java @@ -0,0 +1,40 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureFallbackProvider extends IStructureElement { + IStructureElementProvider[] fallbacks(); + + @Override + default boolean check(T t,World world, int x, int y, int z){ + for (IStructureElementProvider fallback : fallbacks()) { + if (fallback.getStructureElement(t).check(t, world, x, y, z)) { + return true; + } + } + return false; + } + + @Override + default boolean spawnHint(T t,World world, int x, int y, int z) { + for (IStructureElementProvider fallback : fallbacks()) { + if (fallback.getStructureElement(t).spawnHint(t, world, x, y, z)) { + return true; + } + } + return false; + } + + @Override + default boolean placeBlock(T t,World world, int x, int y, int z) { + for (IStructureElementProvider fallback : fallbacks()) { + if (fallback.getStructureElement(t).placeBlock(t, world, x, y, z)) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java new file mode 100644 index 0000000000..bba3dc5239 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -0,0 +1,23 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureNavigate extends IStructureElement { + @Override + default boolean check(T t, World world, int x, int y, int z){ + return true; + } + + @Override + default boolean spawnHint(T t, World world, int x, int y, int z) { + return true; + } + + @Override + default boolean placeBlock(T t, World world, int x, int y, int z) { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java new file mode 100644 index 0000000000..9d983e1c4d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.tileentity.TileEntity; + +public interface ITileAdder { + /** + * Callback to add hatch + * @param tileEntity tile + * @return managed to add hatch (structure still valid) + */ + boolean apply(TileEntity tileEntity); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java new file mode 100644 index 0000000000..77c47ad19e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -0,0 +1,265 @@ +package com.github.technus.tectech.mechanics.structure; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.regex.Pattern; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; + +@Deprecated +public class Structure { + private static final Pattern MATCH_E = Pattern.compile("(E,(E,)+)"); + + private Structure(){} + + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller + //This only checks for REGULAR BLOCKS! + public static boolean checker( + String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + IHatchAdder[] addingMethods, + short[] casingTextures, + Block[] blockTypeFallback,//use numbers 0-9 for casing types + byte[] blockMetaFallback,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity aBaseMetaTileEntity, + ExtendedFacing extendedFacing, + boolean forceCheck) { + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return false; + } + //TE Rotation + if (extendedFacing == null) { + extendedFacing = ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); + } + + IGregTechTileEntity igt; + + int[] xyz = new int[3]; + int[] abc = new int[3]; + int pointer; + int baseX = aBaseMetaTileEntity.getXCoord(), + baseZ = aBaseMetaTileEntity.getZCoord(), + baseY = aBaseMetaTileEntity.getYCoord(); + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + //yPos - absolute height of checked block + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = -verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') { + //Control chars allow skipping + abc[1] += block; + break; + } else if (block > '@') { + //characters allow to skip check A-1 skip, B-2 skips etc. + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.') { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += baseX; + xyz[1] += baseY; + xyz[2] += baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos + switch (block) { + case '-'://must be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { + return false; + } + break; + case '+'://must not be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { + return false; + } + break; + default://check for block (countable) + if ((pointer = block - '0') >= 0) { + //countable air -> net.minecraft.block.BlockAir + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); + } + return false; + } + } else if ((pointer = block - ' ') >= 0) { + igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); + if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); + } + return false; + } + } + } + } + } else if (forceCheck) { + return false; + } + abc[0]++;//block in horizontal layer + } + } + abc[1]++;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, + tileEntity.getWorld(), tileEntity.getXCoord(), tileEntity.getYCoord(), tileEntity.getZCoord(), + extendedFacing, hintsOnly); + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + TileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, + tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, + extendedFacing, hintsOnly); + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + World world, int baseX, int baseY, int baseZ, ExtendedFacing extendedFacing, boolean hintsOnly) { + if (world == null || (!world.isRemote && hintsOnly)) { + return false; + } + + //TE Rotation + int[] xyz = new int[3]; + int[] abc = new int[3]; + int pointer; + + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = -verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] += block; + break; + } + if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. + { + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.')// this TE + { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += baseX; + xyz[1] += baseY; + xyz[2] += baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded + if (hintsOnly) { + switch (block) { + case '-'://must be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); + break; + case '+'://must not be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); + } + } else if ((pointer = block - ' ') >= 0) { + if (pointer < 12) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); + } + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); + } + } + } else { + switch (block) { + case '-'://must be air + world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); + break; + case '+'://must not be air + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); + } + } + } + } + abc[0]++;//block in horizontal layer + } + } + abc[1]++;//horizontal layer + } + abc[2]++;//depth + } + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java new file mode 100644 index 0000000000..52386d8373 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -0,0 +1,170 @@ +package com.github.technus.tectech.mechanics.structure; + +import java.util.*; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; + +public class StructureDefinition implements IStructureDefinition { + private final Map> elements; + private final Map shapes; + private final Map[]> compiled; + + public static Builder builder() { + return new Builder<>(); + } + + private StructureDefinition( + Map> elements, + Map shapes, + Map[]> compiled) { + this.elements =elements; + this.shapes=shapes; + this.compiled =compiled; + } + + public static class Builder { + private static final char A='\uA000'; + private static final char B='\uB000'; + private static final char C='\uC000'; + private static final char D='\uD000'; + private final Map> elements; + private final Map shapes; + + private Builder() { + elements = new HashMap<>(); + shapes = new HashMap<>(); + } + + public Map> getElements() { + return elements; + } + + public Map getShapes() { + return shapes; + } + + /** + * Adds shape + * +- is air/no air checks + * space bar is skip + * . is also skip (but marks controller position, optional and logically it is a space...) + * rest needs to be defined + * + * next char is next block(a) + * next string is next line(a,b) + * next string[] is next slice(a,b,c) + * + * char A000-FFFF range is reserved for generated skips + * @param name unlocalized/code name + * @param structurePiece generated or written struct - DO NOT STORE IT ANYWHERE, or at least set them to null afterwards + * @return this builder + */ + public Builder addShape(String name, String[][] structurePiece) { + StringBuilder builder = new StringBuilder(); + if (structurePiece.length > 0) { + for (String[] strings : structurePiece) { + if (strings.length > 0) { + for (String string : strings) { + builder.append(string).append(B); + } + builder.setLength(builder.length() - 1); + } + builder.append(C); + } + builder.setLength(builder.length() - 1); + } + int a=0,b=0,c=0; + char d=D; + for (int i = 0; i < builder.length(); i++) { + char ch = builder.charAt(i); + if(ch ==' ' || ch =='.'){ + builder.setCharAt(i,A); + } + if(ch==A){ + a++; + }else if(ch==B){ + a=0; + b++; + }else if(ch==C){ + a=0; + b=0; + c++; + }else if(a!=0 || b!=0 || c!=0){ + builder.setCharAt(i-1,d); + addElement(d,step(a,b,c)); + a=0; + b=0; + c=0; + d++; + } + } + + String built = builder.toString().replaceAll("[\\uA000\\uB000\\uC000]",""); + + if(built.contains("+")){ + addElement('+',notAir()); + } + if (built.contains("-")) { + addElement('-', isAir()); + } + shapes.put(name, built); + return this; + } + + public Builder addElement(Character name, IStructureElementProvider structurePiece) { + elements.put(name, structurePiece); + return this; + } + + public IStructureDefinition build() { + if(DEBUG_MODE){ + return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), compileMap()); + }else { + return compileMap()::get; + } + } + + @SuppressWarnings("unchecked") + private Map[]> compileMap() { + List mising = new ArrayList<>(); + shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { + IStructureElementProvider iStructureElement = elements.get((char) c); + if (iStructureElement == null) { + mising.add(c); + } + })); + if (mising.isEmpty()) { + Map[]> map = new HashMap<>(); + shapes.forEach((key, value) -> { + IStructureElementProvider[] compiled = new IStructureElementProvider[value.length()]; + for (char i = 0; i < compiled.length; i++) { + compiled[i] = this.elements.get(i); + } + map.put(key, compiled); + }); + return map; + } else { + throw new RuntimeException("Missing Structure Element bindings for (chars as integers): " + + Arrays.toString(mising.toArray())); + } + } + } + + public Map> getElements(){ + return elements; + } + + public Map getShapes() { + return shapes; + } + + public Map[]> getCompiled() { + return compiled; + } + + @Override + public IStructureElementProvider[] getElementsFor(String name) { + return compiled.get(name); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java new file mode 100644 index 0000000000..69f5a6e43c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -0,0 +1,473 @@ +package com.github.technus.tectech.mechanics.structure; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.util.Vec3Impl; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.*; + +public class StructureUtility { + private static final String NICE_CHARS ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_=|[]{};:'<>,./?"; + @SuppressWarnings("rawtypes") + private static final Map STEP = new HashMap<>(); + @SuppressWarnings("rawtypes") + private static final IStructureElement AIR= (t, world, x, y, z) -> world.getBlock(x, y, z).getMaterial() == Material.air; + @SuppressWarnings("rawtypes") + private static final IStructureElement NOT_AIR= (t, world, x, y, z) -> world.getBlock(x, y, z).getMaterial() != Material.air; + + private StructureUtility(){ + + } + + @SuppressWarnings("unchecked") + public static IStructureElement isAir(){ + return AIR; + } + + @SuppressWarnings("unchecked") + public static IStructureElement notAir(){ + return NOT_AIR; + } + + /** + * Does not allow Block duplicates (with different meta) + */ + public static IStructureElement ofBlocksFlat(Map blocsMap,Block hintBlock,int hintMeta){ + if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return blocsMap.getOrDefault(world.getBlock(x, y, z), -1) == world.getBlockMetadata(x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + world.setBlock(x,y,z,hintBlock,hintMeta,2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + /** + * Allows block duplicates (with different meta) + */ + public static IStructureElement ofBlocks(Map> blocsMap,Block hintBlock,int hintMeta){ + if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + throw new IllegalArgumentException(); + } + for (Set value : blocsMap.values()) { + if(value.isEmpty()){ + throw new IllegalArgumentException(); + } + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return blocsMap.getOrDefault(world.getBlock(x, y, z), Collections.emptySet()).contains(world.getBlockMetadata(x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + world.setBlock(x,y,z,hintBlock,hintMeta,2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + public static IStructureElement ofBlock(Block block, int meta,Block hintBlock,int hintMeta){ + if(block==null || hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return block == world.getBlock(x, y, z) && meta == world.getBlockMetadata(x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + world.setBlock(x,y,z,hintBlock,hintMeta,2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + public static IStructureElement ofBlock(Block block, int meta){ + return ofBlock(block, meta,block,meta); + } + + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,Block hintBlock,int hintMeta){ + if(iBlockAdder==null ||hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return iBlockAdder.apply(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + world.setBlock(x,y,z,hintBlock,hintMeta,2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + public static IStructureElement ofTileAdder(ITileAdder iTileAdder,Block hintBlock,int hintMeta){ + if(iTileAdder==null ||hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(tileEntity); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex,Block hintBlock,int hintMeta){ + if(iHatchAdder==null ||hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply((IGregTechTileEntity) tileEntity, textureIndex); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + @SuppressWarnings("unchecked") + public static IStructureNavigate step(Vec3Impl step){ + if(step==null || step.get0()<0 || step.get1()<0 || step.get2()<0){ + throw new IllegalArgumentException(); + } + return STEP.computeIfAbsent(step, vec3 -> { + if(vec3.get2()>0){ + return stepC(vec3.get0(), vec3.get1(), vec3.get2()); + }else if(vec3.get1()>0){ + return stepB(vec3.get0(), vec3.get1(), vec3.get2()); + }else { + return stepA(vec3.get0(), vec3.get1(), vec3.get2()); + } + }); + } + + public static IStructureNavigate step(int a,int b, int c){ + return step(new Vec3Impl(a,b,c)); + } + + private static IStructureNavigate stepA(int a,int b, int c){ + return new IStructureNavigate() { + @Override + public int getStepA() { + return a; + } + + @Override + public int getStepB() { + return b; + } + + @Override + public int getStepC() { + return c; + } + }; + } + + private static IStructureNavigate stepB(int a,int b, int c){ + return new IStructureNavigate() { + @Override + public int getStepA() { + return a; + } + + @Override + public int getStepB() { + return b; + } + + @Override + public int getStepC() { + return c; + } + + @Override + public boolean resetA() { + return true; + } + }; + } + + private static IStructureNavigate stepC(int a,int b, int c){ + return new IStructureNavigate() { + @Override + public int getStepA() { + return a; + } + + @Override + public int getStepB() { + return b; + } + + @Override + public int getStepC() { + return c; + } + + @Override + public boolean resetA() { + return true; + } + + @Override + public boolean resetB() { + return true; + } + }; + } + + public static IStructureFallback ofElementChain(IStructureElement... elementChain){ + if(elementChain==null || elementChain.length==0){ + throw new IllegalArgumentException(); + } + for (IStructureElementProvider iStructureElement : elementChain) { + if(iStructureElement==null){ + throw new IllegalArgumentException(); + } + } + return () -> elementChain; + } + + public static IStructureFallbackProvider ofProviderChain(IStructureElementProvider... elementChain){ + if(elementChain==null || elementChain.length==0){ + throw new IllegalArgumentException(); + } + for (IStructureElementProvider iStructureElement : elementChain) { + if(iStructureElement==null){ + throw new IllegalArgumentException(); + } + } + return () -> elementChain; + } + + /** + * Use only to get pseudo code... + * @param world + * @return + */ + public static String getPseudoJavaCode(World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + int sizeA,int sizeB, int sizeC) { + Map> blocks = new TreeMap<>(Comparator.comparing(Block::getUnlocalizedName)); + Set> tiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); + Set> gtTiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); + iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC, + sizeA, sizeB, sizeC, ((w, x, y, z) -> { + TileEntity tileEntity = w.getTileEntity(x, y, z); + if (tileEntity == null) { + Block block = w.getBlock(x, y, z); + if (block != null && block != Blocks.air) { + blocks.compute(block, (b, set) -> { + if (set == null) { + set = new TreeSet<>(); + } + set.add(world.getBlockMetadata(x, y, z)); + return set; + }); + } + } else { + if (tileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (meta != null) { + gtTiles.add(meta.getClass()); + } else { + tiles.add(tileEntity.getClass()); + } + } else { + tiles.add(tileEntity.getClass()); + } + } + })); + Map map = new HashMap<>(); + StringBuilder builder = new StringBuilder(); + { + int i = 0; + char c; + builder.append("\n\nStructure:\n") + .append("\nBlocks:\n"); + for (Map.Entry> entry : blocks.entrySet()) { + Block block = entry.getKey(); + Set set = entry.getValue(); + for (Integer meta : set) { + c = NICE_CHARS.charAt(i++); + if(i>NICE_CHARS.length()){ + return "Too complicated for nice chars"; + } + map.put(block.getUnlocalizedName() + '\0' + meta, c); + builder.append(c).append(" -> ofBlock...(") + .append(block.getUnlocalizedName()).append(", ").append(meta).append(", ...);\n"); + } + } + builder.append("\nTiles:\n"); + for (Class tile : tiles) { + c = NICE_CHARS.charAt(i++); + if(i>NICE_CHARS.length()){ + return "Too complicated for nice chars"; + } + map.put(tile.getCanonicalName(), c); + builder.append(c).append(" -> ofTileAdder(") + .append(tile.getCanonicalName()).append(", ...);\n"); + } + builder.append("\nMeta:\n"); + for (Class gtTile : gtTiles) { + c = NICE_CHARS.charAt(i++); + if(i>NICE_CHARS.length()){ + return "Too complicated for nice chars"; + } + map.put(gtTile.getCanonicalName(), c); + builder.append(c).append(" -> ofHatchAdder(") + .append(gtTile.getCanonicalName()).append(", textureId, ...);\n"); + } + } + builder.append("\nOffsets:\n") + .append(basePositionA).append(' ').append(basePositionB).append(' ').append(basePositionC).append('\n'); + builder.append("\nScan:\n") + .append("new String[][]{{\n") + .append(" \""); + + iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC, + sizeA, sizeB, sizeC, ((w, x, y, z) -> { + TileEntity tileEntity = w.getTileEntity(x, y, z); + if (tileEntity == null) { + Block block = w.getBlock(x, y, z); + if (block != null && block != Blocks.air) { + builder.append(map.get(block.getUnlocalizedName() + '\0' + world.getBlockMetadata(x, y, z))); + }else { + builder.append(' '); + } + } else { + if (tileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (meta != null) { + builder.append(map.get(meta.getClass().getCanonicalName())); + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } + } + }), + () -> builder.append("\",\n").append(" \""), + () -> { + builder.setLength(builder.length()-7); + builder.append("\n").append("},{\n").append(" \""); + }); + builder.setLength(builder.length()-8); + builder.append("};\n\n"); + return(builder.toString().replaceAll("\"\"","E")); + } + + public static void iterate(World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + int sizeA,int sizeB, int sizeC, + IBlockPosConsumer iBlockPosConsumer){ + sizeA-=basePositionA; + sizeB-=basePositionB; + sizeC-=basePositionC; + + int[] abc = new int[3]; + int[] xyz = new int[3]; + + for (abc[2]=-basePositionC ; abc[2] < sizeC; abc[2]++) { + for (abc[1]=-basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[0]=-basePositionA ; abc[0] < sizeA; abc[0]++) { + extendedFacing.getWorldOffset(abc, xyz); + iBlockPosConsumer.consume(world, xyz[0]+basePositionX,xyz[1]+basePositionY,xyz[2]+basePositionZ); + } + + } + } + } + + public static void iterate(World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + int sizeA, int sizeB, int sizeC, + IBlockPosConsumer iBlockPosConsumer, + Runnable nextB, + Runnable nextC){ + sizeA-=basePositionA; + sizeB-=basePositionB; + sizeC-=basePositionC; + + int[] abc = new int[3]; + int[] xyz = new int[3]; + + for (abc[2]=-basePositionC ; abc[2] < sizeC; abc[2]++) { + for (abc[1]=-basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[0]=-basePositionA ; abc[0] < sizeA; abc[0]++) { + extendedFacing.getWorldOffset(abc, xyz); + iBlockPosConsumer.consume(world, xyz[0]+basePositionX,xyz[1]+basePositionY,xyz[2]+basePositionZ); + } + nextB.run(); + } + nextC.run(); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 7b7d1983fa..4160ae2aba 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -1,15 +1,14 @@ package com.github.technus.tectech.thing.item; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.IAlignment; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; @@ -82,7 +81,7 @@ public final class ConstructableTriggerItem extends Item { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE instanceof IConstructable) { ((IConstructable) metaTE).construct(aStack, true); - TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); + TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack)); return false; } else if(MULTIBLOCK_MAP.containsKey(metaTE.getClass().getCanonicalName())){ IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()); @@ -93,12 +92,12 @@ public final class ConstructableTriggerItem extends Item { iMultiblockInfoContainer.construct(aStack, true, tTileEntity, ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); } - TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()).getDescription(aStack)); return false; } } else if(tTileEntity instanceof IConstructable){ ((IConstructable) tTileEntity).construct(aStack,true); - TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); + TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack)); return false; } else if(MULTIBLOCK_MAP.containsKey(tTileEntity.getClass().getCanonicalName())){ IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()); @@ -109,7 +108,7 @@ public final class ConstructableTriggerItem extends Item { iMultiblockInfoContainer.construct(aStack, true, tTileEntity, ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); } - TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack)); return false; } //} else { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 4333d4c8c9..4151dbfec0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -108,7 +108,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index c5aaa1d66f..d90f4af8d2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -306,7 +306,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index fe676910ee..490ca2084b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; @@ -689,7 +690,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file 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 433b8b4950..e70cc10926 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; @@ -350,7 +351,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 7a71f36d3b..a9e5b2f8a1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -110,7 +110,7 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 647bbf4a3b..d5c9162d1d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; @@ -10,7 +10,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -175,7 +175,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index be28a3d0c8..3b17dfa9b9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; @@ -248,7 +249,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index fed03d1845..5dfa38294b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -153,7 +153,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index aed3025d4f..1fff071e9c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; @@ -9,7 +9,7 @@ import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -187,7 +187,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 8a76ee6ff1..199bb8ee6f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; @@ -174,7 +175,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file 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 6315a2f295..ab86c0494f 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 @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; @@ -14,7 +14,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -202,7 +202,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 2a739cb6c7..c6f9c810a8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; @@ -557,7 +557,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } 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 48479b9d71..896d0f41bc 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; @@ -518,7 +519,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index ece01f7489..140383caac 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -74,7 +74,7 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 39f9441cb7..7398889c89 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; @@ -221,7 +222,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index c2e759e96c..4e2f916f2f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -1,26 +1,27 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHatchAdder; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -32,21 +33,25 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {" ", " 0 ", " ",}, - {" ", " ", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasings1}; - private static final byte[] blockMeta = new byte[]{15}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addEnergyIOToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.transformer.hint"),//1 - Energy IO Hatches or High Power Casing }; + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main",new String[][]{ + {"111", "1.1", "111",}, + {"111", "101", "111",}, + {"111", "111", "111",}, + }) + .addElement('0', ofBlock(sBlockCasings1,15)) + .addElement('1', trafo->ofHatchAdder(trafo::addEnergyIOToMachineList,textureOffset,sBlockCasingsTT,0)) + .build(); + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } //endregion public GT_MetaTileEntity_EM_transformer(int aID, String aName, String aNameRegional) { @@ -78,7 +83,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -150,11 +155,11 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 2b2ebdd1a4..f909d000c7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -109,7 +109,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 9c40d6ebc9..ba926f1ace 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.constructable.IConstructable; @@ -250,7 +251,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 678f211744..47f36014ac 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -126,7 +126,7 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 327b54e561..a4a234f9b4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; @@ -827,7 +828,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file 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 2f23aae431..7735678f72 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 @@ -6,7 +6,9 @@ import com.github.technus.tectech.mechanics.alignment.*; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.util.Vec3Impl; import com.github.technus.tectech.loader.NetworkDispatcher; @@ -191,6 +193,27 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt toolSetDirection(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing())); } + /** + * Gets structure + * @return STATIC INSTANCE OF STRUCTURE + */ + public IStructureDefinition getStructure_EM(){ + throw new NoSuchMethodError("Implement it as STATIC INSTANCE"); + } + + @SuppressWarnings("unchecked") + private IStructureDefinition getStructure_EM_Internal(){ + return (IStructureDefinition)getStructure_EM(); + } + + public final boolean structureCheck_EM(String piece,int horizontalOffset, int verticalOffset, int depthOffset) { + IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); + return getStructure_EM_Internal().check(this,piece, baseMetaTileEntity.getWorld(),getExtendedFacing(), + baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord(), + horizontalOffset,verticalOffset,depthOffset,!mMachine); + } + + @Deprecated public final boolean structureCheck_EM( String[][] structure,//0-9 casing, +- air no air, a-z ignore Block[] blockType,//use numbers 0-9 for casing types diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java deleted file mode 100644 index b695472012..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.base; - - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -public interface IHatchAdder { - Boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort); -} 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 f6f3ec9a63..722580a221 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.constructable.Structure; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; @@ -354,7 +355,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } \ No newline at end of file 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 194d357b1c..42f25ddfde 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 @@ -1,11 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.mechanics.constructable.Structure; -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.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.structure.StructureUtility; 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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,6 +21,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -105,21 +107,22 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isAllowedToWork()) { - result = Structure.writer(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); - for (String s : result) { - TecTech.LOGGER.info(s); - } - aBaseMetaTileEntity.disableWorking(); - } + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick(aBaseMetaTileEntity); + aBaseMetaTileEntity.disableWorking(); } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - result = Structure.writer(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); - for (String s : result) { - TecTech.LOGGER.info(s); + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isAllowedToWork()) { + String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), + ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), + aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), + numbers[0], numbers[1], numbers[2], + numbers[3], numbers[4], numbers[5]); + TecTech.LOGGER.info(pseudoJavaCode); + result = pseudoJavaCode.split("\\n"); + aBaseMetaTileEntity.disableWorking(); } } @@ -129,8 +132,6 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti return true; } aBaseMetaTileEntity.openGUI(aPlayer); - //if (TecTechConfig.DEBUG_MODE && aPlayer.getHeldItem() != null) - // TecTech.LOGGER.info("UnlocalizedName: " + getUniqueIdentifier(aPlayer.getHeldItem())); return true; } diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java index b81506d27c..1843770e3a 100644 --- a/src/main/java/com/github/technus/tectech/util/Util.java +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -1,22 +1,14 @@ package com.github.technus.tectech.util; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; 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.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; @@ -25,14 +17,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; 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.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.StringUtils; @@ -42,12 +32,6 @@ import java.io.FileOutputStream; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static gregtech.api.enums.GT_Values.E; -import static java.nio.charset.Charset.forName; /** * Created by Tec on 21.03.2017. diff --git a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java index 84e6497560..9ba96d741a 100644 --- a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java +++ b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java @@ -20,20 +20,6 @@ public class Vec3Impl implements Comparable { this(baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord()); } - public boolean equals(Object o) { - if (this == o) { - return true; - } else if (o instanceof Vec3Impl) { - Vec3Impl vec3i = (Vec3Impl)o; - return val0 == vec3i.val0 && val1 == vec3i.val1 && val2 == vec3i.val2; - } - return false; - } - - public int hashCode() { - return (val1 + val2 * 31) * 31 + val0; - } - public int compareTo(Vec3Impl o) { return val1 == o.val1 ? val2 == o.val2 ? val0 - o.val0 : val2 - o.val2 : val1 - o.val1; } @@ -143,4 +129,18 @@ public class Vec3Impl implements Comparable { public Vec3Impl abs() { return new Vec3Impl(Math.abs(val0),Math.abs(val1),Math.abs(val2)); } + + public boolean equals(Object o) { + if (this == o) { + return true; + } else if (o instanceof Vec3Impl) { + Vec3Impl vec3i = (Vec3Impl)o; + return val0 == vec3i.val0 && val1 == vec3i.val1 && val2 == vec3i.val2; + } + return false; + } + + public int hashCode() { + return (val1 + val2 * 31) * 31 + val0; + } } \ No newline at end of file -- cgit From 7ddc00ec1d41bb22218e16e66a306336cff4a761 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 25 Apr 2020 23:54:10 +0200 Subject: Finish example implementation on transformer --- .../metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java | 2 +- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 4e2f916f2f..6d83b80d9a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -155,7 +155,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, hintsOnly); } @Override 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 7735678f72..cf78a18a74 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 @@ -213,6 +213,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt horizontalOffset,verticalOffset,depthOffset,!mMachine); } + public final boolean structureBuild_EM(String piece,int horizontalOffset, int verticalOffset, int depthOffset,boolean hintsOnly) { + IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); + return getStructure_EM_Internal().buildOrHints(this,piece, baseMetaTileEntity.getWorld(),getExtendedFacing(), + baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord(), + horizontalOffset,verticalOffset,depthOffset,hintsOnly); + } + @Deprecated public final boolean structureCheck_EM( String[][] structure,//0-9 casing, +- air no air, a-z ignore -- cgit From a66cc45857e9a414f7d2d8c4257871212007596b Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 00:12:00 +0200 Subject: Fix compilation issues --- .../technus/tectech/mechanics/structure/StructureDefinition.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index 52386d8373..79176c3f25 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -80,6 +80,7 @@ public class StructureDefinition implements IStructureDefinition { char ch = builder.charAt(i); if(ch ==' ' || ch =='.'){ builder.setCharAt(i,A); + ch=A; } if(ch==A){ a++; @@ -138,8 +139,8 @@ public class StructureDefinition implements IStructureDefinition { Map[]> map = new HashMap<>(); shapes.forEach((key, value) -> { IStructureElementProvider[] compiled = new IStructureElementProvider[value.length()]; - for (char i = 0; i < compiled.length; i++) { - compiled[i] = this.elements.get(i); + for (int i = 0; i < value.length(); i++) { + compiled[i] = elements.get(value.charAt(i)); } map.put(key, compiled); }); -- cgit From 5ab4d194f5e46ab71b07eac45b3980b80411864a Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 00:29:14 +0200 Subject: Add hint blocks and fallbacks --- .../mechanics/structure/StructureUtility.java | 48 +++++++++++++++++++++- .../multi/GT_MetaTileEntity_EM_transformer.java | 9 ++-- 2 files changed, 52 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 69f5a6e43c..fe7a0d7510 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -13,14 +13,51 @@ import net.minecraft.world.World; import java.util.*; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; + public class StructureUtility { private static final String NICE_CHARS ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_=|[]{};:'<>,./?"; @SuppressWarnings("rawtypes") private static final Map STEP = new HashMap<>(); @SuppressWarnings("rawtypes") - private static final IStructureElement AIR= (t, world, x, y, z) -> world.getBlock(x, y, z).getMaterial() == Material.air; + private static final IStructureElement AIR= new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial() == Material.air; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,13); + return true; + } + }; + @SuppressWarnings("rawtypes") + private static final IStructureElement NOT_AIR= new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial() != Material.air; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,14); + return true; + } + }; @SuppressWarnings("rawtypes") - private static final IStructureElement NOT_AIR= (t, world, x, y, z) -> world.getBlock(x, y, z).getMaterial() != Material.air; + private static final IStructureElement ERROR= new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return false; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,15); + return true; + } + }; private StructureUtility(){ @@ -36,6 +73,11 @@ public class StructureUtility { return NOT_AIR; } + @SuppressWarnings("unchecked") + public static IStructureElement error(){ + return ERROR; + } + /** * Does not allow Block duplicates (with different meta) */ @@ -277,6 +319,7 @@ public class StructureUtility { }; } + @SafeVarargs public static IStructureFallback ofElementChain(IStructureElement... elementChain){ if(elementChain==null || elementChain.length==0){ throw new IllegalArgumentException(); @@ -289,6 +332,7 @@ public class StructureUtility { return () -> elementChain; } + @SafeVarargs public static IStructureFallbackProvider ofProviderChain(IStructureElementProvider... elementChain){ if(elementChain==null || elementChain.length==0){ throw new IllegalArgumentException(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 6d83b80d9a..62c2b981a1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -20,11 +20,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHatchAdder; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static gregtech.api.GregTech_API.sBlockCasings1; import static net.minecraft.util.StatCollector.translateToLocal; @@ -45,7 +45,10 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo {"111", "111", "111",}, }) .addElement('0', ofBlock(sBlockCasings1,15)) - .addElement('1', trafo->ofHatchAdder(trafo::addEnergyIOToMachineList,textureOffset,sBlockCasingsTT,0)) + .addElement('1', ofProviderChain( + trafo->ofHatchAdder(trafo::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), + ofBlock(sBlockCasingsTT,0) + )) .build(); @Override -- cgit From f740e2e7665c3a2aecca1ca912755353e875ad4c Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 00:30:34 +0200 Subject: Add hint only helpers for blocks --- .../mechanics/structure/StructureUtility.java | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index fe7a0d7510..6feb07196d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -76,6 +76,73 @@ public class StructureUtility { @SuppressWarnings("unchecked") public static IStructureElement error(){ return ERROR; + } /** + * Does not allow Block duplicates (with different meta) + */ + public static IStructureElement ofHintFlat(Map blocsMap,Block hintBlock,int hintMeta){ + if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return blocsMap.getOrDefault(world.getBlock(x, y, z), -1) == world.getBlockMetadata(x, y, z); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + /** + * Allows block duplicates (with different meta) + */ + public static IStructureElement ofHint(Map> blocsMap,Block hintBlock,int hintMeta){ + if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + throw new IllegalArgumentException(); + } + for (Set value : blocsMap.values()) { + if(value.isEmpty()){ + throw new IllegalArgumentException(); + } + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return blocsMap.getOrDefault(world.getBlock(x, y, z), Collections.emptySet()).contains(world.getBlockMetadata(x, y, z)); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + public static IStructureElement ofHint(Block block, int meta,Block hintBlock,int hintMeta){ + if(block==null || hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return block == world.getBlock(x, y, z) && meta == world.getBlockMetadata(x, y, z); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + + public static IStructureElement ofHint(Block block, int meta){ + return ofHint(block, meta,block,meta); } /** -- cgit From 5314ad9da0ea1e776c1576ae13a6bb9ba5d5c019 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 06:32:52 +0200 Subject: Drop element provider by reworking T into calls properly --- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 2 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../tectech/mechanics/structure/IBlockAdder.java | 4 +-- .../tectech/mechanics/structure/IHatchAdder.java | 4 +-- .../mechanics/structure/IStructureDefinition.java | 16 ++++----- .../mechanics/structure/IStructureElement.java | 7 +--- .../structure/IStructureElementProvider.java | 5 --- .../structure/IStructureFallbackProvider.java | 40 ---------------------- .../tectech/mechanics/structure/ITileAdder.java | 4 +-- .../tectech/mechanics/structure/Structure.java | 1 + .../mechanics/structure/StructureDefinition.java | 28 +++++++-------- .../mechanics/structure/StructureUtility.java | 27 ++++----------- .../multi/GT_MetaTileEntity_EM_annihilation.java | 2 +- .../multi/GT_MetaTileEntity_EM_bhg.java | 2 +- .../multi/GT_MetaTileEntity_EM_collider.java | 2 +- .../multi/GT_MetaTileEntity_EM_computer.java | 2 +- .../multi/GT_MetaTileEntity_EM_crafting.java | 2 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 2 +- .../multi/GT_MetaTileEntity_EM_decay.java | 2 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_infuser.java | 2 +- .../multi/GT_MetaTileEntity_EM_junction.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_research.java | 2 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 2 +- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_switch.java | 2 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 4 +-- .../multi/GT_MetaTileEntity_EM_wormhole.java | 2 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 2 +- .../GT_MetaTileEntity_TM_proccessingStack.java | 2 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 2 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 1 - .../metaTileEntity/multi/base/IHatchAdder.java | 15 ++++++++ .../em_machine/GT_MetaTileEntity_EM_machine.java | 2 +- 35 files changed, 74 insertions(+), 126 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index df5054ab4a..0ab4893000 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index d48c345e8e..c2ae9f3fdb 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java index 3dda99fed2..85d6f1be3f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java @@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.block.Block; -public interface IBlockAdder { +public interface IBlockAdder { /** * Callback on block added * @param block block attempted to add * @param meta meta of block attempted to add * @return is structure still valid */ - boolean apply(Block block, Integer meta); + boolean apply(T t,Block block, Integer meta); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java index 10d4c398ec..6e5aca5be3 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java @@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -public interface IHatchAdder { +public interface IHatchAdder { /** * Callback to add hatch * @param iGregTechTileEntity hatch * @param aShort requested texture index, or null if not... * @return managed to add hatch (structure still valid) */ - boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort); + boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index 656151dc86..1152713d5e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -9,7 +9,7 @@ public interface IStructureDefinition { * @param name same name as for other methods here * @return the array of elements to process */ - IStructureElementProvider[] getElementsFor(String name); + IStructureElement[] getElementsFor(String name); default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, @@ -41,7 +41,7 @@ public interface IStructureDefinition { basePositionA, basePositionB, basePositionC,hintsOnly,null); } - static boolean iterate(T object, IStructureElementProvider[] elements, World world, ExtendedFacing extendedFacing, + static boolean iterate(T object, IStructureElement[] elements, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){ @@ -59,8 +59,7 @@ public interface IStructureDefinition { if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){ if(checkBlocksIfNotNullForceCheckAllIfTrue){ - for (IStructureElementProvider elementProvider : elements) { - IStructureElement element=elementProvider.getStructureElement(object); + for (IStructureElement element : elements) { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; xyz[1] += basePositionY; @@ -79,8 +78,7 @@ public interface IStructureDefinition { abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); } } else { - for (IStructureElementProvider elementProvider : elements) { - IStructureElement element=elementProvider.getStructureElement(object); + for (IStructureElement element : elements) { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; xyz[1] += basePositionY; @@ -99,8 +97,7 @@ public interface IStructureDefinition { } }else { if(hintsOnly) { - for (IStructureElementProvider elementProvider : elements) { - IStructureElement element=elementProvider.getStructureElement(object); + for (IStructureElement element : elements) { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; xyz[1] += basePositionY; @@ -115,8 +112,7 @@ public interface IStructureDefinition { abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); } } else { - for (IStructureElementProvider elementProvider : elements) { - IStructureElement element=elementProvider.getStructureElement(object); + for (IStructureElement element : elements) { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; xyz[1] += basePositionY; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index d33eac4119..78997648ab 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -5,7 +5,7 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -public interface IStructureElement extends IStructureElementProvider { +public interface IStructureElement { boolean check(T t,World world,int x,int y,int z); default boolean spawnHint(T t,World world,int x,int y,int z){ @@ -39,9 +39,4 @@ public interface IStructureElement extends IStructureElementProvider { default boolean resetC(){ return false; } - - @Override - default IStructureElement getStructureElement(T object){ - return this; - } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java deleted file mode 100644 index b38c2164c3..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementProvider.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -public interface IStructureElementProvider { - IStructureElement getStructureElement(T object); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java deleted file mode 100644 index c0c24eaec4..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallbackProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.world.World; - -/** - * Use StructureUtility to instantiate - */ -public interface IStructureFallbackProvider extends IStructureElement { - IStructureElementProvider[] fallbacks(); - - @Override - default boolean check(T t,World world, int x, int y, int z){ - for (IStructureElementProvider fallback : fallbacks()) { - if (fallback.getStructureElement(t).check(t, world, x, y, z)) { - return true; - } - } - return false; - } - - @Override - default boolean spawnHint(T t,World world, int x, int y, int z) { - for (IStructureElementProvider fallback : fallbacks()) { - if (fallback.getStructureElement(t).spawnHint(t, world, x, y, z)) { - return true; - } - } - return false; - } - - @Override - default boolean placeBlock(T t,World world, int x, int y, int z) { - for (IStructureElementProvider fallback : fallbacks()) { - if (fallback.getStructureElement(t).placeBlock(t, world, x, y, z)) { - return true; - } - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java index 9d983e1c4d..bdb619984a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java @@ -2,11 +2,11 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.tileentity.TileEntity; -public interface ITileAdder { +public interface ITileAdder { /** * Callback to add hatch * @param tileEntity tile * @return managed to add hatch (structure still valid) */ - boolean apply(TileEntity tileEntity); + boolean apply(T t,TileEntity tileEntity); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 77c47ad19e..5da14f58f9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.structure; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index 79176c3f25..c8262e8473 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -6,18 +6,18 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; public class StructureDefinition implements IStructureDefinition { - private final Map> elements; + private final Map> elements; private final Map shapes; - private final Map[]> compiled; + private final Map[]> compiled; public static Builder builder() { return new Builder<>(); } private StructureDefinition( - Map> elements, + Map> elements, Map shapes, - Map[]> compiled) { + Map[]> compiled) { this.elements =elements; this.shapes=shapes; this.compiled =compiled; @@ -28,7 +28,7 @@ public class StructureDefinition implements IStructureDefinition { private static final char B='\uB000'; private static final char C='\uC000'; private static final char D='\uD000'; - private final Map> elements; + private final Map> elements; private final Map shapes; private Builder() { @@ -36,7 +36,7 @@ public class StructureDefinition implements IStructureDefinition { shapes = new HashMap<>(); } - public Map> getElements() { + public Map> getElements() { return elements; } @@ -113,7 +113,7 @@ public class StructureDefinition implements IStructureDefinition { return this; } - public Builder addElement(Character name, IStructureElementProvider structurePiece) { + public Builder addElement(Character name, IStructureElement structurePiece) { elements.put(name, structurePiece); return this; } @@ -127,18 +127,18 @@ public class StructureDefinition implements IStructureDefinition { } @SuppressWarnings("unchecked") - private Map[]> compileMap() { + private Map[]> compileMap() { List mising = new ArrayList<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { - IStructureElementProvider iStructureElement = elements.get((char) c); + IStructureElement iStructureElement = elements.get((char) c); if (iStructureElement == null) { mising.add(c); } })); if (mising.isEmpty()) { - Map[]> map = new HashMap<>(); + Map[]> map = new HashMap<>(); shapes.forEach((key, value) -> { - IStructureElementProvider[] compiled = new IStructureElementProvider[value.length()]; + IStructureElement[] compiled = new IStructureElement[value.length()]; for (int i = 0; i < value.length(); i++) { compiled[i] = elements.get(value.charAt(i)); } @@ -152,7 +152,7 @@ public class StructureDefinition implements IStructureDefinition { } } - public Map> getElements(){ + public Map> getElements(){ return elements; } @@ -160,12 +160,12 @@ public class StructureDefinition implements IStructureDefinition { return shapes; } - public Map[]> getCompiled() { + public Map[]> getCompiled() { return compiled; } @Override - public IStructureElementProvider[] getElementsFor(String name) { + public IStructureElement[] getElementsFor(String name) { return compiled.get(name); } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 6feb07196d..3d13ca86e2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -232,14 +232,14 @@ public class StructureUtility { return ofBlock(block, meta,block,meta); } - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,Block hintBlock,int hintMeta){ + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,Block hintBlock,int hintMeta){ if(iBlockAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return iBlockAdder.apply(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + return iBlockAdder.apply(t,world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); } @Override @@ -256,7 +256,7 @@ public class StructureUtility { }; } - public static IStructureElement ofTileAdder(ITileAdder iTileAdder,Block hintBlock,int hintMeta){ + public static IStructureElement ofTileAdder(ITileAdder iTileAdder,Block hintBlock,int hintMeta){ if(iTileAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } @@ -264,7 +264,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(tileEntity); + return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t,tileEntity); } @Override @@ -275,7 +275,7 @@ public class StructureUtility { }; } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex,Block hintBlock,int hintMeta){ + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, Block hintBlock, int hintMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } @@ -283,7 +283,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply((IGregTechTileEntity) tileEntity, textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); } @Override @@ -391,20 +391,7 @@ public class StructureUtility { if(elementChain==null || elementChain.length==0){ throw new IllegalArgumentException(); } - for (IStructureElementProvider iStructureElement : elementChain) { - if(iStructureElement==null){ - throw new IllegalArgumentException(); - } - } - return () -> elementChain; - } - - @SafeVarargs - public static IStructureFallbackProvider ofProviderChain(IStructureElementProvider... elementChain){ - if(elementChain==null || elementChain.length==0){ - throw new IllegalArgumentException(); - } - for (IStructureElementProvider iStructureElement : elementChain) { + for (IStructureElement iStructureElement : elementChain) { if(iStructureElement==null){ throw new IllegalArgumentException(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 4151dbfec0..36a89650fd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index d90f4af8d2..aeb569efff 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 490ca2084b..0816f6d9ee 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; 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 e70cc10926..0aaa87bab4 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 @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index a9e5b2f8a1..b7904b3219 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index d5c9162d1d..a00c9b9041 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -10,7 +10,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 3b17dfa9b9..2dafe62db6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 5dfa38294b..77f73edc63 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 1fff071e9c..c07be438d4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -9,7 +9,7 @@ import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 199bb8ee6f..b7555a4163 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.constructable.IConstructable; 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 ab86c0494f..935f3b3997 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 @@ -14,7 +14,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index c6f9c810a8..72a3c241ba 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -7,7 +7,7 @@ import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; 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 896d0f41bc..3db6f66eb0 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 @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 140383caac..7219429d11 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 7398889c89..043b266f62 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 62c2b981a1..1381c1b0f7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -45,8 +45,8 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo {"111", "111", "111",}, }) .addElement('0', ofBlock(sBlockCasings1,15)) - .addElement('1', ofProviderChain( - trafo->ofHatchAdder(trafo::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), + .addElement('1', ofElementChain( + ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), ofBlock(sBlockCasingsTT,0) )) .build(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index f909d000c7..1d06a3b0d7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index ba926f1ace..a320a8b35a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 47f36014ac..e800037850 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index a4a234f9b4..6a9991451b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; 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 cf78a18a74..8cf1cee16d 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 @@ -6,7 +6,6 @@ import com.github.technus.tectech.mechanics.alignment.*; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.Util; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java new file mode 100644 index 0000000000..539fcf4f38 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java @@ -0,0 +1,15 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.base; + + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +@Deprecated +public interface IHatchAdder { + /** + * Callback to add hatch + * @param iGregTechTileEntity hatch + * @param aShort requested texture index, or null if not... + * @return managed to add hatch (structure still valid) + */ + boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort); +} 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 722580a221..5c3296f980 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 @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -- cgit From a94138b2c1dccb88d1cce040fda5f29fe10dfa2c Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 07:21:56 +0200 Subject: Refactor old api for fully static context --- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 19 ++++++++------- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 19 ++++++++------- .../tectech/mechanics/structure/Structure.java | 16 +++++++++---- .../multi/GT_MetaTileEntity_EM_annihilation.java | 11 +++++---- .../multi/GT_MetaTileEntity_EM_bhg.java | 7 ++++-- .../multi/GT_MetaTileEntity_EM_collider.java | 24 +++++++++++-------- .../multi/GT_MetaTileEntity_EM_computer.java | 19 ++++++++------- .../multi/GT_MetaTileEntity_EM_crafting.java | 11 +++++---- .../multi/GT_MetaTileEntity_EM_dataBank.java | 15 +++++++----- .../multi/GT_MetaTileEntity_EM_decay.java | 20 ++++++++++------ .../multi/GT_MetaTileEntity_EM_dequantizer.java | 19 ++++++++------- .../multi/GT_MetaTileEntity_EM_infuser.java | 10 ++++---- .../multi/GT_MetaTileEntity_EM_junction.java | 18 +++++++++----- .../multi/GT_MetaTileEntity_EM_quantizer.java | 21 ++++++++-------- .../multi/GT_MetaTileEntity_EM_research.java | 15 +++++++----- .../multi/GT_MetaTileEntity_EM_scanner.java | 25 +++++++++---------- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 11 +++++---- .../multi/GT_MetaTileEntity_EM_switch.java | 19 +++++++++------ .../multi/GT_MetaTileEntity_EM_wormhole.java | 11 +++++---- .../multi/GT_MetaTileEntity_TM_microwave.java | 10 ++++---- .../GT_MetaTileEntity_TM_proccessingStack.java | 8 ++++--- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 28 +++++++++++++++------- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 27 ++++++++++++--------- .../metaTileEntity/multi/base/IHatchAdder.java | 15 ------------ .../em_machine/GT_MetaTileEntity_EM_machine.java | 15 +++++++----- 25 files changed, 239 insertions(+), 174 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 0ab4893000..0ce33b31b3 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -24,10 +24,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; -import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,10 +47,10 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ }; private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalMufflerToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index c2ae9f3fdb..98daad91c3 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -24,10 +24,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; -import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,10 +47,10 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu }; private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 5da14f58f9..7eda9b690a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.mechanics.structure; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -22,20 +22,26 @@ public class Structure { private Structure(){} + @SafeVarargs + public static IHatchAdder[] adders(IHatchAdder... iHatchAdder){ + return iHatchAdder; + } + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller //This only checks for REGULAR BLOCKS! - public static boolean checker( + public static boolean checker( String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, + IHatchAdder[] addingMethods, short[] casingTextures, Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, + T metaTile, ExtendedFacing extendedFacing, boolean forceCheck) { + IGregTechTileEntity aBaseMetaTileEntity = metaTile.getBaseMetaTileEntity(); World world = aBaseMetaTileEntity.getWorld(); if (world.isRemote) { return false; @@ -117,7 +123,7 @@ public class Structure { } } else if ((pointer = block - ' ') >= 0) { igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); - if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { + if (igt == null || !addingMethods[pointer].apply(metaTile,igt, casingTextures[pointer])) { if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { if (DEBUG_MODE) { TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 36a89650fd..4eb2028dd8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -18,6 +18,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -48,7 +49,9 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, + GT_MetaTileEntity_EM_annihilation::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index aeb569efff..0dc949bc2f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -18,6 +18,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -84,7 +85,9 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{12, 13, 14, 10, 11}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_bhg::addClassicToMachineList, + GT_MetaTileEntity_EM_bhg::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 0816f6d9ee..8df3122381 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,11 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; @@ -13,12 +11,17 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -35,6 +38,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -329,11 +333,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }; private static final byte[] blockMeta1 = new byte[]{4, 7, 4, 0, 4, 8}; private static final byte[] blockMeta2 = new byte[]{4, 7, 5, 0, 6, 9}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_collider::addClassicToMachineList, + GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, + GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; 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 0aaa87bab4..c6a6e584df 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 @@ -1,18 +1,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -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.Vec3Impl; -import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; 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.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -30,11 +30,12 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -55,7 +56,9 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},}; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{2, 1, 3}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addToMachineList, this::addRackToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_computer::addToMachineList, + GT_MetaTileEntity_EM_computer::addRackToMachineList); private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{1, 3}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index b7904b3219..7e338da853 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -18,6 +18,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -50,7 +51,9 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_crafting::addClassicToMachineList, + GT_MetaTileEntity_EM_crafting::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index a00c9b9041..319141e55c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -28,11 +28,12 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { @@ -49,7 +50,9 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{2, 1}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addDataBankHatchToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, + GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 1}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 1}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 2dafe62db6..0d243db7e8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,15 +1,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -28,12 +31,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.util.CommonValues.VN; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; +import static com.github.technus.tectech.util.CommonValues.VN; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -66,7 +70,9 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_decay::addClassicToMachineList, + GT_MetaTileEntity_EM_decay::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 77f73edc63..1b17eaa4a6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.iExchangeInfo; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -25,12 +25,13 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 net.minecraft.util.StatCollector.translateToLocal; /** @@ -47,10 +48,10 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; private static final byte[] blockMeta = new byte[]{0, 4, 0}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalMufflerToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, + GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index c07be438d4..224e7afc86 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -1,15 +1,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -24,6 +24,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 gregtech.api.GregTech_API.mEUtoRF; @@ -41,7 +42,8 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{7, 4}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_infuser::addClassicToMachineList); private static final short[] casingTextures = new short[]{textureOffset}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index b7555a4163..c4c0189431 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,12 +1,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.util.CommonValues; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; @@ -14,10 +17,11 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; @@ -42,7 +46,9 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 5}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_junction::addClassicToMachineList, + GT_MetaTileEntity_EM_junction::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; 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 935f3b3997..1d2ef85ace 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 @@ -1,9 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; @@ -11,10 +10,11 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -29,17 +29,18 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.isInputEqual; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; 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 net.minecraft.util.StatCollector.translateToLocal; /** @@ -56,10 +57,10 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 72a3c241ba..9ef566a9d3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.recipe.TT_recipe; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -36,14 +36,15 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; import java.util.LinkedHashMap; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.CommonValues.VN; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.VN; import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -77,7 +78,9 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{1, 3, 2}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addHolderToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_research::addClassicToMachineList, + GT_MetaTileEntity_EM_research::addHolderToMachineList); private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; private static final byte[] blockMetaFallback = new byte[]{1, 0}; 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 3db6f66eb0..25da9bfe5a 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 @@ -1,21 +1,21 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.util.CommonValues; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -34,16 +34,17 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.reflect.FieldUtils; -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.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.VN; +import static com.github.technus.tectech.util.Util.areBitsSet; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -80,11 +81,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_scanner::addClassicToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 7219429d11..e579e68d51 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,17 +1,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 net.minecraft.util.StatCollector.translateToLocal; @@ -30,7 +31,9 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, + GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 043b266f62..ced1bceed1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,15 +1,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,11 +25,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -41,7 +45,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas }; private static final Block[] blockType = new Block[]{sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{3}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_switch::addClassicToMachineList); private static final short[] casingTextures = new short[]{textureOffset + 1}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{1}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 1d06a3b0d7..65f09c03dc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -18,6 +18,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -49,7 +50,9 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, + GT_MetaTileEntity_EM_wormhole::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index a320a8b35a..4ab79a6732 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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.Vec3Impl; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.HashSet; import static com.github.technus.tectech.loader.MainLoader.microwaving; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static gregtech.api.GregTech_API.sBlockCasings4; @@ -53,7 +54,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock private static final Block[] blockType = new Block[]{sBlockCasings4}; private static final byte[] blockMeta = new byte[]{1}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_TM_microwave::addClassicToMachineList); private static final short[] casingTextures = new short[]{49}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; private static final byte[] blockMetaFallback = new byte[]{1}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index e800037850..4ca2ada866 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -17,6 +17,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static gregtech.api.GregTech_API.sBlockCasings4; import static net.minecraft.util.StatCollector.translateToLocal; @@ -45,7 +46,8 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul private static final Block[] blockType = new Block[]{sBlockCasings4}; private static final byte[] blockMeta = new byte[]{1}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_TM_proccessingStack::addClassicToMachineList); private static final short[] casingTextures = new short[]{49}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; private static final byte[] blockMetaFallback = new byte[]{1}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 6a9991451b..16743bd2de 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -1,22 +1,25 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.data.RendererMessage; import com.github.technus.tectech.mechanics.data.ThaumSpark; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TeslaCoil; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -31,13 +34,18 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.*; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.entriesSortedByValues; +import static com.github.technus.tectech.util.Util.map; import static gregtech.api.enums.GT_Values.E; import static java.lang.Math.max; import static java.lang.Math.min; @@ -97,7 +105,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8}; private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8}; private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addCapacitorToMachineList, this::addFrameToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, + GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList); private static final short[] casingTextures = new short[]{(texturePage << 7) + 16 + 6, 0}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsBA0, null}; private static final byte[] blockMetaFallback = new byte[]{6, 0}; 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 8cf1cee16d..1e5b36ab86 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 @@ -2,21 +2,25 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.*; +import com.github.technus.tectech.loader.NetworkDispatcher; +import com.github.technus.tectech.mechanics.alignment.AlignmentLimits; +import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.util.Vec3Impl; -import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.Structure; 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.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -42,10 +46,10 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import static com.github.technus.tectech.util.CommonValues.*; -import static com.github.technus.tectech.util.Util.getTier; 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.Util.getTier; /** * Created by danie_000 on 27.10.2016. @@ -220,17 +224,18 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } @Deprecated - public final boolean structureCheck_EM( + @SuppressWarnings("unchecked") + public final boolean structureCheck_EM( String[][] structure,//0-9 casing, +- air no air, a-z ignore Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, + IHatchAdder[] addingMethods, short[] casingTextures, Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset) { return Structure.checker(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, - horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), getExtendedFacing(), !mMachine); + horizontalOffset, verticalOffset, depthOffset, (T)this, getExtendedFacing(), !mMachine); } //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java deleted file mode 100644 index 539fcf4f38..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.base; - - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -@Deprecated -public interface IHatchAdder { - /** - * Callback to add hatch - * @param iGregTechTileEntity hatch - * @param aShort requested texture index, or null if not... - * @return managed to add hatch (structure still valid) - */ - boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort); -} 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 5c3296f980..1c76f7be6c 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 @@ -1,15 +1,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -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.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -23,6 +23,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -50,7 +51,9 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa {"B0", "A!!!", "0!!!0", "A!!!", "B0",},}; private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_machine::addClassicToMachineList, + GT_MetaTileEntity_EM_machine::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; -- cgit From eb4333b293eb2046269f5d9347c4d02760d697bd Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 07:57:11 +0200 Subject: Use generics here --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main') 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 1e5b36ab86..83c7066938 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 @@ -1140,12 +1140,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = -1; } } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = -1; } @@ -1209,13 +1209,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } id = 1; - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = id++; } } id = 1; - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = id++; } -- cgit From 93bca910f733b60d8151e4e619b27a1e585811ed Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 08:00:35 +0200 Subject: Fix pollutor localization --- .../thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java | 2 +- src/main/resources/assets/tectech/lang/en_US.lang | 2 +- src/main/resources/assets/tectech/lang/zh_CN.lang | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') 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 6fef2efbe9..0d5a59a5c1 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 @@ -148,7 +148,7 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac CommonValues.TEC_MARK_GENERAL, translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.0"),//Shit genny broke! EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.1"),//Infinite Producer/Consumer - EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.1")//Since i wanted one... + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.2")//Since i wanted one? }; } diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index b3ae51a407..5005a90c60 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -762,7 +762,7 @@ gt.blockmachines.machine.tt.tesla.desc.1=Lightning stoves for the rich gt.blockmachines.debug.tt.pollutor.name=Debug Pollution Generator gt.blockmachines.debug.tt.pollutor.desc.0=Shit genny broke! gt.blockmachines.debug.tt.pollutor.desc.1=Infinite Producer/Consumer -gt.blockmachines.debug.tt.pollutor.desc.2=Since i wanted one... +gt.blockmachines.debug.tt.pollutor.desc.2=Since i wanted one? gt.blockmachines.debug.tt.data.name=Debug Data Hatch gt.blockmachines.debug.tt.data.desc.0=Quantum Data Output gt.blockmachines.debug.tt.data.desc.1=High speed fibre optics connector. diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 16d32829f7..a96b13a58f 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -762,7 +762,7 @@ gt.blockmachines.machine.tt.tesla.desc.1=富人的闪电洪炉 gt.blockmachines.debug.tt.pollutor.name=Debug污染生成机 gt.blockmachines.debug.tt.pollutor.desc.0=该死的genny破产了! gt.blockmachines.debug.tt.pollutor.desc.1=无限的生产者/消费者 -gt.blockmachines.debug.tt.pollutor.desc.2=我只是想要一个... +gt.blockmachines.debug.tt.pollutor.desc.2=我只是想要一个? gt.blockmachines.debug.tt.data.name=Debug数据仓 gt.blockmachines.debug.tt.data.desc.0=量子数据输出 gt.blockmachines.debug.tt.data.desc.1=高速光纤接口 -- cgit From 0c35badc49defc7bd7f76f763aa0a86bd9e7be64 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 08:25:24 +0200 Subject: Add helper method for on check pass --- .../mechanics/structure/StructureUtility.java | 47 +++++++++++++++++++++- .../multi/GT_MetaTileEntity_EM_transformer.java | 6 ++- 2 files changed, 50 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 3d13ca86e2..e0e94a00eb 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -12,6 +12,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import java.util.*; +import java.util.function.Consumer; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; @@ -76,7 +77,9 @@ public class StructureUtility { @SuppressWarnings("unchecked") public static IStructureElement error(){ return ERROR; - } /** + } + + /** * Does not allow Block duplicates (with different meta) */ public static IStructureElement ofHintFlat(Map blocsMap,Block hintBlock,int hintMeta){ @@ -145,6 +148,24 @@ public class StructureUtility { return ofHint(block, meta,block,meta); } + public static IStructureElement ofHintAdder(IBlockAdder iBlockAdder,Block hintBlock,int hintMeta){ + if(iBlockAdder==null ||hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return iBlockAdder.apply(t,world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + }; + } + /** * Does not allow Block duplicates (with different meta) */ @@ -256,6 +277,7 @@ public class StructureUtility { }; } + public static IStructureElement ofTileAdder(ITileAdder iTileAdder,Block hintBlock,int hintMeta){ if(iTileAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); @@ -294,6 +316,29 @@ public class StructureUtility { }; } + public static IStructureElement onCheckPass(Consumer onCheckPass, IStructureElement element){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + boolean check = element.check(t, world, x, y, z); + if(check){ + onCheckPass.accept(t); + } + return check; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + return element.placeBlock(t, world, x, y, z); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + return element.spawnHint(t, world, x, y, z); + } + }; + } + @SuppressWarnings("unchecked") public static IStructureNavigate step(Vec3Impl step){ if(step==null || step.get0()<0 || step.get1()<0 || step.get2()<0){ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 1381c1b0f7..b65fcda229 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -47,9 +47,10 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo .addElement('0', ofBlock(sBlockCasings1,15)) .addElement('1', ofElementChain( ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), - ofBlock(sBlockCasingsTT,0) + onCheckPass(t->t.casingCount++,ofBlock(sBlockCasingsTT,0)) )) .build(); + private int casingCount=0; @Override public IStructureDefinition getStructure_EM() { @@ -86,7 +87,8 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); + casingCount=0; + return structureCheck_EM("main", 1, 1, 0) && casingCount>=5; } @Override -- cgit From 1522dceb7629b3026e3c4506305d7d1f8708527c Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 08:27:32 +0200 Subject: add some doc --- .../com/github/technus/tectech/mechanics/structure/IBlockAdder.java | 2 +- .../com/github/technus/tectech/mechanics/structure/IHatchAdder.java | 2 +- .../java/com/github/technus/tectech/mechanics/structure/ITileAdder.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java index 85d6f1be3f..21841fc380 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java @@ -5,7 +5,7 @@ import net.minecraft.block.Block; public interface IBlockAdder { /** - * Callback on block added + * Callback on block added, needs to check if block is valid (and add it) * @param block block attempted to add * @param meta meta of block attempted to add * @return is structure still valid diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java index 6e5aca5be3..0666e3f214 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java @@ -5,7 +5,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public interface IHatchAdder { /** - * Callback to add hatch + * Callback to add hatch, needs to check if hatch is valid (and add it) * @param iGregTechTileEntity hatch * @param aShort requested texture index, or null if not... * @return managed to add hatch (structure still valid) diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java index bdb619984a..2af878c79e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java @@ -4,7 +4,7 @@ import net.minecraft.tileentity.TileEntity; public interface ITileAdder { /** - * Callback to add hatch + * Callback to add hatch, needs to check if tile is valid (and add it) * @param tileEntity tile * @return managed to add hatch (structure still valid) */ -- cgit From f40fed706320a4de336bd4e764921daf85262ea1 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 08:28:07 +0200 Subject: remove unused field --- .../com/github/technus/tectech/mechanics/structure/Structure.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 7eda9b690a..21bf0281bc 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -12,14 +12,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.regex.Pattern; - import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @Deprecated public class Structure { - private static final Pattern MATCH_E = Pattern.compile("(E,(E,)+)"); - private Structure(){} @SafeVarargs -- cgit From 65cbb63664bfcad81265b26751f1d53e50b7ea96 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 09:00:00 +0200 Subject: Make that api chooch --- .../tectech/loader/ConstructableLoader.java | 10 +++---- .../constructable/IMultiblockInfoContainer.java | 19 +++++++++---- .../thing/item/ConstructableTriggerItem.java | 31 +++++++++++----------- 3 files changed, 34 insertions(+), 26 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java index 665889dc1f..2cd4f04fc8 100644 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -6,17 +6,16 @@ import com.github.technus.tectech.mechanics.structure.Structure; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.*; +import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.registerMetaClass; import static gregtech.api.GregTech_API.sBlockCasings1; public class ConstructableLoader implements Runnable { @Override public void run() { - registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { + registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { //region Structure private final String[][] shape = new String[][]{ {"000","\"\"\"","\"\"\""," . ",}, @@ -34,8 +33,9 @@ public class ConstructableLoader implements Runnable { //endregion @Override - public void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide) { - Structure.builder(shape, blockType, blockMeta, 1, 3, 0, tileEntity, aSide, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly, GT_MetaTileEntity_ElectricBlastFurnace tileEntity, ExtendedFacing aSide) { + Structure.builder(shape, blockType, blockMeta, 1, 3, 0, + tileEntity.getBaseMetaTileEntity(), aSide, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java index 2506342f72..173e0d16ec 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java @@ -12,18 +12,27 @@ import java.util.HashMap; /** * To implement IConstructable on not own TileEntities */ -public interface IMultiblockInfoContainer { - HashMap MULTIBLOCK_MAP = new HashMap<>(); +public interface IMultiblockInfoContainer { + HashMap> MULTIBLOCK_MAP = new HashMap<>(); - static void registerTileClass(Class clazz, IMultiblockInfoContainer info){ + static void registerTileClass(Class clazz, IMultiblockInfoContainer info){ MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); } - static void registerMetaClass(Class clazz, IMultiblockInfoContainer info){ + static void registerMetaClass(Class clazz, IMultiblockInfoContainer info){ MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); } - void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide); + @SuppressWarnings("unchecked") + static IMultiblockInfoContainer get(Class tClass){ + return (IMultiblockInfoContainer)MULTIBLOCK_MAP.get(tClass.getCanonicalName()); + } + + static boolean contains(Class tClass){ + return MULTIBLOCK_MAP.containsKey(tClass.getCanonicalName()); + } + + void construct(ItemStack stackSize, boolean hintsOnly, T tileEntity, ExtendedFacing aSide); @SideOnly(Side.CLIENT) String[] getDescription(ItemStack stackSize); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 4160ae2aba..c24b35f8d5 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -23,7 +23,6 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.MULTIBLOCK_MAP; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -51,20 +50,20 @@ public final class ConstructableTriggerItem extends Item { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE instanceof IConstructable) { ((IConstructable) metaTE).construct(aStack, false); - } else if (MULTIBLOCK_MAP.containsKey(metaTE.getClass().getCanonicalName())) { - IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()); + } else if (IMultiblockInfoContainer.contains(metaTE.getClass())) { + IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); if(metaTE instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, false, tTileEntity, ( + iMultiblockInfoContainer.construct(aStack, false, metaTE, ( (IAlignment) metaTE).getExtendedFacing()); }else { - iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + iMultiblockInfoContainer.construct(aStack, false, metaTE, ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); } } } else if (tTileEntity instanceof IConstructable) { ((IConstructable) tTileEntity).construct(aStack, false); - } else if (MULTIBLOCK_MAP.containsKey(tTileEntity.getClass().getCanonicalName())) { - IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()); + } else if (IMultiblockInfoContainer.contains(tTileEntity.getClass())) { + IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(tTileEntity.getClass()); if(tTileEntity instanceof IAlignment){ iMultiblockInfoContainer.construct(aStack, false, tTileEntity, ((IAlignment) tTileEntity).getExtendedFacing()); @@ -83,24 +82,24 @@ public final class ConstructableTriggerItem extends Item { ((IConstructable) metaTE).construct(aStack, true); TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack)); return false; - } else if(MULTIBLOCK_MAP.containsKey(metaTE.getClass().getCanonicalName())){ - IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()); + } else if(IMultiblockInfoContainer.contains(metaTE.getClass())){ + IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); if(metaTE instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, true, tTileEntity, ( - (IAlignment) metaTE).getExtendedFacing()); + iMultiblockInfoContainer.construct(aStack, true, metaTE, + ((IAlignment) metaTE).getExtendedFacing()); }else { - iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + iMultiblockInfoContainer.construct(aStack, true, metaTE, ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); } - TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()).getDescription(aStack)); + TecTech.proxy.printInchat(IMultiblockInfoContainer.get(metaTE.getClass()).getDescription(aStack)); return false; } } else if(tTileEntity instanceof IConstructable){ ((IConstructable) tTileEntity).construct(aStack,true); TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack)); return false; - } else if(MULTIBLOCK_MAP.containsKey(tTileEntity.getClass().getCanonicalName())){ - IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()); + } else if(IMultiblockInfoContainer.contains(tTileEntity.getClass())){ + IMultiblockInfoContainer iMultiblockInfoContainer = IMultiblockInfoContainer.get(tTileEntity.getClass()); if(tTileEntity instanceof IAlignment){ iMultiblockInfoContainer.construct(aStack, true, tTileEntity, ((IAlignment) tTileEntity).getExtendedFacing()); @@ -108,7 +107,7 @@ public final class ConstructableTriggerItem extends Item { iMultiblockInfoContainer.construct(aStack, true, tTileEntity, ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); } - TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack)); + TecTech.proxy.printInchat(IMultiblockInfoContainer.get(tTileEntity.getClass()).getDescription(aStack)); return false; } //} else { -- cgit From d0cafa5c88cbbff75321e2d781bca79a9057e473 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 09:03:21 +0200 Subject: add on element fail --- .../mechanics/structure/StructureUtility.java | 25 +++++++++++++++++++++- .../multi/GT_MetaTileEntity_EM_transformer.java | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index e0e94a00eb..f619c7482b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -316,7 +316,7 @@ public class StructureUtility { }; } - public static IStructureElement onCheckPass(Consumer onCheckPass, IStructureElement element){ + public static IStructureElement onElementPass(Consumer onCheckPass, IStructureElement element){ return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -339,6 +339,29 @@ public class StructureUtility { }; } + public static IStructureElement onElementFail(Consumer onFail, IStructureElement element){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + boolean check = element.check(t, world, x, y, z); + if(!check){ + onFail.accept(t); + } + return check; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + return element.placeBlock(t, world, x, y, z); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + return element.spawnHint(t, world, x, y, z); + } + }; + } + @SuppressWarnings("unchecked") public static IStructureNavigate step(Vec3Impl step){ if(step==null || step.get0()<0 || step.get1()<0 || step.get2()<0){ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index b65fcda229..2d7fc5b524 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -47,7 +47,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo .addElement('0', ofBlock(sBlockCasings1,15)) .addElement('1', ofElementChain( ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), - onCheckPass(t->t.casingCount++,ofBlock(sBlockCasingsTT,0)) + onElementPass(t->t.casingCount++,ofBlock(sBlockCasingsTT,0)) )) .build(); private int casingCount=0; -- cgit From ffcba9cfeada309748e3f2ad206b141fc102cb3e Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 09:10:57 +0200 Subject: Optimize navigation --- .../mechanics/structure/IStructureDefinition.java | 44 ++++++++++++++++------ .../mechanics/structure/IStructureElement.java | 24 ------------ .../mechanics/structure/IStructureNavigate.java | 26 ++++++++++++- .../mechanics/structure/StructureUtility.java | 4 +- 4 files changed, 59 insertions(+), 39 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index 1152713d5e..97e4fe2bad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -73,9 +73,14 @@ public interface IStructureDefinition { return false; } - abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); - abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); - abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + if(element instanceof IStructureNavigate) { + IStructureNavigate navigate=(IStructureNavigate)element; + abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); + abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); + abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + }else { + abc[0]+=1; + } } } else { for (IStructureElement element : elements) { @@ -90,9 +95,14 @@ public interface IStructureDefinition { } } - abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); - abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); - abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + if(element instanceof IStructureNavigate) { + IStructureNavigate navigate=(IStructureNavigate)element; + abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); + abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); + abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + }else { + abc[0]+=1; + } } } }else { @@ -107,9 +117,14 @@ public interface IStructureDefinition { element.spawnHint(object, world, xyz[0], xyz[1], xyz[2]); } - abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); - abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); - abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + if(element instanceof IStructureNavigate) { + IStructureNavigate navigate=(IStructureNavigate)element; + abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); + abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); + abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + }else { + abc[0]+=1; + } } } else { for (IStructureElement element : elements) { @@ -122,9 +137,14 @@ public interface IStructureDefinition { element.placeBlock(object, world, xyz[0], xyz[1], xyz[2]); } - abc[0] =(element.resetA()?basePositionA:abc[0])+element.getStepA(); - abc[1] =(element.resetB()?basePositionA:abc[1])+element.getStepB(); - abc[2] =(element.resetC()?basePositionA:abc[2])+element.getStepC(); + if(element instanceof IStructureNavigate) { + IStructureNavigate navigate=(IStructureNavigate)element; + abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); + abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); + abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + }else { + abc[0]+=1; + } } } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index 78997648ab..2ac5c19538 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -15,28 +15,4 @@ public interface IStructureElement { default boolean placeBlock(T t,World world,int x,int y,int z){ return false; } - - default int getStepA(){ - return 1; - } - - default int getStepB(){ - return 0; - } - - default int getStepC(){ - return 0; - } - - default boolean resetA(){ - return false; - } - - default boolean resetB(){ - return false; - } - - default boolean resetC(){ - return false; - } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java index bba3dc5239..6382f130ee 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -5,7 +5,7 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -public interface IStructureNavigate extends IStructureElement { +interface IStructureNavigate extends IStructureElement { @Override default boolean check(T t, World world, int x, int y, int z){ return true; @@ -20,4 +20,28 @@ public interface IStructureNavigate extends IStructureElement { default boolean placeBlock(T t, World world, int x, int y, int z) { return true; } + + default int getStepA(){ + return 1; + } + + default int getStepB(){ + return 0; + } + + default int getStepC(){ + return 0; + } + + default boolean resetA(){ + return false; + } + + default boolean resetB(){ + return false; + } + + default boolean resetC(){ + return false; + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index f619c7482b..703c68221c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -363,7 +363,7 @@ public class StructureUtility { } @SuppressWarnings("unchecked") - public static IStructureNavigate step(Vec3Impl step){ + static IStructureNavigate step(Vec3Impl step){ if(step==null || step.get0()<0 || step.get1()<0 || step.get2()<0){ throw new IllegalArgumentException(); } @@ -378,7 +378,7 @@ public class StructureUtility { }); } - public static IStructureNavigate step(int a,int b, int c){ + static IStructureNavigate step(int a,int b, int c){ return step(new Vec3Impl(a,b,c)); } -- cgit From 99dcb842b73b8046b92df2bceb517af406a135cc Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 09:13:09 +0200 Subject: move adders to new package --- .../multi/GT_MetaTileEntity_EM_essentiaDequantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../technus/tectech/mechanics/structure/IBlockAdder.java | 14 -------------- .../technus/tectech/mechanics/structure/IHatchAdder.java | 14 -------------- .../technus/tectech/mechanics/structure/ITileAdder.java | 12 ------------ .../technus/tectech/mechanics/structure/Structure.java | 1 + .../tectech/mechanics/structure/StructureUtility.java | 7 +++++-- .../tectech/mechanics/structure/adders/IBlockAdder.java | 14 ++++++++++++++ .../tectech/mechanics/structure/adders/IHatchAdder.java | 14 ++++++++++++++ .../tectech/mechanics/structure/adders/ITileAdder.java | 12 ++++++++++++ .../multi/GT_MetaTileEntity_EM_annihilation.java | 2 +- .../metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java | 2 +- .../multi/GT_MetaTileEntity_EM_collider.java | 2 +- .../multi/GT_MetaTileEntity_EM_computer.java | 2 +- .../multi/GT_MetaTileEntity_EM_crafting.java | 2 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 2 +- .../metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java | 2 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 2 +- .../metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java | 2 +- .../multi/GT_MetaTileEntity_EM_junction.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_research.java | 2 +- .../metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java | 2 +- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 2 +- .../metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java | 2 +- .../multi/GT_MetaTileEntity_EM_wormhole.java | 2 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 2 +- .../multi/GT_MetaTileEntity_TM_proccessingStack.java | 2 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 2 +- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 +- .../multi/em_machine/GT_MetaTileEntity_EM_machine.java | 2 +- 31 files changed, 69 insertions(+), 65 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 0ce33b31b3..87e2660e01 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defin import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 98daad91c3..a716420e81 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defin import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java deleted file mode 100644 index 21841fc380..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockAdder.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - - -import net.minecraft.block.Block; - -public interface IBlockAdder { - /** - * Callback on block added, needs to check if block is valid (and add it) - * @param block block attempted to add - * @param meta meta of block attempted to add - * @return is structure still valid - */ - boolean apply(T t,Block block, Integer meta); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java deleted file mode 100644 index 0666e3f214..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IHatchAdder.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -public interface IHatchAdder { - /** - * Callback to add hatch, needs to check if hatch is valid (and add it) - * @param iGregTechTileEntity hatch - * @param aShort requested texture index, or null if not... - * @return managed to add hatch (structure still valid) - */ - boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java deleted file mode 100644 index 2af878c79e..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/ITileAdder.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.tileentity.TileEntity; - -public interface ITileAdder { - /** - * Callback to add hatch, needs to check if tile is valid (and add it) - * @param tileEntity tile - * @return managed to add hatch (structure still valid) - */ - boolean apply(T t,TileEntity tileEntity); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 21bf0281bc..4bab18bd28 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.mechanics.structure; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 703c68221c..a953cf277f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -2,6 +2,9 @@ package com.github.technus.tectech.mechanics.structure; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.structure.adders.IBlockAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.ITileAdder; import com.github.technus.tectech.util.Vec3Impl; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -148,7 +151,7 @@ public class StructureUtility { return ofHint(block, meta,block,meta); } - public static IStructureElement ofHintAdder(IBlockAdder iBlockAdder,Block hintBlock,int hintMeta){ + public static IStructureElement ofHintAdder(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta){ if(iBlockAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } @@ -278,7 +281,7 @@ public class StructureUtility { } - public static IStructureElement ofTileAdder(ITileAdder iTileAdder,Block hintBlock,int hintMeta){ + public static IStructureElement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta){ if(iTileAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java new file mode 100644 index 0000000000..908c4c4aca --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.mechanics.structure.adders; + + +import net.minecraft.block.Block; + +public interface IBlockAdder { + /** + * Callback on block added, needs to check if block is valid (and add it) + * @param block block attempted to add + * @param meta meta of block attempted to add + * @return is structure still valid + */ + boolean apply(T t,Block block, Integer meta); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java new file mode 100644 index 0000000000..a47befc2e8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.mechanics.structure.adders; + + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public interface IHatchAdder { + /** + * Callback to add hatch, needs to check if hatch is valid (and add it) + * @param iGregTechTileEntity hatch + * @param aShort requested texture index, or null if not... + * @return managed to add hatch (structure still valid) + */ + boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java new file mode 100644 index 0000000000..cc3c7dbb7a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.structure.adders; + +import net.minecraft.tileentity.TileEntity; + +public interface ITileAdder { + /** + * Callback to add hatch, needs to check if tile is valid (and add it) + * @param tileEntity tile + * @return managed to add hatch (structure still valid) + */ + boolean apply(T t,TileEntity tileEntity); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 4eb2028dd8..584e28a607 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 0dc949bc2f..63b45500ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 8df3122381..dea65d322f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -11,7 +11,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; 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 c6a6e584df..c845fe361e 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 @@ -3,7 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 7e338da853..7d8204c07f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 319141e55c..77647a0e20 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 0d243db7e8..d8ddc2c5b5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 1b17eaa4a6..1ba1389c80 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -6,7 +6,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElement import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.iExchangeInfo; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 224e7afc86..152d110c8d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -4,7 +4,7 @@ import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index c4c0189431..b63079d2dc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; 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 1d2ef85ace..a04a960bf1 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 @@ -10,7 +10,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 9ef566a9d3..213c919ec8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; 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 25da9bfe5a..b418ec0fa4 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 @@ -6,7 +6,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.CustomItemList; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index e579e68d51..dcd85af99d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index ced1bceed1..5ade4ec965 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 65f09c03dc..fa51447e9f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 4ab79a6732..543c09b72a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 4ca2ada866..189eae8205 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 16743bd2de..15263e2042 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.data.RendererMessage; import com.github.technus.tectech.mechanics.data.ThaumSpark; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; 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 83c7066938..dc9c6d39e5 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 @@ -14,7 +14,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; 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 1c76f7be6c..6b26132292 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 @@ -3,7 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.structure.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; -- cgit From 9450b8b91b629095036d783b9b01f5a39508a80a Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 09:16:44 +0200 Subject: Do not all methods on navigation --- .../mechanics/structure/IStructureDefinition.java | 40 ++++++++++------------ 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index 97e4fe2bad..f70422fe72 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -65,20 +65,19 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ - return false; - } - }else { - return false; - } - if(element instanceof IStructureNavigate) { IStructureNavigate navigate=(IStructureNavigate)element; abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); }else { + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + return false; + } + }else { + return false; + } abc[0]+=1; } } @@ -89,18 +88,17 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ - return false; - } - } - if(element instanceof IStructureNavigate) { IStructureNavigate navigate=(IStructureNavigate)element; abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); }else { + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + return false; + } + } abc[0]+=1; } } @@ -113,16 +111,15 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.spawnHint(object, world, xyz[0], xyz[1], xyz[2]); - } - if(element instanceof IStructureNavigate) { IStructureNavigate navigate=(IStructureNavigate)element; abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); }else { + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + element.spawnHint(object, world, xyz[0], xyz[1], xyz[2]); + } abc[0]+=1; } } @@ -133,16 +130,15 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.placeBlock(object, world, xyz[0], xyz[1], xyz[2]); - } - if(element instanceof IStructureNavigate) { IStructureNavigate navigate=(IStructureNavigate)element; abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); }else { + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + element.placeBlock(object, world, xyz[0], xyz[1], xyz[2]); + } abc[0]+=1; } } -- cgit From b8a654436e29505d1ac7bae0742819ff756b5e0f Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 09:25:06 +0200 Subject: Refactor instance of for isNavigating method --- .../mechanics/structure/IStructureDefinition.java | 36 ++++++++++------------ .../mechanics/structure/IStructureElement.java | 28 +++++++++++++++++ .../mechanics/structure/IStructureNavigate.java | 24 ++------------- 3 files changed, 46 insertions(+), 42 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index f70422fe72..a32c1f8840 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -65,11 +65,10 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if(element instanceof IStructureNavigate) { - IStructureNavigate navigate=(IStructureNavigate)element; - abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); - abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); - abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { if (world.blockExists(xyz[0], xyz[1], xyz[2])) { if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ @@ -88,11 +87,10 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if(element instanceof IStructureNavigate) { - IStructureNavigate navigate=(IStructureNavigate)element; - abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); - abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); - abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { if (world.blockExists(xyz[0], xyz[1], xyz[2])) { if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ @@ -111,11 +109,10 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if(element instanceof IStructureNavigate) { - IStructureNavigate navigate=(IStructureNavigate)element; - abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); - abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); - abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { if (world.blockExists(xyz[0], xyz[1], xyz[2])) { element.spawnHint(object, world, xyz[0], xyz[1], xyz[2]); @@ -130,11 +127,10 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if(element instanceof IStructureNavigate) { - IStructureNavigate navigate=(IStructureNavigate)element; - abc[0] = (navigate.resetA() ? basePositionA : abc[0]) + navigate.getStepA(); - abc[1] = (navigate.resetB() ? basePositionA : abc[1]) + navigate.getStepB(); - abc[2] = (navigate.resetC() ? basePositionA : abc[2]) + navigate.getStepC(); + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { if (world.blockExists(xyz[0], xyz[1], xyz[2])) { element.placeBlock(object, world, xyz[0], xyz[1], xyz[2]); diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index 2ac5c19538..f9510910ed 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -15,4 +15,32 @@ public interface IStructureElement { default boolean placeBlock(T t,World world,int x,int y,int z){ return false; } + + default int getStepA(){ + return 1; + } + + default int getStepB(){ + return 0; + } + + default int getStepC(){ + return 0; + } + + default boolean resetA(){ + return false; + } + + default boolean resetB(){ + return false; + } + + default boolean resetC(){ + return false; + } + + default boolean isNavigating(){ + return false; + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java index 6382f130ee..4628c710af 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -21,27 +21,7 @@ interface IStructureNavigate extends IStructureElement { return true; } - default int getStepA(){ - return 1; - } - - default int getStepB(){ - return 0; - } - - default int getStepC(){ - return 0; - } - - default boolean resetA(){ - return false; - } - - default boolean resetB(){ - return false; - } - - default boolean resetC(){ - return false; + default boolean isNavigating(){ + return true; } } -- cgit From c601ecf8cd72b76f88fe0b020305a79405a484a5 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 10:04:43 +0200 Subject: Further optimize navigation --- .../mechanics/structure/IStructureDefinition.java | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index a32c1f8840..ef6ead0eed 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -60,16 +60,16 @@ public interface IStructureDefinition { if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){ if(checkBlocksIfNotNullForceCheckAllIfTrue){ for (IStructureElement element : elements) { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ return false; @@ -82,16 +82,16 @@ public interface IStructureDefinition { } } else { for (IStructureElement element : elements) { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ return false; @@ -104,16 +104,16 @@ public interface IStructureDefinition { }else { if(hintsOnly) { for (IStructureElement element : elements) { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { element.spawnHint(object, world, xyz[0], xyz[1], xyz[2]); } @@ -122,16 +122,16 @@ public interface IStructureDefinition { } } else { for (IStructureElement element : elements) { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { element.placeBlock(object, world, xyz[0], xyz[1], xyz[2]); } -- cgit From f1d6a097d4bbe66de07e78a9997eb7f2d6ac2cb6 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 26 Apr 2020 10:54:31 +0200 Subject: Remove more old api, add compat, fix typos,add hint only --- .../tectech/loader/ConstructableLoader.java | 32 +++++--- .../mechanics/structure/IStructureDefinition.java | 16 ++-- .../tectech/mechanics/structure/Structure.java | 25 +----- .../mechanics/structure/StructureDefinition.java | 91 +++++++++++++++++++++- .../mechanics/structure/StructureUtility.java | 16 ++++ 5 files changed, 136 insertions(+), 44 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java index 2cd4f04fc8..537bbf8cca 100644 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -2,13 +2,16 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; -import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.registerMetaClass; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHintOnly; import static gregtech.api.GregTech_API.sBlockCasings1; public class ConstructableLoader implements Runnable { @@ -17,13 +20,18 @@ public class ConstructableLoader implements Runnable { public void run() { registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { //region Structure - private final String[][] shape = new String[][]{ - {"000","\"\"\"","\"\"\""," . ",}, - {"0!0","\"A\"","\"A\""," ",}, - {"000","\"\"\"","\"\"\""," ",}, - }; - private final Block[] blockType = new Block[]{sBlockCasings1}; - private final byte[] blockMeta = new byte[]{11}; + private final IStructureDefinition definition= + StructureDefinition.builder() + .addShapeOldApi("main",new String[][]{ + {"000","\"\"\"","\"\"\""," . ",}, + {"0!0","\"A\"","\"A\""," ",}, + {"000","\"\"\"","\"\"\""," ",}, + }) + .addElement('0', ofBlock(sBlockCasings1,11)) + .addElement('\"', ofHintOnly(3)) + .addElement('!', ofHintOnly(2)) + .addElement(' ', ofHintOnly(1)) + .build(); private final String[] desc=new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or Heat Proof Casing", @@ -34,8 +42,10 @@ public class ConstructableLoader implements Runnable { @Override public void construct(ItemStack stackSize, boolean hintsOnly, GT_MetaTileEntity_ElectricBlastFurnace tileEntity, ExtendedFacing aSide) { - Structure.builder(shape, blockType, blockMeta, 1, 3, 0, - tileEntity.getBaseMetaTileEntity(), aSide, hintsOnly); + IGregTechTileEntity base = tileEntity.getBaseMetaTileEntity(); + definition.buildOrHints(tileEntity,"main", base.getWorld(),aSide, + base.getXCoord(),base.getYCoord(),base.getZCoord(), + 1, 3, 0,hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index ef6ead0eed..9319b4954b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -62,8 +62,8 @@ public interface IStructureDefinition { for (IStructureElement element : elements) { if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); }else { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; @@ -84,8 +84,8 @@ public interface IStructureDefinition { for (IStructureElement element : elements) { if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); }else { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; @@ -106,8 +106,8 @@ public interface IStructureDefinition { for (IStructureElement element : elements) { if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); }else { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; @@ -124,8 +124,8 @@ public interface IStructureDefinition { for (IStructureElement element : elements) { if(element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionA : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionA : abc[2]) + element.getStepC(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); }else { extendedFacing.getWorldOffset(abc, xyz); xyz[0] += basePositionX; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 4bab18bd28..e7769b3e04 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -9,7 +9,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; -import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -154,26 +153,10 @@ public class Structure { byte[] blockMeta,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset, IGregTechTileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, - tileEntity.getWorld(), tileEntity.getXCoord(), tileEntity.getYCoord(), tileEntity.getZCoord(), - extendedFacing, hintsOnly); - } - - public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, - tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, - extendedFacing, hintsOnly); - } - - public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - World world, int baseX, int baseY, int baseZ, ExtendedFacing extendedFacing, boolean hintsOnly) { + World world=tileEntity.getWorld(); + int baseX=tileEntity.getXCoord(); + int baseY=tileEntity.getYCoord(); + int baseZ=tileEntity.getZCoord(); if (world == null || (!world.isRemote && hintsOnly)) { return false; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index c8262e8473..5c54d05e60 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -1,5 +1,7 @@ package com.github.technus.tectech.mechanics.structure; +import com.github.technus.tectech.util.Vec3Impl; + import java.util.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @@ -28,10 +30,12 @@ public class StructureDefinition implements IStructureDefinition { private static final char B='\uB000'; private static final char C='\uC000'; private static final char D='\uD000'; + private final Map navigates; private final Map> elements; private final Map shapes; private Builder() { + navigates=new HashMap<>(); elements = new HashMap<>(); shapes = new HashMap<>(); } @@ -44,6 +48,79 @@ public class StructureDefinition implements IStructureDefinition { return shapes; } + @Deprecated + public Builder addShapeOldApi(String name, String[][] structurePiece) { + StringBuilder builder = new StringBuilder(); + if (structurePiece.length > 0) { + for (String[] strings : structurePiece) { + if (strings.length > 0) { + for (String string : strings) { + for (int i = 0; i < string.length(); i++) { + char ch = string.charAt(i); + if(ch<' '){ + for (int c = 0; c < ch; c++) { + builder.append(B); + } + }else if(ch>'@'){ + for (int c = '@'; c < ch; c++) { + builder.append(A); + } + }else{ + builder.append(ch); + } + } + builder.append(B); + } + builder.setLength(builder.length() - 1); + } + builder.append(C); + } + builder.setLength(builder.length() - 1); + } + int a=0,b=0,c=0; + char d=D; + for (int i = 0; i < builder.length(); i++) { + char ch = builder.charAt(i); + if(ch =='.'){ + builder.setCharAt(i,A); + ch=A; + } + if(ch==A){ + a++; + }else if(ch==B){ + a=0; + b++; + }else if(ch==C){ + a=0; + b=0; + c++; + }else if(a!=0 || b!=0 || c!=0){ + Vec3Impl vec3 = new Vec3Impl(a, b, c); + Character navigate = navigates.get(vec3); + if(navigate==null){ + navigate=d++; + navigates.put(vec3,navigate); + addElement(navigate,step(vec3)); + } + builder.setCharAt(i-1,navigate); + a=0; + b=0; + c=0; + } + } + + String built = builder.toString().replaceAll("[\\uA000\\uB000\\uC000]",""); + + if(built.contains("+")){ + addElement('+',notAir()); + } + if (built.contains("-")) { + addElement('-', isAir()); + } + shapes.put(name, built); + return this; + } + /** * Adds shape * +- is air/no air checks @@ -92,8 +169,14 @@ public class StructureDefinition implements IStructureDefinition { b=0; c++; }else if(a!=0 || b!=0 || c!=0){ - builder.setCharAt(i-1,d); - addElement(d,step(a,b,c)); + Vec3Impl vec3 = new Vec3Impl(a, b, c); + Character navigate = navigates.get(vec3); + if(navigate==null){ + navigate=d++; + navigates.put(vec3,navigate); + addElement(navigate,step(vec3)); + } + builder.setCharAt(i-1,navigate); a=0; b=0; c=0; @@ -114,7 +197,7 @@ public class StructureDefinition implements IStructureDefinition { } public Builder addElement(Character name, IStructureElement structurePiece) { - elements.put(name, structurePiece); + elements.putIfAbsent(name, structurePiece); return this; } @@ -128,7 +211,7 @@ public class StructureDefinition implements IStructureDefinition { @SuppressWarnings("unchecked") private Map[]> compileMap() { - List mising = new ArrayList<>(); + Set mising = new HashSet<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { IStructureElement iStructureElement = elements.get((char) c); if (iStructureElement == null) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index a953cf277f..40b1793f93 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -151,6 +151,22 @@ public class StructureUtility { return ofHint(block, meta,block,meta); } + public static IStructureElement ofHintOnly(int dots){ + int meta=dots-1; + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return false; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); + return true; + } + }; + } + public static IStructureElement ofHintAdder(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta){ if(iBlockAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); -- cgit From 0f5cbab6552dfbd514f3183afd4b855f3d1ccb9d Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 27 Apr 2020 18:01:15 +0200 Subject: Addmore util --- .../tectech/loader/ConstructableLoader.java | 8 +- .../mechanics/structure/StructureUtility.java | 98 ++++++++++++++++++---- 2 files changed, 88 insertions(+), 18 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java index 537bbf8cca..4e1a2eff75 100644 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -11,7 +11,7 @@ import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.registerMetaClass; import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHintOnly; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHint; import static gregtech.api.GregTech_API.sBlockCasings1; public class ConstructableLoader implements Runnable { @@ -28,9 +28,9 @@ public class ConstructableLoader implements Runnable { {"000","\"\"\"","\"\"\""," ",}, }) .addElement('0', ofBlock(sBlockCasings1,11)) - .addElement('\"', ofHintOnly(3)) - .addElement('!', ofHintOnly(2)) - .addElement(' ', ofHintOnly(1)) + .addElement('\"', ofHint(3)) + .addElement('!', ofHint(2)) + .addElement(' ', ofHint(1)) .build(); private final String[] desc=new String[]{ EnumChatFormatting.AQUA+"Hint Details:", diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 40b1793f93..b1be2071a7 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -85,7 +85,7 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElement ofHintFlat(Map blocsMap,Block hintBlock,int hintMeta){ + public static IStructureElement ofBlocksFlatHint(Map blocsMap,Block hintBlock,int hintMeta){ if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ throw new IllegalArgumentException(); } @@ -106,7 +106,7 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElement ofHint(Map> blocsMap,Block hintBlock,int hintMeta){ + public static IStructureElement ofBlocksMapHint(Map> blocsMap,Block hintBlock,int hintMeta){ if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ throw new IllegalArgumentException(); } @@ -129,7 +129,7 @@ public class StructureUtility { }; } - public static IStructureElement ofHint(Block block, int meta,Block hintBlock,int hintMeta){ + public static IStructureElement ofBlockHint(Block block, int meta,Block hintBlock,int hintMeta){ if(block==null || hintBlock==null){ throw new IllegalArgumentException(); } @@ -147,11 +147,11 @@ public class StructureUtility { }; } - public static IStructureElement ofHint(Block block, int meta){ - return ofHint(block, meta,block,meta); + public static IStructureElement ofBlockHint(Block block, int meta){ + return ofBlockHint(block, meta,block,meta); } - public static IStructureElement ofHintOnly(int dots){ + public static IStructureElement ofHint(int dots){ int meta=dots-1; return new IStructureElement() { @Override @@ -167,7 +167,7 @@ public class StructureUtility { }; } - public static IStructureElement ofHintAdder(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta){ + public static IStructureElement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta){ if(iBlockAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } @@ -215,7 +215,7 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElement ofBlocks(Map> blocsMap,Block hintBlock,int hintMeta){ + public static IStructureElement ofBlocskMap(Map> blocsMap,Block hintBlock,int hintMeta){ if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ throw new IllegalArgumentException(); } @@ -296,7 +296,6 @@ public class StructureUtility { }; } - public static IStructureElement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta){ if(iTileAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); @@ -316,6 +315,52 @@ public class StructureUtility { }; } + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, int dots){ + int meta=dots-1; + if(iHatchAdder==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); + return true; + } + }; + } + + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, int dots, Block placeCasing,int placeCasingMeta){ + int meta=dots-1; + if(iHatchAdder==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); + return true; + } + }; + } + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, Block hintBlock, int hintMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); @@ -335,6 +380,31 @@ public class StructureUtility { }; } + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ + if(iHatchAdder==null ||hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z) { + world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); + return true; + } + }; + } + public static IStructureElement onElementPass(Consumer onCheckPass, IStructureElement element){ return new IStructureElement() { @Override @@ -381,8 +451,12 @@ public class StructureUtility { }; } + public static IStructureNavigate step(int a,int b, int c){ + return step(new Vec3Impl(a,b,c)); + } + @SuppressWarnings("unchecked") - static IStructureNavigate step(Vec3Impl step){ + public static IStructureNavigate step(Vec3Impl step){ if(step==null || step.get0()<0 || step.get1()<0 || step.get2()<0){ throw new IllegalArgumentException(); } @@ -397,10 +471,6 @@ public class StructureUtility { }); } - static IStructureNavigate step(int a,int b, int c){ - return step(new Vec3Impl(a,b,c)); - } - private static IStructureNavigate stepA(int a,int b, int c){ return new IStructureNavigate() { @Override -- cgit From d58f2055aab235a3f3ead64ef86d1dc39396cae5 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 28 Apr 2020 19:21:13 +0200 Subject: Implement new api for collider --- .../tectech/loader/ConstructableLoader.java | 6 +- .../mechanics/structure/IStructureDefinition.java | 23 +- .../mechanics/structure/IStructureElement.java | 5 +- .../mechanics/structure/IStructureFallback.java | 9 +- .../mechanics/structure/IStructureNavigate.java | 5 +- .../mechanics/structure/StructureDefinition.java | 59 ++- .../mechanics/structure/StructureUtility.java | 488 ++++++++++++++++++--- .../multi/GT_MetaTileEntity_EM_collider.java | 123 +++--- .../multi/GT_MetaTileEntity_EM_transformer.java | 2 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 8 +- 10 files changed, 570 insertions(+), 158 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java index 4e1a2eff75..dc282ec0b6 100644 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -43,9 +43,9 @@ public class ConstructableLoader implements Runnable { @Override public void construct(ItemStack stackSize, boolean hintsOnly, GT_MetaTileEntity_ElectricBlastFurnace tileEntity, ExtendedFacing aSide) { IGregTechTileEntity base = tileEntity.getBaseMetaTileEntity(); - definition.buildOrHints(tileEntity,"main", base.getWorld(),aSide, - base.getXCoord(),base.getYCoord(),base.getZCoord(), - 1, 3, 0,hintsOnly); + definition.buildOrHints(tileEntity, stackSize, "main", base.getWorld(), + aSide, base.getXCoord(), base.getYCoord(), + base.getZCoord(), 1, 3, 0, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index 9319b4954b..71305ebd92 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.mechanics.structure; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; public interface IStructureDefinition { @@ -9,39 +10,39 @@ public interface IStructureDefinition { * @param name same name as for other methods here * @return the array of elements to process */ - IStructureElement[] getElementsFor(String name); + IStructureElement[] getStructureFor(String name); default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean forceCheckAllBlocks){ - return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + return iterate(object, null, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, basePositionA, basePositionB, basePositionC,false,forceCheckAllBlocks); } - default boolean hints(T object,String piece, World world, ExtendedFacing extendedFacing, + default boolean hints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { - return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, basePositionA, basePositionB, basePositionC,true,null); } - default boolean build(T object,String piece, World world, ExtendedFacing extendedFacing, + default boolean build(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { - return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, basePositionA, basePositionB, basePositionC,false,null); } - default boolean buildOrHints(T object,String piece, World world, ExtendedFacing extendedFacing, + default boolean buildOrHints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean hintsOnly){ - return iterate(object,getElementsFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, basePositionA, basePositionB, basePositionC,hintsOnly,null); } - static boolean iterate(T object, IStructureElement[] elements, World world, ExtendedFacing extendedFacing, + static boolean iterate(T object, ItemStack trigger, IStructureElement[] elements, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){ @@ -115,7 +116,7 @@ public interface IStructureDefinition { xyz[2] += basePositionZ; if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.spawnHint(object, world, xyz[0], xyz[1], xyz[2]); + element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); } abc[0]+=1; } @@ -133,7 +134,7 @@ public interface IStructureDefinition { xyz[2] += basePositionZ; if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.placeBlock(object, world, xyz[0], xyz[1], xyz[2]); + element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger); } abc[0]+=1; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index f9510910ed..7ed173fbfa 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.structure; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; /** @@ -8,11 +9,11 @@ import net.minecraft.world.World; public interface IStructureElement { boolean check(T t,World world,int x,int y,int z); - default boolean spawnHint(T t,World world,int x,int y,int z){ + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){ return false; } - default boolean placeBlock(T t,World world,int x,int y,int z){ + default boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger){ return false; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java index 354aaf60e9..1c55753d19 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.structure; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; /** @@ -19,9 +20,9 @@ public interface IStructureFallback extends IStructureElement { } @Override - default boolean spawnHint(T t, World world, int x, int y, int z) { + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { for (IStructureElement fallback : fallbacks()) { - if (fallback.spawnHint(t, world, x, y, z)) { + if (fallback.spawnHint(t, world, x, y, z, trigger)) { return true; } } @@ -29,9 +30,9 @@ public interface IStructureFallback extends IStructureElement { } @Override - default boolean placeBlock(T t, World world, int x, int y, int z) { + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { for (IStructureElement fallback : fallbacks()) { - if (fallback.placeBlock(t, world, x, y, z)) { + if (fallback.placeBlock(t, world, x, y, z, trigger)) { return true; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java index 4628c710af..d3f4134cea 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.structure; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; /** @@ -12,12 +13,12 @@ interface IStructureNavigate extends IStructureElement { } @Override - default boolean spawnHint(T t, World world, int x, int y, int z) { + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { return true; } @Override - default boolean placeBlock(T t, World world, int x, int y, int z) { + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { return true; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index 5c54d05e60..9cc82699b9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -10,7 +10,7 @@ import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; public class StructureDefinition implements IStructureDefinition { private final Map> elements; private final Map shapes; - private final Map[]> compiled; + private final Map[]> structures; public static Builder builder() { return new Builder<>(); @@ -19,10 +19,10 @@ public class StructureDefinition implements IStructureDefinition { private StructureDefinition( Map> elements, Map shapes, - Map[]> compiled) { + Map[]> structures) { this.elements =elements; this.shapes=shapes; - this.compiled =compiled; + this.structures = structures; } public static class Builder { @@ -48,6 +48,14 @@ public class StructureDefinition implements IStructureDefinition { return shapes; } + /** + * Casings go: 0 1 2 3 4 5 6 7 8 9 : ; < = > ? + *
+ * HatchAdders go: space ! " # $ % & ' ( ) * + * @param name + * @param structurePiece + * @return + */ @Deprecated public Builder addShapeOldApi(String name, String[][] structurePiece) { StringBuilder builder = new StringBuilder(); @@ -202,15 +210,46 @@ public class StructureDefinition implements IStructureDefinition { } public IStructureDefinition build() { + Map[]> structures = compileStructureMap(); if(DEBUG_MODE){ - return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), compileMap()); + return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), structures); }else { - return compileMap()::get; + return structures::get; + } + } + + @SuppressWarnings("unchecked") + private Map[]> compileElementSetMap() { + Set mising = new HashSet<>(); + shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { + IStructureElement iStructureElement = elements.get((char) c); + if (iStructureElement == null) { + mising.add(c); + } + })); + if (mising.isEmpty()) { + Map[]> map = new HashMap<>(); + shapes.forEach((key, value) -> { + Set chars=new HashSet<>(); + for (char c : value.toCharArray()) { + chars.add(c); + } + IStructureElement[] compiled = new IStructureElement[chars.size()]; + int i=0; + for (Character aChar : chars) { + compiled[i++]=elements.get(aChar); + } + map.put(key, compiled); + }); + return map; + } else { + throw new RuntimeException("Missing Structure Element bindings for (chars as integers): " + + Arrays.toString(mising.toArray())); } } @SuppressWarnings("unchecked") - private Map[]> compileMap() { + private Map[]> compileStructureMap() { Set mising = new HashSet<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { IStructureElement iStructureElement = elements.get((char) c); @@ -243,12 +282,12 @@ public class StructureDefinition implements IStructureDefinition { return shapes; } - public Map[]> getCompiled() { - return compiled; + public Map[]> getStructures() { + return structures; } @Override - public IStructureElement[] getElementsFor(String name) { - return compiled.get(name); + public IStructureElement[] getStructureFor(String name) { + return structures.get(name); } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index b1be2071a7..1658620d2e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -11,11 +11,15 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import java.util.*; +import java.util.function.BiFunction; import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; @@ -31,7 +35,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(Object o, World world, int x, int y, int z) { + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,13); return true; } @@ -44,7 +48,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(Object o, World world, int x, int y, int z) { + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,14); return true; } @@ -57,7 +61,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(Object o, World world, int x, int y, int z) { + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,15); return true; } @@ -96,7 +100,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @@ -122,7 +126,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @@ -140,7 +144,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @@ -160,7 +164,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); return true; } @@ -178,7 +182,7 @@ public class StructureUtility { } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @@ -199,13 +203,13 @@ public class StructureUtility { } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x,y,z,hintBlock,hintMeta,2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @@ -231,13 +235,13 @@ public class StructureUtility { } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x,y,z,hintBlock,hintMeta,2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @@ -255,13 +259,13 @@ public class StructureUtility { } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x,y,z,hintBlock,hintMeta,2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @@ -283,19 +287,44 @@ public class StructureUtility { } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x,y,z,hintBlock,hintMeta,2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } }; } + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,int dots){ + int meta=dots-1; + if(iBlockAdder==null ){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return iBlockAdder.apply(t,world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x,y,z,sHintCasingsTT,meta,2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); + return true; + } + }; + } + public static IStructureElement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta){ if(iTileAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); @@ -308,14 +337,14 @@ public class StructureUtility { } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } }; } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, int dots){ + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots){ int meta=dots-1; if(iHatchAdder==null){ throw new IllegalArgumentException(); @@ -324,18 +353,18 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); return true; } }; } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, int dots, Block placeCasing,int placeCasingMeta){ + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ int meta=dots-1; if(iHatchAdder==null){ throw new IllegalArgumentException(); @@ -344,24 +373,24 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); return true; } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); return true; } }; } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, Block hintBlock, int hintMeta){ + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } @@ -369,18 +398,18 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } }; } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, Short textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } @@ -388,17 +417,17 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); return true; } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); return true; } @@ -417,13 +446,13 @@ public class StructureUtility { } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { - return element.placeBlock(t, world, x, y, z); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { - return element.spawnHint(t, world, x, y, z); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(t, world, x, y, z, trigger); } }; } @@ -440,13 +469,381 @@ public class StructureUtility { } @Override - public boolean placeBlock(T t, World world, int x, int y, int z) { - return element.placeBlock(t, world, x, y, z); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z) { - return element.spawnHint(t, world, x, y, z); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SafeVarargs + public static IStructureFallback ofElementChain(IStructureElement... elementChain){ + if(elementChain==null || elementChain.length==0){ + throw new IllegalArgumentException(); + } + for (IStructureElement iStructureElement : elementChain) { + if(iStructureElement==null){ + throw new IllegalArgumentException(); + } + } + return () -> elementChain; + } + + public static IStructureElement defer(Supplier> to){ + if(to==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return to.get().check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.get().placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.get().spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function> to){ + if(to==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return to.apply(t).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function keyExtractor,Map> map){ + if(keyExtractor==null||map==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(t)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function keyExtractor,Map> map,IStructureElement defaultElem){ + if(keyExtractor==null||map==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(t),defaultElem).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t),defaultElem).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t),defaultElem).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SafeVarargs + public static IStructureElement defer(Function keyExtractor, IStructureElement... array){ + if(keyExtractor==null||array==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractor.apply(t)].check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t)].placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t)].spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function keyExtractor,List> array){ + if(keyExtractor==null||array==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array.get(keyExtractor.apply(t)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(BiFunction> to){ + if(to==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return to.apply(t,null).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t,trigger).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t,trigger).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(BiFunction keyExtractor,Map> map){ + if(keyExtractor==null||map==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(t,null)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ + if(keyExtractor==null||map==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(t,null),defaultElem).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SafeVarargs + public static IStructureElement defer(BiFunction keyExtractor, IStructureElement... array){ + if(keyExtractor==null||array==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractor.apply(t,null)].check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t,trigger)].placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t,trigger)].spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(BiFunction keyExtractor, List> array){ + if(keyExtractor==null||array==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array.get(keyExtractor.apply(t,null)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function> toCheck, BiFunction> to){ + if(to==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return toCheck.apply(t).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t,trigger).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t,trigger).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map){ + if(keyExtractor==null||map==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ + if(keyExtractor==null||map==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractorCheck.apply(t),defaultElem).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SafeVarargs + public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor, IStructureElement... array){ + if(keyExtractor==null||array==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractorCheck.apply(t)].check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t,trigger)].placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t,trigger)].spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor, List> array){ + if(keyExtractor==null||array==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); } }; } @@ -543,19 +940,6 @@ public class StructureUtility { }; } - @SafeVarargs - public static IStructureFallback ofElementChain(IStructureElement... elementChain){ - if(elementChain==null || elementChain.length==0){ - throw new IllegalArgumentException(); - } - for (IStructureElement iStructureElement : elementChain) { - if(iStructureElement==null){ - throw new IllegalArgumentException(); - } - } - return () -> elementChain; - } - /** * Use only to get pseudo code... * @param world diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index dea65d322f..924353cd29 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -11,8 +11,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; @@ -28,8 +28,6 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -38,7 +36,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -300,47 +298,49 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {"I0A0A0", "I00000", "I0A0A0",}, - {"H0000000", "G001111100", "H0000000",}, - {"F22223332222", "F41155555114", "F22223332222",}, - {"E2000000000002", "E4155111115514", "E2000000000002",}, - {"D20000E00002", "D41511E11514", "D20000E00002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0030O0300", "0151O1510", "0030O0300",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"D200002 200002", "D415112 . 211514", "D200002 200002",}, - {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, - {"F2222#\"#2222", "F41155555114", "F2222#\"#2222",}, - }; - private static final Block[] blockType = new Block[]{ - sBlockCasingsTT, - sBlockCasingsTT, - sBlockCasingsTT, - QuantumGlassBlock.INSTANCE, - sBlockCasingsTT, - sBlockCasingsTT - }; - private static final byte[] blockMeta1 = new byte[]{4, 7, 4, 0, 4, 8}; - private static final byte[] blockMeta2 = new byte[]{4, 7, 5, 0, 6, 9}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_collider::addClassicToMachineList, - GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, - GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, - GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition + .builder() + .addShapeOldApi("main",new String[][]{ + {"I0A0A0", "I00000", "I0A0A0",}, + {"H0000000", "G001111100", "H0000000",}, + {"F22223332222", "F41155555114", "F22223332222",}, + {"E2000000000002", "E4155111115514", "E2000000000002",}, + {"D20000E00002", "D41511E11514", "D20000E00002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0030O0300", "0151O1510", "0030O0300",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, + {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, + {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT,4)) + .addElement('1', ofBlock(sBlockCasingsTT,7)) + .addElement('2', defer(t->(int)t.eTier,(t,item)->(item.stackSize%2)+1, + error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,5))) + .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE,0)) + .addElement('4', defer(t->(int)t.eTier,(t,item)->(item.stackSize%2)+1, + error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,6))) + .addElement('5', defer(t->(int)t.eTier,(t,item)->(item.stackSize%2)+1, + error(),ofBlock(sBlockCasingsTT,8),ofBlock(sBlockCasingsTT,9))) + .addElement('&', ofHatchAdder(GT_MetaTileEntity_EM_collider::addClassicToMachineList, + textureOffset,1,sBlockCasingsTT,0)) + .addElement('!', ofHatchAdder(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, + textureOffset + 4,2,sBlockCasingsTT,4)) + .addElement('$', ofHatchAdder(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, + textureOffset + 4,3,sBlockCasingsTT,4)) + .addElement('#', ofHatchAdder(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, + textureOffset + 4,4,sBlockCasingsTT,4)) + .build(); private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing @@ -349,6 +349,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction }; + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + //endregion public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { @@ -470,20 +476,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB eTier = 0; return false; } - - boolean test; - switch (eTier) { - case 1: - test = structureCheck_EM(shape, blockType, blockMeta1, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 11, 1, 18); - break; - case 2: - test = structureCheck_EM(shape, blockType, blockMeta2, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 11, 1, 18); - break; - default: - eTier = 0; - return false; - } - if (test) { + if (structureCheck_EM("main",11, 1, 18)) { return true; } eTier = 0; @@ -681,16 +674,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); - } - } - if ((stackSize.stackSize & 1) == 1) { - Structure.builder(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); - } else { - Structure.builder(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } + structureBuild_EM("main",11, 1, 18,hintsOnly, stackSize); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 2d7fc5b524..26a8af04ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -160,7 +160,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, hintsOnly); + structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } @Override 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 dc9c6d39e5..3e53f63736 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 @@ -216,11 +216,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt horizontalOffset,verticalOffset,depthOffset,!mMachine); } - public final boolean structureBuild_EM(String piece,int horizontalOffset, int verticalOffset, int depthOffset,boolean hintsOnly) { + public final boolean structureBuild_EM(String piece,int horizontalOffset, int verticalOffset, int depthOffset,boolean hintsOnly,ItemStack trigger) { IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); - return getStructure_EM_Internal().buildOrHints(this,piece, baseMetaTileEntity.getWorld(),getExtendedFacing(), - baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord(), - horizontalOffset,verticalOffset,depthOffset,hintsOnly); + return getStructure_EM_Internal().buildOrHints(this, trigger, piece, baseMetaTileEntity.getWorld(), + getExtendedFacing(), baseMetaTileEntity.getXCoord(), baseMetaTileEntity.getYCoord(), + baseMetaTileEntity.getZCoord(), horizontalOffset, verticalOffset, depthOffset, hintsOnly); } @Deprecated -- cgit From c6615bd442b41170c6ab46d948d832bc063f2b4a Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 28 Apr 2020 21:47:13 +0200 Subject: Add optional hatch adders --- .../mechanics/structure/StructureUtility.java | 55 ++++++++++++++++++++++ .../multi/GT_MetaTileEntity_EM_collider.java | 14 +++--- 2 files changed, 62 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 1658620d2e..467140cb2c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -390,6 +390,34 @@ public class StructureUtility { }; } + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ + int meta=dots-1; + if(iHatchAdder==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && + (iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex) || + (world.getBlock(x,y,z)==placeCasing&&world.getBlockMetadata(x,y,z)==placeCasingMeta)); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); + return true; + } + }; + } + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); @@ -434,6 +462,33 @@ public class StructureUtility { }; } + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ + if(iHatchAdder==null ||hintBlock==null){ + throw new IllegalArgumentException(); + } + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && + (iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex) || + (world.getBlock(x,y,z)==placeCasing&&world.getBlockMetadata(x,y,z)==placeCasingMeta)); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); + return true; + } + }; + } + public static IStructureElement onElementPass(Consumer onCheckPass, IStructureElement element){ return new IStructureElement() { @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 924353cd29..2782e7924f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -325,20 +325,20 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }) .addElement('0', ofBlock(sBlockCasingsTT,4)) .addElement('1', ofBlock(sBlockCasingsTT,7)) - .addElement('2', defer(t->(int)t.eTier,(t,item)->(item.stackSize%2)+1, + .addElement('2', defer(t->(int)t.eTier,(t,item)->(item.stackSize&1)+1, error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,5))) .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE,0)) - .addElement('4', defer(t->(int)t.eTier,(t,item)->(item.stackSize%2)+1, + .addElement('4', defer(t->(int)t.eTier,(t,item)->(item.stackSize&1)+1, error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,6))) - .addElement('5', defer(t->(int)t.eTier,(t,item)->(item.stackSize%2)+1, + .addElement('5', defer(t->(int)t.eTier,(t,item)->(item.stackSize&1)+1, error(),ofBlock(sBlockCasingsTT,8),ofBlock(sBlockCasingsTT,9))) - .addElement('&', ofHatchAdder(GT_MetaTileEntity_EM_collider::addClassicToMachineList, + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, textureOffset,1,sBlockCasingsTT,0)) - .addElement('!', ofHatchAdder(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, textureOffset + 4,2,sBlockCasingsTT,4)) - .addElement('$', ofHatchAdder(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, textureOffset + 4,3,sBlockCasingsTT,4)) - .addElement('#', ofHatchAdder(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, + .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, textureOffset + 4,4,sBlockCasingsTT,4)) .build(); private static final String[] description = new String[]{ -- cgit From 15dbf1c823e31c437cde0b3e186f791b71ec3506 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 29 Apr 2020 20:50:47 +0200 Subject: Cleanup struct util --- .../mechanics/structure/IStructureElement.java | 8 +- .../structure/IStructureElementChain.java | 41 +++ .../structure/IStructureElementCheckOnly.java | 16 + .../structure/IStructureElementDeferred.java | 7 + .../structure/IStructureElementNoPlacement.java | 11 + .../mechanics/structure/IStructureFallback.java | 41 --- .../mechanics/structure/StructureUtility.java | 374 ++++++++------------- .../multi/GT_MetaTileEntity_EM_transformer.java | 2 +- 8 files changed, 223 insertions(+), 277 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index 7ed173fbfa..f946e71f91 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -9,13 +9,9 @@ import net.minecraft.world.World; public interface IStructureElement { boolean check(T t,World world,int x,int y,int z); - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){ - return false; - } + boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger); - default boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger){ - return false; - } + boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger); default int getStepA(){ return 1; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java new file mode 100644 index 0000000000..f9593ee1c5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java @@ -0,0 +1,41 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureElementChain extends IStructureElement { + IStructureElement[] fallbacks(); + + @Override + default boolean check(T t, World world, int x, int y, int z){ + for (IStructureElement fallback : fallbacks()) { + if (fallback.check(t, world, x, y, z)) { + return true; + } + } + return false; + } + + @Override + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.spawnHint(t, world, x, y, z, trigger)) { + return true; + } + } + return false; + } + + @Override + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.placeBlock(t, world, x, y, z, trigger)) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java new file mode 100644 index 0000000000..ec15aea53b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IStructureElementCheckOnly extends IStructureElement { + @Override + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ + return false; + } + + @Override + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){ + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java new file mode 100644 index 0000000000..dbb74312a8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java @@ -0,0 +1,7 @@ +package com.github.technus.tectech.mechanics.structure; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureElementDeferred extends IStructureElement { +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java new file mode 100644 index 0000000000..47e6060878 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java @@ -0,0 +1,11 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IStructureElementNoPlacement extends IStructureElement { + @Override + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java deleted file mode 100644 index 1c55753d19..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureFallback.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Use StructureUtility to instantiate - */ -public interface IStructureFallback extends IStructureElement { - IStructureElement[] fallbacks(); - - @Override - default boolean check(T t, World world, int x, int y, int z){ - for (IStructureElement fallback : fallbacks()) { - if (fallback.check(t, world, x, y, z)) { - return true; - } - } - return false; - } - - @Override - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - for (IStructureElement fallback : fallbacks()) { - if (fallback.spawnHint(t, world, x, y, z, trigger)) { - return true; - } - } - return false; - } - - @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - for (IStructureElement fallback : fallbacks()) { - if (fallback.placeBlock(t, world, x, y, z, trigger)) { - return true; - } - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 467140cb2c..68c00cf1ac 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -39,6 +39,12 @@ public class StructureUtility { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,13); return true; } + + @Override + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x,y,z,Blocks.air,0,2); + return false; + } }; @SuppressWarnings("rawtypes") private static final IStructureElement NOT_AIR= new IStructureElement() { @@ -52,6 +58,12 @@ public class StructureUtility { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,14); return true; } + + @Override + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x,y,z,sHintCasingsTT,14,2); + return true; + } }; @SuppressWarnings("rawtypes") private static final IStructureElement ERROR= new IStructureElement() { @@ -65,6 +77,11 @@ public class StructureUtility { TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,15); return true; } + + @Override + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + return true; + } }; private StructureUtility(){ @@ -81,19 +98,48 @@ public class StructureUtility { return NOT_AIR; } + /** + * Check returns false. + * Placement is always handled by this and does nothing. + * Makes little to no use it in fallback chain. + * @param + * @return + */ @SuppressWarnings("unchecked") public static IStructureElement error(){ return ERROR; } + /** + * Check always returns: true. + * @param dots + * @param + * @return + */ + public static IStructureElementNoPlacement ofHint(int dots){ + int meta=dots-1; + return new IStructureElementNoPlacement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, meta); + return false; + } + }; + } + /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElement ofBlocksFlatHint(Map blocsMap,Block hintBlock,int hintMeta){ + public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta){ if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { return blocsMap.getOrDefault(world.getBlock(x, y, z), -1) == world.getBlockMetadata(x, y, z); @@ -110,7 +156,7 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElement ofBlocksMapHint(Map> blocsMap,Block hintBlock,int hintMeta){ + public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta){ if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ throw new IllegalArgumentException(); } @@ -119,7 +165,7 @@ public class StructureUtility { throw new IllegalArgumentException(); } } - return new IStructureElement() { + return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { return blocsMap.getOrDefault(world.getBlock(x, y, z), Collections.emptySet()).contains(world.getBlockMetadata(x, y, z)); @@ -133,11 +179,11 @@ public class StructureUtility { }; } - public static IStructureElement ofBlockHint(Block block, int meta,Block hintBlock,int hintMeta){ + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta,Block hintBlock,int hintMeta){ if(block==null || hintBlock==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { return block == world.getBlock(x, y, z) && meta == world.getBlockMetadata(x, y, z); @@ -151,31 +197,15 @@ public class StructureUtility { }; } - public static IStructureElement ofBlockHint(Block block, int meta){ + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta){ return ofBlockHint(block, meta,block,meta); } - public static IStructureElement ofHint(int dots){ - int meta=dots-1; - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return false; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); - return true; - } - }; - } - - public static IStructureElement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta){ + public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta){ if(iBlockAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { return iBlockAdder.apply(t,world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); @@ -192,8 +222,8 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElement ofBlocksFlat(Map blocsMap,Block hintBlock,int hintMeta){ - if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + public static IStructureElement ofBlocksFlat(Map blocsMap,Block defaultBlock,int defaultMeta){ + if(blocsMap==null || blocsMap.isEmpty() || defaultBlock==null){ throw new IllegalArgumentException(); } return new IStructureElement() { @@ -204,13 +234,13 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,hintBlock,hintMeta,2); + world.setBlock(x,y,z,defaultBlock,defaultMeta,2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); return true; } }; @@ -219,8 +249,8 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElement ofBlocskMap(Map> blocsMap,Block hintBlock,int hintMeta){ - if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta){ + if(blocsMap==null || blocsMap.isEmpty() || defaultBlock==null){ throw new IllegalArgumentException(); } for (Set value : blocsMap.values()) { @@ -236,20 +266,20 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,hintBlock,hintMeta,2); + world.setBlock(x,y,z,defaultBlock,defaultMeta,2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); return true; } }; } - public static IStructureElement ofBlock(Block block, int meta,Block hintBlock,int hintMeta){ - if(block==null || hintBlock==null){ + public static IStructureElement ofBlock(Block block, int meta,Block defaultBlock,int defaultMeta){ + if(block==null || defaultBlock==null){ throw new IllegalArgumentException(); } return new IStructureElement() { @@ -260,13 +290,13 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,hintBlock,hintMeta,2); + world.setBlock(x,y,z,defaultBlock,defaultMeta,2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); return true; } }; @@ -276,8 +306,8 @@ public class StructureUtility { return ofBlock(block, meta,block,meta); } - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,Block hintBlock,int hintMeta){ - if(iBlockAdder==null ||hintBlock==null){ + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,Block defaultBlock,int defaultMeta){ + if(iBlockAdder==null ||defaultBlock==null){ throw new IllegalArgumentException(); } return new IStructureElement() { @@ -288,48 +318,27 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,hintBlock,hintMeta,2); + world.setBlock(x,y,z,defaultBlock,defaultMeta,2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); return true; } }; } public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,int dots){ - int meta=dots-1; - if(iBlockAdder==null ){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return iBlockAdder.apply(t,world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,sHintCasingsTT,meta,2); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); - return true; - } - }; + return ofBlockAdder(iBlockAdder,sHintCasingsTT,dots-1); } - public static IStructureElement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta){ + public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta){ if(iTileAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); @@ -344,85 +353,15 @@ public class StructureUtility { }; } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots){ - int meta=dots-1; - if(iHatchAdder==null){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); - return true; - } - }; + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots){ + return ofHatchAdder(iHatchAdder, textureIndex,sHintCasingsTT, dots-1); } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ - int meta=dots-1; - if(iHatchAdder==null){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); - return true; - } - }; - } - - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ - int meta=dots-1; - if(iHatchAdder==null){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && - (iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex) || - (world.getBlock(x,y,z)==placeCasing&&world.getBlockMetadata(x,y,z)==placeCasingMeta)); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,meta); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); - return true; - } - }; - } - - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta){ + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); @@ -437,6 +376,10 @@ public class StructureUtility { }; } + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ + return ofHatchAdder(iHatchAdder, textureIndex,sHintCasingsTT, dots-1, placeCasing, placeCasingMeta); + } + public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); @@ -462,6 +405,10 @@ public class StructureUtility { }; } + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ + return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots-1, placeCasing, placeCasingMeta); + } + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ if(iHatchAdder==null ||hintBlock==null){ throw new IllegalArgumentException(); @@ -489,7 +436,7 @@ public class StructureUtility { }; } - public static IStructureElement onElementPass(Consumer onCheckPass, IStructureElement element){ + public static ,T> IStructureElement onElementPass(Consumer onCheckPass, B element){ return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -512,7 +459,7 @@ public class StructureUtility { }; } - public static IStructureElement onElementFail(Consumer onFail, IStructureElement element){ + public static ,T> IStructureElement onElementFail(Consumer onFail, B element){ return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -535,8 +482,16 @@ public class StructureUtility { }; } + + /** + * Take care while chaining, as it will try to call every structure element until it returns true. + * If none does it will finally return false. + * @param elementChain + * @param + * @return + */ @SafeVarargs - public static IStructureFallback ofElementChain(IStructureElement... elementChain){ + public static IStructureElementChain ofChain(IStructureElement... elementChain){ if(elementChain==null || elementChain.length==0){ throw new IllegalArgumentException(); } @@ -548,11 +503,23 @@ public class StructureUtility { return () -> elementChain; } - public static IStructureElement defer(Supplier> to){ + /** + * Take care while chaining, as it will try to call every structure element until it returns true. + * If none does it will finally return false. + * @param elementChain + * @param + * @return + */ + @SuppressWarnings("unchecked") + public static IStructureElementChain ofChain(List> elementChain){ + return ofChain(elementChain.toArray(new IStructureElement[0])); + } + + public static IStructureElementDeferred defer(Supplier> to){ if(to==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return to.get().check(t, world, x, y, z); @@ -570,11 +537,11 @@ public class StructureUtility { }; } - public static IStructureElement defer(Function> to){ + public static IStructureElementDeferred defer(Function> to){ if(to==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return to.apply(t).check(t, world, x, y, z); @@ -592,11 +559,11 @@ public class StructureUtility { }; } - public static IStructureElement defer(Function keyExtractor,Map> map){ + public static IStructureElementDeferred defer(Function keyExtractor,Map> map){ if(keyExtractor==null||map==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return map.get(keyExtractor.apply(t)).check(t, world, x, y, z); @@ -614,11 +581,11 @@ public class StructureUtility { }; } - public static IStructureElement defer(Function keyExtractor,Map> map,IStructureElement defaultElem){ + public static IStructureElementDeferred defer(Function keyExtractor,Map> map,IStructureElement defaultElem){ if(keyExtractor==null||map==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return map.getOrDefault(keyExtractor.apply(t),defaultElem).check(t, world, x, y, z); @@ -637,11 +604,11 @@ public class StructureUtility { } @SafeVarargs - public static IStructureElement defer(Function keyExtractor, IStructureElement... array){ + public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array){ if(keyExtractor==null||array==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return array[keyExtractor.apply(t)].check(t, world, x, y, z); @@ -659,33 +626,16 @@ public class StructureUtility { }; } - public static IStructureElement defer(Function keyExtractor,List> array){ - if(keyExtractor==null||array==null){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return array.get(keyExtractor.apply(t)).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger); - } - }; + @SuppressWarnings("unchecked") + public static IStructureElementDeferred defer(Function keyExtractor,List> array){ + return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElement defer(BiFunction> to){ + public static IStructureElementDeferred defer(BiFunction> to){ if(to==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return to.apply(t,null).check(t, world, x, y, z); @@ -703,11 +653,11 @@ public class StructureUtility { }; } - public static IStructureElement defer(BiFunction keyExtractor,Map> map){ + public static IStructureElementDeferred defer(BiFunction keyExtractor,Map> map){ if(keyExtractor==null||map==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return map.get(keyExtractor.apply(t,null)).check(t, world, x, y, z); @@ -725,11 +675,11 @@ public class StructureUtility { }; } - public static IStructureElement defer(BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ + public static IStructureElementDeferred defer(BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ if(keyExtractor==null||map==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return map.getOrDefault(keyExtractor.apply(t,null),defaultElem).check(t, world, x, y, z); @@ -748,11 +698,11 @@ public class StructureUtility { } @SafeVarargs - public static IStructureElement defer(BiFunction keyExtractor, IStructureElement... array){ + public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array){ if(keyExtractor==null||array==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return array[keyExtractor.apply(t,null)].check(t, world, x, y, z); @@ -770,33 +720,16 @@ public class StructureUtility { }; } - public static IStructureElement defer(BiFunction keyExtractor, List> array){ - if(keyExtractor==null||array==null){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return array.get(keyExtractor.apply(t,null)).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); - } - }; + @SuppressWarnings("unchecked") + public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array){ + return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElement defer(Function> toCheck, BiFunction> to){ + public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to){ if(to==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return toCheck.apply(t).check(t, world, x, y, z); @@ -814,11 +747,11 @@ public class StructureUtility { }; } - public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map){ + public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map){ if(keyExtractor==null||map==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return map.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); @@ -836,11 +769,11 @@ public class StructureUtility { }; } - public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ + public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ if(keyExtractor==null||map==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return map.getOrDefault(keyExtractorCheck.apply(t),defaultElem).check(t, world, x, y, z); @@ -859,11 +792,11 @@ public class StructureUtility { } @SafeVarargs - public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor, IStructureElement... array){ + public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor, IStructureElement... array){ if(keyExtractor==null||array==null){ throw new IllegalArgumentException(); } - return new IStructureElement() { + return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { return array[keyExtractorCheck.apply(t)].check(t, world, x, y, z); @@ -881,26 +814,9 @@ public class StructureUtility { }; } - public static IStructureElement defer(Function keyExtractorCheck,BiFunction keyExtractor, List> array){ - if(keyExtractor==null||array==null){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return array.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); - } - }; + @SuppressWarnings("unchecked") + public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor, List> array){ + return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0])); } public static IStructureNavigate step(int a,int b, int c){ @@ -996,7 +912,7 @@ public class StructureUtility { } /** - * Use only to get pseudo code... + * Used only to get pseudo code in structure writer... * @param world * @return */ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 26a8af04ed..bfd74ab448 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -45,7 +45,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo {"111", "111", "111",}, }) .addElement('0', ofBlock(sBlockCasings1,15)) - .addElement('1', ofElementChain( + .addElement('1', ofChain( ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), onElementPass(t->t.casingCount++,ofBlock(sBlockCasingsTT,0)) )) -- cgit From 9099a93e902cd29f5312f4691e00be91c2dbe554 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 29 Apr 2020 20:57:41 +0200 Subject: Remove pointless methods --- .../mechanics/structure/StructureUtility.java | 29 ---------------------- 1 file changed, 29 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 68c00cf1ac..1f8beaa240 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -376,35 +376,6 @@ public class StructureUtility { }; } - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ - return ofHatchAdder(iHatchAdder, textureIndex,sHintCasingsTT, dots-1, placeCasing, placeCasingMeta); - } - - public static IStructureElement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ - if(iHatchAdder==null ||hintBlock==null){ - throw new IllegalArgumentException(); - } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); - return true; - } - }; - } - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots-1, placeCasing, placeCasingMeta); } -- cgit From 31f7fc89f41e430494bb6e03415f58049f85da51 Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 1 May 2020 10:47:04 +0200 Subject: Fix navigation, move handles to util --- .../mechanics/alignment/AlignmentUtility.java | 45 ++ .../constructable/ConstructableUtility.java | 114 +++++ .../mechanics/structure/IStructureDefinition.java | 5 +- .../mechanics/structure/StructureDefinition.java | 38 +- .../mechanics/structure/StructureUtility.java | 481 ++++++++++++--------- .../thing/item/ConstructableTriggerItem.java | 104 +---- .../technus/tectech/thing/item/EuMeterGT.java | 2 +- .../thing/item/FrontRotationTriggerItem.java | 36 +- 8 files changed, 468 insertions(+), 357 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java new file mode 100644 index 0000000000..68e11b77af --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.alignment; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; + +public class AlignmentUtility { + private AlignmentUtility(){ + + } + + public static boolean handle(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ){ + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if(tTileEntity==null || aPlayer instanceof FakePlayer) { + return aPlayer instanceof EntityPlayerMP; + } + if (aPlayer instanceof EntityPlayerMP) { + if (tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (metaTE instanceof IAlignmentProvider) { + IAlignment alignment = ((IAlignmentProvider) metaTE).getAlignment(); + if(aPlayer.isSneaking()){ + alignment.toolSetFlip(null); + }else { + alignment.toolSetRotation(null); + } + return true; + } + } else if (tTileEntity instanceof IAlignmentProvider) { + IAlignment alignment = ((IAlignmentProvider) tTileEntity).getAlignment(); + if(aPlayer.isSneaking()){ + alignment.toolSetFlip(null); + }else { + alignment.toolSetRotation(null); + } + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java new file mode 100644 index 0000000000..2dc74330f9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java @@ -0,0 +1,114 @@ +package com.github.technus.tectech.mechanics.constructable; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.ForgeDirection; + +public class ConstructableUtility { + private ConstructableUtility(){ + + } + + public static boolean handle(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if(tTileEntity==null || aPlayer instanceof FakePlayer) { + return aPlayer instanceof EntityPlayerMP; + } + if (aPlayer instanceof EntityPlayerMP) { + //struct gen + if (aPlayer.isSneaking() && aPlayer.capabilities.isCreativeMode) { + if (tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (metaTE instanceof IConstructable) { + ((IConstructable) metaTE).construct(aStack, false); + } else if (IMultiblockInfoContainer.contains(metaTE.getClass())) { + IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, metaTE, ( + (IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, metaTE, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } + } + } else if (tTileEntity instanceof IConstructable) { + ((IConstructable) tTileEntity).construct(aStack, false); + } else if (IMultiblockInfoContainer.contains(tTileEntity.getClass())) { + IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(tTileEntity.getClass()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); + } + } + } + return true; + }else if (TecTech.proxy.isThePlayer(aPlayer)){//particles and text client side + //if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) { + if(tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (metaTE instanceof IConstructable) { + ((IConstructable) metaTE).construct(aStack, true); + TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack)); + return false; + } else if(IMultiblockInfoContainer.contains(metaTE.getClass())){ + IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, metaTE, + ((IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, metaTE, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } + TecTech.proxy.printInchat(IMultiblockInfoContainer.get(metaTE.getClass()).getDescription(aStack)); + return false; + } + } else if(tTileEntity instanceof IConstructable){ + ((IConstructable) tTileEntity).construct(aStack,true); + TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack)); + return false; + } else if(IMultiblockInfoContainer.contains(tTileEntity.getClass())){ + IMultiblockInfoContainer iMultiblockInfoContainer = IMultiblockInfoContainer.get(tTileEntity.getClass()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); + } + TecTech.proxy.printInchat(IMultiblockInfoContainer.get(tTileEntity.getClass()).getDescription(aStack)); + return false; + } + //} else { + // if(tTileEntity instanceof IGregTechTileEntity) { + // IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + // if (metaTE instanceof IConstructable) { + // TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); + // return false; + // } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ + // TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + // return false; + // } + // } else if(tTileEntity instanceof IConstructable){ + // TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); + // return false; + // } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ + // TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + // return false; + // } + //} + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index 71305ebd92..542d13a7cd 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -115,9 +115,8 @@ public interface IStructureDefinition { xyz[1] += basePositionY; xyz[2] += basePositionZ; - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); - } + element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); + abc[0]+=1; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index 9cc82699b9..29114647ac 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.structure; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Vec3Impl; import java.util.*; @@ -29,7 +30,7 @@ public class StructureDefinition implements IStructureDefinition { private static final char A='\uA000'; private static final char B='\uB000'; private static final char C='\uC000'; - private static final char D='\uD000'; + private char d ='\uD000'; private final Map navigates; private final Map> elements; private final Map shapes; @@ -61,8 +62,12 @@ public class StructureDefinition implements IStructureDefinition { StringBuilder builder = new StringBuilder(); if (structurePiece.length > 0) { for (String[] strings : structurePiece) { + + if (strings.length > 0) { for (String string : strings) { + + for (int i = 0; i < string.length(); i++) { char ch = string.charAt(i); if(ch<' '){ @@ -77,16 +82,29 @@ public class StructureDefinition implements IStructureDefinition { builder.append(ch); } } + + builder.append(B); } builder.setLength(builder.length() - 1); } + + builder.append(C); } builder.setLength(builder.length() - 1); } + if(DEBUG_MODE){ + Exception exception = new Exception(); + exception.getStackTrace(); + + TecTech.LOGGER.info("Structure shape normal:"); + + + TecTech.LOGGER.info("Structure shape transposed:"); + + } int a=0,b=0,c=0; - char d=D; for (int i = 0; i < builder.length(); i++) { char ch = builder.charAt(i); if(ch =='.'){ @@ -106,7 +124,7 @@ public class StructureDefinition implements IStructureDefinition { Vec3Impl vec3 = new Vec3Impl(a, b, c); Character navigate = navigates.get(vec3); if(navigate==null){ - navigate=d++; + navigate= d++; navigates.put(vec3,navigate); addElement(navigate,step(vec3)); } @@ -137,8 +155,8 @@ public class StructureDefinition implements IStructureDefinition { * rest needs to be defined * * next char is next block(a) - * next string is next line(a,b) - * next string[] is next slice(a,b,c) + * next string is next line(b) + * next string[] is next slice(c) * * char A000-FFFF range is reserved for generated skips * @param name unlocalized/code name @@ -160,7 +178,6 @@ public class StructureDefinition implements IStructureDefinition { builder.setLength(builder.length() - 1); } int a=0,b=0,c=0; - char d=D; for (int i = 0; i < builder.length(); i++) { char ch = builder.charAt(i); if(ch ==' ' || ch =='.'){ @@ -188,7 +205,6 @@ public class StructureDefinition implements IStructureDefinition { a=0; b=0; c=0; - d++; } } @@ -220,14 +236,14 @@ public class StructureDefinition implements IStructureDefinition { @SuppressWarnings("unchecked") private Map[]> compileElementSetMap() { - Set mising = new HashSet<>(); + Set missing = new HashSet<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { IStructureElement iStructureElement = elements.get((char) c); if (iStructureElement == null) { - mising.add(c); + missing.add(c); } })); - if (mising.isEmpty()) { + if (missing.isEmpty()) { Map[]> map = new HashMap<>(); shapes.forEach((key, value) -> { Set chars=new HashSet<>(); @@ -244,7 +260,7 @@ public class StructureDefinition implements IStructureDefinition { return map; } else { throw new RuntimeException("Missing Structure Element bindings for (chars as integers): " + - Arrays.toString(mising.toArray())); + Arrays.toString(missing.toArray())); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 1f8beaa240..868bfec181 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -24,11 +24,11 @@ import java.util.function.Supplier; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; public class StructureUtility { - private static final String NICE_CHARS ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_=|[]{};:'<>,./?"; + private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_=|[]{};:'<>,./?"; @SuppressWarnings("rawtypes") - private static final Map STEP = new HashMap<>(); + private static final Map STEP = new HashMap<>(); @SuppressWarnings("rawtypes") - private static final IStructureElement AIR= new IStructureElement() { + private static final IStructureElement AIR = new IStructureElement() { @Override public boolean check(Object t, World world, int x, int y, int z) { return world.getBlock(x, y, z).getMaterial() == Material.air; @@ -36,18 +36,18 @@ public class StructureUtility { @Override public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,13); + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 13); return true; } @Override public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,Blocks.air,0,2); + world.setBlock(x, y, z, Blocks.air, 0, 2); return false; } }; @SuppressWarnings("rawtypes") - private static final IStructureElement NOT_AIR= new IStructureElement() { + private static final IStructureElement NOT_AIR = new IStructureElement() { @Override public boolean check(Object t, World world, int x, int y, int z) { return world.getBlock(x, y, z).getMaterial() != Material.air; @@ -55,18 +55,18 @@ public class StructureUtility { @Override public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,14); + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 14); return true; } @Override public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,sHintCasingsTT,14,2); + world.setBlock(x, y, z, sHintCasingsTT, 14, 2); return true; } }; @SuppressWarnings("rawtypes") - private static final IStructureElement ERROR= new IStructureElement() { + private static final IStructureElement ERROR = new IStructureElement() { @Override public boolean check(Object t, World world, int x, int y, int z) { return false; @@ -74,7 +74,7 @@ public class StructureUtility { @Override public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,15); + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 15); return true; } @@ -84,17 +84,17 @@ public class StructureUtility { } }; - private StructureUtility(){ + private StructureUtility() { } @SuppressWarnings("unchecked") - public static IStructureElement isAir(){ + public static IStructureElement isAir() { return AIR; } @SuppressWarnings("unchecked") - public static IStructureElement notAir(){ + public static IStructureElement notAir() { return NOT_AIR; } @@ -102,22 +102,24 @@ public class StructureUtility { * Check returns false. * Placement is always handled by this and does nothing. * Makes little to no use it in fallback chain. + * * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureElement error(){ + public static IStructureElement error() { return ERROR; } /** * Check always returns: true. + * * @param dots * @param * @return */ - public static IStructureElementNoPlacement ofHint(int dots){ - int meta=dots-1; + public static IStructureElementNoPlacement ofHint(int dots) { + int meta = dots - 1; return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -135,8 +137,8 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta){ - if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta) { + if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { throw new IllegalArgumentException(); } return new IStructureElementNoPlacement() { @@ -147,7 +149,7 @@ public class StructureUtility { @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; @@ -156,12 +158,12 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta){ - if(blocsMap==null || blocsMap.isEmpty() || hintBlock==null){ + public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta) { + if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { throw new IllegalArgumentException(); } for (Set value : blocsMap.values()) { - if(value.isEmpty()){ + if (value.isEmpty()) { throw new IllegalArgumentException(); } } @@ -173,14 +175,14 @@ public class StructureUtility { @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta,Block hintBlock,int hintMeta){ - if(block==null || hintBlock==null){ + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) { + if (block == null || hintBlock == null) { throw new IllegalArgumentException(); } return new IStructureElementNoPlacement() { @@ -191,29 +193,29 @@ public class StructureUtility { @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta){ - return ofBlockHint(block, meta,block,meta); + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta) { + return ofBlockHint(block, meta, block, meta); } - public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta){ - if(iBlockAdder==null ||hintBlock==null){ + public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta) { + if (iBlockAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return iBlockAdder.apply(t,world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + return iBlockAdder.apply(t, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; @@ -222,8 +224,8 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElement ofBlocksFlat(Map blocsMap,Block defaultBlock,int defaultMeta){ - if(blocsMap==null || blocsMap.isEmpty() || defaultBlock==null){ + public static IStructureElement ofBlocksFlat(Map blocsMap, Block defaultBlock, int defaultMeta) { + if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { throw new IllegalArgumentException(); } return new IStructureElement() { @@ -234,13 +236,13 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,defaultBlock,defaultMeta,2); + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; @@ -249,12 +251,12 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta){ - if(blocsMap==null || blocsMap.isEmpty() || defaultBlock==null){ + public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta) { + if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { throw new IllegalArgumentException(); } for (Set value : blocsMap.values()) { - if(value.isEmpty()){ + if (value.isEmpty()) { throw new IllegalArgumentException(); } } @@ -266,20 +268,20 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,defaultBlock,defaultMeta,2); + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; } - public static IStructureElement ofBlock(Block block, int meta,Block defaultBlock,int defaultMeta){ - if(block==null || defaultBlock==null){ + public static IStructureElement ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { + if (block == null || defaultBlock == null) { throw new IllegalArgumentException(); } return new IStructureElement() { @@ -290,98 +292,98 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,defaultBlock,defaultMeta,2); + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; } - public static IStructureElement ofBlock(Block block, int meta){ - return ofBlock(block, meta,block,meta); + public static IStructureElement ofBlock(Block block, int meta) { + return ofBlock(block, meta, block, meta); } - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,Block defaultBlock,int defaultMeta){ - if(iBlockAdder==null ||defaultBlock==null){ + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, int defaultMeta) { + if (iBlockAdder == null || defaultBlock == null) { throw new IllegalArgumentException(); } return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return iBlockAdder.apply(t,world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + return iBlockAdder.apply(t, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,defaultBlock,defaultMeta,2); + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,defaultBlock,defaultMeta); + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; } - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder,int dots){ - return ofBlockAdder(iBlockAdder,sHintCasingsTT,dots-1); + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, int dots) { + return ofBlockAdder(iBlockAdder, sHintCasingsTT, dots - 1); } - public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta){ - if(iTileAdder==null ||hintBlock==null){ + public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta) { + if (iTileAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t,tileEntity); + return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t, tileEntity); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots){ - return ofHatchAdder(iHatchAdder, textureIndex,sHintCasingsTT, dots-1); + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots) { + return ofHatchAdder(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1); } - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta){ - if(iHatchAdder==null ||hintBlock==null){ + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) { + if (iHatchAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing,int placeCasingMeta){ - return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots-1, placeCasing, placeCasingMeta); + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { + return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1, placeCasing, placeCasingMeta); } - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing,int placeCasingMeta){ - if(iHatchAdder==null ||hintBlock==null){ + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { + if (iHatchAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } return new IStructureElement() { @@ -389,30 +391,30 @@ public class StructureUtility { public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); return tileEntity instanceof IGregTechTileEntity && - (iHatchAdder.apply(t,(IGregTechTileEntity) tileEntity, (short)textureIndex) || - (world.getBlock(x,y,z)==placeCasing&&world.getBlockMetadata(x,y,z)==placeCasingMeta)); + (iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex) || + (world.getBlock(x, y, z) == placeCasing && world.getBlockMetadata(x, y, z) == placeCasingMeta)); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world,x,y,z,hintBlock,hintMeta); + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x,y,z,placeCasing,placeCasingMeta,2); + world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); return true; } }; } - public static ,T> IStructureElement onElementPass(Consumer onCheckPass, B element){ + public static , T> IStructureElement onElementPass(Consumer onCheckPass, B element) { return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { boolean check = element.check(t, world, x, y, z); - if(check){ + if (check) { onCheckPass.accept(t); } return check; @@ -430,12 +432,12 @@ public class StructureUtility { }; } - public static ,T> IStructureElement onElementFail(Consumer onFail, B element){ + public static , T> IStructureElement onElementFail(Consumer onFail, B element) { return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { boolean check = element.check(t, world, x, y, z); - if(!check){ + if (!check) { onFail.accept(t); } return check; @@ -457,17 +459,18 @@ public class StructureUtility { /** * Take care while chaining, as it will try to call every structure element until it returns true. * If none does it will finally return false. + * * @param elementChain * @param * @return */ @SafeVarargs - public static IStructureElementChain ofChain(IStructureElement... elementChain){ - if(elementChain==null || elementChain.length==0){ + public static IStructureElementChain ofChain(IStructureElement... elementChain) { + if (elementChain == null || elementChain.length == 0) { throw new IllegalArgumentException(); } for (IStructureElement iStructureElement : elementChain) { - if(iStructureElement==null){ + if (iStructureElement == null) { throw new IllegalArgumentException(); } } @@ -477,17 +480,18 @@ public class StructureUtility { /** * Take care while chaining, as it will try to call every structure element until it returns true. * If none does it will finally return false. + * * @param elementChain * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureElementChain ofChain(List> elementChain){ + public static IStructureElementChain ofChain(List> elementChain) { return ofChain(elementChain.toArray(new IStructureElement[0])); } - public static IStructureElementDeferred defer(Supplier> to){ - if(to==null){ + public static IStructureElementDeferred defer(Supplier> to) { + if (to == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @@ -508,8 +512,8 @@ public class StructureUtility { }; } - public static IStructureElementDeferred defer(Function> to){ - if(to==null){ + public static IStructureElementDeferred defer(Function> to) { + if (to == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @@ -530,8 +534,8 @@ public class StructureUtility { }; } - public static IStructureElementDeferred defer(Function keyExtractor,Map> map){ - if(keyExtractor==null||map==null){ + public static IStructureElementDeferred defer(Function keyExtractor, Map> map) { + if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @@ -552,31 +556,31 @@ public class StructureUtility { }; } - public static IStructureElementDeferred defer(Function keyExtractor,Map> map,IStructureElement defaultElem){ - if(keyExtractor==null||map==null){ + public static IStructureElementDeferred defer(Function keyExtractor, Map> map, IStructureElement defaultElem) { + if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(t),defaultElem).check(t, world, x, y, z); + return map.getOrDefault(keyExtractor.apply(t), defaultElem).check(t, world, x, y, z); } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t),defaultElem).placeBlock(t, world, x, y, z, trigger); + return map.getOrDefault(keyExtractor.apply(t), defaultElem).placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t),defaultElem).spawnHint(t, world, x, y, z, trigger); + return map.getOrDefault(keyExtractor.apply(t), defaultElem).spawnHint(t, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array){ - if(keyExtractor==null||array==null){ + public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array) { + if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @@ -598,106 +602,106 @@ public class StructureUtility { } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractor,List> array){ + public static IStructureElementDeferred defer(Function keyExtractor, List> array) { return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElementDeferred defer(BiFunction> to){ - if(to==null){ + public static IStructureElementDeferred defer(BiFunction> to) { + if (to == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { - return to.apply(t,null).check(t, world, x, y, z); + return to.apply(t, null).check(t, world, x, y, z); } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t,trigger).placeBlock(t, world, x, y, z, trigger); + return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t,trigger).spawnHint(t, world, x, y, z, trigger); + return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(BiFunction keyExtractor,Map> map){ - if(keyExtractor==null||map==null){ + public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map) { + if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { - return map.get(keyExtractor.apply(t,null)).check(t, world, x, y, z); + return map.get(keyExtractor.apply(t, null)).check(t, world, x, y, z); } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); + return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); + return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ - if(keyExtractor==null||map==null){ + public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { + if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(t,null),defaultElem).check(t, world, x, y, z); + return map.getOrDefault(keyExtractor.apply(t, null), defaultElem).check(t, world, x, y, z); } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).placeBlock(t, world, x, y, z, trigger); + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).spawnHint(t, world, x, y, z, trigger); + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array){ - if(keyExtractor==null||array==null){ + public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array) { + if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { - return array[keyExtractor.apply(t,null)].check(t, world, x, y, z); + return array[keyExtractor.apply(t, null)].check(t, world, x, y, z); } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t,trigger)].placeBlock(t, world, x, y, z, trigger); + return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t,trigger)].spawnHint(t, world, x, y, z, trigger); + return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array){ + public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array) { return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to){ - if(to==null){ + public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to) { + if (to == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @@ -708,18 +712,18 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t,trigger).placeBlock(t, world, x, y, z, trigger); + return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t,trigger).spawnHint(t, world, x, y, z, trigger); + return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map){ - if(keyExtractor==null||map==null){ + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map) { + if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @@ -730,41 +734,41 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t,trigger)).placeBlock(t, world, x, y, z, trigger); + return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t,trigger)).spawnHint(t, world, x, y, z, trigger); + return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor,Map> map,IStructureElement defaultElem){ - if(keyExtractor==null||map==null){ + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { + if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @Override public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractorCheck.apply(t),defaultElem).check(t, world, x, y, z); + return map.getOrDefault(keyExtractorCheck.apply(t), defaultElem).check(t, world, x, y, z); } @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).placeBlock(t, world, x, y, z, trigger); + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t,trigger),defaultElem).spawnHint(t, world, x, y, z, trigger); + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor, IStructureElement... array){ - if(keyExtractor==null||array==null){ + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, IStructureElement... array) { + if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } return new IStructureElementDeferred() { @@ -775,42 +779,42 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t,trigger)].placeBlock(t, world, x, y, z, trigger); + return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); } @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t,trigger)].spawnHint(t, world, x, y, z, trigger); + return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractorCheck,BiFunction keyExtractor, List> array){ + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, List> array) { return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureNavigate step(int a,int b, int c){ - return step(new Vec3Impl(a,b,c)); + public static IStructureNavigate step(int a, int b, int c) { + return step(new Vec3Impl(a, b, c)); } @SuppressWarnings("unchecked") - public static IStructureNavigate step(Vec3Impl step){ - if(step==null || step.get0()<0 || step.get1()<0 || step.get2()<0){ + public static IStructureNavigate step(Vec3Impl step) { + if (step == null || step.get0() < 0 || step.get1() < 0 || step.get2() < 0) { throw new IllegalArgumentException(); } return STEP.computeIfAbsent(step, vec3 -> { - if(vec3.get2()>0){ + if (vec3.get2() > 0) { return stepC(vec3.get0(), vec3.get1(), vec3.get2()); - }else if(vec3.get1()>0){ + } else if (vec3.get1() > 0) { return stepB(vec3.get0(), vec3.get1(), vec3.get2()); - }else { + } else { return stepA(vec3.get0(), vec3.get1(), vec3.get2()); } }); } - private static IStructureNavigate stepA(int a,int b, int c){ + private static IStructureNavigate stepA(int a, int b, int c) { return new IStructureNavigate() { @Override public int getStepA() { @@ -829,7 +833,7 @@ public class StructureUtility { }; } - private static IStructureNavigate stepB(int a,int b, int c){ + private static IStructureNavigate stepB(int a, int b, int c) { return new IStructureNavigate() { @Override public int getStepA() { @@ -853,7 +857,7 @@ public class StructureUtility { }; } - private static IStructureNavigate stepC(int a,int b, int c){ + private static IStructureNavigate stepC(int a, int b, int c) { return new IStructureNavigate() { @Override public int getStepA() { @@ -884,13 +888,14 @@ public class StructureUtility { /** * Used only to get pseudo code in structure writer... + * * @param world * @return */ public static String getPseudoJavaCode(World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, - int sizeA,int sizeB, int sizeC) { + int sizeA, int sizeB, int sizeC, boolean transpose) { Map> blocks = new TreeMap<>(Comparator.comparing(Block::getUnlocalizedName)); Set> tiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); Set> gtTiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); @@ -934,7 +939,7 @@ public class StructureUtility { Set set = entry.getValue(); for (Integer meta : set) { c = NICE_CHARS.charAt(i++); - if(i>NICE_CHARS.length()){ + if (i > NICE_CHARS.length()) { return "Too complicated for nice chars"; } map.put(block.getUnlocalizedName() + '\0' + meta, c); @@ -945,7 +950,7 @@ public class StructureUtility { builder.append("\nTiles:\n"); for (Class tile : tiles) { c = NICE_CHARS.charAt(i++); - if(i>NICE_CHARS.length()){ + if (i > NICE_CHARS.length()) { return "Too complicated for nice chars"; } map.put(tile.getCanonicalName(), c); @@ -955,7 +960,7 @@ public class StructureUtility { builder.append("\nMeta:\n"); for (Class gtTile : gtTiles) { c = NICE_CHARS.charAt(i++); - if(i>NICE_CHARS.length()){ + if (i > NICE_CHARS.length()) { return "Too complicated for nice chars"; } map.put(gtTile.getCanonicalName(), c); @@ -965,61 +970,97 @@ public class StructureUtility { } builder.append("\nOffsets:\n") .append(basePositionA).append(' ').append(basePositionB).append(' ').append(basePositionC).append('\n'); - builder.append("\nScan:\n") - .append("new String[][]{{\n") - .append(" \""); - - iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC, - sizeA, sizeB, sizeC, ((w, x, y, z) -> { - TileEntity tileEntity = w.getTileEntity(x, y, z); - if (tileEntity == null) { - Block block = w.getBlock(x, y, z); - if (block != null && block != Blocks.air) { - builder.append(map.get(block.getUnlocalizedName() + '\0' + world.getBlockMetadata(x, y, z))); - }else { - builder.append(' '); - } - } else { - if (tileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); - if (meta != null) { - builder.append(map.get(meta.getClass().getCanonicalName())); + if (transpose) { + builder.append("\nTransposed Scan:\n") + .append("new String[][]{\n") + .append(" {\""); + iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC, true, + sizeA, sizeB, sizeC, ((w, x, y, z) -> { + TileEntity tileEntity = w.getTileEntity(x, y, z); + if (tileEntity == null) { + Block block = w.getBlock(x, y, z); + if (block != null && block != Blocks.air) { + builder.append(map.get(block.getUnlocalizedName() + '\0' + world.getBlockMetadata(x, y, z))); + } else { + builder.append(' '); + } + } else { + if (tileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (meta != null) { + builder.append(map.get(meta.getClass().getCanonicalName())); + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } } else { builder.append(map.get(tileEntity.getClass().getCanonicalName())); } + } + }), + () -> builder.append("\",\""), + () -> { + builder.setLength(builder.length() - 2); + builder.append("},\n {\""); + }); + builder.setLength(builder.length() - 8); + builder.append("\n}\n\n"); + } else { + builder.append("\nNormal Scan:\n") + .append("new String[][]{{\n") + .append(" \""); + iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC, false, + sizeA, sizeB, sizeC, ((w, x, y, z) -> { + TileEntity tileEntity = w.getTileEntity(x, y, z); + if (tileEntity == null) { + Block block = w.getBlock(x, y, z); + if (block != null && block != Blocks.air) { + builder.append(map.get(block.getUnlocalizedName() + '\0' + world.getBlockMetadata(x, y, z))); + } else { + builder.append(' '); + } } else { - builder.append(map.get(tileEntity.getClass().getCanonicalName())); + if (tileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (meta != null) { + builder.append(map.get(meta.getClass().getCanonicalName())); + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } } - } - }), - () -> builder.append("\",\n").append(" \""), - () -> { - builder.setLength(builder.length()-7); - builder.append("\n").append("},{\n").append(" \""); - }); - builder.setLength(builder.length()-8); - builder.append("};\n\n"); - return(builder.toString().replaceAll("\"\"","E")); + }), + () -> builder.append("\",\n").append(" \""), + () -> { + builder.setLength(builder.length() - 7); + builder.append("\n").append("},{\n").append(" \""); + }); + builder.setLength(builder.length() - 8); + builder.append("}\n\n"); + } + return (builder.toString().replaceAll("\"\"", "E")); } public static void iterate(World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - int sizeA,int sizeB, int sizeC, - IBlockPosConsumer iBlockPosConsumer){ - sizeA-=basePositionA; - sizeB-=basePositionB; - sizeC-=basePositionC; + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + int sizeA, int sizeB, int sizeC, + IBlockPosConsumer iBlockPosConsumer) { + sizeA -= basePositionA; + sizeB -= basePositionB; + sizeC -= basePositionC; int[] abc = new int[3]; int[] xyz = new int[3]; - for (abc[2]=-basePositionC ; abc[2] < sizeC; abc[2]++) { - for (abc[1]=-basePositionB; abc[1] < sizeB; abc[1]++) { - for (abc[0]=-basePositionA ; abc[0] < sizeA; abc[0]++) { + for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { + for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { extendedFacing.getWorldOffset(abc, xyz); - iBlockPosConsumer.consume(world, xyz[0]+basePositionX,xyz[1]+basePositionY,xyz[2]+basePositionZ); + iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); } } @@ -1027,28 +1068,56 @@ public class StructureUtility { } public static void iterate(World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - int sizeA, int sizeB, int sizeC, - IBlockPosConsumer iBlockPosConsumer, - Runnable nextB, - Runnable nextC){ - sizeA-=basePositionA; - sizeB-=basePositionB; - sizeC-=basePositionC; + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean transpose, int sizeA, int sizeB, int sizeC, + IBlockPosConsumer iBlockPosConsumer, + Runnable nextB, + Runnable nextC) { + sizeA -= basePositionA; + sizeB -= basePositionB; + sizeC -= basePositionC; int[] abc = new int[3]; int[] xyz = new int[3]; - - for (abc[2]=-basePositionC ; abc[2] < sizeC; abc[2]++) { - for (abc[1]=-basePositionB; abc[1] < sizeB; abc[1]++) { - for (abc[0]=-basePositionA ; abc[0] < sizeA; abc[0]++) { - extendedFacing.getWorldOffset(abc, xyz); - iBlockPosConsumer.consume(world, xyz[0]+basePositionX,xyz[1]+basePositionY,xyz[2]+basePositionZ); + if (transpose) { + for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { + for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { + extendedFacing.getWorldOffset(abc, xyz); + iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); + } + nextB.run(); + } + nextC.run(); + } + } else { + for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { + for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { + extendedFacing.getWorldOffset(abc, xyz); + iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); + } + nextB.run(); } - nextB.run(); + nextC.run(); + } + } + } + + /** + * Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape) + * WARNING! Do not use on old api... + * @param structurePiece shape (transposed shape) + * @return transposed shape (untransposed shape) + */ + public static String[][] transpose(String[][] structurePiece){ + String[][] shape=new String[structurePiece[0].length][structurePiece.length]; + for (int i = 0; i < structurePiece.length; i++) { + for (int j = 0; j < structurePiece[i].length; j++) { + shape[j][i]=structurePiece[i][j]; } - nextC.run(); } + return shape; } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index c24b35f8d5..752f2d1bcc 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -1,23 +1,13 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.IAlignment; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; +import com.github.technus.tectech.mechanics.constructable.ConstructableUtility; import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.common.util.ForgeDirection; import java.util.List; @@ -39,97 +29,7 @@ public final class ConstructableTriggerItem extends Item { @Override public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if(tTileEntity==null || aPlayer instanceof FakePlayer) { - return aPlayer instanceof EntityPlayerMP; - } - if (aPlayer instanceof EntityPlayerMP) { - //struct gen - if (aPlayer.isSneaking() && aPlayer.capabilities.isCreativeMode) { - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack, false); - } else if (IMultiblockInfoContainer.contains(metaTE.getClass())) { - IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); - if(metaTE instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, false, metaTE, ( - (IAlignment) metaTE).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, false, metaTE, - ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); - } - } - } else if (tTileEntity instanceof IConstructable) { - ((IConstructable) tTileEntity).construct(aStack, false); - } else if (IMultiblockInfoContainer.contains(tTileEntity.getClass())) { - IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(tTileEntity.getClass()); - if(tTileEntity instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, false, tTileEntity, - ((IAlignment) tTileEntity).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, false, tTileEntity, - ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); - } - } - } - return true; - }else if (TecTech.proxy.isThePlayer(aPlayer)){//particles and text client side - //if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) { - if(tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack, true); - TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack)); - return false; - } else if(IMultiblockInfoContainer.contains(metaTE.getClass())){ - IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); - if(metaTE instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, true, metaTE, - ((IAlignment) metaTE).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, true, metaTE, - ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); - } - TecTech.proxy.printInchat(IMultiblockInfoContainer.get(metaTE.getClass()).getDescription(aStack)); - return false; - } - } else if(tTileEntity instanceof IConstructable){ - ((IConstructable) tTileEntity).construct(aStack,true); - TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack)); - return false; - } else if(IMultiblockInfoContainer.contains(tTileEntity.getClass())){ - IMultiblockInfoContainer iMultiblockInfoContainer = IMultiblockInfoContainer.get(tTileEntity.getClass()); - if(tTileEntity instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, true, tTileEntity, - ((IAlignment) tTileEntity).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, true, tTileEntity, - ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); - } - TecTech.proxy.printInchat(IMultiblockInfoContainer.get(tTileEntity.getClass()).getDescription(aStack)); - return false; - } - //} else { - // if(tTileEntity instanceof IGregTechTileEntity) { - // IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - // if (metaTE instanceof IConstructable) { - // TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); - // return false; - // } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ - // TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); - // return false; - // } - // } else if(tTileEntity instanceof IConstructable){ - // TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); - // return false; - // } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ - // TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); - // return false; - // } - //} - } - return false; + return ConstructableUtility.handle(aStack, aPlayer, aWorld, aX, aY, aZ, aSide); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java index 8e3d770da1..f4531a248b 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java +++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java @@ -73,7 +73,7 @@ public class EuMeterGT extends Item { } } if (!(aPlayer instanceof EntityPlayerMP)) { - GT_Utility.doSoundAtClient(Reference.MODID + ":fx_scan", 1, 1.0F, (double) aX, (double) aY, (double) aZ); + GT_Utility.doSoundAtClient(Reference.MODID + ":fx_scan", 1, 1.0F, aX, aY, aZ); } return false; } diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index 5edc238a91..d71abb34b7 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -1,19 +1,13 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.mechanics.alignment.IAlignment; -import com.github.technus.tectech.mechanics.alignment.IAlignmentProvider; +import com.github.technus.tectech.mechanics.alignment.AlignmentUtility; import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; import java.util.List; @@ -36,33 +30,7 @@ public final class FrontRotationTriggerItem extends Item { @Override public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if(tTileEntity==null || aPlayer instanceof FakePlayer) { - return aPlayer instanceof EntityPlayerMP; - } - if (aPlayer instanceof EntityPlayerMP) { - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IAlignmentProvider) { - IAlignment alignment = ((IAlignmentProvider) metaTE).getAlignment(); - if(aPlayer.isSneaking()){ - alignment.toolSetFlip(null); - }else { - alignment.toolSetRotation(null); - } - return true; - } - } else if (tTileEntity instanceof IAlignmentProvider) { - IAlignment alignment = ((IAlignmentProvider) tTileEntity).getAlignment(); - if(aPlayer.isSneaking()){ - alignment.toolSetFlip(null); - }else { - alignment.toolSetRotation(null); - } - return true; - } - } - return false; + return AlignmentUtility.handle(aPlayer,aWorld,aX,aY,aZ); } @Override -- cgit From ec623a00822141f002149f5f9453295288967119 Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 1 May 2020 10:47:43 +0200 Subject: Update struct writer --- .../single/GT_MetaTileEntity_DebugStructureWriter.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main') 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 42f25ddfde..3b194c516b 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 @@ -119,13 +119,26 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), numbers[0], numbers[1], numbers[2], - numbers[3], numbers[4], numbers[5]); + numbers[3], numbers[4], numbers[5],false); TecTech.LOGGER.info(pseudoJavaCode); result = pseudoJavaCode.split("\\n"); aBaseMetaTileEntity.disableWorking(); } } + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); + String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), + ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), + aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), + numbers[0], numbers[1], numbers[2], + numbers[3], numbers[4], numbers[5],true); + TecTech.LOGGER.info(pseudoJavaCode); + result = pseudoJavaCode.split("\\n"); + aBaseMetaTileEntity.disableWorking(); + } + @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { -- cgit From ed992c9ce5077a4ccf56d554eaba73e038258d9e Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 1 May 2020 12:15:47 +0200 Subject: Tweak the api some more, fix bugs --- .../mechanics/structure/StructureDefinition.java | 33 +--- .../mechanics/structure/StructureUtility.java | 2 +- .../multi/GT_MetaTileEntity_EM_bhg.java | 194 +++++++++++---------- .../multi/GT_MetaTileEntity_EM_collider.java | 6 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 2 +- 5 files changed, 109 insertions(+), 128 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index 29114647ac..9a1e94d98a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.mechanics.structure; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Vec3Impl; import java.util.*; @@ -62,55 +61,35 @@ public class StructureDefinition implements IStructureDefinition { StringBuilder builder = new StringBuilder(); if (structurePiece.length > 0) { for (String[] strings : structurePiece) { - - if (strings.length > 0) { for (String string : strings) { - - for (int i = 0; i < string.length(); i++) { char ch = string.charAt(i); if(ch<' '){ - for (int c = 0; c < ch; c++) { + for (int b = 0; b < ch; b++) { builder.append(B); } }else if(ch>'@'){ - for (int c = '@'; c < ch; c++) { + for (int a = '@'; a < ch; a++) { builder.append(A); } + }else if(ch=='.'){ + builder.append(A); }else{ builder.append(ch); } } - - builder.append(B); } builder.setLength(builder.length() - 1); } - - builder.append(C); } builder.setLength(builder.length() - 1); } - if(DEBUG_MODE){ - Exception exception = new Exception(); - exception.getStackTrace(); - - TecTech.LOGGER.info("Structure shape normal:"); - - - TecTech.LOGGER.info("Structure shape transposed:"); - - } int a=0,b=0,c=0; for (int i = 0; i < builder.length(); i++) { char ch = builder.charAt(i); - if(ch =='.'){ - builder.setCharAt(i,A); - ch=A; - } if(ch==A){ a++; }else if(ch==B){ @@ -151,7 +130,7 @@ public class StructureDefinition implements IStructureDefinition { * Adds shape * +- is air/no air checks * space bar is skip - * . is also skip (but marks controller position, optional and logically it is a space...) + * ~ is also skip (but marks controller position, optional and logically it is a space...) * rest needs to be defined * * next char is next block(a) @@ -180,7 +159,7 @@ public class StructureDefinition implements IStructureDefinition { int a=0,b=0,c=0; for (int i = 0; i < builder.length(); i++) { char ch = builder.charAt(i); - if(ch ==' ' || ch =='.'){ + if(ch ==' ' || ch =='~'){ builder.setCharAt(i,A); ch=A; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 868bfec181..8e2cedd6e2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -24,7 +24,7 @@ import java.util.function.Supplier; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; public class StructureUtility { - private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_=|[]{};:'<>,./?"; + private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz=|!@#$%&()[]{};:<>/?_,.*^'`"; @SuppressWarnings("rawtypes") private static final Map STEP = new HashMap<>(); @SuppressWarnings("rawtypes") diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 63b45500ed..24fbb9e423 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,24 +1,24 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHatchAdderOptional; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -48,49 +48,95 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E //per dim disable thingies //region structure actual - private static final String[][] shape = new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{12, 13, 14, 10, 11}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_bhg::addClassicToMachineList, - GT_MetaTileEntity_EM_bhg::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition + .builder() + .addShapeOldApi("t1",new String[][]{ + {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, + {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, + {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, + {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, + {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, + {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, + {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, + {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, + {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, + {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, + {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, + {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, + {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, + {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, + {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, + {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, + {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, + {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, + {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, + {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, + {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, + {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, + {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, + }) + .addShapeOldApi("t2",new String[][]{ + {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, + {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, + {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, + {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, + {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, + {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, + {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, + {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, + {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, + {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, + {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, + {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, + {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, + {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, + {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, + {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, + {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, + {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, + {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, + {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, + {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, + {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, + {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, + {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, + {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, + {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, + {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, + {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, + {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, + {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, + {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, + {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, + {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT,12)) + .addElement('1', ofBlock(sBlockCasingsTT,13)) + .addElement('2', ofBlock(sBlockCasingsTT,14)) + .addElement('3', ofBlock(sBlockCasingsTT,10)) + .addElement('4', ofBlock(sBlockCasingsTT,11)) + .addElement('5', ofBlock(QuantumGlassBlock.INSTANCE,0)) + .addElement(' ', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, + textureOffset,1,sBlockCasingsTT,0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, + textureOffset + 4,2,sBlockCasingsTT,4)) + .build(); + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.blackholegenerator.hint.0"),//1 - Classic Hatches or High Power Casing @@ -98,46 +144,6 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E }; //endregion - //region structure dank - glass sphere for the looks - private static final String[][] shape2 = new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "M110A011", "L1110A0111", "K11110A01111", "J1111222221111", "J1112202022111", "I000020020020000", "M2222222", "I000020020020000", "J1112202022111", "J1111222221111", "K11110A01111", "L1110A0111", "M110A011", "O0A0",}, - {"\u0006", "O0A0", "M110A011", "K11110A01111", "J111C2C111", "I111D2D111", "I11B2222222B11", "H11B22E22B11", "H11B2B333B2B11", "G000B2A34443A2B000", "J222A34443A222", "G000B2A34443A2B000", "H11B2B333B2B11", "H11B22E22B11", "I11B2222222B11", "I111D2D111", "J111C2C111", "K11110A01111", "M110A011", "O0A0",}, - {"\u0005", "O0A0", "L1110A0111", "J111C2C111", "I11E2E11", "H11M11", "H1O1", "G11O11", "G1Q1", "G1Q1", "F00Q00", "H22M22", "F00Q00", "G1Q1", "G1Q1", "G11O11", "H1O1", "H11M11", "I11E2E11", "J111C2C111", "L1110A0111", "O0A0",}, - {"\u0004", "O0A0", "K11100000111", "I111D2D111", "H11F5F11", "G11G5G11", "G1Q1", "F11Q11", "F1S1", "F1S1", "F0S0", "E00S00", "F0255M5520", "E00S00", "F0S0", "F1S1", "F1S1", "F11Q11", "G1Q1", "G11G5G11", "H11F5F11", "I111D2D111", "K11100000111", "O0A0",}, - {"\u0003", "O0A0", "J111110A011111", "H111E2E111", "G11D3335333D11", "F11Q11", "F1S1", "E11S11", "E1U1", "E1U1", "E1A3Q3A1", "E1A3Q3A1", "D00A3Q3A00", "F25Q52", "D00A3Q3A00", "E1A3Q3A1", "E1A3Q3A1", "E1U1", "E1U1", "E11S11", "F1S1", "F11Q11", "G11D3335333D11", "H111E2E111", "J111110A011111", "O0A0",}, - {"\u0002", "O0A0", "K11100000111", "H111E2E111", "G11G5G11", "F1S1", "E11S11", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "D0W0", "C00W00", "D025S520", "C00W00", "D0W0", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "E11S11", "F1S1", "G11G5G11", "H111E2E111", "K11100000111", "O0A0",}, - {"\u0001", "O0A0", "L1110A0111", "I111D2D111", "G11D3335333D11", "F1S1", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "C1Y1", "C1A3U3A1", "C1A3U3A1", "B00A3U3A00", "D25U52", "B00A3U3A00", "C1A3U3A1", "C1A3U3A1", "C1Y1", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "F1S1", "G11D3335333D11", "I111D2D111", "L1110A0111", "O0A0",}, - {"\u0001", "M110A011", "J111C2C111", "H11F5F11", "F11Q11", "E11S11", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B0[0", "C25W52", "B0[0", "B1[1", "B1[1", "C1Y1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "E11S11", "F11Q11", "H11F5F11", "J111C2C111", "M110A011",}, - {E, "O0A0", "K11110A01111", "I11E2E11", "G11G5G11", "F1S1", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "B1[1", "A00[00", "C25W52", "A00[00", "B1[1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "F1S1", "G11G5G11", "I11E2E11", "K11110A01111", "O0A0",}, - {E, "M110A011", "J111C2C111", "H11M11", "G1Q1", "E11S11", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "E11S11", "G1Q1", "H11M11", "J111C2C111", "M110A011",}, - {E, "L1110A0111", "I111D2D111", "H1O1", "F11Q11", "E1U1", "D1W1", "D1W1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "D1W1", "D1W1", "E1U1", "F11Q11", "H1O1", "I111D2D111", "L1110A0111",}, - {"O0A0", "K11110A01111", "I11B2222222B11", "G11O11", "F1S1", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "002[200", "B2[2", "002[200", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "F1S1", "G11O11", "I11B2222222B11", "K11110A01111", "O0A0",}, - {"O0A0", "J1111222221111", "H11B22E22B11", "G1Q1", "F1S1", "E1A3Q3A1", "D1W1", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "A2]2", "02]20", "A2]2", "02]20", "A2]2", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D1W1", "E1A3Q3A1", "F1S1", "G1Q1", "H11B22E22B11", "J1111222221111", "O0A0",}, - {"O0A0", "J1112202022111", "H11B2B333B2B11", "G1Q1", "F0S0", "E1A3Q3A1", "D0W0", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A2]2", "A2]2", "003[300", "A23[32", "003[300", "A2]2", "A2]2", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D0W0", "E1A3Q3A1", "F0S0", "G1Q1", "H11B2B333B2B11", "J1112202022111", "O0A0",}, - {"L000000000", "I000020020020000", "G000B2A34443A2B000", "F00Q00", "E00S00", "D00A3Q3A00", "C00W00", "B00A3U3A00", "B0[0", "A00[00", "A0]0", "A0]0", "002[200", "02]20", "003[300", "004[400", "024[420", "004[400", "003[300", "02]20", "002[200", "A0]0", "A0]0", "A00[00", "B0[0", "B00A3U3A00", "C00W00", "D00A3Q3A00", "E00S00", "F00Q00", "G000B2A34443A2B000", "I000020020020000", "L000000000",}, - {"O0A0", "M2222222", "J222A34443A222", "H22M22", "F0255M5520", "F25Q52", "D025S520", "D25U52", "C25W52", "C25W52", "B2[2", "B2[2", "B2[2", "A2]2", "A23[32", "024[420", "A24[42", "024[420", "A23[32", "A2]2", "B2[2", "B2[2", "B2[2", "C25W52", "C25W52", "D25U52", "D025S520", "F25Q52", "F0255M5520", "H22M22", "J222A34443A222", "M2222222", "O0A0",}, - {"L000000000", "I000020020020000", "G000B2A34443A2B000", "F00Q00", "E00S00", "D00A3Q3A00", "C00W00", "B00A3U3A00", "B0[0", "A00[00", "A0]0", "A0]0", "002[200", "02]20", "003[300", "004[400", "024[420", "004[400", "003[300", "02]20", "002[200", "A0]0", "A0]0", "A00[00", "B0[0", "B00A3U3A00", "C00W00", "D00A3Q3A00", "E00S00", "F00Q00", "G000B2A34443A2B000", "I000020020020000", "L000000000",}, - {"O0A0", "J1112202022111", "H11B2B333B2B11", "G1Q1", "F0S0", "E1A3Q3A1", "D0W0", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A2]2", "A2]2", "003[300", "A23[32", "003[300", "A2]2", "A2]2", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D0W0", "E1A3Q3A1", "F0S0", "G1Q1", "H11B2B333B2B11", "J1112202022111", "O0A0",}, - {"O0A0", "J1111222221111", "H11B22E22B11", "G1Q1", "F1S1", "E1A3Q3A1", "D1W1", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "A2]2", "02]20", "A2]2", "02]20", "A2]2", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D1W1", "E1A3Q3A1", "F1S1", "G1Q1", "H11B22E22B11", "J1111222221111", "O0A0",}, - {"O0A0", "K11110A01111", "I11B2222222B11", "G11O11", "F1S1", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "002[200", "B2[2", "002[200", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "F1S1", "G11O11", "I11B2222222B11", "K11110A01111", "O0A0",}, - {E, "L1110A0111", "I111D2D111", "H1O1", "F11Q11", "E1U1", "D1W1", "D1W1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "D1W1", "D1W1", "E1U1", "F11Q11", "H1O1", "I111D2D111", "L1110A0111",}, - {E, "M110A011", "J111C2C111", "H11M11", "G1Q1", "E11S11", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "E11S11", "G1Q1", "H11M11", "J111C2C111", "M110A011",}, - {E, "O0A0", "K11110A01111", "I11E2E11", "G11G5G11", "F1S1", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "B1[1", "A00[00", "C25W52", "A00[00", "B1[1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "F1S1", "G11G5G11", "I11E2E11", "K11110A01111", "O0A0",}, - {"\u0001", "M110A011", "J111C2C111", "H11F5F11", "F11Q11", "E11S11", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B0[0", "C25W52", "B0[0", "B1[1", "B1[1", "C1Y1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "E11S11", "F11Q11", "H11F5F11", "J111C2C111", "M110A011",}, - {"\u0001", "O0A0", "L1110A0111", "I111D2D111", "G11D3335333D11", "F1S1", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "C1Y1", "C1A3U3A1", "C1A3U3A1", "B00A3U3A00", "D25U52", "B00A3U3A00", "C1A3U3A1", "C1A3U3A1", "C1Y1", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "F1S1", "G11D3335333D11", "I111D2D111", "L1110A0111", "O0A0",}, - {"\u0002", "O0A0", "K11100000111", "H111E2E111", "G11G5G11", "F1S1", "E11S11", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "D0W0", "C00W00", "D025S520", "C00W00", "D0W0", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "E11S11", "F1S1", "G11G5G11", "H111E2E111", "K11100000111", "O0A0",}, - {"\u0003", "O0A0", "J111110A011111", "H111E2E111", "G11D3335333D11", "F11Q11", "F1S1", "E11S11", "E1U1", "E1U1", "E1A3Q3A1", "E1A3Q3A1", "D00A3Q3A00", "F25Q52", "D00A3Q3A00", "E1A3Q3A1", "E1A3Q3A1", "E1U1", "E1U1", "E11S11", "F1S1", "F11Q11", "G11D3335333D11", "H111E2E111", "J111110A011111", "O0A0",}, - {"\u0004", "O0A0", "K11100000111", "I111D2D111", "H11F5F11", "G11G5G11", "G1Q1", "F11Q11", "F1S1", "F1S1", "F0S0", "E00S00", "F0255M5520", "E00S00", "F0S0", "F1S1", "F1S1", "F11Q11", "G1Q1", "G11G5G11", "H11F5F11", "I111D2D111", "K11100000111", "O0A0",}, - {"\u0005", "O0A0", "L1110A0111", "J111C2C111", "I11E2E11", "H11M11", "H1O1", "G11O11", "G1Q1", "G1Q1", "F00Q00", "H22M22", "F00Q00", "G1Q1", "G1Q1", "G11O11", "H1O1", "H11M11", "I11E2E11", "J111C2C111", "L1110A0111", "O0A0",}, - {"\u0006", "O0A0", "M110A011", "K11110A01111", "J111C2C111", "I111D2D111", "I11B2222222B11", "H11B22E22B11", "H11B2B333B2B11", "G000B2A34443A2B000", "J222A34443A222", "G000B2A34443A2B000", "H11B2B333B2B11", "H11B22E22B11", "I11B2222222B11", "I111D2D111", "J111C2C111", "K11110A01111", "M110A011", "O0A0",}, - {"\u0008", "O0A0", "M110A011", "L1110A0111", "K11110A01111", "J1111222221111", "J1112202022111", "I000020020020000", "M2222222", "I000020020020000", "J1112202022111", "J1111222221111", "K11110A01111", "L1110A0111", "M110A011", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }; - private static final Block[] blockType2 = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta2 = new byte[]{12, 0, 13, 14, 10, 11}; - //endregion - public GT_MetaTileEntity_EM_bhg(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -262,11 +268,11 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (structureCheck_EM(shape2, blockType2, blockMeta2, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)) { + if (structureCheck_EM("t2", 16, 16, 0)) { glassDome = true; return true; } - if (structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)) { + if (structureCheck_EM("t1", 16, 16, 0)) { glassDome = false; return true; } @@ -301,11 +307,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - if ((stackSize.stackSize & 1) == 1) { - Structure.builder(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); - } else { - Structure.builder(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); - } + structureBuild_EM((stackSize.stackSize&1)==1?"t1":"t2", 16, 16, 0, hintsOnly,stackSize); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 2782e7924f..8f4e7969ee 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -325,12 +325,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }) .addElement('0', ofBlock(sBlockCasingsTT,4)) .addElement('1', ofBlock(sBlockCasingsTT,7)) - .addElement('2', defer(t->(int)t.eTier,(t,item)->(item.stackSize&1)+1, + .addElement('2', defer(t->(int)t.eTier,(t,item)->2-(item.stackSize&1), error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,5))) .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE,0)) - .addElement('4', defer(t->(int)t.eTier,(t,item)->(item.stackSize&1)+1, + .addElement('4', defer(t->(int)t.eTier,(t,item)->2-(item.stackSize&1), error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,6))) - .addElement('5', defer(t->(int)t.eTier,(t,item)->(item.stackSize&1)+1, + .addElement('5', defer(t->(int)t.eTier,(t,item)->2-(item.stackSize&1), error(),ofBlock(sBlockCasingsTT,8),ofBlock(sBlockCasingsTT,9))) .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, textureOffset,1,sBlockCasingsTT,0)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index bfd74ab448..cdac772541 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -40,7 +40,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() .addShape("main",new String[][]{ - {"111", "1.1", "111",}, + {"111", "1~1", "111",}, {"111", "101", "111",}, {"111", "111", "111",}, }) -- cgit From 145e443d70af83109b3b9c4cb92097b4964d4402 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 2 May 2020 16:04:17 +0200 Subject: Add IIcon hint particle --- .../technus/tectech/entity/fx/BlockHint.java | 19 ++++++++++++++++++ .../mechanics/structure/StructureUtility.java | 23 ++++++++++++++++++++++ .../github/technus/tectech/proxy/ClientProxy.java | 10 ++++++++++ .../github/technus/tectech/proxy/CommonProxy.java | 2 ++ 4 files changed, 54 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java index ab075f7ffd..24459a89b8 100644 --- a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java +++ b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java @@ -19,6 +19,25 @@ public class BlockHint extends EntityFX { this(world,0,0,0, Blocks.stone,0); } + /** + * + * @param world + * @param x + * @param y + * @param z + * @param icons DOWN, UP, NORTH, SOUTH, WEST, EAST + */ + public BlockHint(World world, int x, int y, int z, IIcon[] icons) { + super(world, x + .25, y + .5, z + .25); + particleGravity = 0; + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + noClip = true; + particleMaxAge = 2000 + TecTech.RANDOM.nextInt(200); + this.icons=icons; + } + public BlockHint(World world, int x, int y, int z, Block block, int meta) { super(world, x+.25, y+.5, z+.25); particleGravity = 0; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 8e2cedd6e2..d544efc48e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -13,6 +13,7 @@ import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.*; @@ -134,6 +135,28 @@ public class StructureUtility { }; } + /** + * Check always returns: true. + * + * @param icons + * @param + * @return + */ + public static IStructureElementNoPlacement ofHint(IIcon[] icons) { + return new IStructureElementNoPlacement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, icons); + return false; + } + }; + } + /** * Does not allow Block duplicates (with different meta) */ diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 720460d56b..43f4989638 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -24,6 +24,7 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.util.ForgeDirection; @@ -45,6 +46,15 @@ public class ClientProxy extends CommonProxy { } } + @Override + public void hint_particle(World w,int x, int y, int z, IIcon[] icons) { + Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons)); + + EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + Minecraft.getMinecraft().effectRenderer.addEffect(particle); + } + @Override public void hint_particle(World w,int x, int y, int z, Block block, int meta) { Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta)); diff --git a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java index 955b664bd1..5891c21d5d 100644 --- a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java @@ -7,12 +7,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraft.world.WorldServer; public class CommonProxy implements IGuiHandler { public void registerRenderInfo() {} + public void hint_particle(World w,int x, int y, int z, IIcon[] icons){} public void hint_particle(World w,int x, int y, int z, Block block, int meta){} public void em_particle(IGregTechTileEntity aMuffler, byte facing) {}//CUTE! public void pollutor_particle(IGregTechTileEntity aPollutor, byte facing) {}//CUTE! -- cgit From 132765721d820021e594fe417ee7bbb6180df970 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 2 May 2020 17:03:12 +0200 Subject: Expose tinting --- .../technus/tectech/entity/fx/BlockHint.java | 9 ++++++++- .../mechanics/structure/StructureUtility.java | 23 ++++++++++++++++++++++ .../github/technus/tectech/proxy/ClientProxy.java | 18 +++++++++++++++++ .../github/technus/tectech/proxy/CommonProxy.java | 2 ++ 4 files changed, 51 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java index 24459a89b8..dd5cd59ac7 100644 --- a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java +++ b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.entity.fx; import com.github.technus.tectech.TecTech; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Dyes; import net.minecraft.block.Block; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; @@ -14,6 +15,7 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class BlockHint extends EntityFX { private IIcon[] icons = new IIcon[6]; + private short[] mRGBa = Dyes._NULL.mRGBa; public BlockHint(World world){ this(world,0,0,0, Blocks.stone,0); @@ -51,6 +53,11 @@ public class BlockHint extends EntityFX { } } + public BlockHint withColorTint(short[] coloure){ + this.mRGBa =coloure; + return this; + } + @Override public void renderParticle(Tessellator tes, float subTickTime, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) { float size = .5f; @@ -59,7 +66,7 @@ public class BlockHint extends EntityFX { float Z = (float) (prevPosZ + (posZ - prevPosZ) * (double) subTickTime - EntityFX.interpPosZ); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); - tes.setColorRGBA_F(.9F, .95F, 1F, .75f); + tes.setColorRGBA((int) (mRGBa[0] * .9F), (int) (mRGBa[1] * .95F), (int) (mRGBa[2] * 1F), 192); //var8, var9 - X U //var 10, var 11 - Y V diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index d544efc48e..2177d1a00e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -157,6 +157,29 @@ public class StructureUtility { }; } + /** + * Check always returns: true. + * + * @param icons + * @param RGBa + * @param + * @return + */ + public static IStructureElementNoPlacement ofHint(IIcon[] icons,short[] RGBa) { + return new IStructureElementNoPlacement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle_tinted(world, x, y, z, icons,RGBa); + return false; + } + }; + } + /** * Does not allow Block duplicates (with different meta) */ diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 43f4989638..9e693b7664 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -46,6 +46,24 @@ public class ClientProxy extends CommonProxy { } } + @Override + public void hint_particle_tinted(World w,int x, int y, int z, IIcon[] icons,short[] RGBa) { + Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons).withColorTint(RGBa)); + + EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + Minecraft.getMinecraft().effectRenderer.addEffect(particle); + } + + @Override + public void hint_particle_tinted(World w,int x, int y, int z, Block block, int meta,short[] RGBa) { + Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta).withColorTint(RGBa)); + + EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + Minecraft.getMinecraft().effectRenderer.addEffect(particle); + } + @Override public void hint_particle(World w,int x, int y, int z, IIcon[] icons) { Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons)); diff --git a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java index 5891c21d5d..490cdf1092 100644 --- a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java @@ -14,6 +14,8 @@ import net.minecraft.world.WorldServer; public class CommonProxy implements IGuiHandler { public void registerRenderInfo() {} + public void hint_particle_tinted(World w,int x, int y, int z, IIcon[] icons,short[] RGBa){} + public void hint_particle_tinted(World w,int x, int y, int z, Block block, int meta,short[] RGBa){} public void hint_particle(World w,int x, int y, int z, IIcon[] icons){} public void hint_particle(World w,int x, int y, int z, Block block, int meta){} public void em_particle(IGregTechTileEntity aMuffler, byte facing) {}//CUTE! -- cgit From f072d69ee5dbbef49e46e4c2357b985f86d202a3 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 3 May 2020 11:02:55 +0200 Subject: Defer get icons --- src/main/java/com/github/technus/tectech/loader/MainLoader.java | 2 +- .../technus/tectech/mechanics/structure/StructureUtility.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index f8fbcda2da..bab6c6d092 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -157,7 +157,7 @@ public final class MainLoader { fixBlocks(); TecTech.LOGGER.info("Blocks nerf done"); - progressBarPostLoad.step("Initialize more constructable stuff"); + progressBarPostLoad.step("Constructable stuff"); new ConstructableLoader().run(); TecTech.LOGGER.info("Constructable initialized"); diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 2177d1a00e..00bdcdb1ad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -142,7 +142,7 @@ public class StructureUtility { * @param * @return */ - public static IStructureElementNoPlacement ofHint(IIcon[] icons) { + public static IStructureElementNoPlacement ofHintDeferred(Supplier icons) { return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -151,7 +151,7 @@ public class StructureUtility { @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, icons); + TecTech.proxy.hint_particle(world, x, y, z, icons.get()); return false; } }; @@ -165,7 +165,7 @@ public class StructureUtility { * @param * @return */ - public static IStructureElementNoPlacement ofHint(IIcon[] icons,short[] RGBa) { + public static IStructureElementNoPlacement ofHintDeferred(Supplier icons,short[] RGBa) { return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -174,7 +174,7 @@ public class StructureUtility { @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle_tinted(world, x, y, z, icons,RGBa); + TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(),RGBa); return false; } }; -- cgit From 87d6601b4890b3a69c0d0fdcd3e7cbf0092377b7 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 4 May 2020 20:15:05 +0200 Subject: Fix loss, to be max instead of min... --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') 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 3e53f63736..cf37fb0689 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 @@ -1435,7 +1435,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput(); if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7, 1), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar >> 7, 1), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -1444,7 +1444,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput() * tHatch.Amperes; if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7, tHatch.Amperes), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar >> 7, tHatch.Amperes), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } -- cgit From f1dff1a236a32284d733464e220995aca79aea6b Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 9 May 2020 09:16:53 +0200 Subject: Refactor thaum spark --- .../technus/tectech/loader/NetworkDispatcher.java | 2 +- .../tectech/mechanics/data/RendererMessage.java | 82 ---------------------- .../technus/tectech/mechanics/data/ThaumSpark.java | 54 -------------- .../tectech/mechanics/spark/RendererMessage.java | 82 ++++++++++++++++++++++ .../tectech/mechanics/spark/ThaumSpark.java | 54 ++++++++++++++ .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 4 +- .../single/GT_MetaTileEntity_TeslaCoil.java | 4 +- 7 files changed, 141 insertions(+), 141 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/RendererMessage.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/ThaumSpark.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java index 7d35a216f0..581c81d15f 100644 --- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java +++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; -import com.github.technus.tectech.mechanics.data.RendererMessage; +import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/data/RendererMessage.java deleted file mode 100644 index 514b8b88ad..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/data/RendererMessage.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.github.technus.tectech.mechanics.data; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import thaumcraft.client.fx.bolt.FXLightningBolt; - -import java.io.*; -import java.util.Arrays; -import java.util.HashSet; - -public class RendererMessage implements IMessage { - HashSet sparkList = new HashSet(); - - public RendererMessage() { - } - - @Override - public void fromBytes(ByteBuf pBuffer) { - try { - //I'd love to know why I need to offset by one byte for this to work - byte[] boop = pBuffer.array(); - boop = Arrays.copyOfRange(boop, 1, boop.length); - InputStream is = new ByteArrayInputStream(boop); - ObjectInputStream ois = new ObjectInputStream(is); - Object data = ois.readObject(); - sparkList = (HashSet) data; - } catch (IOException | ClassNotFoundException ex) { - } - } - - @Override - public void toBytes(ByteBuf pBuffer) { - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(sparkList); - oos.flush(); - InputStream is = new ByteArrayInputStream(baos.toByteArray()); - pBuffer.writeBytes(is, baos.toByteArray().length); - } catch (IOException ex) { - } - } - - public static class RendererData extends RendererMessage { - public RendererData() { - } - - public RendererData(HashSet eSparkList) { - sparkList = eSparkList; - } - } - - - public static class ClientHandler extends AbstractClientMessageHandler { - @Override - public IMessage handleClientMessage(EntityPlayer pPlayer, RendererData pMessage, MessageContext pCtx) { - for (ThaumSpark sp : pMessage.sparkList) { - thaumLightning(sp.x, sp.y, sp.z, sp.xR, sp.yR, sp.zR, sp.wID); - } - pMessage.sparkList.clear(); - return null; - } - } - - private static void thaumLightning(int tX, int tY, int tZ, int tXN, int tYN, int tZN, int wID) { - //This is enough to check for thaum, since it only ever matters for client side effects (Tested not to crash) - if (Loader.isModLoaded("Thaumcraft")) { - World world = DimensionManager.getWorld(wID); - FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8); - bolt.defaultFractal(); - bolt.setType(2); - bolt.setWidth(0.125F); - bolt.finalizeBolt(); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/ThaumSpark.java b/src/main/java/com/github/technus/tectech/mechanics/data/ThaumSpark.java deleted file mode 100644 index 99f3696aa9..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/data/ThaumSpark.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.github.technus.tectech.mechanics.data; - -import java.io.Serializable; -import java.util.Objects; - -public class ThaumSpark implements Serializable { - //This works regardless of if TC is loaded - private static final long serialVersionUID = -7037856938316679566L; - public int x, y, z, wID; - public byte xR, yR, zR; - - public ThaumSpark(){ - this.x = 0; - this.z = 0; - this.y = 0; - - this.xR = 0; - this.yR = 0; - this.zR = 0; - - this.wID = 0; - } - - public ThaumSpark(int x, int y, int z, byte xR, byte yR, byte zR, int wID) { - this.x = x; - this.z = z; - this.y = y; - - this.xR = xR; - this.yR = yR; - this.zR = zR; - - this.wID = wID; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ThaumSpark that = (ThaumSpark) o; - return x == that.x && - y == that.y && - z == that.z && - wID == that.wID && - xR == that.xR && - yR == that.yR && - zR == that.zR; - } - - @Override - public int hashCode() { - return Objects.hash(x, y, z, wID, xR, yR, zR); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java new file mode 100644 index 0000000000..f2fd17817d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java @@ -0,0 +1,82 @@ +package com.github.technus.tectech.mechanics.spark; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; +import thaumcraft.client.fx.bolt.FXLightningBolt; + +import java.io.*; +import java.util.Arrays; +import java.util.HashSet; + +public class RendererMessage implements IMessage { + HashSet sparkList = new HashSet(); + + public RendererMessage() { + } + + @Override + public void fromBytes(ByteBuf pBuffer) { + try { + //I'd love to know why I need to offset by one byte for this to work + byte[] boop = pBuffer.array(); + boop = Arrays.copyOfRange(boop, 1, boop.length); + InputStream is = new ByteArrayInputStream(boop); + ObjectInputStream ois = new ObjectInputStream(is); + Object data = ois.readObject(); + sparkList = (HashSet) data; + } catch (IOException | ClassNotFoundException ex) { + } + } + + @Override + public void toBytes(ByteBuf pBuffer) { + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(sparkList); + oos.flush(); + InputStream is = new ByteArrayInputStream(baos.toByteArray()); + pBuffer.writeBytes(is, baos.toByteArray().length); + } catch (IOException ex) { + } + } + + public static class RendererData extends RendererMessage { + public RendererData() { + } + + public RendererData(HashSet eSparkList) { + sparkList = eSparkList; + } + } + + + public static class ClientHandler extends AbstractClientMessageHandler { + @Override + public IMessage handleClientMessage(EntityPlayer pPlayer, RendererData pMessage, MessageContext pCtx) { + for (ThaumSpark sp : pMessage.sparkList) { + thaumLightning(sp.x, sp.y, sp.z, sp.xR, sp.yR, sp.zR, sp.wID); + } + pMessage.sparkList.clear(); + return null; + } + } + + private static void thaumLightning(int tX, int tY, int tZ, int tXN, int tYN, int tZN, int wID) { + //This is enough to check for thaum, since it only ever matters for client side effects (Tested not to crash) + if (Loader.isModLoaded("Thaumcraft")) { + World world = DimensionManager.getWorld(wID); + FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8); + bolt.defaultFractal(); + bolt.setType(2); + bolt.setWidth(0.125F); + bolt.finalizeBolt(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java new file mode 100644 index 0000000000..604624828c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java @@ -0,0 +1,54 @@ +package com.github.technus.tectech.mechanics.spark; + +import java.io.Serializable; +import java.util.Objects; + +public class ThaumSpark implements Serializable { + //This works regardless of if TC is loaded + private static final long serialVersionUID = -7037856938316679566L; + public int x, y, z, wID; + public byte xR, yR, zR; + + public ThaumSpark(){ + this.x = 0; + this.z = 0; + this.y = 0; + + this.xR = 0; + this.yR = 0; + this.zR = 0; + + this.wID = 0; + } + + public ThaumSpark(int x, int y, int z, byte xR, byte yR, byte zR, int wID) { + this.x = x; + this.z = z; + this.y = y; + + this.xR = xR; + this.yR = yR; + this.zR = zR; + + this.wID = wID; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ThaumSpark that = (ThaumSpark) o; + return x == that.x && + y == that.y && + z == that.z && + wID == that.wID && + xR == that.xR && + yR == that.yR && + zR == that.zR; + } + + @Override + public int hashCode() { + return Objects.hash(x, y, z, wID, xR, yR, zR); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 15263e2042..89093bdba7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -3,8 +3,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.data.RendererMessage; -import com.github.technus.tectech.mechanics.data.ThaumSpark; +import com.github.technus.tectech.mechanics.spark.RendererMessage; +import com.github.technus.tectech.mechanics.spark.ThaumSpark; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; 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 0c282ac94f..ed36dec7cb 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 @@ -4,8 +4,8 @@ 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.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.RendererMessage; -import com.github.technus.tectech.mechanics.data.ThaumSpark; +import com.github.technus.tectech.mechanics.spark.RendererMessage; +import com.github.technus.tectech.mechanics.spark.ThaumSpark; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil; -- cgit From 7d64270920ef2f095ae9923fdb9f0e685f940220 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 12 May 2020 20:11:23 +0200 Subject: Update descriptions --- .../tectech/loader/thing/MachineLoader.java | 252 ++++++++++----------- src/main/resources/assets/tectech/lang/en_US.lang | 252 ++++++++++----------- src/main/resources/assets/tectech/lang/zh_CN.lang | 252 ++++++++++----------- 3 files changed, 378 insertions(+), 378 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 9dd71df9eb..7b1e85591d 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -198,139 +198,139 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_energyTunnel1_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15130, "hatch.energytunnel1.tier.05", "IV 256/t Laser Target Hatch", 5, 256).getStackForm(1L)); + 15130, "hatch.energytunnel1.tier.05", "IV 256A/s Laser Target Hatch", 5, 256).getStackForm(1L)); eM_energyTunnel2_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15140, "hatch.energytunnel2.tier.05", "IV 1024/t Laser Target Hatch", 5, 1024).getStackForm(1L)); + 15140, "hatch.energytunnel2.tier.05", "IV 1024A/s Laser Target Hatch", 5, 1024).getStackForm(1L)); eM_energyTunnel3_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15150, "hatch.energytunnel3.tier.05", "IV 4096/t Laser Target Hatch", 5, 4096).getStackForm(1L)); + 15150, "hatch.energytunnel3.tier.05", "IV 4096A/s Laser Target Hatch", 5, 4096).getStackForm(1L)); eM_energyTunnel4_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15160, "hatch.energytunnel4.tier.05", "IV 16384/t Laser Target Hatch", 5, 16384).getStackForm(1L)); + 15160, "hatch.energytunnel4.tier.05", "IV 16384A/s Laser Target Hatch", 5, 16384).getStackForm(1L)); eM_energyTunnel5_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15170, "hatch.energytunnel5.tier.05", "IV 65536/t Laser Target Hatch", 5, 65536).getStackForm(1L)); + 15170, "hatch.energytunnel5.tier.05", "IV 65536A/s Laser Target Hatch", 5, 65536).getStackForm(1L)); eM_energyTunnel6_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15180, "hatch.energytunnel6.tier.05", "IV 262144/t Laser Target Hatch", 5, 262144).getStackForm(1L)); + 15180, "hatch.energytunnel6.tier.05", "IV 262144A/s Laser Target Hatch", 5, 262144).getStackForm(1L)); eM_energyTunnel7_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15190, "hatch.energytunnel7.tier.05", "IV 1048576/t Laser Target Hatch", 5, 1048576).getStackForm(1L)); + 15190, "hatch.energytunnel7.tier.05", "IV 1048576A/s Laser Target Hatch", 5, 1048576).getStackForm(1L)); eM_energyTunnel1_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15131, "hatch.energytunnel1.tier.06", "LuV 256/t Laser Target Hatch", 6, 256).getStackForm(1L)); + 15131, "hatch.energytunnel1.tier.06", "LuV 256A/s Laser Target Hatch", 6, 256).getStackForm(1L)); eM_energyTunnel2_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15141, "hatch.energytunnel2.tier.06", "LuV 1024/t Laser Target Hatch", 6, 1024).getStackForm(1L)); + 15141, "hatch.energytunnel2.tier.06", "LuV 1024A/s Laser Target Hatch", 6, 1024).getStackForm(1L)); eM_energyTunnel3_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15151, "hatch.energytunnel3.tier.06", "LuV 4096/t Laser Target Hatch", 6, 4096).getStackForm(1L)); + 15151, "hatch.energytunnel3.tier.06", "LuV 4096A/s Laser Target Hatch", 6, 4096).getStackForm(1L)); eM_energyTunnel4_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15161, "hatch.energytunnel4.tier.06", "LuV 16384/t Laser Target Hatch", 6, 16384).getStackForm(1L)); + 15161, "hatch.energytunnel4.tier.06", "LuV 16384A/s Laser Target Hatch", 6, 16384).getStackForm(1L)); eM_energyTunnel5_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15171, "hatch.energytunnel5.tier.06", "LuV 65536/t Laser Target Hatch", 6, 65536).getStackForm(1L)); + 15171, "hatch.energytunnel5.tier.06", "LuV 65536A/s Laser Target Hatch", 6, 65536).getStackForm(1L)); eM_energyTunnel6_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15181, "hatch.energytunnel6.tier.06", "LuV 262144/t Laser Target Hatch", 6, 262144).getStackForm(1L)); + 15181, "hatch.energytunnel6.tier.06", "LuV 262144A/s Laser Target Hatch", 6, 262144).getStackForm(1L)); eM_energyTunnel7_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15191, "hatch.energytunnel7.tier.06", "LuV 1048576/t Laser Target Hatch", 6, 1048576).getStackForm(1L)); + 15191, "hatch.energytunnel7.tier.06", "LuV 1048576A/s Laser Target Hatch", 6, 1048576).getStackForm(1L)); eM_energyTunnel1_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15132, "hatch.energytunnel1.tier.07", "ZPM 256/t Laser Target Hatch", 7, 256).getStackForm(1L)); + 15132, "hatch.energytunnel1.tier.07", "ZPM 256A/s Laser Target Hatch", 7, 256).getStackForm(1L)); eM_energyTunnel2_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15142, "hatch.energytunnel2.tier.07", "ZPM 1024/t Laser Target Hatch", 7, 1024).getStackForm(1L)); + 15142, "hatch.energytunnel2.tier.07", "ZPM 1024A/s Laser Target Hatch", 7, 1024).getStackForm(1L)); eM_energyTunnel3_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15152, "hatch.energytunnel3.tier.07", "ZPM 4096/t Laser Target Hatch", 7, 4096).getStackForm(1L)); + 15152, "hatch.energytunnel3.tier.07", "ZPM 4096A/s Laser Target Hatch", 7, 4096).getStackForm(1L)); eM_energyTunnel4_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15162, "hatch.energytunnel4.tier.07", "ZPM 16384/t Laser Target Hatch", 7, 16384).getStackForm(1L)); + 15162, "hatch.energytunnel4.tier.07", "ZPM 16384A/s Laser Target Hatch", 7, 16384).getStackForm(1L)); eM_energyTunnel5_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15172, "hatch.energytunnel5.tier.07", "ZPM 65536/t Laser Target Hatch", 7, 65536).getStackForm(1L)); + 15172, "hatch.energytunnel5.tier.07", "ZPM 65536A/s Laser Target Hatch", 7, 65536).getStackForm(1L)); eM_energyTunnel6_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15182, "hatch.energytunnel6.tier.07", "ZPM 262144/t Laser Target Hatch", 7, 262144).getStackForm(1L)); + 15182, "hatch.energytunnel6.tier.07", "ZPM 262144A/s Laser Target Hatch", 7, 262144).getStackForm(1L)); eM_energyTunnel7_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15192, "hatch.energytunnel7.tier.07", "ZPM 1048576/t Laser Target Hatch", 7, 1048576).getStackForm(1L)); + 15192, "hatch.energytunnel7.tier.07", "ZPM 1048576A/s Laser Target Hatch", 7, 1048576).getStackForm(1L)); eM_energyTunnel1_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15133, "hatch.energytunnel1.tier.08", "UV 256/t Laser Target Hatch", 8, 256).getStackForm(1L)); + 15133, "hatch.energytunnel1.tier.08", "UV 256A/s Laser Target Hatch", 8, 256).getStackForm(1L)); eM_energyTunnel2_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15143, "hatch.energytunnel2.tier.08", "UV 1024/t Laser Target Hatch", 8, 1024).getStackForm(1L)); + 15143, "hatch.energytunnel2.tier.08", "UV 1024A/s Laser Target Hatch", 8, 1024).getStackForm(1L)); eM_energyTunnel3_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15153, "hatch.energytunnel3.tier.08", "UV 4096/t Laser Target Hatch", 8, 4096).getStackForm(1L)); + 15153, "hatch.energytunnel3.tier.08", "UV 4096A/s Laser Target Hatch", 8, 4096).getStackForm(1L)); eM_energyTunnel4_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15163, "hatch.energytunnel4.tier.08", "UV 16384/t Laser Target Hatch", 8, 16384).getStackForm(1L)); + 15163, "hatch.energytunnel4.tier.08", "UV 16384A/s Laser Target Hatch", 8, 16384).getStackForm(1L)); eM_energyTunnel5_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15173, "hatch.energytunnel5.tier.08", "UV 65536/t Laser Target Hatch", 8, 65536).getStackForm(1L)); + 15173, "hatch.energytunnel5.tier.08", "UV 65536A/s Laser Target Hatch", 8, 65536).getStackForm(1L)); eM_energyTunnel6_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15183, "hatch.energytunnel6.tier.08", "UV 262144/t Laser Target Hatch", 8, 262144).getStackForm(1L)); + 15183, "hatch.energytunnel6.tier.08", "UV 262144A/s Laser Target Hatch", 8, 262144).getStackForm(1L)); eM_energyTunnel7_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15193, "hatch.energytunnel7.tier.08", "UV 1048576/t Laser Target Hatch", 8, 1048576).getStackForm(1L)); + 15193, "hatch.energytunnel7.tier.08", "UV 1048576A/s Laser Target Hatch", 8, 1048576).getStackForm(1L)); eM_energyTunnel1_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15134, "hatch.energytunnel1.tier.09", "UHV 256/t Laser Target Hatch", 9, 256).getStackForm(1L)); + 15134, "hatch.energytunnel1.tier.09", "UHV 256A/s Laser Target Hatch", 9, 256).getStackForm(1L)); eM_energyTunnel2_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15144, "hatch.energytunnel2.tier.09", "UHV 1024/t Laser Target Hatch", 9, 1024).getStackForm(1L)); + 15144, "hatch.energytunnel2.tier.09", "UHV 1024A/s Laser Target Hatch", 9, 1024).getStackForm(1L)); eM_energyTunnel3_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15154, "hatch.energytunnel3.tier.09", "UHV 4096/t Laser Target Hatch", 9, 4096).getStackForm(1L)); + 15154, "hatch.energytunnel3.tier.09", "UHV 4096A/s Laser Target Hatch", 9, 4096).getStackForm(1L)); eM_energyTunnel4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15164, "hatch.energytunnel4.tier.09", "UHV 16384/t Laser Target Hatch", 9, 16384).getStackForm(1L)); + 15164, "hatch.energytunnel4.tier.09", "UHV 16384A/s Laser Target Hatch", 9, 16384).getStackForm(1L)); eM_energyTunnel5_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15174, "hatch.energytunnel5.tier.09", "UHV 65536/t Laser Target Hatch", 9, 65536).getStackForm(1L)); + 15174, "hatch.energytunnel5.tier.09", "UHV 65536A/s Laser Target Hatch", 9, 65536).getStackForm(1L)); eM_energyTunnel6_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15184, "hatch.energytunnel6.tier.09", "UHV 262144/t Laser Target Hatch", 9, 262144).getStackForm(1L)); + 15184, "hatch.energytunnel6.tier.09", "UHV 262144A/s Laser Target Hatch", 9, 262144).getStackForm(1L)); eM_energyTunnel7_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15194, "hatch.energytunnel7.tier.09", "UHV 1048576/t Laser Target Hatch", 9, 1048576).getStackForm(1L)); + 15194, "hatch.energytunnel7.tier.09", "UHV 1048576A/s Laser Target Hatch", 9, 1048576).getStackForm(1L)); eM_energyTunnel1_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15135, "hatch.energytunnel1.tier.10", "UEV 256/t Laser Target Hatch", 10, 256).getStackForm(1L)); + 15135, "hatch.energytunnel1.tier.10", "UEV 256A/s Laser Target Hatch", 10, 256).getStackForm(1L)); eM_energyTunnel2_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15145, "hatch.energytunnel2.tier.10", "UEV 1024/t Laser Target Hatch", 10, 1024).getStackForm(1L)); + 15145, "hatch.energytunnel2.tier.10", "UEV 1024A/s Laser Target Hatch", 10, 1024).getStackForm(1L)); eM_energyTunnel3_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15155, "hatch.energytunnel3.tier.10", "UEV 4096/t Laser Target Hatch", 10, 4096).getStackForm(1L)); + 15155, "hatch.energytunnel3.tier.10", "UEV 4096A/s Laser Target Hatch", 10, 4096).getStackForm(1L)); eM_energyTunnel4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15165, "hatch.energytunnel4.tier.10", "UEV 16384/t Laser Target Hatch", 10, 16384).getStackForm(1L)); + 15165, "hatch.energytunnel4.tier.10", "UEV 16384A/s Laser Target Hatch", 10, 16384).getStackForm(1L)); eM_energyTunnel5_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15175, "hatch.energytunnel5.tier.10", "UEV 65536/t Laser Target Hatch", 10, 65536).getStackForm(1L)); + 15175, "hatch.energytunnel5.tier.10", "UEV 65536A/s Laser Target Hatch", 10, 65536).getStackForm(1L)); eM_energyTunnel6_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15185, "hatch.energytunnel6.tier.10", "UEV 262144/t Laser Target Hatch", 10, 262144).getStackForm(1L)); + 15185, "hatch.energytunnel6.tier.10", "UEV 262144A/s Laser Target Hatch", 10, 262144).getStackForm(1L)); eM_energyTunnel7_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15195, "hatch.energytunnel7.tier.10", "UEV 1048576/t Laser Target Hatch", 10, 1048576).getStackForm(1L)); + 15195, "hatch.energytunnel7.tier.10", "UEV 1048576A/s Laser Target Hatch", 10, 1048576).getStackForm(1L)); eM_energyTunnel1_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15136, "hatch.energytunnel1.tier.11", "UIV 256/t Laser Target Hatch", 11, 256).getStackForm(1L)); + 15136, "hatch.energytunnel1.tier.11", "UIV 256A/s Laser Target Hatch", 11, 256).getStackForm(1L)); eM_energyTunnel2_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15146, "hatch.energytunnel2.tier.11", "UIV 1024/t Laser Target Hatch", 11, 1024).getStackForm(1L)); + 15146, "hatch.energytunnel2.tier.11", "UIV 1024A/s Laser Target Hatch", 11, 1024).getStackForm(1L)); eM_energyTunnel3_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15156, "hatch.energytunnel3.tier.11", "UIV 4096/t Laser Target Hatch", 11, 4096).getStackForm(1L)); + 15156, "hatch.energytunnel3.tier.11", "UIV 4096A/s Laser Target Hatch", 11, 4096).getStackForm(1L)); eM_energyTunnel4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15166, "hatch.energytunnel4.tier.11", "UIV 16384/t Laser Target Hatch", 11, 16384).getStackForm(1L)); + 15166, "hatch.energytunnel4.tier.11", "UIV 16384A/s Laser Target Hatch", 11, 16384).getStackForm(1L)); eM_energyTunnel5_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15176, "hatch.energytunnel5.tier.11", "UIV 65536/t Laser Target Hatch", 11, 65536).getStackForm(1L)); + 15176, "hatch.energytunnel5.tier.11", "UIV 65536A/s Laser Target Hatch", 11, 65536).getStackForm(1L)); eM_energyTunnel6_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15186, "hatch.energytunnel6.tier.11", "UIV 262144/t Laser Target Hatch", 11, 262144).getStackForm(1L)); + 15186, "hatch.energytunnel6.tier.11", "UIV 262144A/s Laser Target Hatch", 11, 262144).getStackForm(1L)); eM_energyTunnel7_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15196, "hatch.energytunnel7.tier.11", "UIV 1048576/t Laser Target Hatch", 11, 1048576).getStackForm(1L)); + 15196, "hatch.energytunnel7.tier.11", "UIV 1048576A/s Laser Target Hatch", 11, 1048576).getStackForm(1L)); eM_energyTunnel1_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15137, "hatch.energytunnel1.tier.12", "UMV 256/t Laser Target Hatch", 12, 256).getStackForm(1L)); + 15137, "hatch.energytunnel1.tier.12", "UMV 256A/s Laser Target Hatch", 12, 256).getStackForm(1L)); eM_energyTunnel2_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15147, "hatch.energytunnel2.tier.12", "UMV 1024/t Laser Target Hatch", 12, 1024).getStackForm(1L)); + 15147, "hatch.energytunnel2.tier.12", "UMV 1024A/s Laser Target Hatch", 12, 1024).getStackForm(1L)); eM_energyTunnel3_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15157, "hatch.energytunnel3.tier.12", "UMV 4096/t Laser Target Hatch", 12, 4096).getStackForm(1L)); + 15157, "hatch.energytunnel3.tier.12", "UMV 4096A/s Laser Target Hatch", 12, 4096).getStackForm(1L)); eM_energyTunnel4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15167, "hatch.energytunnel4.tier.12", "UMV 16384/t Laser Target Hatch", 12, 16384).getStackForm(1L)); + 15167, "hatch.energytunnel4.tier.12", "UMV 16384A/s Laser Target Hatch", 12, 16384).getStackForm(1L)); eM_energyTunnel5_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15177, "hatch.energytunnel5.tier.12", "UMV 65536/t Laser Target Hatch", 12, 65536).getStackForm(1L)); + 15177, "hatch.energytunnel5.tier.12", "UMV 65536A/s Laser Target Hatch", 12, 65536).getStackForm(1L)); eM_energyTunnel6_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15187, "hatch.energytunnel6.tier.12", "UMV 262144/t Laser Target Hatch", 12, 262144).getStackForm(1L)); + 15187, "hatch.energytunnel6.tier.12", "UMV 262144A/s Laser Target Hatch", 12, 262144).getStackForm(1L)); eM_energyTunnel7_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15197, "hatch.energytunnel7.tier.12", "UMV 1048576/t Laser Target Hatch", 12, 1048576).getStackForm(1L)); + 15197, "hatch.energytunnel7.tier.12", "UMV 1048576A/s Laser Target Hatch", 12, 1048576).getStackForm(1L)); eM_energyTunnel1_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15138, "hatch.energytunnel1.tier.13", "UXV 256/t Laser Target Hatch", 13, 256).getStackForm(1L)); + 15138, "hatch.energytunnel1.tier.13", "UXV 256A/s Laser Target Hatch", 13, 256).getStackForm(1L)); eM_energyTunnel2_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15148, "hatch.energytunnel2.tier.13", "UXV 1024/t Laser Target Hatch", 13, 1024).getStackForm(1L)); + 15148, "hatch.energytunnel2.tier.13", "UXV 1024A/s Laser Target Hatch", 13, 1024).getStackForm(1L)); eM_energyTunnel3_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15158, "hatch.energytunnel3.tier.13", "UXV 4096/t Laser Target Hatch", 13, 4096).getStackForm(1L)); + 15158, "hatch.energytunnel3.tier.13", "UXV 4096A/s Laser Target Hatch", 13, 4096).getStackForm(1L)); eM_energyTunnel4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15168, "hatch.energytunnel4.tier.13", "UXV 16384/t Laser Target Hatch", 13, 16384).getStackForm(1L)); + 15168, "hatch.energytunnel4.tier.13", "UXV 16384A/s Laser Target Hatch", 13, 16384).getStackForm(1L)); eM_energyTunnel5_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15178, "hatch.energytunnel5.tier.13", "UXV 65536/t Laser Target Hatch", 13, 65536).getStackForm(1L)); + 15178, "hatch.energytunnel5.tier.13", "UXV 65536A/s Laser Target Hatch", 13, 65536).getStackForm(1L)); eM_energyTunnel6_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15188, "hatch.energytunnel6.tier.13", "UXV 262144/t Laser Target Hatch", 13, 262144).getStackForm(1L)); + 15188, "hatch.energytunnel6.tier.13", "UXV 262144A/s Laser Target Hatch", 13, 262144).getStackForm(1L)); eM_energyTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15198, "hatch.energytunnel7.tier.13", "UXV 1048576/t Laser Target Hatch", 13, 1048576).getStackForm(1L)); + 15198, "hatch.energytunnel7.tier.13", "UXV 1048576A/s Laser Target Hatch", 13, 1048576).getStackForm(1L)); eM_energyTunnel9001.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( 15199, "hatch.energytunnel.tier.14", "Legendary Laser Target Hatch", 14, (int) V[14]).getStackForm(1L)); @@ -406,139 +406,139 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_dynamoTunnel1_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15230, "hatch.dynamotunnel1.tier.05", "IV 256/t Laser Source Hatch", 5, 256).getStackForm(1L)); + 15230, "hatch.dynamotunnel1.tier.05", "IV 256A/s Laser Source Hatch", 5, 256).getStackForm(1L)); eM_dynamoTunnel2_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15240, "hatch.dynamotunnel2.tier.05", "IV 1024/t Laser Source Hatch", 5, 1024).getStackForm(1L)); + 15240, "hatch.dynamotunnel2.tier.05", "IV 1024A/s Laser Source Hatch", 5, 1024).getStackForm(1L)); eM_dynamoTunnel3_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15250, "hatch.dynamotunnel3.tier.05", "IV 4096/t Laser Source Hatch", 5, 4096).getStackForm(1L)); + 15250, "hatch.dynamotunnel3.tier.05", "IV 4096A/s Laser Source Hatch", 5, 4096).getStackForm(1L)); eM_dynamoTunnel4_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15260, "hatch.dynamotunnel4.tier.05", "IV 16384/t Laser Source Hatch", 5, 16384).getStackForm(1L)); + 15260, "hatch.dynamotunnel4.tier.05", "IV 16384A/s Laser Source Hatch", 5, 16384).getStackForm(1L)); eM_dynamoTunnel5_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15270, "hatch.dynamotunnel5.tier.05", "IV 65536/t Laser Source Hatch", 5, 65536).getStackForm(1L)); + 15270, "hatch.dynamotunnel5.tier.05", "IV 65536A/s Laser Source Hatch", 5, 65536).getStackForm(1L)); eM_dynamoTunnel6_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15280, "hatch.dynamotunnel6.tier.05", "IV 262144/t Laser Source Hatch", 5, 262144).getStackForm(1L)); + 15280, "hatch.dynamotunnel6.tier.05", "IV 262144A/s Laser Source Hatch", 5, 262144).getStackForm(1L)); eM_dynamoTunnel7_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15290, "hatch.dynamotunnel7.tier.05", "IV 1048576/t Laser Source Hatch", 5, 1048576).getStackForm(1L)); + 15290, "hatch.dynamotunnel7.tier.05", "IV 1048576A/s Laser Source Hatch", 5, 1048576).getStackForm(1L)); eM_dynamoTunnel1_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15231, "hatch.dynamotunnel1.tier.06", "LuV 256/t Laser Source Hatch", 6, 256).getStackForm(1L)); + 15231, "hatch.dynamotunnel1.tier.06", "LuV 256A/s Laser Source Hatch", 6, 256).getStackForm(1L)); eM_dynamoTunnel2_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15241, "hatch.dynamotunnel2.tier.06", "LuV 1024/t Laser Source Hatch", 6, 1024).getStackForm(1L)); + 15241, "hatch.dynamotunnel2.tier.06", "LuV 1024A/s Laser Source Hatch", 6, 1024).getStackForm(1L)); eM_dynamoTunnel3_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15251, "hatch.dynamotunnel3.tier.06", "LuV 4096/t Laser Source Hatch", 6, 4096).getStackForm(1L)); + 15251, "hatch.dynamotunnel3.tier.06", "LuV 4096A/s Laser Source Hatch", 6, 4096).getStackForm(1L)); eM_dynamoTunnel4_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15261, "hatch.dynamotunnel4.tier.06", "LuV 16384/t Laser Source Hatch", 6, 16384).getStackForm(1L)); + 15261, "hatch.dynamotunnel4.tier.06", "LuV 16384A/s Laser Source Hatch", 6, 16384).getStackForm(1L)); eM_dynamoTunnel5_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15271, "hatch.dynamotunnel5.tier.06", "LuV 65536/t Laser Source Hatch", 6, 65536).getStackForm(1L)); + 15271, "hatch.dynamotunnel5.tier.06", "LuV 65536A/s Laser Source Hatch", 6, 65536).getStackForm(1L)); eM_dynamoTunnel6_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15281, "hatch.dynamotunnel6.tier.06", "LuV 262144/t Laser Source Hatch", 6, 262144).getStackForm(1L)); + 15281, "hatch.dynamotunnel6.tier.06", "LuV 262144A/s Laser Source Hatch", 6, 262144).getStackForm(1L)); eM_dynamoTunnel7_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15291, "hatch.dynamotunnel7.tier.06", "LuV 1048576/t Laser Source Hatch", 6, 1048576).getStackForm(1L)); + 15291, "hatch.dynamotunnel7.tier.06", "LuV 1048576A/s Laser Source Hatch", 6, 1048576).getStackForm(1L)); eM_dynamoTunnel1_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15232, "hatch.dynamotunnel1.tier.07", "ZPM 256/t Laser Source Hatch", 7, 256).getStackForm(1L)); + 15232, "hatch.dynamotunnel1.tier.07", "ZPM 256A/s Laser Source Hatch", 7, 256).getStackForm(1L)); eM_dynamoTunnel2_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15242, "hatch.dynamotunnel2.tier.07", "ZPM 1024/t Laser Source Hatch", 7, 1024).getStackForm(1L)); + 15242, "hatch.dynamotunnel2.tier.07", "ZPM 1024A/s Laser Source Hatch", 7, 1024).getStackForm(1L)); eM_dynamoTunnel3_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15252, "hatch.dynamotunnel3.tier.07", "ZPM 4096/t Laser Source Hatch", 7, 4096).getStackForm(1L)); + 15252, "hatch.dynamotunnel3.tier.07", "ZPM 4096A/s Laser Source Hatch", 7, 4096).getStackForm(1L)); eM_dynamoTunnel4_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15262, "hatch.dynamotunnel4.tier.07", "ZPM 16384/t Laser Source Hatch", 7, 16384).getStackForm(1L)); + 15262, "hatch.dynamotunnel4.tier.07", "ZPM 16384A/s Laser Source Hatch", 7, 16384).getStackForm(1L)); eM_dynamoTunnel5_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15272, "hatch.dynamotunnel5.tier.07", "ZPM 65536/t Laser Source Hatch", 7, 65536).getStackForm(1L)); + 15272, "hatch.dynamotunnel5.tier.07", "ZPM 65536A/s Laser Source Hatch", 7, 65536).getStackForm(1L)); eM_dynamoTunnel6_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15282, "hatch.dynamotunnel6.tier.07", "ZPM 262144/t Laser Source Hatch", 7, 262144).getStackForm(1L)); + 15282, "hatch.dynamotunnel6.tier.07", "ZPM 262144A/s Laser Source Hatch", 7, 262144).getStackForm(1L)); eM_dynamoTunnel7_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15292, "hatch.dynamotunnel7.tier.07", "ZPM 1048576/t Laser Source Hatch", 7, 1048576).getStackForm(1L)); + 15292, "hatch.dynamotunnel7.tier.07", "ZPM 1048576A/s Laser Source Hatch", 7, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15233, "hatch.dynamotunnel1.tier.08", "UV 256/t Laser Source Hatch", 8, 256).getStackForm(1L)); + 15233, "hatch.dynamotunnel1.tier.08", "UV 256A/s Laser Source Hatch", 8, 256).getStackForm(1L)); eM_dynamoTunnel2_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15243, "hatch.dynamotunnel2.tier.08", "UV 1024/t Laser Source Hatch", 8, 1024).getStackForm(1L)); + 15243, "hatch.dynamotunnel2.tier.08", "UV 1024A/s Laser Source Hatch", 8, 1024).getStackForm(1L)); eM_dynamoTunnel3_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15253, "hatch.dynamotunnel3.tier.08", "UV 4096/t Laser Source Hatch", 8, 4096).getStackForm(1L)); + 15253, "hatch.dynamotunnel3.tier.08", "UV 4096A/s Laser Source Hatch", 8, 4096).getStackForm(1L)); eM_dynamoTunnel4_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15263, "hatch.dynamotunnel4.tier.08", "UV 16384/t Laser Source Hatch", 8, 16384).getStackForm(1L)); + 15263, "hatch.dynamotunnel4.tier.08", "UV 16384A/s Laser Source Hatch", 8, 16384).getStackForm(1L)); eM_dynamoTunnel5_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15273, "hatch.dynamotunnel5.tier.08", "UV 65536/t Laser Source Hatch", 8, 65536).getStackForm(1L)); + 15273, "hatch.dynamotunnel5.tier.08", "UV 65536A/s Laser Source Hatch", 8, 65536).getStackForm(1L)); eM_dynamoTunnel6_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15283, "hatch.dynamotunnel6.tier.08", "UV 262144/t Laser Source Hatch", 8, 262144).getStackForm(1L)); + 15283, "hatch.dynamotunnel6.tier.08", "UV 262144A/s Laser Source Hatch", 8, 262144).getStackForm(1L)); eM_dynamoTunnel7_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15293, "hatch.dynamotunnel7.tier.08", "UV 1048576/t Laser Source Hatch", 8, 1048576).getStackForm(1L)); + 15293, "hatch.dynamotunnel7.tier.08", "UV 1048576A/s Laser Source Hatch", 8, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15234, "hatch.dynamotunnel1.tier.09", "UHV 256/t Laser Source Hatch", 9, 256).getStackForm(1L)); + 15234, "hatch.dynamotunnel1.tier.09", "UHV 256A/s Laser Source Hatch", 9, 256).getStackForm(1L)); eM_dynamoTunnel2_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15244, "hatch.dynamotunnel2.tier.09", "UHV 1024/t Laser Source Hatch", 9, 1024).getStackForm(1L)); + 15244, "hatch.dynamotunnel2.tier.09", "UHV 1024A/s Laser Source Hatch", 9, 1024).getStackForm(1L)); eM_dynamoTunnel3_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15254, "hatch.dynamotunnel3.tier.09", "UHV 4096/t Laser Source Hatch", 9, 4096).getStackForm(1L)); + 15254, "hatch.dynamotunnel3.tier.09", "UHV 4096A/s Laser Source Hatch", 9, 4096).getStackForm(1L)); eM_dynamoTunnel4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15264, "hatch.dynamotunnel4.tier.09", "UHV 16384/t Laser Source Hatch", 9, 16384).getStackForm(1L)); + 15264, "hatch.dynamotunnel4.tier.09", "UHV 16384A/s Laser Source Hatch", 9, 16384).getStackForm(1L)); eM_dynamoTunnel5_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15274, "hatch.dynamotunnel5.tier.09", "UHV 65536/t Laser Source Hatch", 9, 65536).getStackForm(1L)); + 15274, "hatch.dynamotunnel5.tier.09", "UHV 65536A/s Laser Source Hatch", 9, 65536).getStackForm(1L)); eM_dynamoTunnel6_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15284, "hatch.dynamotunnel6.tier.09", "UHV 262144/t Laser Source Hatch", 9, 262144).getStackForm(1L)); + 15284, "hatch.dynamotunnel6.tier.09", "UHV 262144A/s Laser Source Hatch", 9, 262144).getStackForm(1L)); eM_dynamoTunnel7_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15294, "hatch.dynamotunnel7.tier.09", "UHV 1048576/t Laser Source Hatch", 9, 1048576).getStackForm(1L)); + 15294, "hatch.dynamotunnel7.tier.09", "UHV 1048576A/s Laser Source Hatch", 9, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15235, "hatch.dynamotunnel1.tier.10", "UEV 256/t Laser Source Hatch", 10, 256).getStackForm(1L)); + 15235, "hatch.dynamotunnel1.tier.10", "UEV 256A/s Laser Source Hatch", 10, 256).getStackForm(1L)); eM_dynamoTunnel2_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15245, "hatch.dynamotunnel2.tier.10", "UEV 1024/t Laser Source Hatch", 10, 1024).getStackForm(1L)); + 15245, "hatch.dynamotunnel2.tier.10", "UEV 1024A/s Laser Source Hatch", 10, 1024).getStackForm(1L)); eM_dynamoTunnel3_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15255, "hatch.dynamotunnel3.tier.10", "UEV 4096/t Laser Source Hatch", 10, 4096).getStackForm(1L)); + 15255, "hatch.dynamotunnel3.tier.10", "UEV 4096A/s Laser Source Hatch", 10, 4096).getStackForm(1L)); eM_dynamoTunnel4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15265, "hatch.dynamotunnel4.tier.10", "UEV 16384/t Laser Source Hatch", 10, 16384).getStackForm(1L)); + 15265, "hatch.dynamotunnel4.tier.10", "UEV 16384A/s Laser Source Hatch", 10, 16384).getStackForm(1L)); eM_dynamoTunnel5_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15275, "hatch.dynamotunnel5.tier.10", "UEV 65536/t Laser Source Hatch", 10, 65536).getStackForm(1L)); + 15275, "hatch.dynamotunnel5.tier.10", "UEV 65536A/s Laser Source Hatch", 10, 65536).getStackForm(1L)); eM_dynamoTunnel6_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15285, "hatch.dynamotunnel6.tier.10", "UEV 262144/t Laser Source Hatch", 10, 262144).getStackForm(1L)); + 15285, "hatch.dynamotunnel6.tier.10", "UEV 262144A/s Laser Source Hatch", 10, 262144).getStackForm(1L)); eM_dynamoTunnel7_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15295, "hatch.dynamotunnel7.tier.10", "UEV 1048576/t Laser Source Hatch", 10, 1048576).getStackForm(1L)); + 15295, "hatch.dynamotunnel7.tier.10", "UEV 1048576A/s Laser Source Hatch", 10, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15236, "hatch.dynamotunnel1.tier.11", "UIV 256/t Laser Source Hatch", 11, 256).getStackForm(1L)); + 15236, "hatch.dynamotunnel1.tier.11", "UIV 256A/s Laser Source Hatch", 11, 256).getStackForm(1L)); eM_dynamoTunnel2_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15246, "hatch.dynamotunnel2.tier.11", "UIV 1024/t Laser Source Hatch", 11, 1024).getStackForm(1L)); + 15246, "hatch.dynamotunnel2.tier.11", "UIV 1024A/s Laser Source Hatch", 11, 1024).getStackForm(1L)); eM_dynamoTunnel3_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15256, "hatch.dynamotunnel3.tier.11", "UIV 4096/t Laser Source Hatch", 11, 4096).getStackForm(1L)); + 15256, "hatch.dynamotunnel3.tier.11", "UIV 4096A/s Laser Source Hatch", 11, 4096).getStackForm(1L)); eM_dynamoTunnel4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15266, "hatch.dynamotunnel4.tier.11", "UIV 16384/t Laser Source Hatch", 11, 16384).getStackForm(1L)); + 15266, "hatch.dynamotunnel4.tier.11", "UIV 16384A/s Laser Source Hatch", 11, 16384).getStackForm(1L)); eM_dynamoTunnel5_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15276, "hatch.dynamotunnel5.tier.11", "UIV 65536/t Laser Source Hatch", 11, 65536).getStackForm(1L)); + 15276, "hatch.dynamotunnel5.tier.11", "UIV 65536A/s Laser Source Hatch", 11, 65536).getStackForm(1L)); eM_dynamoTunnel6_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15286, "hatch.dynamotunnel6.tier.11", "UIV 262144/t Laser Source Hatch", 11, 262144).getStackForm(1L)); + 15286, "hatch.dynamotunnel6.tier.11", "UIV 262144A/s Laser Source Hatch", 11, 262144).getStackForm(1L)); eM_dynamoTunnel7_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15296, "hatch.dynamotunnel7.tier.11", "UIV 1048576/t Laser Source Hatch", 11, 1048576).getStackForm(1L)); + 15296, "hatch.dynamotunnel7.tier.11", "UIV 1048576A/s Laser Source Hatch", 11, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15237, "hatch.dynamotunnel1.tier.12", "UMV 256/t Laser Source Hatch", 12, 256).getStackForm(1L)); + 15237, "hatch.dynamotunnel1.tier.12", "UMV 256A/s Laser Source Hatch", 12, 256).getStackForm(1L)); eM_dynamoTunnel2_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15247, "hatch.dynamotunnel2.tier.12", "UMV 1024/t Laser Source Hatch", 12, 1024).getStackForm(1L)); + 15247, "hatch.dynamotunnel2.tier.12", "UMV 1024A/s Laser Source Hatch", 12, 1024).getStackForm(1L)); eM_dynamoTunnel3_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15257, "hatch.dynamotunnel3.tier.12", "UMV 4096/t Laser Source Hatch", 12, 4096).getStackForm(1L)); + 15257, "hatch.dynamotunnel3.tier.12", "UMV 4096A/s Laser Source Hatch", 12, 4096).getStackForm(1L)); eM_dynamoTunnel4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15267, "hatch.dynamotunnel4.tier.12", "UMV 16384/t Laser Source Hatch", 12, 16384).getStackForm(1L)); + 15267, "hatch.dynamotunnel4.tier.12", "UMV 16384A/s Laser Source Hatch", 12, 16384).getStackForm(1L)); eM_dynamoTunnel5_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15277, "hatch.dynamotunnel5.tier.12", "UMV 65536/t Laser Source Hatch", 12, 65536).getStackForm(1L)); + 15277, "hatch.dynamotunnel5.tier.12", "UMV 65536A/s Laser Source Hatch", 12, 65536).getStackForm(1L)); eM_dynamoTunnel6_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15287, "hatch.dynamotunnel6.tier.12", "UMV 262144/t Laser Source Hatch", 12, 262144).getStackForm(1L)); + 15287, "hatch.dynamotunnel6.tier.12", "UMV 262144A/s Laser Source Hatch", 12, 262144).getStackForm(1L)); eM_dynamoTunnel7_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15297, "hatch.dynamotunnel7.tier.12", "UMV 1048576/t Laser Source Hatch", 12, 1048576).getStackForm(1L)); + 15297, "hatch.dynamotunnel7.tier.12", "UMV 1048576A/s Laser Source Hatch", 12, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15238, "hatch.dynamotunnel1.tier.13", "UXV 256/t Laser Source Hatch", 13, 256).getStackForm(1L)); + 15238, "hatch.dynamotunnel1.tier.13", "UXV 256A/s Laser Source Hatch", 13, 256).getStackForm(1L)); eM_dynamoTunnel2_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15248, "hatch.dynamotunnel2.tier.13", "UXV 1024/t Laser Source Hatch", 13, 1024).getStackForm(1L)); + 15248, "hatch.dynamotunnel2.tier.13", "UXV 1024A/s Laser Source Hatch", 13, 1024).getStackForm(1L)); eM_dynamoTunnel3_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15258, "hatch.dynamotunnel3.tier.13", "UXV 4096/t Laser Source Hatch", 13, 4096).getStackForm(1L)); + 15258, "hatch.dynamotunnel3.tier.13", "UXV 4096A/s Laser Source Hatch", 13, 4096).getStackForm(1L)); eM_dynamoTunnel4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15268, "hatch.dynamotunnel4.tier.13", "UXV 16384/t Laser Source Hatch", 13, 16384).getStackForm(1L)); + 15268, "hatch.dynamotunnel4.tier.13", "UXV 16384A/s Laser Source Hatch", 13, 16384).getStackForm(1L)); eM_dynamoTunnel5_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15278, "hatch.dynamotunnel5.tier.13", "UXV 65536/t Laser Source Hatch", 13, 65536).getStackForm(1L)); + 15278, "hatch.dynamotunnel5.tier.13", "UXV 65536A/s Laser Source Hatch", 13, 65536).getStackForm(1L)); eM_dynamoTunnel6_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15288, "hatch.dynamotunnel6.tier.13", "UXV 262144/t Laser Source Hatch", 13, 262144).getStackForm(1L)); + 15288, "hatch.dynamotunnel6.tier.13", "UXV 262144A/s Laser Source Hatch", 13, 262144).getStackForm(1L)); eM_dynamoTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15298, "hatch.dynamotunnel7.tier.13", "UXV 1048576/t Laser Source Hatch", 13, 1048576).getStackForm(1L)); + 15298, "hatch.dynamotunnel7.tier.13", "UXV 1048576A/s Laser Source Hatch", 13, 1048576).getStackForm(1L)); eM_dynamoTunnel9001.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( 15299, "hatch.dynamotunnel.tier.14", "Legendary Laser Source Hatch", 14, (int) V[14]).getStackForm(1L)); diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 5005a90c60..70f7d5ab8f 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -210,69 +210,69 @@ gt.blockmachines.hatch.energymulti64.tier.13.name=UXV 64A Energy Hatch gt.blockmachines.hatch.energymulti.desc.0=Multiple Ampere Energy Injector for Multiblocks gt.blockmachines.hatch.energymulti.desc.1=Amperes In -gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/s Laser Target Hatch gt.blockmachines.hatch.energytunnel.tier.14.name=Legendary Laser Target Hatch gt.blockmachines.hatch.energytunnel.desc.0=Energy injecting terminal for Multiblocks gt.blockmachines.hatch.energytunnel.desc.1=Throughput @@ -307,69 +307,69 @@ gt.blockmachines.hatch.dynamomulti64.tier.13.name=IV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti.desc.0=Multiple Ampere Energy Extractor for Multiblocks gt.blockmachines.hatch.dynamomulti.desc.1=Amperes Out -gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/s Laser Source Hatch gt.blockmachines.hatch.dynamotunnel.tier.14.name=Legendary Laser Source Hatch gt.blockmachines.hatch.dynamotunnel.desc.0=Energy extracting terminal for Multiblocks gt.blockmachines.hatch.dynamotunnel.desc.1=Throughput diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index a96b13a58f..3484eb3579 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -210,69 +210,69 @@ gt.blockmachines.hatch.energymulti64.tier.13.name=64安UXV能源仓 gt.blockmachines.hatch.energymulti.desc.0=为多方块机器以高电流输入能源 gt.blockmachines.hatch.energymulti.desc.1=输入电流 -gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/s 激光靶仓 gt.blockmachines.hatch.energytunnel.tier.14.name=传奇激光靶仓 gt.blockmachines.hatch.energytunnel.desc.0=多方块机器的能量输入端 gt.blockmachines.hatch.energytunnel.desc.1=通量 @@ -307,69 +307,69 @@ gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安IV动力仓 gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 -gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/s 激光源仓 gt.blockmachines.hatch.dynamotunnel.tier.14.name=传奇激光源仓 gt.blockmachines.hatch.dynamotunnel.desc.0=多方块机器的能量输出端 gt.blockmachines.hatch.dynamotunnel.desc.1=通量 -- cgit From 92b50677c155e8781efc26a5e9ddb660c48ffec5 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 12 May 2020 21:35:29 +0200 Subject: Added config Option for Block Nerf (#28) --- .../github/technus/tectech/loader/MainLoader.java | 11 ++++++++--- .../github/technus/tectech/loader/TecTechConfig.java | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index bab6c6d092..d473da6b07 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -153,9 +153,14 @@ public final class MainLoader { registerExtraHazmats(); TecTech.LOGGER.info("Hazmat additions done"); - progressBarPostLoad.step("Nerf blocks blast resistance"); - fixBlocks(); - TecTech.LOGGER.info("Blocks nerf done"); + if (!configTecTech.DISABLE_BLOCK_HARDNESS_NERF) { + progressBarPostLoad.step("Nerf blocks blast resistance"); + fixBlocks(); + TecTech.LOGGER.info("Blocks nerf done"); + } else { + progressBarPostLoad.step("Do not nerf blocks blast resistance"); + TecTech.LOGGER.info("Blocks were not nerfed"); + } progressBarPostLoad.step("Constructable stuff"); new ConstructableLoader().run(); diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index e16580befe..0c2920e585 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -18,6 +18,7 @@ public class TecTechConfig extends ConfigManager { public boolean NERF_FUSION; public boolean ENABLE_TURRET_EXPLOSIONS; public boolean DISABLE_MATERIAL_LOADING_FFS; + public boolean DISABLE_BLOCK_HARDNESS_NERF; public float TURRET_DAMAGE_FACTOR; public float TURRET_EXPLOSION_FACTOR; public float TESLA_MULTI_MIN_EFFICIENCY; @@ -38,8 +39,9 @@ public class TecTechConfig extends ConfigManager { EASY_SCAN = false; BOOM_ENABLE = true; NERF_FUSION = false; + DISABLE_BLOCK_HARDNESS_NERF = false; ENABLE_TURRET_EXPLOSIONS = true; - DISABLE_MATERIAL_LOADING_FFS=false; + DISABLE_MATERIAL_LOADING_FFS = false; TURRET_DAMAGE_FACTOR = 10; TURRET_EXPLOSION_FACTOR = 1; TESLA_MULTI_MIN_EFFICIENCY = 0.955F; @@ -72,19 +74,21 @@ public class TecTechConfig extends ConfigManager { "Damage is multiplied by this number"); TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "Features", TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE, "Explosion strength is multiplied by this number"); - DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS, + DISABLE_BLOCK_HARDNESS_NERF = _mainConfig.getBoolean("DisableBlockHardnessNerf", "Features", DISABLE_BLOCK_HARDNESS_NERF, + "Set to true to disable the block hardness nerf"); + DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS, "Set to true to disable gregtech material processing"); - TESLA_MULTI_MIN_EFFICIENCY = _mainConfig.getFloat("teslaMultiMinEfficency", "Features", TESLA_MULTI_MIN_EFFICIENCY, 0, 1, + TESLA_MULTI_MIN_EFFICIENCY = _mainConfig.getFloat("teslaMultiMinEfficency", "Features", TESLA_MULTI_MIN_EFFICIENCY, 0, 1, "Worst possible power loss per block for the multi block tesla"); - TESLA_MULTI_MAX_EFFICIENCY = _mainConfig.getFloat("teslaMultiMaxEfficency", "Features", TESLA_MULTI_MAX_EFFICIENCY, 0, 1, + TESLA_MULTI_MAX_EFFICIENCY = _mainConfig.getFloat("teslaMultiMaxEfficency", "Features", TESLA_MULTI_MAX_EFFICIENCY, 0, 1, "Best possible power loss per block for the multi block tesla"); - TESLA_MULTI_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaMultiOverdriveLoss", "Features", TESLA_MULTI_OVERDRIVE_LOSS, 0, 1, + TESLA_MULTI_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaMultiOverdriveLoss", "Features", TESLA_MULTI_OVERDRIVE_LOSS, 0, 1, "Additional losses for overdrive use on the multi block tesla"); - TESLA_SINGLE_MIN_EFFICIENCY = _mainConfig.getFloat("teslaSingleMinEfficency", "Features", TESLA_SINGLE_MIN_EFFICIENCY, 0, 1, + TESLA_SINGLE_MIN_EFFICIENCY = _mainConfig.getFloat("teslaSingleMinEfficency", "Features", TESLA_SINGLE_MIN_EFFICIENCY, 0, 1, "Worst possible power loss per block for the single block tesla"); - TESLA_SINGLE_MAX_EFFICIENCY = _mainConfig.getFloat("teslaSingleMaxEfficency", "Features", TESLA_SINGLE_MAX_EFFICIENCY, 0, 1, + TESLA_SINGLE_MAX_EFFICIENCY = _mainConfig.getFloat("teslaSingleMaxEfficency", "Features", TESLA_SINGLE_MAX_EFFICIENCY, 0, 1, "Best possible power loss per block for the single block tesla"); - TESLA_SINGLE_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaSingleOverdriveLoss", "Features", TESLA_SINGLE_OVERDRIVE_LOSS, 0, 1, + TESLA_SINGLE_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaSingleOverdriveLoss", "Features", TESLA_SINGLE_OVERDRIVE_LOSS, 0, 1, "Additional losses for overdrive use on the single block tesla"); } -- cgit From 20212d1d6950dadd1fa705f144d8f62abe59fbfc Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 12 May 2020 22:14:22 +0200 Subject: Fix laser logic --- .../tectech/loader/thing/MachineLoader.java | 252 ++++++++++----------- .../GT_MetaTileEntity_Hatch_DynamoTunnel.java | 7 +- src/main/resources/assets/tectech/lang/en_US.lang | 252 ++++++++++----------- src/main/resources/assets/tectech/lang/zh_CN.lang | 252 ++++++++++----------- 4 files changed, 381 insertions(+), 382 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 7b1e85591d..3891d28845 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -198,139 +198,139 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_energyTunnel1_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15130, "hatch.energytunnel1.tier.05", "IV 256A/s Laser Target Hatch", 5, 256).getStackForm(1L)); + 15130, "hatch.energytunnel1.tier.05", "IV 256A/t Laser Target Hatch", 5, 256).getStackForm(1L)); eM_energyTunnel2_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15140, "hatch.energytunnel2.tier.05", "IV 1024A/s Laser Target Hatch", 5, 1024).getStackForm(1L)); + 15140, "hatch.energytunnel2.tier.05", "IV 1024A/t Laser Target Hatch", 5, 1024).getStackForm(1L)); eM_energyTunnel3_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15150, "hatch.energytunnel3.tier.05", "IV 4096A/s Laser Target Hatch", 5, 4096).getStackForm(1L)); + 15150, "hatch.energytunnel3.tier.05", "IV 4096A/t Laser Target Hatch", 5, 4096).getStackForm(1L)); eM_energyTunnel4_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15160, "hatch.energytunnel4.tier.05", "IV 16384A/s Laser Target Hatch", 5, 16384).getStackForm(1L)); + 15160, "hatch.energytunnel4.tier.05", "IV 16384A/t Laser Target Hatch", 5, 16384).getStackForm(1L)); eM_energyTunnel5_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15170, "hatch.energytunnel5.tier.05", "IV 65536A/s Laser Target Hatch", 5, 65536).getStackForm(1L)); + 15170, "hatch.energytunnel5.tier.05", "IV 65536A/t Laser Target Hatch", 5, 65536).getStackForm(1L)); eM_energyTunnel6_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15180, "hatch.energytunnel6.tier.05", "IV 262144A/s Laser Target Hatch", 5, 262144).getStackForm(1L)); + 15180, "hatch.energytunnel6.tier.05", "IV 262144A/t Laser Target Hatch", 5, 262144).getStackForm(1L)); eM_energyTunnel7_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15190, "hatch.energytunnel7.tier.05", "IV 1048576A/s Laser Target Hatch", 5, 1048576).getStackForm(1L)); + 15190, "hatch.energytunnel7.tier.05", "IV 1048576A/t Laser Target Hatch", 5, 1048576).getStackForm(1L)); eM_energyTunnel1_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15131, "hatch.energytunnel1.tier.06", "LuV 256A/s Laser Target Hatch", 6, 256).getStackForm(1L)); + 15131, "hatch.energytunnel1.tier.06", "LuV 256A/t Laser Target Hatch", 6, 256).getStackForm(1L)); eM_energyTunnel2_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15141, "hatch.energytunnel2.tier.06", "LuV 1024A/s Laser Target Hatch", 6, 1024).getStackForm(1L)); + 15141, "hatch.energytunnel2.tier.06", "LuV 1024A/t Laser Target Hatch", 6, 1024).getStackForm(1L)); eM_energyTunnel3_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15151, "hatch.energytunnel3.tier.06", "LuV 4096A/s Laser Target Hatch", 6, 4096).getStackForm(1L)); + 15151, "hatch.energytunnel3.tier.06", "LuV 4096A/t Laser Target Hatch", 6, 4096).getStackForm(1L)); eM_energyTunnel4_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15161, "hatch.energytunnel4.tier.06", "LuV 16384A/s Laser Target Hatch", 6, 16384).getStackForm(1L)); + 15161, "hatch.energytunnel4.tier.06", "LuV 16384A/t Laser Target Hatch", 6, 16384).getStackForm(1L)); eM_energyTunnel5_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15171, "hatch.energytunnel5.tier.06", "LuV 65536A/s Laser Target Hatch", 6, 65536).getStackForm(1L)); + 15171, "hatch.energytunnel5.tier.06", "LuV 65536A/t Laser Target Hatch", 6, 65536).getStackForm(1L)); eM_energyTunnel6_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15181, "hatch.energytunnel6.tier.06", "LuV 262144A/s Laser Target Hatch", 6, 262144).getStackForm(1L)); + 15181, "hatch.energytunnel6.tier.06", "LuV 262144A/t Laser Target Hatch", 6, 262144).getStackForm(1L)); eM_energyTunnel7_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15191, "hatch.energytunnel7.tier.06", "LuV 1048576A/s Laser Target Hatch", 6, 1048576).getStackForm(1L)); + 15191, "hatch.energytunnel7.tier.06", "LuV 1048576A/t Laser Target Hatch", 6, 1048576).getStackForm(1L)); eM_energyTunnel1_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15132, "hatch.energytunnel1.tier.07", "ZPM 256A/s Laser Target Hatch", 7, 256).getStackForm(1L)); + 15132, "hatch.energytunnel1.tier.07", "ZPM 256A/t Laser Target Hatch", 7, 256).getStackForm(1L)); eM_energyTunnel2_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15142, "hatch.energytunnel2.tier.07", "ZPM 1024A/s Laser Target Hatch", 7, 1024).getStackForm(1L)); + 15142, "hatch.energytunnel2.tier.07", "ZPM 1024A/t Laser Target Hatch", 7, 1024).getStackForm(1L)); eM_energyTunnel3_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15152, "hatch.energytunnel3.tier.07", "ZPM 4096A/s Laser Target Hatch", 7, 4096).getStackForm(1L)); + 15152, "hatch.energytunnel3.tier.07", "ZPM 4096A/t Laser Target Hatch", 7, 4096).getStackForm(1L)); eM_energyTunnel4_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15162, "hatch.energytunnel4.tier.07", "ZPM 16384A/s Laser Target Hatch", 7, 16384).getStackForm(1L)); + 15162, "hatch.energytunnel4.tier.07", "ZPM 16384A/t Laser Target Hatch", 7, 16384).getStackForm(1L)); eM_energyTunnel5_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15172, "hatch.energytunnel5.tier.07", "ZPM 65536A/s Laser Target Hatch", 7, 65536).getStackForm(1L)); + 15172, "hatch.energytunnel5.tier.07", "ZPM 65536A/t Laser Target Hatch", 7, 65536).getStackForm(1L)); eM_energyTunnel6_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15182, "hatch.energytunnel6.tier.07", "ZPM 262144A/s Laser Target Hatch", 7, 262144).getStackForm(1L)); + 15182, "hatch.energytunnel6.tier.07", "ZPM 262144A/t Laser Target Hatch", 7, 262144).getStackForm(1L)); eM_energyTunnel7_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15192, "hatch.energytunnel7.tier.07", "ZPM 1048576A/s Laser Target Hatch", 7, 1048576).getStackForm(1L)); + 15192, "hatch.energytunnel7.tier.07", "ZPM 1048576A/t Laser Target Hatch", 7, 1048576).getStackForm(1L)); eM_energyTunnel1_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15133, "hatch.energytunnel1.tier.08", "UV 256A/s Laser Target Hatch", 8, 256).getStackForm(1L)); + 15133, "hatch.energytunnel1.tier.08", "UV 256A/t Laser Target Hatch", 8, 256).getStackForm(1L)); eM_energyTunnel2_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15143, "hatch.energytunnel2.tier.08", "UV 1024A/s Laser Target Hatch", 8, 1024).getStackForm(1L)); + 15143, "hatch.energytunnel2.tier.08", "UV 1024A/t Laser Target Hatch", 8, 1024).getStackForm(1L)); eM_energyTunnel3_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15153, "hatch.energytunnel3.tier.08", "UV 4096A/s Laser Target Hatch", 8, 4096).getStackForm(1L)); + 15153, "hatch.energytunnel3.tier.08", "UV 4096A/t Laser Target Hatch", 8, 4096).getStackForm(1L)); eM_energyTunnel4_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15163, "hatch.energytunnel4.tier.08", "UV 16384A/s Laser Target Hatch", 8, 16384).getStackForm(1L)); + 15163, "hatch.energytunnel4.tier.08", "UV 16384A/t Laser Target Hatch", 8, 16384).getStackForm(1L)); eM_energyTunnel5_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15173, "hatch.energytunnel5.tier.08", "UV 65536A/s Laser Target Hatch", 8, 65536).getStackForm(1L)); + 15173, "hatch.energytunnel5.tier.08", "UV 65536A/t Laser Target Hatch", 8, 65536).getStackForm(1L)); eM_energyTunnel6_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15183, "hatch.energytunnel6.tier.08", "UV 262144A/s Laser Target Hatch", 8, 262144).getStackForm(1L)); + 15183, "hatch.energytunnel6.tier.08", "UV 262144A/t Laser Target Hatch", 8, 262144).getStackForm(1L)); eM_energyTunnel7_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15193, "hatch.energytunnel7.tier.08", "UV 1048576A/s Laser Target Hatch", 8, 1048576).getStackForm(1L)); + 15193, "hatch.energytunnel7.tier.08", "UV 1048576A/t Laser Target Hatch", 8, 1048576).getStackForm(1L)); eM_energyTunnel1_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15134, "hatch.energytunnel1.tier.09", "UHV 256A/s Laser Target Hatch", 9, 256).getStackForm(1L)); + 15134, "hatch.energytunnel1.tier.09", "UHV 256A/t Laser Target Hatch", 9, 256).getStackForm(1L)); eM_energyTunnel2_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15144, "hatch.energytunnel2.tier.09", "UHV 1024A/s Laser Target Hatch", 9, 1024).getStackForm(1L)); + 15144, "hatch.energytunnel2.tier.09", "UHV 1024A/t Laser Target Hatch", 9, 1024).getStackForm(1L)); eM_energyTunnel3_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15154, "hatch.energytunnel3.tier.09", "UHV 4096A/s Laser Target Hatch", 9, 4096).getStackForm(1L)); + 15154, "hatch.energytunnel3.tier.09", "UHV 4096A/t Laser Target Hatch", 9, 4096).getStackForm(1L)); eM_energyTunnel4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15164, "hatch.energytunnel4.tier.09", "UHV 16384A/s Laser Target Hatch", 9, 16384).getStackForm(1L)); + 15164, "hatch.energytunnel4.tier.09", "UHV 16384A/t Laser Target Hatch", 9, 16384).getStackForm(1L)); eM_energyTunnel5_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15174, "hatch.energytunnel5.tier.09", "UHV 65536A/s Laser Target Hatch", 9, 65536).getStackForm(1L)); + 15174, "hatch.energytunnel5.tier.09", "UHV 65536A/t Laser Target Hatch", 9, 65536).getStackForm(1L)); eM_energyTunnel6_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15184, "hatch.energytunnel6.tier.09", "UHV 262144A/s Laser Target Hatch", 9, 262144).getStackForm(1L)); + 15184, "hatch.energytunnel6.tier.09", "UHV 262144A/t Laser Target Hatch", 9, 262144).getStackForm(1L)); eM_energyTunnel7_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15194, "hatch.energytunnel7.tier.09", "UHV 1048576A/s Laser Target Hatch", 9, 1048576).getStackForm(1L)); + 15194, "hatch.energytunnel7.tier.09", "UHV 1048576A/t Laser Target Hatch", 9, 1048576).getStackForm(1L)); eM_energyTunnel1_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15135, "hatch.energytunnel1.tier.10", "UEV 256A/s Laser Target Hatch", 10, 256).getStackForm(1L)); + 15135, "hatch.energytunnel1.tier.10", "UEV 256A/t Laser Target Hatch", 10, 256).getStackForm(1L)); eM_energyTunnel2_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15145, "hatch.energytunnel2.tier.10", "UEV 1024A/s Laser Target Hatch", 10, 1024).getStackForm(1L)); + 15145, "hatch.energytunnel2.tier.10", "UEV 1024A/t Laser Target Hatch", 10, 1024).getStackForm(1L)); eM_energyTunnel3_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15155, "hatch.energytunnel3.tier.10", "UEV 4096A/s Laser Target Hatch", 10, 4096).getStackForm(1L)); + 15155, "hatch.energytunnel3.tier.10", "UEV 4096A/t Laser Target Hatch", 10, 4096).getStackForm(1L)); eM_energyTunnel4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15165, "hatch.energytunnel4.tier.10", "UEV 16384A/s Laser Target Hatch", 10, 16384).getStackForm(1L)); + 15165, "hatch.energytunnel4.tier.10", "UEV 16384A/t Laser Target Hatch", 10, 16384).getStackForm(1L)); eM_energyTunnel5_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15175, "hatch.energytunnel5.tier.10", "UEV 65536A/s Laser Target Hatch", 10, 65536).getStackForm(1L)); + 15175, "hatch.energytunnel5.tier.10", "UEV 65536A/t Laser Target Hatch", 10, 65536).getStackForm(1L)); eM_energyTunnel6_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15185, "hatch.energytunnel6.tier.10", "UEV 262144A/s Laser Target Hatch", 10, 262144).getStackForm(1L)); + 15185, "hatch.energytunnel6.tier.10", "UEV 262144A/t Laser Target Hatch", 10, 262144).getStackForm(1L)); eM_energyTunnel7_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15195, "hatch.energytunnel7.tier.10", "UEV 1048576A/s Laser Target Hatch", 10, 1048576).getStackForm(1L)); + 15195, "hatch.energytunnel7.tier.10", "UEV 1048576A/t Laser Target Hatch", 10, 1048576).getStackForm(1L)); eM_energyTunnel1_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15136, "hatch.energytunnel1.tier.11", "UIV 256A/s Laser Target Hatch", 11, 256).getStackForm(1L)); + 15136, "hatch.energytunnel1.tier.11", "UIV 256A/t Laser Target Hatch", 11, 256).getStackForm(1L)); eM_energyTunnel2_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15146, "hatch.energytunnel2.tier.11", "UIV 1024A/s Laser Target Hatch", 11, 1024).getStackForm(1L)); + 15146, "hatch.energytunnel2.tier.11", "UIV 1024A/t Laser Target Hatch", 11, 1024).getStackForm(1L)); eM_energyTunnel3_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15156, "hatch.energytunnel3.tier.11", "UIV 4096A/s Laser Target Hatch", 11, 4096).getStackForm(1L)); + 15156, "hatch.energytunnel3.tier.11", "UIV 4096A/t Laser Target Hatch", 11, 4096).getStackForm(1L)); eM_energyTunnel4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15166, "hatch.energytunnel4.tier.11", "UIV 16384A/s Laser Target Hatch", 11, 16384).getStackForm(1L)); + 15166, "hatch.energytunnel4.tier.11", "UIV 16384A/t Laser Target Hatch", 11, 16384).getStackForm(1L)); eM_energyTunnel5_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15176, "hatch.energytunnel5.tier.11", "UIV 65536A/s Laser Target Hatch", 11, 65536).getStackForm(1L)); + 15176, "hatch.energytunnel5.tier.11", "UIV 65536A/t Laser Target Hatch", 11, 65536).getStackForm(1L)); eM_energyTunnel6_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15186, "hatch.energytunnel6.tier.11", "UIV 262144A/s Laser Target Hatch", 11, 262144).getStackForm(1L)); + 15186, "hatch.energytunnel6.tier.11", "UIV 262144A/t Laser Target Hatch", 11, 262144).getStackForm(1L)); eM_energyTunnel7_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15196, "hatch.energytunnel7.tier.11", "UIV 1048576A/s Laser Target Hatch", 11, 1048576).getStackForm(1L)); + 15196, "hatch.energytunnel7.tier.11", "UIV 1048576A/t Laser Target Hatch", 11, 1048576).getStackForm(1L)); eM_energyTunnel1_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15137, "hatch.energytunnel1.tier.12", "UMV 256A/s Laser Target Hatch", 12, 256).getStackForm(1L)); + 15137, "hatch.energytunnel1.tier.12", "UMV 256A/t Laser Target Hatch", 12, 256).getStackForm(1L)); eM_energyTunnel2_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15147, "hatch.energytunnel2.tier.12", "UMV 1024A/s Laser Target Hatch", 12, 1024).getStackForm(1L)); + 15147, "hatch.energytunnel2.tier.12", "UMV 1024A/t Laser Target Hatch", 12, 1024).getStackForm(1L)); eM_energyTunnel3_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15157, "hatch.energytunnel3.tier.12", "UMV 4096A/s Laser Target Hatch", 12, 4096).getStackForm(1L)); + 15157, "hatch.energytunnel3.tier.12", "UMV 4096A/t Laser Target Hatch", 12, 4096).getStackForm(1L)); eM_energyTunnel4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15167, "hatch.energytunnel4.tier.12", "UMV 16384A/s Laser Target Hatch", 12, 16384).getStackForm(1L)); + 15167, "hatch.energytunnel4.tier.12", "UMV 16384A/t Laser Target Hatch", 12, 16384).getStackForm(1L)); eM_energyTunnel5_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15177, "hatch.energytunnel5.tier.12", "UMV 65536A/s Laser Target Hatch", 12, 65536).getStackForm(1L)); + 15177, "hatch.energytunnel5.tier.12", "UMV 65536A/t Laser Target Hatch", 12, 65536).getStackForm(1L)); eM_energyTunnel6_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15187, "hatch.energytunnel6.tier.12", "UMV 262144A/s Laser Target Hatch", 12, 262144).getStackForm(1L)); + 15187, "hatch.energytunnel6.tier.12", "UMV 262144A/t Laser Target Hatch", 12, 262144).getStackForm(1L)); eM_energyTunnel7_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15197, "hatch.energytunnel7.tier.12", "UMV 1048576A/s Laser Target Hatch", 12, 1048576).getStackForm(1L)); + 15197, "hatch.energytunnel7.tier.12", "UMV 1048576A/t Laser Target Hatch", 12, 1048576).getStackForm(1L)); eM_energyTunnel1_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15138, "hatch.energytunnel1.tier.13", "UXV 256A/s Laser Target Hatch", 13, 256).getStackForm(1L)); + 15138, "hatch.energytunnel1.tier.13", "UXV 256A/t Laser Target Hatch", 13, 256).getStackForm(1L)); eM_energyTunnel2_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15148, "hatch.energytunnel2.tier.13", "UXV 1024A/s Laser Target Hatch", 13, 1024).getStackForm(1L)); + 15148, "hatch.energytunnel2.tier.13", "UXV 1024A/t Laser Target Hatch", 13, 1024).getStackForm(1L)); eM_energyTunnel3_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15158, "hatch.energytunnel3.tier.13", "UXV 4096A/s Laser Target Hatch", 13, 4096).getStackForm(1L)); + 15158, "hatch.energytunnel3.tier.13", "UXV 4096A/t Laser Target Hatch", 13, 4096).getStackForm(1L)); eM_energyTunnel4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15168, "hatch.energytunnel4.tier.13", "UXV 16384A/s Laser Target Hatch", 13, 16384).getStackForm(1L)); + 15168, "hatch.energytunnel4.tier.13", "UXV 16384A/t Laser Target Hatch", 13, 16384).getStackForm(1L)); eM_energyTunnel5_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15178, "hatch.energytunnel5.tier.13", "UXV 65536A/s Laser Target Hatch", 13, 65536).getStackForm(1L)); + 15178, "hatch.energytunnel5.tier.13", "UXV 65536A/t Laser Target Hatch", 13, 65536).getStackForm(1L)); eM_energyTunnel6_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15188, "hatch.energytunnel6.tier.13", "UXV 262144A/s Laser Target Hatch", 13, 262144).getStackForm(1L)); + 15188, "hatch.energytunnel6.tier.13", "UXV 262144A/t Laser Target Hatch", 13, 262144).getStackForm(1L)); eM_energyTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15198, "hatch.energytunnel7.tier.13", "UXV 1048576A/s Laser Target Hatch", 13, 1048576).getStackForm(1L)); + 15198, "hatch.energytunnel7.tier.13", "UXV 1048576A/t Laser Target Hatch", 13, 1048576).getStackForm(1L)); eM_energyTunnel9001.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( 15199, "hatch.energytunnel.tier.14", "Legendary Laser Target Hatch", 14, (int) V[14]).getStackForm(1L)); @@ -406,139 +406,139 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_dynamoTunnel1_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15230, "hatch.dynamotunnel1.tier.05", "IV 256A/s Laser Source Hatch", 5, 256).getStackForm(1L)); + 15230, "hatch.dynamotunnel1.tier.05", "IV 256A/t Laser Source Hatch", 5, 256).getStackForm(1L)); eM_dynamoTunnel2_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15240, "hatch.dynamotunnel2.tier.05", "IV 1024A/s Laser Source Hatch", 5, 1024).getStackForm(1L)); + 15240, "hatch.dynamotunnel2.tier.05", "IV 1024A/t Laser Source Hatch", 5, 1024).getStackForm(1L)); eM_dynamoTunnel3_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15250, "hatch.dynamotunnel3.tier.05", "IV 4096A/s Laser Source Hatch", 5, 4096).getStackForm(1L)); + 15250, "hatch.dynamotunnel3.tier.05", "IV 4096A/t Laser Source Hatch", 5, 4096).getStackForm(1L)); eM_dynamoTunnel4_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15260, "hatch.dynamotunnel4.tier.05", "IV 16384A/s Laser Source Hatch", 5, 16384).getStackForm(1L)); + 15260, "hatch.dynamotunnel4.tier.05", "IV 16384A/t Laser Source Hatch", 5, 16384).getStackForm(1L)); eM_dynamoTunnel5_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15270, "hatch.dynamotunnel5.tier.05", "IV 65536A/s Laser Source Hatch", 5, 65536).getStackForm(1L)); + 15270, "hatch.dynamotunnel5.tier.05", "IV 65536A/t Laser Source Hatch", 5, 65536).getStackForm(1L)); eM_dynamoTunnel6_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15280, "hatch.dynamotunnel6.tier.05", "IV 262144A/s Laser Source Hatch", 5, 262144).getStackForm(1L)); + 15280, "hatch.dynamotunnel6.tier.05", "IV 262144A/t Laser Source Hatch", 5, 262144).getStackForm(1L)); eM_dynamoTunnel7_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15290, "hatch.dynamotunnel7.tier.05", "IV 1048576A/s Laser Source Hatch", 5, 1048576).getStackForm(1L)); + 15290, "hatch.dynamotunnel7.tier.05", "IV 1048576A/t Laser Source Hatch", 5, 1048576).getStackForm(1L)); eM_dynamoTunnel1_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15231, "hatch.dynamotunnel1.tier.06", "LuV 256A/s Laser Source Hatch", 6, 256).getStackForm(1L)); + 15231, "hatch.dynamotunnel1.tier.06", "LuV 256A/t Laser Source Hatch", 6, 256).getStackForm(1L)); eM_dynamoTunnel2_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15241, "hatch.dynamotunnel2.tier.06", "LuV 1024A/s Laser Source Hatch", 6, 1024).getStackForm(1L)); + 15241, "hatch.dynamotunnel2.tier.06", "LuV 1024A/t Laser Source Hatch", 6, 1024).getStackForm(1L)); eM_dynamoTunnel3_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15251, "hatch.dynamotunnel3.tier.06", "LuV 4096A/s Laser Source Hatch", 6, 4096).getStackForm(1L)); + 15251, "hatch.dynamotunnel3.tier.06", "LuV 4096A/t Laser Source Hatch", 6, 4096).getStackForm(1L)); eM_dynamoTunnel4_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15261, "hatch.dynamotunnel4.tier.06", "LuV 16384A/s Laser Source Hatch", 6, 16384).getStackForm(1L)); + 15261, "hatch.dynamotunnel4.tier.06", "LuV 16384A/t Laser Source Hatch", 6, 16384).getStackForm(1L)); eM_dynamoTunnel5_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15271, "hatch.dynamotunnel5.tier.06", "LuV 65536A/s Laser Source Hatch", 6, 65536).getStackForm(1L)); + 15271, "hatch.dynamotunnel5.tier.06", "LuV 65536A/t Laser Source Hatch", 6, 65536).getStackForm(1L)); eM_dynamoTunnel6_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15281, "hatch.dynamotunnel6.tier.06", "LuV 262144A/s Laser Source Hatch", 6, 262144).getStackForm(1L)); + 15281, "hatch.dynamotunnel6.tier.06", "LuV 262144A/t Laser Source Hatch", 6, 262144).getStackForm(1L)); eM_dynamoTunnel7_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15291, "hatch.dynamotunnel7.tier.06", "LuV 1048576A/s Laser Source Hatch", 6, 1048576).getStackForm(1L)); + 15291, "hatch.dynamotunnel7.tier.06", "LuV 1048576A/t Laser Source Hatch", 6, 1048576).getStackForm(1L)); eM_dynamoTunnel1_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15232, "hatch.dynamotunnel1.tier.07", "ZPM 256A/s Laser Source Hatch", 7, 256).getStackForm(1L)); + 15232, "hatch.dynamotunnel1.tier.07", "ZPM 256A/t Laser Source Hatch", 7, 256).getStackForm(1L)); eM_dynamoTunnel2_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15242, "hatch.dynamotunnel2.tier.07", "ZPM 1024A/s Laser Source Hatch", 7, 1024).getStackForm(1L)); + 15242, "hatch.dynamotunnel2.tier.07", "ZPM 1024A/t Laser Source Hatch", 7, 1024).getStackForm(1L)); eM_dynamoTunnel3_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15252, "hatch.dynamotunnel3.tier.07", "ZPM 4096A/s Laser Source Hatch", 7, 4096).getStackForm(1L)); + 15252, "hatch.dynamotunnel3.tier.07", "ZPM 4096A/t Laser Source Hatch", 7, 4096).getStackForm(1L)); eM_dynamoTunnel4_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15262, "hatch.dynamotunnel4.tier.07", "ZPM 16384A/s Laser Source Hatch", 7, 16384).getStackForm(1L)); + 15262, "hatch.dynamotunnel4.tier.07", "ZPM 16384A/t Laser Source Hatch", 7, 16384).getStackForm(1L)); eM_dynamoTunnel5_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15272, "hatch.dynamotunnel5.tier.07", "ZPM 65536A/s Laser Source Hatch", 7, 65536).getStackForm(1L)); + 15272, "hatch.dynamotunnel5.tier.07", "ZPM 65536A/t Laser Source Hatch", 7, 65536).getStackForm(1L)); eM_dynamoTunnel6_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15282, "hatch.dynamotunnel6.tier.07", "ZPM 262144A/s Laser Source Hatch", 7, 262144).getStackForm(1L)); + 15282, "hatch.dynamotunnel6.tier.07", "ZPM 262144A/t Laser Source Hatch", 7, 262144).getStackForm(1L)); eM_dynamoTunnel7_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15292, "hatch.dynamotunnel7.tier.07", "ZPM 1048576A/s Laser Source Hatch", 7, 1048576).getStackForm(1L)); + 15292, "hatch.dynamotunnel7.tier.07", "ZPM 1048576A/t Laser Source Hatch", 7, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15233, "hatch.dynamotunnel1.tier.08", "UV 256A/s Laser Source Hatch", 8, 256).getStackForm(1L)); + 15233, "hatch.dynamotunnel1.tier.08", "UV 256A/t Laser Source Hatch", 8, 256).getStackForm(1L)); eM_dynamoTunnel2_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15243, "hatch.dynamotunnel2.tier.08", "UV 1024A/s Laser Source Hatch", 8, 1024).getStackForm(1L)); + 15243, "hatch.dynamotunnel2.tier.08", "UV 1024A/t Laser Source Hatch", 8, 1024).getStackForm(1L)); eM_dynamoTunnel3_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15253, "hatch.dynamotunnel3.tier.08", "UV 4096A/s Laser Source Hatch", 8, 4096).getStackForm(1L)); + 15253, "hatch.dynamotunnel3.tier.08", "UV 4096A/t Laser Source Hatch", 8, 4096).getStackForm(1L)); eM_dynamoTunnel4_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15263, "hatch.dynamotunnel4.tier.08", "UV 16384A/s Laser Source Hatch", 8, 16384).getStackForm(1L)); + 15263, "hatch.dynamotunnel4.tier.08", "UV 16384A/t Laser Source Hatch", 8, 16384).getStackForm(1L)); eM_dynamoTunnel5_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15273, "hatch.dynamotunnel5.tier.08", "UV 65536A/s Laser Source Hatch", 8, 65536).getStackForm(1L)); + 15273, "hatch.dynamotunnel5.tier.08", "UV 65536A/t Laser Source Hatch", 8, 65536).getStackForm(1L)); eM_dynamoTunnel6_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15283, "hatch.dynamotunnel6.tier.08", "UV 262144A/s Laser Source Hatch", 8, 262144).getStackForm(1L)); + 15283, "hatch.dynamotunnel6.tier.08", "UV 262144A/t Laser Source Hatch", 8, 262144).getStackForm(1L)); eM_dynamoTunnel7_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15293, "hatch.dynamotunnel7.tier.08", "UV 1048576A/s Laser Source Hatch", 8, 1048576).getStackForm(1L)); + 15293, "hatch.dynamotunnel7.tier.08", "UV 1048576A/t Laser Source Hatch", 8, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15234, "hatch.dynamotunnel1.tier.09", "UHV 256A/s Laser Source Hatch", 9, 256).getStackForm(1L)); + 15234, "hatch.dynamotunnel1.tier.09", "UHV 256A/t Laser Source Hatch", 9, 256).getStackForm(1L)); eM_dynamoTunnel2_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15244, "hatch.dynamotunnel2.tier.09", "UHV 1024A/s Laser Source Hatch", 9, 1024).getStackForm(1L)); + 15244, "hatch.dynamotunnel2.tier.09", "UHV 1024A/t Laser Source Hatch", 9, 1024).getStackForm(1L)); eM_dynamoTunnel3_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15254, "hatch.dynamotunnel3.tier.09", "UHV 4096A/s Laser Source Hatch", 9, 4096).getStackForm(1L)); + 15254, "hatch.dynamotunnel3.tier.09", "UHV 4096A/t Laser Source Hatch", 9, 4096).getStackForm(1L)); eM_dynamoTunnel4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15264, "hatch.dynamotunnel4.tier.09", "UHV 16384A/s Laser Source Hatch", 9, 16384).getStackForm(1L)); + 15264, "hatch.dynamotunnel4.tier.09", "UHV 16384A/t Laser Source Hatch", 9, 16384).getStackForm(1L)); eM_dynamoTunnel5_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15274, "hatch.dynamotunnel5.tier.09", "UHV 65536A/s Laser Source Hatch", 9, 65536).getStackForm(1L)); + 15274, "hatch.dynamotunnel5.tier.09", "UHV 65536A/t Laser Source Hatch", 9, 65536).getStackForm(1L)); eM_dynamoTunnel6_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15284, "hatch.dynamotunnel6.tier.09", "UHV 262144A/s Laser Source Hatch", 9, 262144).getStackForm(1L)); + 15284, "hatch.dynamotunnel6.tier.09", "UHV 262144A/t Laser Source Hatch", 9, 262144).getStackForm(1L)); eM_dynamoTunnel7_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15294, "hatch.dynamotunnel7.tier.09", "UHV 1048576A/s Laser Source Hatch", 9, 1048576).getStackForm(1L)); + 15294, "hatch.dynamotunnel7.tier.09", "UHV 1048576A/t Laser Source Hatch", 9, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15235, "hatch.dynamotunnel1.tier.10", "UEV 256A/s Laser Source Hatch", 10, 256).getStackForm(1L)); + 15235, "hatch.dynamotunnel1.tier.10", "UEV 256A/t Laser Source Hatch", 10, 256).getStackForm(1L)); eM_dynamoTunnel2_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15245, "hatch.dynamotunnel2.tier.10", "UEV 1024A/s Laser Source Hatch", 10, 1024).getStackForm(1L)); + 15245, "hatch.dynamotunnel2.tier.10", "UEV 1024A/t Laser Source Hatch", 10, 1024).getStackForm(1L)); eM_dynamoTunnel3_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15255, "hatch.dynamotunnel3.tier.10", "UEV 4096A/s Laser Source Hatch", 10, 4096).getStackForm(1L)); + 15255, "hatch.dynamotunnel3.tier.10", "UEV 4096A/t Laser Source Hatch", 10, 4096).getStackForm(1L)); eM_dynamoTunnel4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15265, "hatch.dynamotunnel4.tier.10", "UEV 16384A/s Laser Source Hatch", 10, 16384).getStackForm(1L)); + 15265, "hatch.dynamotunnel4.tier.10", "UEV 16384A/t Laser Source Hatch", 10, 16384).getStackForm(1L)); eM_dynamoTunnel5_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15275, "hatch.dynamotunnel5.tier.10", "UEV 65536A/s Laser Source Hatch", 10, 65536).getStackForm(1L)); + 15275, "hatch.dynamotunnel5.tier.10", "UEV 65536A/t Laser Source Hatch", 10, 65536).getStackForm(1L)); eM_dynamoTunnel6_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15285, "hatch.dynamotunnel6.tier.10", "UEV 262144A/s Laser Source Hatch", 10, 262144).getStackForm(1L)); + 15285, "hatch.dynamotunnel6.tier.10", "UEV 262144A/t Laser Source Hatch", 10, 262144).getStackForm(1L)); eM_dynamoTunnel7_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15295, "hatch.dynamotunnel7.tier.10", "UEV 1048576A/s Laser Source Hatch", 10, 1048576).getStackForm(1L)); + 15295, "hatch.dynamotunnel7.tier.10", "UEV 1048576A/t Laser Source Hatch", 10, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15236, "hatch.dynamotunnel1.tier.11", "UIV 256A/s Laser Source Hatch", 11, 256).getStackForm(1L)); + 15236, "hatch.dynamotunnel1.tier.11", "UIV 256A/t Laser Source Hatch", 11, 256).getStackForm(1L)); eM_dynamoTunnel2_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15246, "hatch.dynamotunnel2.tier.11", "UIV 1024A/s Laser Source Hatch", 11, 1024).getStackForm(1L)); + 15246, "hatch.dynamotunnel2.tier.11", "UIV 1024A/t Laser Source Hatch", 11, 1024).getStackForm(1L)); eM_dynamoTunnel3_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15256, "hatch.dynamotunnel3.tier.11", "UIV 4096A/s Laser Source Hatch", 11, 4096).getStackForm(1L)); + 15256, "hatch.dynamotunnel3.tier.11", "UIV 4096A/t Laser Source Hatch", 11, 4096).getStackForm(1L)); eM_dynamoTunnel4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15266, "hatch.dynamotunnel4.tier.11", "UIV 16384A/s Laser Source Hatch", 11, 16384).getStackForm(1L)); + 15266, "hatch.dynamotunnel4.tier.11", "UIV 16384A/t Laser Source Hatch", 11, 16384).getStackForm(1L)); eM_dynamoTunnel5_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15276, "hatch.dynamotunnel5.tier.11", "UIV 65536A/s Laser Source Hatch", 11, 65536).getStackForm(1L)); + 15276, "hatch.dynamotunnel5.tier.11", "UIV 65536A/t Laser Source Hatch", 11, 65536).getStackForm(1L)); eM_dynamoTunnel6_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15286, "hatch.dynamotunnel6.tier.11", "UIV 262144A/s Laser Source Hatch", 11, 262144).getStackForm(1L)); + 15286, "hatch.dynamotunnel6.tier.11", "UIV 262144A/t Laser Source Hatch", 11, 262144).getStackForm(1L)); eM_dynamoTunnel7_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15296, "hatch.dynamotunnel7.tier.11", "UIV 1048576A/s Laser Source Hatch", 11, 1048576).getStackForm(1L)); + 15296, "hatch.dynamotunnel7.tier.11", "UIV 1048576A/t Laser Source Hatch", 11, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15237, "hatch.dynamotunnel1.tier.12", "UMV 256A/s Laser Source Hatch", 12, 256).getStackForm(1L)); + 15237, "hatch.dynamotunnel1.tier.12", "UMV 256A/t Laser Source Hatch", 12, 256).getStackForm(1L)); eM_dynamoTunnel2_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15247, "hatch.dynamotunnel2.tier.12", "UMV 1024A/s Laser Source Hatch", 12, 1024).getStackForm(1L)); + 15247, "hatch.dynamotunnel2.tier.12", "UMV 1024A/t Laser Source Hatch", 12, 1024).getStackForm(1L)); eM_dynamoTunnel3_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15257, "hatch.dynamotunnel3.tier.12", "UMV 4096A/s Laser Source Hatch", 12, 4096).getStackForm(1L)); + 15257, "hatch.dynamotunnel3.tier.12", "UMV 4096A/t Laser Source Hatch", 12, 4096).getStackForm(1L)); eM_dynamoTunnel4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15267, "hatch.dynamotunnel4.tier.12", "UMV 16384A/s Laser Source Hatch", 12, 16384).getStackForm(1L)); + 15267, "hatch.dynamotunnel4.tier.12", "UMV 16384A/t Laser Source Hatch", 12, 16384).getStackForm(1L)); eM_dynamoTunnel5_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15277, "hatch.dynamotunnel5.tier.12", "UMV 65536A/s Laser Source Hatch", 12, 65536).getStackForm(1L)); + 15277, "hatch.dynamotunnel5.tier.12", "UMV 65536A/t Laser Source Hatch", 12, 65536).getStackForm(1L)); eM_dynamoTunnel6_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15287, "hatch.dynamotunnel6.tier.12", "UMV 262144A/s Laser Source Hatch", 12, 262144).getStackForm(1L)); + 15287, "hatch.dynamotunnel6.tier.12", "UMV 262144A/t Laser Source Hatch", 12, 262144).getStackForm(1L)); eM_dynamoTunnel7_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15297, "hatch.dynamotunnel7.tier.12", "UMV 1048576A/s Laser Source Hatch", 12, 1048576).getStackForm(1L)); + 15297, "hatch.dynamotunnel7.tier.12", "UMV 1048576A/t Laser Source Hatch", 12, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15238, "hatch.dynamotunnel1.tier.13", "UXV 256A/s Laser Source Hatch", 13, 256).getStackForm(1L)); + 15238, "hatch.dynamotunnel1.tier.13", "UXV 256A/t Laser Source Hatch", 13, 256).getStackForm(1L)); eM_dynamoTunnel2_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15248, "hatch.dynamotunnel2.tier.13", "UXV 1024A/s Laser Source Hatch", 13, 1024).getStackForm(1L)); + 15248, "hatch.dynamotunnel2.tier.13", "UXV 1024A/t Laser Source Hatch", 13, 1024).getStackForm(1L)); eM_dynamoTunnel3_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15258, "hatch.dynamotunnel3.tier.13", "UXV 4096A/s Laser Source Hatch", 13, 4096).getStackForm(1L)); + 15258, "hatch.dynamotunnel3.tier.13", "UXV 4096A/t Laser Source Hatch", 13, 4096).getStackForm(1L)); eM_dynamoTunnel4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15268, "hatch.dynamotunnel4.tier.13", "UXV 16384A/s Laser Source Hatch", 13, 16384).getStackForm(1L)); + 15268, "hatch.dynamotunnel4.tier.13", "UXV 16384A/t Laser Source Hatch", 13, 16384).getStackForm(1L)); eM_dynamoTunnel5_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15278, "hatch.dynamotunnel5.tier.13", "UXV 65536A/s Laser Source Hatch", 13, 65536).getStackForm(1L)); + 15278, "hatch.dynamotunnel5.tier.13", "UXV 65536A/t Laser Source Hatch", 13, 65536).getStackForm(1L)); eM_dynamoTunnel6_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15288, "hatch.dynamotunnel6.tier.13", "UXV 262144A/s Laser Source Hatch", 13, 262144).getStackForm(1L)); + 15288, "hatch.dynamotunnel6.tier.13", "UXV 262144A/t Laser Source Hatch", 13, 262144).getStackForm(1L)); eM_dynamoTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15298, "hatch.dynamotunnel7.tier.13", "UXV 1048576A/s Laser Source Hatch", 13, 1048576).getStackForm(1L)); + 15298, "hatch.dynamotunnel7.tier.13", "UXV 1048576A/t Laser Source Hatch", 13, 1048576).getStackForm(1L)); eM_dynamoTunnel9001.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( 15299, "hatch.dynamotunnel.tier.14", "Legendary Laser Source Hatch", 14, (int) V[14]).getStackForm(1L)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java index fb3487bc09..841d2ec1a8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java @@ -148,13 +148,12 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc return; } else if (maxEUOutput() == ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity).maxEUInput()) { long diff = Math.min( - Amperes * 20, + Amperes * 20L * maxEUOutput(), Math.min( ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity).maxEUStore() - aMetaTileEntity.getBaseMetaTileEntity().getStoredEU(), - maxEUStore() - aBaseMetaTileEntity.getStoredEU() - ) / maxEUOutput() - ) * maxEUOutput(); + aBaseMetaTileEntity.getStoredEU() + )); setEUVar(aBaseMetaTileEntity.getStoredEU() - diff); diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 70f7d5ab8f..3b8bc433ed 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -210,69 +210,69 @@ gt.blockmachines.hatch.energymulti64.tier.13.name=UXV 64A Energy Hatch gt.blockmachines.hatch.energymulti.desc.0=Multiple Ampere Energy Injector for Multiblocks gt.blockmachines.hatch.energymulti.desc.1=Amperes In -gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/s Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/s Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/t Laser Target Hatch gt.blockmachines.hatch.energytunnel.tier.14.name=Legendary Laser Target Hatch gt.blockmachines.hatch.energytunnel.desc.0=Energy injecting terminal for Multiblocks gt.blockmachines.hatch.energytunnel.desc.1=Throughput @@ -307,69 +307,69 @@ gt.blockmachines.hatch.dynamomulti64.tier.13.name=IV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti.desc.0=Multiple Ampere Energy Extractor for Multiblocks gt.blockmachines.hatch.dynamomulti.desc.1=Amperes Out -gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/s Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/s Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/t Laser Source Hatch gt.blockmachines.hatch.dynamotunnel.tier.14.name=Legendary Laser Source Hatch gt.blockmachines.hatch.dynamotunnel.desc.0=Energy extracting terminal for Multiblocks gt.blockmachines.hatch.dynamotunnel.desc.1=Throughput diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 3484eb3579..6aae89bb1b 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -210,69 +210,69 @@ gt.blockmachines.hatch.energymulti64.tier.13.name=64安UXV能源仓 gt.blockmachines.hatch.energymulti.desc.0=为多方块机器以高电流输入能源 gt.blockmachines.hatch.energymulti.desc.1=输入电流 -gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/s 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/s 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/t 激光靶仓 gt.blockmachines.hatch.energytunnel.tier.14.name=传奇激光靶仓 gt.blockmachines.hatch.energytunnel.desc.0=多方块机器的能量输入端 gt.blockmachines.hatch.energytunnel.desc.1=通量 @@ -307,69 +307,69 @@ gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安IV动力仓 gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 -gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/s 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/s 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/t 激光源仓 gt.blockmachines.hatch.dynamotunnel.tier.14.name=传奇激光源仓 gt.blockmachines.hatch.dynamotunnel.desc.0=多方块机器的能量输出端 gt.blockmachines.hatch.dynamotunnel.desc.1=通量 -- cgit From b63dcaf7b782d033742b28bf88f9587f6a7ab611 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 12 May 2020 22:22:37 +0200 Subject: Adjust for comfort --- .../java/com/github/technus/tectech/loader/thing/MachineLoader.java | 4 ++-- .../metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java | 2 +- .../metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 3891d28845..8a46732e66 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -332,7 +332,7 @@ public class MachineLoader implements Runnable { eM_energyTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( 15198, "hatch.energytunnel7.tier.13", "UXV 1048576A/t Laser Target Hatch", 13, 1048576).getStackForm(1L)); eM_energyTunnel9001.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15199, "hatch.energytunnel.tier.14", "Legendary Laser Target Hatch", 14, (int) V[14]).getStackForm(1L)); + 15199, "hatch.energytunnel.tier.14", "Legendary Laser Target Hatch", 13, (int) V[13]).getStackForm(1L)); // =================================================================================================== // Multi AMP Power OUTPUTS @@ -540,7 +540,7 @@ public class MachineLoader implements Runnable { eM_dynamoTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( 15298, "hatch.dynamotunnel7.tier.13", "UXV 1048576A/t Laser Source Hatch", 13, 1048576).getStackForm(1L)); eM_dynamoTunnel9001.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15299, "hatch.dynamotunnel.tier.14", "Legendary Laser Source Hatch", 14, (int) V[14]).getStackForm(1L)); + 15299, "hatch.dynamotunnel.tier.14", "Legendary Laser Source Hatch", 13, (int) V[13]).getStackForm(1L)); // =================================================================================================== // MULTIBLOCKS diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java index 841d2ec1a8..beacf26122 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java @@ -78,7 +78,7 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc @Override public long maxEUStore() { - return 512L + V[mTier] * 4L * Amperes; + return V[mTier] * 24L * Amperes; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java index 2407f2ab0a..2393f4f702 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java @@ -75,7 +75,7 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc @Override public long maxEUStore() { - return 512L + V[mTier] * 4L * Amperes; + return V[mTier] * 24L * Amperes; } @Override -- cgit From 3ccc193c26828c3e4ad2016a1b8a08e6793164ff Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 14 May 2020 09:27:22 +0200 Subject: Cleanup, add debug print, fix hatch adder optional --- .../mechanics/structure/IStructureDefinition.java | 24 ++++++++++++- .../mechanics/structure/StructureUtility.java | 39 ++++++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index 542d13a7cd..c8488d5cea 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -1,9 +1,14 @@ package com.github.technus.tectech.mechanics.structure; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import java.util.Arrays; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; + public interface IStructureDefinition { /** * Used internally @@ -73,9 +78,17 @@ public interface IStructureDefinition { if (world.blockExists(xyz[0], xyz[1], xyz[2])) { if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } return false; } - }else { + } else { + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } return false; } abc[0]+=1; @@ -95,8 +108,17 @@ public interface IStructureDefinition { if (world.blockExists(xyz[0], xyz[1], xyz[2])) { if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } return false; } + } else { + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } } abc[0]+=1; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 00bdcdb1ad..1c2fd18326 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -112,6 +112,8 @@ public class StructureUtility { return ERROR; } + //region hint only + /** * Check always returns: true. * @@ -180,6 +182,10 @@ public class StructureUtility { }; } + //endregion + + //region block + /** * Does not allow Block duplicates (with different meta) */ @@ -354,6 +360,10 @@ public class StructureUtility { return ofBlock(block, meta, block, meta); } + //endregion + + //region adders + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, int defaultMeta) { if (iBlockAdder == null || defaultBlock == null) { throw new IllegalArgumentException(); @@ -436,9 +446,9 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && - (iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex) || - (world.getBlock(x, y, z) == placeCasing && world.getBlockMetadata(x, y, z) == placeCasingMeta)); + return (tileEntity instanceof IGregTechTileEntity && + iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + (world.getBlock(x, y, z) == placeCasing && world.getBlockMetadata(x, y, z) == placeCasingMeta); } @Override @@ -455,6 +465,10 @@ public class StructureUtility { }; } + //endregion + + //region side effects + public static , T> IStructureElement onElementPass(Consumer onCheckPass, B element) { return new IStructureElement() { @Override @@ -501,6 +515,7 @@ public class StructureUtility { }; } + //endregion /** * Take care while chaining, as it will try to call every structure element until it returns true. @@ -536,6 +551,8 @@ public class StructureUtility { return ofChain(elementChain.toArray(new IStructureElement[0])); } + //region defer + public static IStructureElementDeferred defer(Supplier> to) { if (to == null) { throw new IllegalArgumentException(); @@ -840,10 +857,26 @@ public class StructureUtility { return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0])); } + //endregion + + /** + * Used internally, to generate skips for structure definitions + * @param a + * @param b + * @param c + * @param + * @return + */ public static IStructureNavigate step(int a, int b, int c) { return step(new Vec3Impl(a, b, c)); } + /** + * Used internally, to generate skips for structure definitions + * @param step + * @param + * @return + */ @SuppressWarnings("unchecked") public static IStructureNavigate step(Vec3Impl step) { if (step == null || step.get0() < 0 || step.get1() < 0 || step.get2() < 0) { -- cgit From f840c335e5a15ff244f2e8cd5583e8c5d3a26de6 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Mon, 1 Jun 2020 17:00:55 +0200 Subject: Buck Converter from TecTech #6179 https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6179 --- .../dreamcraft/DreamCraftRecipeLoader.java | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b863e35901..6fff07cbc5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -253,9 +253,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_dynamoMulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_dynamoMulti64_UEV.get(1), 400, 2000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Dynamo_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_dynamoMulti4_UIV.get(1), 100, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Dynamo_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_dynamoMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); //Energy Hatches IV-UIV GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); @@ -282,10 +282,20 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_energyMulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_energyMulti64_UEV.get(1), 400, 2000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Energy_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); - + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); + + //Buck Converter IV-UIV + if(Loader.isModLoaded("bartworks")) { + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_IV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(144), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_LuV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_ZPM.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(144), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(144), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UHV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(144), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UEV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, Materials.Bedrockium.getMolten(144), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UIV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, Materials.BlackPlutonium.getMolten(144), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); + } //Laser Dynamo IV-UEV 256/t GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_IV.get(1), ItemList.Electric_Pump_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.TungstenSteel, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_IV.get(1), 1000, 7680); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_LuV.get(1), ItemList.Electric_Pump_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.VanadiumGallium, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_LuV.get(1), 1000, 30720); -- cgit From a98c065b4f266979be1ac23fbd1e163964a868cf Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Mon, 1 Jun 2020 17:09:05 +0200 Subject: Buck Converter from TecTech #6179 https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6179 add neutronium fluid if Bedrockium and Black Plutonium not available --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 6fff07cbc5..8621c83216 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -293,8 +293,8 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_ZPM.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(144), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(144), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UHV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(144), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UEV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, Materials.Bedrockium.getMolten(144), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UIV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, Materials.BlackPlutonium.getMolten(144), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UEV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UIV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); } //Laser Dynamo IV-UEV 256/t GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_IV.get(1), ItemList.Electric_Pump_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.TungstenSteel, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_IV.get(1), 1000, 7680); -- cgit From 11bf30cbff2e200f9bb6400aad1c81a209365d14 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Mon, 1 Jun 2020 17:40:54 +0200 Subject: Buck Converter from TecTech #6179 https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6179 fix Display naming --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 8621c83216..3fa004f7d4 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -288,13 +288,13 @@ public class DreamCraftRecipeLoader implements Runnable { //Buck Converter IV-UIV if(Loader.isModLoaded("bartworks")) { - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_IV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(144), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_LuV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_ZPM.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(144), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(144), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UHV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(144), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UEV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UIV.get(1), getItemContainer("display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_IV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(144), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(144), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(144), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UHV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(144), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UEV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UIV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); } //Laser Dynamo IV-UEV 256/t GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_IV.get(1), ItemList.Electric_Pump_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.TungstenSteel, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_IV.get(1), 1000, 7680); -- cgit From 66546d6b566772394523e0bca7848707da609bd9 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Mon, 1 Jun 2020 18:28:20 +0200 Subject: Buck Converter from TecTech #6179 https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6179 change BAse block be a GT Transformator add Wires --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 3fa004f7d4..de1c69f118 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -288,13 +288,13 @@ public class DreamCraftRecipeLoader implements Runnable { //Buck Converter IV-UIV if(Loader.isModLoaded("bartworks")) { - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_IV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(144), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(144), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(144), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UHV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(144), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UEV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energyMulti64_UIV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(144), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.TungstenSteel, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(288), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.NiobiumTitanium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Iridium, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(288), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Osmium, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Naquadah, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(288), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UEV_UHV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.ElectrumFlux, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(288), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UIV_UEV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, getOrDefault("Bedrockium", Materials.Neutronium), 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Bedrockium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UMV_UIV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Piko, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, getOrDefault("BlackPlutonium", Materials.Neutronium), 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Draconium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); } //Laser Dynamo IV-UEV 256/t GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_IV.get(1), ItemList.Electric_Pump_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.TungstenSteel, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_IV.get(1), 1000, 7680); -- cgit From 4de2332482ba078b1b987f098c3b92d7e4884c3c Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Mon, 1 Jun 2020 18:33:03 +0200 Subject: Buck Converter from TecTech #6179 https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6179 make recipes a bit cheaper use lower circuits and normal plates 2x --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index de1c69f118..b45d1b7d10 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -288,13 +288,13 @@ public class DreamCraftRecipeLoader implements Runnable { //Buck Converter IV-UIV if(Loader.isModLoaded("bartworks")) { - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.TungstenSteel, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(288), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.NiobiumTitanium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Iridium, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(288), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Osmium, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Naquadah, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(288), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UEV_UHV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.ElectrumFlux, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(288), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UIV_UEV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, getOrDefault("Bedrockium", Materials.Neutronium), 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Bedrockium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UMV_UIV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Piko, 2), GT_OreDictUnificator.get(OrePrefixes.plateDouble, getOrDefault("BlackPlutonium", Materials.Neutronium), 4), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Draconium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(288), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.NiobiumTitanium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(288), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Naquadah, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(288), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UEV_UHV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.ElectrumFlux, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(288), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UIV_UEV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Bedrockium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UMV_UIV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Draconium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); } //Laser Dynamo IV-UEV 256/t GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_IV.get(1), ItemList.Electric_Pump_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.TungstenSteel, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_IV.get(1), 1000, 7680); -- cgit From 1393d73fea85784d8abf9c81fa2234cf879309a9 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Mon, 1 Jun 2020 18:57:15 +0200 Subject: Buck Converter from TecTech #6179 https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6179 fix derp --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b45d1b7d10..bbbed0a70a 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -292,9 +292,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.NiobiumTitanium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(288), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Naquadah, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(288), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UEV_UHV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.ElectrumFlux, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(288), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UIV_UEV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Bedrockium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.Transformer_UMV_UIV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Draconium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UEV_UHV").get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.ElectrumFlux, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(288), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Bedrockium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Draconium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); } //Laser Dynamo IV-UEV 256/t GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_IV.get(1), ItemList.Electric_Pump_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.TungstenSteel, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_IV.get(1), 1000, 7680); -- cgit From b3fa98eebb71c25e3a59ed965ca217f40bd68470 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 1 Jun 2020 19:12:09 +0200 Subject: Add recipes for some hatches --- .../dreamcraft/DreamCraftRecipeLoader.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b863e35901..fcf89dc1c6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -446,6 +446,20 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 16), }, Materials.Iridium.getMolten(2592), CustomItemList.Parametrizer_Hatch.get(1), 800, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1), + ItemList.Circuit_Ultimatecrystalcomputer.get(1), + CustomItemList.DATApipe.get(6), + ItemList.Cover_Screen.get(1), + new ItemStack(Blocks.stone_button, 32), + }, Materials.Iridium.getMolten(2592), CustomItemList.ParametrizerX_Hatch.get(1), 800, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1), + ItemList.Circuit_Biomainframe.get(1), + CustomItemList.DATApipe.get(8), + ItemList.Cover_Screen.get(2), + new ItemStack(Blocks.stone_button, 64), + }, Materials.Iridium.getMolten(2592), CustomItemList.ParametrizerTXT_Hatch.get(1), 800, 122880); //Uncertainty addAssemblerRecipeWithCleanroom(new ItemStack[]{ CustomItemList.eM_Computer_Casing.get(1), @@ -454,6 +468,13 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 16), }, Materials.Iridium.getMolten(2592), CustomItemList.Uncertainty_Hatch.get(1), 1200, 122880); + addAssemblerRecipeWithCleanroom(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1), + ItemList.Circuit_Biomainframe.get(1), + CustomItemList.DATApipe.get(32), + ItemList.Cover_Screen.get(1), + new ItemStack(Blocks.stone_button, 16), + }, Materials.Iridium.getMolten(2592), CustomItemList.UncertaintyX_Hatch.get(1), 1200, 122880); //Elemental Input addAssemblerRecipeWithCleanroom(new ItemStack[]{ -- cgit From eb479dd05217d6313e3b8cc0b294e1b526663cc5 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Thu, 11 Jun 2020 12:27:07 +0200 Subject: Uncertainty Resolver has no recipe #6217 https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6217 add control circuits to the recipes --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 57eb0179ed..696dc2a1df 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -455,6 +455,7 @@ public class DreamCraftRecipeLoader implements Runnable { CustomItemList.DATApipe.get(4), ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 16), + GT_Utility.getIntegratedCircuit(1), }, Materials.Iridium.getMolten(2592), CustomItemList.Parametrizer_Hatch.get(1), 800, 122880); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.eM_Computer_Casing.get(1), @@ -462,13 +463,16 @@ public class DreamCraftRecipeLoader implements Runnable { CustomItemList.DATApipe.get(6), ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 32), + GT_Utility.getIntegratedCircuit(2), }, Materials.Iridium.getMolten(2592), CustomItemList.ParametrizerX_Hatch.get(1), 800, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.eM_Computer_Casing.get(1), ItemList.Circuit_Biomainframe.get(1), CustomItemList.DATApipe.get(8), ItemList.Cover_Screen.get(2), new ItemStack(Blocks.stone_button, 64), + GT_Utility.getIntegratedCircuit(3), }, Materials.Iridium.getMolten(2592), CustomItemList.ParametrizerTXT_Hatch.get(1), 800, 122880); //Uncertainty addAssemblerRecipeWithCleanroom(new ItemStack[]{ @@ -477,13 +481,16 @@ public class DreamCraftRecipeLoader implements Runnable { CustomItemList.DATApipe.get(16), ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 16), + GT_Utility.getIntegratedCircuit(4), }, Materials.Iridium.getMolten(2592), CustomItemList.Uncertainty_Hatch.get(1), 1200, 122880); + addAssemblerRecipeWithCleanroom(new ItemStack[]{ CustomItemList.eM_Computer_Casing.get(1), ItemList.Circuit_Biomainframe.get(1), CustomItemList.DATApipe.get(32), ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 16), + GT_Utility.getIntegratedCircuit(5), }, Materials.Iridium.getMolten(2592), CustomItemList.UncertaintyX_Hatch.get(1), 1200, 122880); //Elemental Input -- cgit From 55d58b9812096f09a41a5298e74791d82509595b Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 14 Jun 2020 07:35:34 +0200 Subject: REsolve some bugs --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 4 +++- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java | 2 +- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 ++ .../thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 57eb0179ed..c26125fe69 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -30,9 +30,11 @@ import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault */ public class DreamCraftRecipeLoader implements Runnable { //region reflect a bit + @SuppressWarnings("rawtypes") private Class CUSTOM_ITEM_LIST; private Method ADD_ASSEMBLER_RECIPE; + @SuppressWarnings("unchecked") private IItemContainer getItemContainer(String name) { return (IItemContainer) Enum.valueOf(CUSTOM_ITEM_LIST, name); } @@ -41,7 +43,7 @@ public class DreamCraftRecipeLoader implements Runnable { try { ADD_ASSEMBLER_RECIPE.invoke(GT_Values.RA, items, fluid, output, time, eut, true); } catch (Exception e) { - throw new Error(e); + throw new RuntimeException("Failed to add clean room assembler recipe! " +output.getDisplayName(),e); } } //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 213c919ec8..8838286071 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -239,7 +239,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB mEfficiencyIncrease = 10000; eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); - mEUt = ttRecipe.mEUt; + mEUt = Math.min(ttRecipe.mEUt,-ttRecipe.mEUt); eHolders.get(0).getBaseMetaTileEntity().setActive(true); return true; } 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 cf37fb0689..24fd51c7d4 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 @@ -87,6 +87,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected ArrayList eInputData = new ArrayList<>(); protected ArrayList eOutputData = new ArrayList<>(); + //endregion + //region parameters public final Parameters parametrization; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java index 7aabff1af4..ee6f469d59 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java @@ -194,6 +194,7 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn if (meta instanceof IConnectsToDataPipe && meta != source) { if (meta instanceof GT_MetaTileEntity_Pipe_Data && ((GT_MetaTileEntity_Pipe_Data) meta).connectionCount == 2) { + ((GT_MetaTileEntity_Pipe_Data) meta).markUsed(); return (IConnectsToDataPipe) meta; } if (((IConnectsToDataPipe) meta).isDataInputFacing(GT_Utility.getOppositeSide(b))) { -- cgit From 2ad9e1927127ee115741ebed7c24de617e0df1b9 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 14 Jun 2020 08:11:32 +0200 Subject: Add offline temp reading --- .../multi/GT_MetaTileEntity_EM_computer.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main') 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 c845fe361e..5d88fdfc50 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 @@ -35,6 +35,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; @@ -160,6 +161,23 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB return eUncertainHatches.size() == 1; } + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if(aBaseMetaTileEntity.isServerSide() && mMachine && !aBaseMetaTileEntity.isActive() && aTick % 20 == MULTI_CHECK_AT){ + double maxTemp = 0; + for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { + if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { + continue; + } + if (rack.heat > maxTemp) { + maxTemp = rack.heat; + } + } + maxCurrentTemp.set(maxTemp); + } + } + @Override public boolean checkRecipe_EM(ItemStack itemStack) { parametrization.setToDefaults(false, true); -- cgit From 12d5080675762c4ce760f371673a2af37d6476ac Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 14 Jun 2020 08:25:51 +0200 Subject: Add missing machine type --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 8838286071..889b4cfec3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -58,6 +58,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; private TT_recipe.TT_assLineRecipe aRecipe; private String machineType; + private static final String assembly="Assembly line"; private ItemStack holdItem; private long computationRemaining, computationRequired; @@ -282,6 +283,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB if (ItemList.Tool_DataStick.isStackEqual(itemStack, false, true)) { for (GT_Recipe.GT_Recipe_AssemblyLine assRecipe : TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes) { if (GT_Utility.areStacksEqual(assRecipe.mResearchItem, holdItem, true)) { + machineType = assembly; tRecipe = assRecipe; //if found if (iterateRecipes()) return true; @@ -469,6 +471,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes) { if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, holdItem, true)) { this.tRecipe = tRecipe; + machineType = assembly; break; } } -- cgit From 028dd5ee21c8b1d4766ccc6f35dedcb81ca2408a Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 14 Jun 2020 09:12:55 +0200 Subject: Fix sound loops --- .../thing/metaTileEntity/multi/base/SoundLoop.java | 9 ++++----- .../resources/assets/tectech/sounds/fx_lo_freq.ogg | Bin 14802 -> 29373 bytes .../resources/assets/tectech/sounds/fx_mid_freq.ogg | Bin 15252 -> 26378 bytes 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java index 338af1626e..e8e1a7eb27 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java @@ -25,7 +25,7 @@ public class SoundLoop extends MovingSound{ zPosF=base.getZCoord(); worldID=base.getWorld().provider.dimensionId; repeat=true; - volume=0f; + volume= 0.0625f; } @Override @@ -34,14 +34,13 @@ public class SoundLoop extends MovingSound{ return; } if(fadeMe) { - volume-=0.05f; - if(volume<0){ + volume-=0.0625f; + if(volume<=0){ volume=0; - }else if(volume==0){ donePlaying=true; } }else if(volume<1) { - volume += 0.05f; + volume += 0.0625f; } World world=Minecraft.getMinecraft().thePlayer.worldObj; donePlaying=world.provider.dimensionId!=worldID || diff --git a/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg b/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg index 8eab2d92e2..f02581ae56 100644 Binary files a/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg and b/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg differ diff --git a/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg b/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg index b16d1297f4..10ac371e19 100644 Binary files a/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg and b/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg differ -- cgit From 2c0bbbb109aa0cc00193ad294e0aa794137bf9e1 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 14 Jun 2020 09:31:50 +0200 Subject: Fix divide by zero lol --- .../metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main') 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 24fd51c7d4..28c90b58d0 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 @@ -1708,6 +1708,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } private boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { + if(maxEUinputMin==0){ + return false; + } if (EUtTierVoltage < 0) { EUtTierVoltage = -EUtTierVoltage; } -- cgit From 1959a09715b671073379f63e34c2df391635278d Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:36:11 +0200 Subject: Added Support for MetaBlocks --- .../tectech/mechanics/structure/Structure.java | 20 +++++++------ .../mechanics/structure/StructureUtility.java | 33 ++++++++++++++-------- 2 files changed, 32 insertions(+), 21 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index e7769b3e04..7195563d19 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -103,32 +103,34 @@ public class Structure { } break; default://check for block (countable) + Block worldblock = world.getBlock(xyz[0], xyz[1], xyz[2]); + int dmg = worldblock.getDamageValue(world, xyz[0], xyz[1], xyz[2]); if ((pointer = block - '0') >= 0) { //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { + if (worldblock != blockType[pointer]) { if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); + TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + worldblock.getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); } return false; } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + if (dmg != blockMeta[pointer]) { if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); + TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + dmg + ' ' + blockMeta[pointer]); } return false; } } else if ((pointer = block - ' ') >= 0) { igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); if (igt == null || !addingMethods[pointer].apply(metaTile,igt, casingTextures[pointer])) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { + if (worldblock != blockTypeFallback[pointer]) { if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); + TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + worldblock.getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); } return false; } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { + if (dmg != blockMetaFallback[pointer]) { if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); + TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + dmg + ' ' + blockMetaFallback[pointer]); } return false; } @@ -212,7 +214,7 @@ public class Structure { break; default: //check for block if ((pointer = block - '0') >= 0) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || blockType[pointer].getDamageValue(world,xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); } } else if ((pointer = block - ' ') >= 0) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 1c2fd18326..04e79ea33b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -196,7 +196,8 @@ public class StructureUtility { return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return blocsMap.getOrDefault(world.getBlock(x, y, z), -1) == world.getBlockMetadata(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world, x, y, z); } @Override @@ -222,7 +223,8 @@ public class StructureUtility { return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return blocsMap.getOrDefault(world.getBlock(x, y, z), Collections.emptySet()).contains(world.getBlockMetadata(x, y, z)); + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override @@ -240,7 +242,8 @@ public class StructureUtility { return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return block == world.getBlock(x, y, z) && meta == world.getBlockMetadata(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override @@ -262,7 +265,8 @@ public class StructureUtility { return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return iBlockAdder.apply(t, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + Block worldBlock = world.getBlock(x, y, z); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world,x,y,z)); } @Override @@ -283,7 +287,8 @@ public class StructureUtility { return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return blocsMap.getOrDefault(world.getBlock(x, y, z), -1) == world.getBlockMetadata(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world,x,y,z); } @Override @@ -315,7 +320,8 @@ public class StructureUtility { return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return blocsMap.getOrDefault(world.getBlock(x, y, z), Collections.emptySet()).contains(world.getBlockMetadata(x, y, z)); + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override @@ -339,7 +345,8 @@ public class StructureUtility { return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return block == world.getBlock(x, y, z) && meta == world.getBlockMetadata(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override @@ -371,7 +378,8 @@ public class StructureUtility { return new IStructureElement() { @Override public boolean check(T t, World world, int x, int y, int z) { - return iBlockAdder.apply(t, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); + Block worldBlock = world.getBlock(x, y, z); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override @@ -446,9 +454,10 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); + Block worldBlock = world.getBlock(x, y, z); return (tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || - (world.getBlock(x, y, z) == placeCasing && world.getBlockMetadata(x, y, z) == placeCasingMeta); + (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); } @Override @@ -989,7 +998,7 @@ public class StructureUtility { if (set == null) { set = new TreeSet<>(); } - set.add(world.getBlockMetadata(x, y, z)); + set.add(block.getDamageValue(world, x, y, z)); return set; }); } @@ -1060,7 +1069,7 @@ public class StructureUtility { if (tileEntity == null) { Block block = w.getBlock(x, y, z); if (block != null && block != Blocks.air) { - builder.append(map.get(block.getUnlocalizedName() + '\0' + world.getBlockMetadata(x, y, z))); + builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world, x, y, z))); } else { builder.append(' '); } @@ -1095,7 +1104,7 @@ public class StructureUtility { if (tileEntity == null) { Block block = w.getBlock(x, y, z); if (block != null && block != Blocks.air) { - builder.append(map.get(block.getUnlocalizedName() + '\0' + world.getBlockMetadata(x, y, z))); + builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world,x, y, z))); } else { builder.append(' '); } -- cgit From 0afcd6ff4c62200307c409dd62b768c3015ead1d Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 23 Jun 2020 17:08:28 +0200 Subject: Added Build Support for MetaBlocks --- .../mechanics/structure/ICustomMetaBlock.java | 10 +++++++++ .../tectech/mechanics/structure/Structure.java | 5 ++++- .../mechanics/structure/StructureUtility.java | 25 +++++++++++++++++----- 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java new file mode 100644 index 0000000000..2c783ef268 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.block.Block; +import net.minecraft.world.World; + +public interface ICustomMetaBlock { + default void setBlock(World world, int x, int y, int z, int meta){ + world.setBlock(x, y, z, (Block)this, meta, 2); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 7195563d19..9e680b877e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -237,7 +237,10 @@ public class Structure { break; default: //check for block if ((pointer = block - '0') >= 0) { - world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); + if (blockType[pointer] instanceof ICustomMetaBlock) + ((ICustomMetaBlock)blockType[pointer]).setBlock(world,xyz[0], xyz[1], xyz[2], blockMeta[pointer]); + else + world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); } } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 04e79ea33b..10779659dc 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -293,7 +293,10 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + if (defaultBlock instanceof ICustomMetaBlock) + ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); + else + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @@ -326,7 +329,10 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + if (defaultBlock instanceof ICustomMetaBlock) + ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); + else + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @@ -351,7 +357,10 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + if (defaultBlock instanceof ICustomMetaBlock) + ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); + else + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @@ -384,7 +393,10 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + if (defaultBlock instanceof ICustomMetaBlock) + ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); + else + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @@ -468,7 +480,10 @@ public class StructureUtility { @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); + if (placeCasing instanceof ICustomMetaBlock) + ((ICustomMetaBlock)placeCasing).setBlock(world, x, y, z, placeCasingMeta); + else + world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); return true; } }; -- cgit From 3707610dd388d8cdcb9f3a1f30de6249c65ad782 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 23 Jun 2020 21:07:50 +0200 Subject: Cleanup code style, rename interface, unimplement default method to force user to implement it. rework to eager evaluation of instanceof check --- .../mechanics/structure/ICustomBlockSetting.java | 17 ++ .../mechanics/structure/ICustomMetaBlock.java | 10 - .../tectech/mechanics/structure/Structure.java | 24 +- .../mechanics/structure/StructureUtility.java | 311 ++++++++++++++------- 4 files changed, 236 insertions(+), 126 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java new file mode 100644 index 0000000000..b70e76fbac --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java @@ -0,0 +1,17 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.block.Block; +import net.minecraft.world.World; + +public interface ICustomBlockSetting { + /** + * Default block setting calls {@link World#setBlock(int x, int y, int z, Block block, int meta, int updateType)} like: + * {@code world.setBlock(x,y,z,this/block,meta,2)} where updateType 2 means to update lighting and stuff + * @param world world that should be affected + * @param x x position to set + * @param y y position to set + * @param z z position to set + * @param meta required meta + */ + void setBlock(World world, int x, int y, int z, int meta); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java deleted file mode 100644 index 2c783ef268..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -public interface ICustomMetaBlock { - default void setBlock(World world, int x, int y, int z, int meta){ - world.setBlock(x, y, z, (Block)this, meta, 2); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 9e680b877e..4282a9e13c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -16,10 +16,11 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @Deprecated public class Structure { - private Structure(){} + private Structure() { + } @SafeVarargs - public static IHatchAdder[] adders(IHatchAdder... iHatchAdder){ + public static IHatchAdder[] adders(IHatchAdder... iHatchAdder) { return iHatchAdder; } @@ -121,7 +122,7 @@ public class Structure { } } else if ((pointer = block - ' ') >= 0) { igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); - if (igt == null || !addingMethods[pointer].apply(metaTile,igt, casingTextures[pointer])) { + if (igt == null || !addingMethods[pointer].apply(metaTile, igt, casingTextures[pointer])) { if (worldblock != blockTypeFallback[pointer]) { if (DEBUG_MODE) { TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + worldblock.getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); @@ -155,10 +156,10 @@ public class Structure { byte[] blockMeta,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset, IGregTechTileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - World world=tileEntity.getWorld(); - int baseX=tileEntity.getXCoord(); - int baseY=tileEntity.getYCoord(); - int baseZ=tileEntity.getZCoord(); + World world = tileEntity.getWorld(); + int baseX = tileEntity.getXCoord(); + int baseY = tileEntity.getYCoord(); + int baseZ = tileEntity.getZCoord(); if (world == null || (!world.isRemote && hintsOnly)) { return false; } @@ -214,7 +215,7 @@ public class Structure { break; default: //check for block if ((pointer = block - '0') >= 0) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || blockType[pointer].getDamageValue(world,xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || blockType[pointer].getDamageValue(world, xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); } } else if ((pointer = block - ' ') >= 0) { @@ -237,10 +238,11 @@ public class Structure { break; default: //check for block if ((pointer = block - '0') >= 0) { - if (blockType[pointer] instanceof ICustomMetaBlock) - ((ICustomMetaBlock)blockType[pointer]).setBlock(world,xyz[0], xyz[1], xyz[2], blockMeta[pointer]); - else + if (blockType[pointer] instanceof ICustomBlockSetting) { + ((ICustomBlockSetting) blockType[pointer]).setBlock(world, xyz[0], xyz[1], xyz[2], blockMeta[pointer]); + } else { world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); + } } } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 10779659dc..a9b88af2f3 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -167,7 +167,7 @@ public class StructureUtility { * @param * @return */ - public static IStructureElementNoPlacement ofHintDeferred(Supplier icons,short[] RGBa) { + public static IStructureElementNoPlacement ofHintDeferred(Supplier icons, short[] RGBa) { return new IStructureElementNoPlacement() { @Override public boolean check(T t, World world, int x, int y, int z) { @@ -176,7 +176,7 @@ public class StructureUtility { @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(),RGBa); + TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(), RGBa); return false; } }; @@ -266,7 +266,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world,x,y,z)); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override @@ -284,28 +284,47 @@ public class StructureUtility { if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world,x,y,z); - } + if(defaultBlock instanceof ICustomBlockSetting){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world, x, y, z); + } - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - if (defaultBlock instanceof ICustomMetaBlock) - ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); - else + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + }else { + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } + return true; + } - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } } /** @@ -320,56 +339,94 @@ public class StructureUtility { throw new IllegalArgumentException(); } } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); - } + if(defaultBlock instanceof ICustomBlockSetting){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); + } - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - if (defaultBlock instanceof ICustomMetaBlock) - ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); - else + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + }else { + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } + return true; + } - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } } public static IStructureElement ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { if (block == null || defaultBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); - } + if(block instanceof ICustomBlockSetting){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); + } - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - if (defaultBlock instanceof ICustomMetaBlock) - ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); - else + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } else { + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } + return true; + } - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } } public static IStructureElement ofBlock(Block block, int meta) { @@ -384,28 +441,47 @@ public class StructureUtility { if (iBlockAdder == null || defaultBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); - } + if(defaultBlock instanceof ICustomBlockSetting){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + } - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - if (defaultBlock instanceof ICustomMetaBlock) - ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta); - else + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + }else { + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } + return true; + } - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } } public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, int dots) { @@ -462,31 +538,53 @@ public class StructureUtility { if (iHatchAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - Block worldBlock = world.getBlock(x, y, z); - return (tileEntity instanceof IGregTechTileEntity && - iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || - (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); - } + if(placeCasing instanceof ICustomBlockSetting){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return (tileEntity instanceof IGregTechTileEntity && + iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); + } - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - if (placeCasing instanceof ICustomMetaBlock) - ((ICustomMetaBlock)placeCasing).setBlock(world, x, y, z, placeCasingMeta); - else + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) placeCasing).setBlock(world, x, y, z, placeCasingMeta); + return true; + } + }; + }else { + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return (tileEntity instanceof IGregTechTileEntity && + iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); - return true; - } - }; + return true; + } + }; + } } //endregion @@ -885,6 +983,7 @@ public class StructureUtility { /** * Used internally, to generate skips for structure definitions + * * @param a * @param b * @param c @@ -897,6 +996,7 @@ public class StructureUtility { /** * Used internally, to generate skips for structure definitions + * * @param step * @param * @return @@ -1119,7 +1219,7 @@ public class StructureUtility { if (tileEntity == null) { Block block = w.getBlock(x, y, z); if (block != null && block != Blocks.air) { - builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world,x, y, z))); + builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world, x, y, z))); } else { builder.append(' '); } @@ -1211,14 +1311,15 @@ public class StructureUtility { /** * Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape) * WARNING! Do not use on old api... + * * @param structurePiece shape (transposed shape) * @return transposed shape (untransposed shape) */ - public static String[][] transpose(String[][] structurePiece){ - String[][] shape=new String[structurePiece[0].length][structurePiece.length]; + public static String[][] transpose(String[][] structurePiece) { + String[][] shape = new String[structurePiece[0].length][structurePiece.length]; for (int i = 0; i < structurePiece.length; i++) { for (int j = 0; j < structurePiece[i].length; j++) { - shape[j][i]=structurePiece[i][j]; + shape[j][i] = structurePiece[i][j]; } } return shape; -- cgit From 7e55f6a68a7b7b307034c994f2fac95a83f3753b Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 23 Jun 2020 21:09:39 +0200 Subject: Fully mark old api for deprecation --- .../java/com/github/technus/tectech/mechanics/structure/Structure.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 4282a9e13c..83951372a2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -19,6 +19,7 @@ public class Structure { private Structure() { } + @Deprecated @SafeVarargs public static IHatchAdder[] adders(IHatchAdder... iHatchAdder) { return iHatchAdder; @@ -26,6 +27,7 @@ public class Structure { //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller //This only checks for REGULAR BLOCKS! + @Deprecated public static boolean checker( String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks Block[] blockType,//use numbers 0-9 for casing types @@ -151,6 +153,7 @@ public class Structure { return true; } + @Deprecated public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types -- cgit From 8e3024edfde8317f4f0073842563c45a3cb41ab6 Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 6 Jul 2020 17:23:30 +0100 Subject: Add Plasma Boosting to Tesla Towers --- .../technus/tectech/loader/TecTechConfig.java | 22 +++-- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 100 +++++++++++++++++---- 2 files changed, 99 insertions(+), 23 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index 0c2920e585..2cc52e8513 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -24,12 +24,12 @@ public class TecTechConfig extends ConfigManager { public float TESLA_MULTI_MIN_EFFICIENCY; public float TESLA_MULTI_MAX_EFFICIENCY; public float TESLA_MULTI_OVERDRIVE_LOSS; + public int TESLA_MULTI_SCAN_RANGE; + public boolean TESLA_MULTI_MOLTEN_OUTPUT; public float TESLA_SINGLE_MIN_EFFICIENCY; public float TESLA_SINGLE_MAX_EFFICIENCY; public float TESLA_SINGLE_OVERDRIVE_LOSS; - - /** * This loading phases do not correspond to mod loading phases! */ @@ -47,6 +47,8 @@ public class TecTechConfig extends ConfigManager { TESLA_MULTI_MIN_EFFICIENCY = 0.955F; TESLA_MULTI_MAX_EFFICIENCY = 0.98F; TESLA_MULTI_OVERDRIVE_LOSS = 0.005F; + TESLA_MULTI_SCAN_RANGE = 40; + TESLA_MULTI_MOLTEN_OUTPUT = false; TESLA_SINGLE_MIN_EFFICIENCY = 0.91F; TESLA_SINGLE_MAX_EFFICIENCY = 0.95F; TESLA_SINGLE_OVERDRIVE_LOSS = 0.010F; @@ -78,17 +80,21 @@ public class TecTechConfig extends ConfigManager { "Set to true to disable the block hardness nerf"); DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS, "Set to true to disable gregtech material processing"); - TESLA_MULTI_MIN_EFFICIENCY = _mainConfig.getFloat("teslaMultiMinEfficency", "Features", TESLA_MULTI_MIN_EFFICIENCY, 0, 1, + TESLA_MULTI_MIN_EFFICIENCY = _mainConfig.getFloat("TeslaMultiMinEfficency", "Features", TESLA_MULTI_MIN_EFFICIENCY, 0, 1, "Worst possible power loss per block for the multi block tesla"); - TESLA_MULTI_MAX_EFFICIENCY = _mainConfig.getFloat("teslaMultiMaxEfficency", "Features", TESLA_MULTI_MAX_EFFICIENCY, 0, 1, + TESLA_MULTI_MAX_EFFICIENCY = _mainConfig.getFloat("TeslaMultiMaxEfficency", "Features", TESLA_MULTI_MAX_EFFICIENCY, 0, 1, "Best possible power loss per block for the multi block tesla"); - TESLA_MULTI_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaMultiOverdriveLoss", "Features", TESLA_MULTI_OVERDRIVE_LOSS, 0, 1, + TESLA_MULTI_OVERDRIVE_LOSS = _mainConfig.getFloat("TeslaMultiOverdriveLoss", "Features", TESLA_MULTI_OVERDRIVE_LOSS, 0, 1, "Additional losses for overdrive use on the multi block tesla"); - TESLA_SINGLE_MIN_EFFICIENCY = _mainConfig.getFloat("teslaSingleMinEfficency", "Features", TESLA_SINGLE_MIN_EFFICIENCY, 0, 1, + TESLA_MULTI_SCAN_RANGE = _mainConfig.getInt("TeslaMultiScanRange", "Features", TESLA_MULTI_SCAN_RANGE, 4, 256, + "Determines the scan range constant for multi block tesla"); + TESLA_MULTI_MOLTEN_OUTPUT = _mainConfig.getBoolean("TeslaMultiMoltenOutput", "Features", TESLA_MULTI_MOLTEN_OUTPUT, + "Set to true to get molten outputs when boosting the multi block tesla with plasmas"); + TESLA_SINGLE_MIN_EFFICIENCY = _mainConfig.getFloat("TeslaSingleMinEfficency", "Features", TESLA_SINGLE_MIN_EFFICIENCY, 0, 1, "Worst possible power loss per block for the single block tesla"); - TESLA_SINGLE_MAX_EFFICIENCY = _mainConfig.getFloat("teslaSingleMaxEfficency", "Features", TESLA_SINGLE_MAX_EFFICIENCY, 0, 1, + TESLA_SINGLE_MAX_EFFICIENCY = _mainConfig.getFloat("TeslaSingleMaxEfficency", "Features", TESLA_SINGLE_MAX_EFFICIENCY, 0, 1, "Best possible power loss per block for the single block tesla"); - TESLA_SINGLE_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaSingleOverdriveLoss", "Features", TESLA_SINGLE_OVERDRIVE_LOSS, 0, 1, + TESLA_SINGLE_OVERDRIVE_LOSS = _mainConfig.getFloat("TeslaSingleOverdriveLoss", "Features", TESLA_SINGLE_OVERDRIVE_LOSS, 0, 1, "Additional losses for overdrive use on the single block tesla"); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 89093bdba7..dac8800894 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -23,6 +23,7 @@ import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -33,6 +34,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.HashMap; @@ -57,20 +59,24 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - + //TODO Make the setting abstractions static, if they aren't changed at tick time private int mTier = 0; //Determines max voltage and efficiency (MV to LuV) private int maxTier = 6; //Max tier for efficiency calcuation + private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon + private boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_MOLTEN_OUTPUT; //Default is false + private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs for one second private float energyEfficiency = 1; private float overdriveEfficiency = 1; private float minEfficiency = TecTech.configTecTech.TESLA_MULTI_MIN_EFFICIENCY;//Default is 0.955F - private float maxEfficiency = TecTech.configTecTech.TESLA_MULTI_MAX_EFFICIENCY;//Default is 0.98F; + private float maxEfficiency = TecTech.configTecTech.TESLA_MULTI_MAX_EFFICIENCY;//Default is 0.98F private float overdriveEfficiencyExtra = TecTech.configTecTech.TESLA_MULTI_OVERDRIVE_LOSS;//Default is 0.005F private Map eTeslaMap = new HashMap<>(); //Used to store targets for power transmission private final ArrayList eCapacitorHatches = new ArrayList<>(); //Used to determine count and tier of capacitors present private int scanTime = 0; //Scan timer used for tesla search intervals + private int scanRangeXZ = TecTech.configTecTech.TESLA_MULTI_SCAN_RANGE;//Default is 40 private long energyCapacity = 0; //Total energy storage limited by capacitors private long outputVoltageMax = 0; //Tesla voltage output limited by capacitors @@ -254,11 +260,25 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } private float getRangeMulti(int mTier, int vTier) { + //Helium and Nitrogen Plasmas will double the range + //Radon will quadruple the range + int plasmaBoost; + switch (plasmaTier) { + case 2: + plasmaBoost = 4; + break; + case 1: + plasmaBoost = 2; + break; + default: + plasmaBoost = 1; + } + //Over-tiered coils will add +25% range if (vTier > mTier) { - return 1.25F; + return 1.25F * plasmaBoost; } - return 1F; + return 1F * plasmaBoost; } private void scanForTransmissionTargets(Vec3Impl coordsMin, Vec3Impl coordsMax) { @@ -302,6 +322,46 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock sparkList.add(new ThaumSpark(posTop.get0(), posTop.get1(), posTop.get2(), xR, yR, zR, wID)); } + private void checkPlasmaBoost() { + //If there's fluid in the queue, try to output it + //That way it takes at least a second to 'process' the plasma + if (mOutputFluidsQueue != null) { + mOutputFluids = mOutputFluidsQueue; + mOutputFluidsQueue = null; + } + + for (GT_MetaTileEntity_Hatch_Input fluidHatch : mInputHatches) { + if (fluidHatch.mFluid != null) { + if (fluidHatch.mFluid.isFluidEqual(Materials.Helium.getPlasma(1)) && fluidHatch.mFluid.amount >= 100) { + System.out.print("HELIUM\n"); + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 100; + if (doFluidOutput) { + mOutputFluidsQueue = new FluidStack[]{Materials.Helium.getGas(100)}; + } + plasmaTier = 1; + return; + } else if (fluidHatch.mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && fluidHatch.mFluid.amount >= 50) { + System.out.print("NITRO\n"); + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 50; + if (doFluidOutput) { + mOutputFluidsQueue = new FluidStack[]{Materials.Nitrogen.getGas(50)}; + } + plasmaTier = 1; + return; + } else if (fluidHatch.mFluid.isFluidEqual(Materials.Radon.getPlasma(1)) && fluidHatch.mFluid.amount >= 50) { + System.out.print("RADON\n"); + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 50; + if (doFluidOutput) { + mOutputFluidsQueue = new FluidStack[]{Materials.Radon.getGas(50)}; + } + plasmaTier = 2; + return; + } + } + } + plasmaTier = 0; + } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_TM_teslaCoil(mName); @@ -340,20 +400,20 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(getBaseMetaTileEntity()); //Calculate offsets for scanning - scanPosOffsets[0] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, 0, 43)); - scanPosOffsets[1] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -4, -37)); + scanPosOffsets[0] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, 0, scanRangeXZ + 3)); + scanPosOffsets[1] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -4, -1 * scanRangeXZ + 3)); - scanPosOffsets[2] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -5, 43)); - scanPosOffsets[3] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -8, -37)); + scanPosOffsets[2] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -5, scanRangeXZ + 3)); + scanPosOffsets[3] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -8, -1 * scanRangeXZ + 3)); - scanPosOffsets[4] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -9, 43)); - scanPosOffsets[5] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -12, -37)); + scanPosOffsets[4] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -9, scanRangeXZ + 3)); + scanPosOffsets[5] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -12, -1 * scanRangeXZ + 3)); - scanPosOffsets[6] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -13, 43)); - scanPosOffsets[7] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -16, -37)); + scanPosOffsets[6] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -13, scanRangeXZ + 3)); + scanPosOffsets[7] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -16, -1 * scanRangeXZ + 3)); - scanPosOffsets[8] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -17, 43)); - scanPosOffsets[9] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -20, -37)); + scanPosOffsets[8] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -17, scanRangeXZ + 3)); + scanPosOffsets[9] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -20, -1 * scanRangeXZ + 3)); } return true; } @@ -362,6 +422,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public boolean checkRecipe_EM(ItemStack itemStack) { + checkPlasmaBoost(); + if (!histHighSetting.getStatus(false).isOk || !histLowSetting.getStatus(false).isOk || !transferRadiusTowerSetting.getStatus(false).isOk || @@ -825,6 +887,14 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } return false; } @@ -841,4 +911,4 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public String[] getStructureDescription(ItemStack stackSize) { return description; } -} \ No newline at end of file +} -- cgit From 3b388cd947255ccef57215862591228cb4421997 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sat, 11 Jul 2020 13:37:02 +0100 Subject: Plasma range boosting now helps with loss Very generous imo, might need to be scaled back --- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index dac8800894..5ae1d86895 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -252,10 +252,22 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) { + //Helium and Nitrogen Plasmas will half the effective distance + //Radon will half it again + int effectiveDistance = distance; + switch (plasmaTier) { + case 2: + effectiveDistance = distance / 4; + break; + case 1: + effectiveDistance = distance / 2; + break; + } + if (overDriveToggle) { - return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance))); + return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, effectiveDistance))); } else { - return (long) (voltage * Math.pow(energyEfficiency, distance)); + return (long) (voltage * Math.pow(energyEfficiency, effectiveDistance)); } } @@ -333,7 +345,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock for (GT_MetaTileEntity_Hatch_Input fluidHatch : mInputHatches) { if (fluidHatch.mFluid != null) { if (fluidHatch.mFluid.isFluidEqual(Materials.Helium.getPlasma(1)) && fluidHatch.mFluid.amount >= 100) { - System.out.print("HELIUM\n"); fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 100; if (doFluidOutput) { mOutputFluidsQueue = new FluidStack[]{Materials.Helium.getGas(100)}; @@ -341,7 +352,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock plasmaTier = 1; return; } else if (fluidHatch.mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && fluidHatch.mFluid.amount >= 50) { - System.out.print("NITRO\n"); fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 50; if (doFluidOutput) { mOutputFluidsQueue = new FluidStack[]{Materials.Nitrogen.getGas(50)}; @@ -349,7 +359,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock plasmaTier = 1; return; } else if (fluidHatch.mFluid.isFluidEqual(Materials.Radon.getPlasma(1)) && fluidHatch.mFluid.amount >= 50) { - System.out.print("RADON\n"); fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 50; if (doFluidOutput) { mOutputFluidsQueue = new FluidStack[]{Materials.Radon.getGas(50)}; @@ -450,6 +459,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //Calculate Efficiency values energyEfficiency = map(mTier + 1, 1, maxTier, minEfficiency, maxEfficiency); + //OD Eff calc overdriveEfficiency = energyEfficiency - overdriveEfficiencyExtra; energyCapacity = 0; -- cgit From 011cfd255f5324dad9cf53e4efe1b0c455257152 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sat, 11 Jul 2020 13:38:09 +0100 Subject: Expand Tesla tiers We now have ZPM Tier primary coils and LuV and ZPM tier capacitors, props to the madlads at the BigFlex MegaPlex for planning on using it with their fusion reactors --- .../dreamcraft/DreamCraftRecipeLoader.java | 27 +++++++++++++++- .../tectech/loader/recipe/BloodyRecipeLoader.java | 22 +++++++++++++ .../technus/tectech/thing/CustomItemList.java | 2 +- .../tectech/thing/casing/GT_Block_CasingsBA0.java | 35 ++++++++++++++------- .../tectech/thing/casing/GT_Item_CasingsBA0.java | 4 +++ .../tectech/thing/item/TeslaCoilCapacitor.java | 14 ++++++--- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 18 +++++------ .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 10 ++++-- .../iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png | Bin 0 -> 814 bytes .../TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png | Bin 0 -> 838 bytes src/main/resources/assets/tectech/lang/en_US.lang | 3 ++ .../tectech/textures/items/itemCapacitorLuV.png | Bin 0 -> 570 bytes .../tectech/textures/items/itemCapacitorZPM.png | Bin 0 -> 563 bytes 13 files changed, 106 insertions(+), 29 deletions(-) create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png create mode 100644 src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png create mode 100644 src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b669165176..748888c5c9 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -224,7 +224,12 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorLuV, 8), getItemContainer("MicaInsulatorFoil").get(28) - }, Materials.Indium.getMolten(144), CustomItemList.tM_TeslaPrimary_5.get(1), 50, 30720); + }, Materials.Indium.getMolten(144), CustomItemList.tM_TeslaPrimary_5.get(1), 200, 30720); + //Tesla Primary Coils T6 + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorZPM, 8), + getItemContainer("MicaInsulatorFoil").get(32) + }, Materials.Naquadah.getMolten(144), CustomItemList.tM_TeslaPrimary_6.get(1), 200, 122880); //endregion @@ -1599,6 +1604,20 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 24), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 24), }, Materials.Epoxid.getMolten(360), CustomItemList.teslaCapacitor.getWithDamage(1, 4), 320, 7680); + //LuV Tesla Capacitor + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.HSSG, 4), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 14), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 28), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 28), + }, Materials.Epoxid.getMolten(432), CustomItemList.teslaCapacitor.getWithDamage(1, 5), 320, 30720); + //ZPM Tesla Capacitor + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 4), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 16), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 32), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 32), + }, Materials.Epoxid.getMolten(504), CustomItemList.teslaCapacitor.getWithDamage(1, 6), 320, 122880); //Tesla Cover GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.teslaComponent.getWithDamage(4, 0), @@ -1663,6 +1682,12 @@ public class DreamCraftRecipeLoader implements Runnable { //IV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 4), GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 12), 300, 2); + //LuV Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 5), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 14), 300, 2); + //ZPM Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 6), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 16), 300, 2); //endregion diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java index 70f64d3719..7b8cc14f4d 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java @@ -191,6 +191,7 @@ public class BloodyRecipeLoader implements Runnable { GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", 'W', OrePrefixes.wireGt02.get(Materials.Superconductor)}); + //TODO Add Tesla Primary Coils T6 //endregion @@ -1157,6 +1158,21 @@ public class BloodyRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 24), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 24), }, Materials.Epoxid.getMolten(360), CustomItemList.teslaCapacitor.getWithDamage(1, 4), 320, 7680); + //LuV Tesla Capacitor + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.HSSG, 4), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 14), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 28), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 28), + }, Materials.Epoxid.getMolten(432), CustomItemList.teslaCapacitor.getWithDamage(1, 5), 320, 30720); + //ZPM Tesla Capacitor + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + // GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 4), + // GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 16), + // GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 32), + // GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 32), + //}, Materials.Epoxid.getMolten(504), CustomItemList.teslaCapacitor.getWithDamage(1, 6), 320, 122880); + //TODO Allow with the coils, useless alone and will only cause trouble //Tesla Cover GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.teslaComponent.getWithDamage(4, 0), @@ -1221,6 +1237,12 @@ public class BloodyRecipeLoader implements Runnable { //IV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 4), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 12), 300, 2); + //LuV Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 5), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 14), 300, 2); + //ZPM Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 6), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 16), 300, 2); //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 5265ad25c6..a86695ff4a 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -78,7 +78,7 @@ public enum CustomItemList implements IItemContainer { eM_Containment, eM_Containment_Field, eM_Containment_Advanced, eM_Coil, eM_Teleportation, eM_Dimensional, eM_Ultimate_Containment, eM_Ultimate_Containment_Advanced, eM_Ultimate_Containment_Field, eM_Spacetime, eM_Computer_Casing, eM_Computer_Bus, eM_Computer_Vent, eM_Hollow, eM_Power, debugBlock, - tM_TeslaBase, tM_TeslaToroid, tM_TeslaSecondary, tM_TeslaPrimary_0, tM_TeslaPrimary_1, tM_TeslaPrimary_2, tM_TeslaPrimary_3, tM_TeslaPrimary_4, tM_TeslaPrimary_5, + tM_TeslaBase, tM_TeslaToroid, tM_TeslaSecondary, tM_TeslaPrimary_0, tM_TeslaPrimary_1, tM_TeslaPrimary_2, tM_TeslaPrimary_3, tM_TeslaPrimary_4, tM_TeslaPrimary_5, tM_TeslaPrimary_6, Machine_Multi_Microwave, Machine_Multi_TeslaCoil, Machine_Multi_Transformer, diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java index 6d5bcd2b04..823f9ae26e 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java @@ -23,8 +23,8 @@ import static com.github.technus.tectech.TecTech.tectechTexturePage1; * Created by danie_000 on 03.10.2016. */ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { - public static final byte texturePage=tectechTexturePage1; - public static final short textureOffset = (texturePage << 7)+16;//Start of PAGE 8 (which is the 9th page) (8*128)+16 + public static final byte texturePage = tectechTexturePage1; + public static final short textureOffset = (texturePage << 7) + 16;//Start of PAGE 8 (which is the 9th page) (8*128)+16 private static IIcon[] tM0 = new IIcon[2]; private static IIcon[] tM1 = new IIcon[2]; @@ -35,11 +35,12 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { private static IIcon[] tM6 = new IIcon[2]; private static IIcon tM7; private static IIcon[] tM8 = new IIcon[2]; + private static IIcon[] tM9 = new IIcon[2]; public GT_Block_CasingsBA0() { super(GT_Item_CasingsBA0.class, "gt.blockcasingsBA0", GT_Material_Casings.INSTANCE); for (byte b = 0; b < 16; b = (byte) (b + 1)) { - Textures.BlockIcons.casingTexturePages[texturePage][b+16] = new GT_CopiedBlockTexture(this, 6, b); + Textures.BlockIcons.casingTexturePages[texturePage][b + 16] = new GT_CopiedBlockTexture(this, 6, b); /*IMPORTANT for block recoloring**/ } @@ -49,6 +50,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "EV Superconductor Primary Tesla Windings"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "IV Superconductor Primary Tesla Windings"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "LuV Superconductor Primary Tesla Windings"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "ZPM Superconductor Primary Tesla Windings"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Tesla Base Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Tesla Toroid Casing"); @@ -60,6 +62,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { CustomItemList.tM_TeslaPrimary_3.set(new ItemStack(this, 1, 3)); CustomItemList.tM_TeslaPrimary_4.set(new ItemStack(this, 1, 4)); CustomItemList.tM_TeslaPrimary_5.set(new ItemStack(this, 1, 5)); + CustomItemList.tM_TeslaPrimary_6.set(new ItemStack(this, 1, 9)); CustomItemList.tM_TeslaBase.set(new ItemStack(this, 1, 6)); CustomItemList.tM_TeslaToroid.set(new ItemStack(this, 1, 7)); @@ -80,6 +83,8 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { tM4[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_4"); tM5[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_5"); tM5[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_5"); + tM9[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6"); + tM9[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6"); tM6[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_BASE_TOP_BOTTOM"); tM6[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_BASE_SIDES"); @@ -92,7 +97,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { public IIcon getIcon(int aSide, int aMeta) { switch (aMeta) { case 0: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM0[0]; @@ -100,7 +105,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM0[1]; } case 1: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM1[0]; @@ -108,7 +113,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM1[1]; } case 2: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM2[0]; @@ -116,7 +121,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM2[1]; } case 3: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM3[0]; @@ -124,7 +129,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM3[1]; } case 4: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM4[0]; @@ -132,7 +137,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM4[1]; } case 5: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM5[0]; @@ -140,7 +145,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM5[1]; } case 6: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM6[0]; @@ -150,13 +155,21 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { case 7: return tM7; case 8: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM8[0]; default: return tM8[1]; } + case 9: + switch (aSide) { + case 0: + case 1: + return tM9[0]; + default: + return tM9[1]; + } default: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java index 56fdfd22bb..50630820df 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java @@ -45,6 +45,10 @@ public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract { aList.add(translateToLocal("gt.blockcasingsBA0.8.desc.0"));//Picks up power from a primary coil aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.8.desc.1"));//Who wouldn't want a 32k epoxy multi? break; + case 9://"ZPM Superconductor Primary Tesla Windings" + aList.add(translateToLocal("gt.blockcasingsBA0.0.desc.0") + " " + V[7] + " EU/t");//Handles up to + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.0.desc.1"));//What one man calls God, another calls the laws of physics. + break; default://WTF? aList.add("Damn son where did you get that!?"); aList.add(EnumChatFormatting.BLUE.toString() + "From outer space... I guess..."); diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java index 6e7e8c426d..86982e7c09 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java @@ -22,7 +22,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaCoilCapacitor extends Item { public static TeslaCoilCapacitor INSTANCE; - private static IIcon LVicon, MVicon, HVicon, EVicon, IVicon; + private static IIcon LVicon, MVicon, HVicon, EVicon, IVicon, LuVicon, ZPMicon; private TeslaCoilCapacitor() { setHasSubtypes(true); @@ -33,8 +33,8 @@ public final class TeslaCoilCapacitor extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 4) { - aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.0") + " " + V[aStack.getItemDamage() + 1] * 512 + " " + translateToLocal("item.tm.teslaCoilCapacitor.desc.1") +" " + V[aStack.getItemDamage() + 1] + " EU/t");//Stores 16384 EU in a tesla tower at 32 EU/t + if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 6) { + aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.0") + " " + V[aStack.getItemDamage() + 1] * 512 + " " + translateToLocal("item.tm.teslaCoilCapacitor.desc.1") + " " + V[aStack.getItemDamage() + 1] + " EU/t");//Stores 16384 EU in a tesla tower at 32 EU/t } else { aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.2"));//Yeet this broken item into some spicy water! } @@ -61,6 +61,8 @@ public final class TeslaCoilCapacitor extends Item { HVicon = iconRegister.registerIcon(MODID + ":itemCapacitorHV"); EVicon = iconRegister.registerIcon(MODID + ":itemCapacitorEV"); IVicon = iconRegister.registerIcon(MODID + ":itemCapacitorIV"); + LuVicon = iconRegister.registerIcon(MODID + ":itemCapacitorLuV"); + ZPMicon = iconRegister.registerIcon(MODID + ":itemCapacitorZPM"); } @Override @@ -74,6 +76,10 @@ public final class TeslaCoilCapacitor extends Item { return EVicon; case 4: return IVicon; + case 5: + return LuVicon; + case 6: + return ZPMicon; default: return LVicon; } @@ -81,7 +87,7 @@ public final class TeslaCoilCapacitor extends Item { @Override public void getSubItems(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i <= 4; i++) { + for (int i = 0; i <= 6; i++) { aList.add(new ItemStack(aItem, 1, i)); } } 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 b4e8f03a74..4e07622c25 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 @@ -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); + Util.setTier(aTier, this); } public GT_MetaTileEntity_Hatch_Capacitor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -173,11 +173,13 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { } public static void run() { - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.0", 0, 1, V[1]*512);//LV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.1", 1, 1, V[2]*512);//MV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.2", 2, 1, V[3]*512);//HV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.3", 3, 1, V[4]*512);//EV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.4", 4, 1, V[5]*512);//IV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.0", 0, 1, V[1] * 512);//LV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.1", 1, 1, V[2] * 512);//MV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.2", 2, 1, V[3] * 512);//HV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.3", 3, 1, V[4] * 512);//EV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.4", 4, 1, V[5] * 512);//IV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.5", 5, 1, V[6] * 512);//LuV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.6", 6, 1, V[7] * 512);//ZPM Capacitor } public static class CapacitorComponent implements Comparable { @@ -206,12 +208,10 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public boolean equals(Object obj) { - if(obj instanceof CapacitorComponent) { + if (obj instanceof CapacitorComponent) { return compareTo((CapacitorComponent) obj) == 0; } return false; } } } - - diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 5ae1d86895..58ea6d322b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -61,7 +61,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static Textures.BlockIcons.CustomIcon ScreenON; //TODO Make the setting abstractions static, if they aren't changed at tick time private int mTier = 0; //Determines max voltage and efficiency (MV to LuV) - private int maxTier = 6; //Max tier for efficiency calcuation + private int maxTier = 7; //Max tier for efficiency calcuation private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon private boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_MOLTEN_OUTPUT; //Default is false private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs for one second @@ -110,7 +110,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final byte[] blockMetaT3 = new byte[]{7, 3, 6, 8}; private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8}; private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8}; - private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5}; + private static final byte[] blockMetaT6 = new byte[]{7, 9, 6, 8}; + private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5, blockMetaT6}; private static final IHatchAdder[] addingMethods = adders( GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList); @@ -389,6 +390,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); + if (mTier == 9){ + mTier = 6; + } if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { @@ -914,7 +918,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 7], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png new file mode 100644 index 0000000000..833597130b Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png new file mode 100644 index 0000000000..de4ce136e7 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png differ diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 3b8bc433ed..dc4af9970b 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -64,6 +64,8 @@ item.tm.teslaCoilCapacitor.1.name=MV Tesla Capacitor item.tm.teslaCoilCapacitor.2.name=HV Tesla Capacitor item.tm.teslaCoilCapacitor.3.name=EV Tesla Capacitor item.tm.teslaCoilCapacitor.4.name=IV Tesla Capacitor +item.tm.teslaCoilCapacitor.5.name=LuV Tesla Capacitor +item.tm.teslaCoilCapacitor.6.name=ZPM Tesla Capacitor item.tm.teslaCoilCapacitor.desc.0=Stores item.tm.teslaCoilCapacitor.desc.1=EU in a tesla tower at item.tm.teslaCoilCapacitor.desc.2=Yeet this broken item into some spicy water! @@ -518,6 +520,7 @@ gt.blockcasingsBA0.2.name=HV Superconductor Primary Tesla Windings gt.blockcasingsBA0.3.name=EV Superconductor Primary Tesla Windings gt.blockcasingsBA0.4.name=IV Superconductor Primary Tesla Windings gt.blockcasingsBA0.5.name=LuV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.9.name=ZPM Superconductor Primary Tesla Windings gt.blockcasingsBA0.0.desc.0=Handles up to gt.blockcasingsBA0.0.desc.1=What one man calls God, another calls the laws of physics. gt.blockcasingsBA0.6.name=Tesla Base Casing diff --git a/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png b/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png new file mode 100644 index 0000000000..0801e3f0d7 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png differ diff --git a/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png b/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png new file mode 100644 index 0000000000..29b30dc63e Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png differ -- cgit From 792d54ffa2fde437a3af9925c7c41399821b2d83 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sat, 11 Jul 2020 13:51:59 +0100 Subject: Patch ZPM Tesla Primaries missing from NEI --- build.properties | 2 +- .../com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/build.properties b/build.properties index b377db8b58..90269e3abe 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614 -tectech.version=3.9.0 +tectech.version=3.9.1 ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java index 823f9ae26e..0d2f710ae9 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java @@ -184,7 +184,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { @Override public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i <= 8; i++) { + for (int i = 0; i <= 9; i++) { aList.add(new ItemStack(aItem, 1, i)); } } -- cgit From d895a4f85ae7edad8884c5ded8c29ff47bbb8de9 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sat, 18 Jul 2020 09:38:35 +0100 Subject: Lots of Tesla Tower work Reworked power loss Fixed Tesla Tower exploding when already powered off Added and reworded some comments Added plasma consumption values to config --- .../technus/tectech/loader/TecTechConfig.java | 65 +++++------ .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 119 ++++++++++----------- .../single/GT_MetaTileEntity_TeslaCoil.java | 64 ++++++----- 3 files changed, 119 insertions(+), 129 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index 2cc52e8513..030be65f3b 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -21,14 +21,17 @@ public class TecTechConfig extends ConfigManager { public boolean DISABLE_BLOCK_HARDNESS_NERF; public float TURRET_DAMAGE_FACTOR; public float TURRET_EXPLOSION_FACTOR; - public float TESLA_MULTI_MIN_EFFICIENCY; - public float TESLA_MULTI_MAX_EFFICIENCY; - public float TESLA_MULTI_OVERDRIVE_LOSS; - public int TESLA_MULTI_SCAN_RANGE; - public boolean TESLA_MULTI_MOLTEN_OUTPUT; - public float TESLA_SINGLE_MIN_EFFICIENCY; - public float TESLA_SINGLE_MAX_EFFICIENCY; - public float TESLA_SINGLE_OVERDRIVE_LOSS; + public int TESLA_MULTI_HELIUM_PLASMA_PER_SECOND; + public int TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND; + public int TESLA_MULTI_RADON_PLASMA_PER_SECOND; + public int TESLA_MULTI_LOSS_PER_BLOCK_T0; + public int TESLA_MULTI_LOSS_PER_BLOCK_T1; + public int TESLA_MULTI_LOSS_PER_BLOCK_T2; + public float TESLA_MULTI_OVERDRIVE_LOSS_FACTOR; + public int TESLA_MULTI_SCAN_RANGE;//TODO delete + public boolean TESLA_MULTI_GAS_OUTPUT; + public int TESLA_SINGLE_LOSS_PER_BLOCK; + public float TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR; /** * This loading phases do not correspond to mod loading phases! @@ -44,17 +47,19 @@ public class TecTechConfig extends ConfigManager { DISABLE_MATERIAL_LOADING_FFS = false; TURRET_DAMAGE_FACTOR = 10; TURRET_EXPLOSION_FACTOR = 1; - TESLA_MULTI_MIN_EFFICIENCY = 0.955F; - TESLA_MULTI_MAX_EFFICIENCY = 0.98F; - TESLA_MULTI_OVERDRIVE_LOSS = 0.005F; + TESLA_MULTI_HELIUM_PLASMA_PER_SECOND = 100; + TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND = 50; + TESLA_MULTI_RADON_PLASMA_PER_SECOND = 50; + TESLA_MULTI_LOSS_PER_BLOCK_T0 = 1; + TESLA_MULTI_LOSS_PER_BLOCK_T1 = 1; + TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1; + TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = 0.25F; TESLA_MULTI_SCAN_RANGE = 40; - TESLA_MULTI_MOLTEN_OUTPUT = false; - TESLA_SINGLE_MIN_EFFICIENCY = 0.91F; - TESLA_SINGLE_MAX_EFFICIENCY = 0.95F; - TESLA_SINGLE_OVERDRIVE_LOSS = 0.010F; + TESLA_MULTI_GAS_OUTPUT = false; + TESLA_SINGLE_LOSS_PER_BLOCK = 1; + TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = 0.25F; } - /** * This loading phases do not correspond to mod loading phases! */ @@ -80,22 +85,18 @@ public class TecTechConfig extends ConfigManager { "Set to true to disable the block hardness nerf"); DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS, "Set to true to disable gregtech material processing"); - TESLA_MULTI_MIN_EFFICIENCY = _mainConfig.getFloat("TeslaMultiMinEfficency", "Features", TESLA_MULTI_MIN_EFFICIENCY, 0, 1, - "Worst possible power loss per block for the multi block tesla"); - TESLA_MULTI_MAX_EFFICIENCY = _mainConfig.getFloat("TeslaMultiMaxEfficency", "Features", TESLA_MULTI_MAX_EFFICIENCY, 0, 1, - "Best possible power loss per block for the multi block tesla"); - TESLA_MULTI_OVERDRIVE_LOSS = _mainConfig.getFloat("TeslaMultiOverdriveLoss", "Features", TESLA_MULTI_OVERDRIVE_LOSS, 0, 1, - "Additional losses for overdrive use on the multi block tesla"); - TESLA_MULTI_SCAN_RANGE = _mainConfig.getInt("TeslaMultiScanRange", "Features", TESLA_MULTI_SCAN_RANGE, 4, 256, - "Determines the scan range constant for multi block tesla"); - TESLA_MULTI_MOLTEN_OUTPUT = _mainConfig.getBoolean("TeslaMultiMoltenOutput", "Features", TESLA_MULTI_MOLTEN_OUTPUT, - "Set to true to get molten outputs when boosting the multi block tesla with plasmas"); - TESLA_SINGLE_MIN_EFFICIENCY = _mainConfig.getFloat("TeslaSingleMinEfficency", "Features", TESLA_SINGLE_MIN_EFFICIENCY, 0, 1, - "Worst possible power loss per block for the single block tesla"); - TESLA_SINGLE_MAX_EFFICIENCY = _mainConfig.getFloat("TeslaSingleMaxEfficency", "Features", TESLA_SINGLE_MAX_EFFICIENCY, 0, 1, - "Best possible power loss per block for the single block tesla"); - TESLA_SINGLE_OVERDRIVE_LOSS = _mainConfig.getFloat("TeslaSingleOverdriveLoss", "Features", TESLA_SINGLE_OVERDRIVE_LOSS, 0, 1, - "Additional losses for overdrive use on the single block tesla"); + + TESLA_MULTI_HELIUM_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiHeliumPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_HELIUM_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower helium plasma consumed each second the tesla tower is active"); + TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiNitrogenPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower nitrogen plasma consumed each second the tesla tower is active"); + TESLA_MULTI_RADON_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiRadonPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_RADON_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower radon plasma consumed each second the tesla tower is active"); + TESLA_MULTI_LOSS_PER_BLOCK_T0 = _mainConfig.getInt("TeslaMultiLossPerBlockT0", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T0, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using no plasmas"); + TESLA_MULTI_LOSS_PER_BLOCK_T1 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T1, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using helium or nitrogen plasma"); + TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T2, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using radon plasma"); + TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaMultiOverdriveLossFactor", "Balance Tweaks", TESLA_MULTI_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Tower power loss per amp as a factor of the tier voltage"); + TESLA_MULTI_SCAN_RANGE = _mainConfig.getInt("TeslaMultiScanRange", "Balance Tweaks", TESLA_MULTI_SCAN_RANGE, 4, 256, "The horizontal radius scanned by the Tesla Tower"); + TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean("TeslaMultiMoltenOutput", "Balance Tweaks", TESLA_MULTI_GAS_OUTPUT, "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio"); + TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt("TeslaSingleLossPerBlock", "Balance Tweaks", TESLA_SINGLE_LOSS_PER_BLOCK, 0, Integer.MAX_VALUE, "Tesla Transceiver power transmission loss per block per amp"); + TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaSingleOverdriveLossFactor", "Balance Tweaks", TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage"); } /** diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 58ea6d322b..09f6d597ad 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -55,42 +55,44 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables - private final static HashSet sparkList = new HashSet<>(); - + private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_HELIUM_PLASMA_PER_SECOND;//Default is 100 + private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND;//Default is 50 + private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_RADON_PLASMA_PER_SECOND;//Default is 50 + //Default is {1, 1, 1} + private static final int[] plasmaTierLoss = new int[]{TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T0, + TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T1, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T2}; + private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F; + private static final int scanRangeXZ = TecTech.configTecTech.TESLA_MULTI_SCAN_RANGE;//Default is 40 + private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false + + //Face icons private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - //TODO Make the setting abstractions static, if they aren't changed at tick time - private int mTier = 0; //Determines max voltage and efficiency (MV to LuV) - private int maxTier = 7; //Max tier for efficiency calcuation - private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon - private boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_MOLTEN_OUTPUT; //Default is false - private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs for one second - private float energyEfficiency = 1; - private float overdriveEfficiency = 1; - private float minEfficiency = TecTech.configTecTech.TESLA_MULTI_MIN_EFFICIENCY;//Default is 0.955F - private float maxEfficiency = TecTech.configTecTech.TESLA_MULTI_MAX_EFFICIENCY;//Default is 0.98F - private float overdriveEfficiencyExtra = TecTech.configTecTech.TESLA_MULTI_OVERDRIVE_LOSS;//Default is 0.005F + private int mTier = 0; //Determines max voltage (LV to ZPM) + private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon (Does not match actual plasma tiers) + + private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs, so the tesla takes a second to 'cool' any plasma it would output as a gas - private Map eTeslaMap = new HashMap<>(); //Used to store targets for power transmission - private final ArrayList eCapacitorHatches = new ArrayList<>(); //Used to determine count and tier of capacitors present + private final HashSet sparkList = new HashSet<>(); //Thaumcraft lighting coordinate pairs, so we can send them in bursts and save on lag + private final Map eTeslaMap = new HashMap<>(); //Targets for power transmission //TODO Make this fill more efficently and globally + private final ArrayList eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps - private int scanTime = 0; //Scan timer used for tesla search intervals - private int scanRangeXZ = TecTech.configTecTech.TESLA_MULTI_SCAN_RANGE;//Default is 40 + private int scanTime = 0; //Scan timer used for tesla search intervals //TODO Replace with something that fetches from a global map private long energyCapacity = 0; //Total energy storage limited by capacitors private long outputVoltageMax = 0; //Tesla voltage output limited by capacitors private int vTier = -1; //Tesla voltage tier limited by capacitors private long outputCurrentMax = 0; //Tesla current output limited by capacitors - //Prevents unnecessary offset calculation + //Prevents unnecessary offset calculation, saving on lag private byte oldRotation = -1; private byte oldOrientation = -1; //Coordinate Arrays private final Vec3Impl[] scanPosOffsets = new Vec3Impl[10]; - private Vec3Impl posZap = Vec3Impl.NULL_VECTOR;//Power Transfer Origin - public Vec3Impl posTop = Vec3Impl.NULL_VECTOR;//Lightning Origin + private Vec3Impl posZap = Vec3Impl.NULL_VECTOR;//Location of the bottom middle of the tower, used as the power transfer origin + public Vec3Impl posTop = Vec3Impl.NULL_VECTOR;//Location of the center of the sphere on top of the tower, used as theThaumcraft lightning origin //endregion //region structure @@ -252,24 +254,22 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock super(aName); } - private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) { - //Helium and Nitrogen Plasmas will half the effective distance - //Radon will half it again - int effectiveDistance = distance; - switch (plasmaTier) { - case 2: - effectiveDistance = distance / 4; - break; - case 1: - effectiveDistance = distance / 2; - break; - } + private int getPerBlockLoss(){ + return plasmaTierLoss[plasmaTier]; + } + + private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) { + long outputVoltageInjectable; + long outputVoltageConsumption; if (overDriveToggle) { - return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, effectiveDistance))); + outputVoltageInjectable = outputVoltage; + outputVoltageConsumption = outputVoltage + (distance * getPerBlockLoss()) + (long) Math.round(overDriveLoss * outputVoltage); } else { - return (long) (voltage * Math.pow(energyEfficiency, effectiveDistance)); + outputVoltageInjectable = outputVoltage - (distance * getPerBlockLoss()); + outputVoltageConsumption = outputVoltage; } + return new long[]{outputVoltageInjectable, outputVoltageConsumption}; } private float getRangeMulti(int mTier, int vTier) { @@ -345,24 +345,24 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock for (GT_MetaTileEntity_Hatch_Input fluidHatch : mInputHatches) { if (fluidHatch.mFluid != null) { - if (fluidHatch.mFluid.isFluidEqual(Materials.Helium.getPlasma(1)) && fluidHatch.mFluid.amount >= 100) { - fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 100; + if (fluidHatch.mFluid.isFluidEqual(Materials.Helium.getPlasma(1)) && fluidHatch.mFluid.amount >= heliumUse) { + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - heliumUse; if (doFluidOutput) { - mOutputFluidsQueue = new FluidStack[]{Materials.Helium.getGas(100)}; + mOutputFluidsQueue = new FluidStack[]{Materials.Helium.getGas(heliumUse)}; } plasmaTier = 1; return; - } else if (fluidHatch.mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && fluidHatch.mFluid.amount >= 50) { - fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 50; + } else if (fluidHatch.mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && fluidHatch.mFluid.amount >= nitrogenUse) { + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - nitrogenUse; if (doFluidOutput) { - mOutputFluidsQueue = new FluidStack[]{Materials.Nitrogen.getGas(50)}; + mOutputFluidsQueue = new FluidStack[]{Materials.Nitrogen.getGas(nitrogenUse)}; } plasmaTier = 1; return; - } else if (fluidHatch.mFluid.isFluidEqual(Materials.Radon.getPlasma(1)) && fluidHatch.mFluid.amount >= 50) { - fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - 50; + } else if (fluidHatch.mFluid.isFluidEqual(Materials.Radon.getPlasma(1)) && fluidHatch.mFluid.amount >= radonUse) { + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - radonUse; if (doFluidOutput) { - mOutputFluidsQueue = new FluidStack[]{Materials.Radon.getGas(50)}; + mOutputFluidsQueue = new FluidStack[]{Materials.Radon.getGas(radonUse)}; } plasmaTier = 2; return; @@ -390,9 +390,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); - if (mTier == 9){ - mTier = 6; - } + if (mTier == 9){mTier = 6;}//Hacky remap because the ZPM coils were added later if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { @@ -461,11 +459,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } } - //Calculate Efficiency values - energyEfficiency = map(mTier + 1, 1, maxTier, minEfficiency, maxEfficiency); - //OD Eff calc - overdriveEfficiency = energyEfficiency - overdriveEfficiencyExtra; - energyCapacity = 0; outputCurrentMax = 0; @@ -608,6 +601,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock cap.getBaseMetaTileEntity().setActive(false); } + ePowerPass = false; setEUVar(0); energyStoredDisplay.set(0); energyFractionDisplay.set(0); @@ -618,12 +612,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock IGregTechTileEntity mte = getBaseMetaTileEntity(); //Hysteresis based ePowerPass setting - long energyMax = maxEUStore() / 2; long energyStored = getEUVar(); + float energyFrac = (float) energyStored / energyCapacity; - float energyFrac = (float) energyStored / energyMax; - - energyCapacityDisplay.set(energyMax); + energyCapacityDisplay.set(energyCapacity); energyStoredDisplay.set(energyStored); energyFractionDisplay.set(energyFrac); @@ -793,15 +785,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock IGregTechTileEntity node = Rx.getKey(); IMetaTileEntity nodeInside = node.getMetaTileEntity(); - long outputVoltageInjectable; - long outputVoltageConsumption; - if (overdriveToggle) { - outputVoltageInjectable = outputVoltage; - outputVoltageConsumption = getEnergyEfficiency(outputVoltage, Rx.getValue(), true); - } else { - outputVoltageInjectable = getEnergyEfficiency(outputVoltage, Rx.getValue(), false); - outputVoltageConsumption = outputVoltage; - } + long[] outputVoltageNow = getOutputVoltage(outputVoltage, Rx.getValue(), overdriveToggle); + long outputVoltageInjectable = outputVoltageNow[0]; + long outputVoltageConsumption = outputVoltageNow[1]; if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) { GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; @@ -865,6 +851,11 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return energyCapacity * 2; } + @Override + public long getEUVar() { + return getBaseMetaTileEntity().isActive() ? super.getEUVar() : 0; + } + private boolean addCapacitorToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; 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 ed36dec7cb..0f73750d48 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 @@ -36,37 +36,32 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer { + private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 + private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F + + public Map eTeslaMap = new HashMap<>();//Tesla Map to map them tesla bois! private final static HashSet sparkList = new HashSet<>(); private byte sparkCount = 0; - private int maxTier = 4; //Max tier of transceiver - private int minTier = 0; //Min tier of transceiver - - public Map eTeslaMap = new HashMap<>();//Tesla Map to map them tesla bois! + private final static int maxTier = 4; //Max tier of transceiver + private final static int minTier = 0; //Min tier of transceiver - private int transferRadiusMax = 20; - private int transferRadiusMin = 4; - private int transferRadiusLimitTop = (int) map(mTier + 1, minTier + 1, maxTier + 1, transferRadiusMin, transferRadiusMax); - private int transferRadiusLimitBottom = 1; //Minimum user configurable + private final static int transferRadiusMax = 20; + private final static int transferRadiusMin = 4; + private final int transferRadiusLimitTop = (int) map(mTier + 1, minTier + 1, maxTier + 1, transferRadiusMin, transferRadiusMax); + private final static int transferRadiusLimitBottom = 1; //Minimum user configurable private int transferRadius = transferRadiusLimitTop; //Default transferRadius setting - private int transferRadiusTower = 0; //Radius for transceiver to tower transfers - private int transferRadiusCover = 0; //Radius for transceiver to cover transfers public boolean powerPassToggle = false; //Power Pass for public viewing - private int histSteps = 20; //Hysteresis Resolution + private final static int histSteps = 20; //Hysteresis Resolution private int histSettingLow = 3; //Hysteresis Low Limit private int histSettingHigh = 15; //Hysteresis High Limit - private int histLowLimit = 1; //How low can you configure it? - private int histHighLimit = 19; //How high can you configure it? + private final static int histLowLimit = 1; //How low can you configure it? + private final static int histHighLimit = 19; //How high can you configure it? private float histLow = (float) histSettingLow / histSteps; //Power pass is disabled if power is under this fraction private float histHigh = (float) histSettingHigh / histSteps; //Power pass is enabled if power is over this fraction - private long outputVoltage = V[mTier]; - private float minEfficiency = TecTech.configTecTech.TESLA_SINGLE_MIN_EFFICIENCY;//Default is 0.91F - private float maxEfficiency = TecTech.configTecTech.TESLA_SINGLE_MAX_EFFICIENCY;//Default is 0.95F - private float overdriveEfficiencyExtra = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS;//Default is 0.010F - private float energyEfficiency = map(mTier + 1, minTier + 1, maxTier + 1, minEfficiency, maxEfficiency); - private float overdriveEfficiency = energyEfficiency - overdriveEfficiencyExtra; + private final long outputVoltage = V[mTier]; private boolean overdriveToggle = false; private String clientLocale = "en_US"; @@ -220,12 +215,18 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB sparkList.add(new ThaumSpark(x, y, z, xR, yR, zR, wID)); } - private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) { + private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) { + long outputVoltageInjectable; + long outputVoltageConsumption; + if (overDriveToggle) { - return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance))); + outputVoltageInjectable = outputVoltage; + outputVoltageConsumption = outputVoltage + (distance * perBlockLoss) + (long) Math.round(overDriveLoss * outputVoltage); } else { - return (long) (voltage * Math.pow(energyEfficiency, distance)); + outputVoltageInjectable = outputVoltage - (distance * perBlockLoss); + outputVoltageConsumption = outputVoltage; } + return new long[]{outputVoltageInjectable, outputVoltageConsumption}; } @Override @@ -251,8 +252,10 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB if (powerPassToggle) { float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac)); long outputCurrent = mBatteryCount; - transferRadiusTower = (int) (transferRadius * rangeFrac); - transferRadiusCover = (int) (transferRadiusTower / 1.25); + //Radius for transceiver to tower transfers + int transferRadiusTower = (int) (transferRadius * rangeFrac); + //Radius for transceiver to cover transfers + int transferRadiusCover = (int) (transferRadiusTower / 1.25); //Clean the eTeslaMap for (Map.Entry Rx : eTeslaMap.entrySet()) { @@ -282,15 +285,10 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB IGregTechTileEntity node = Rx.getKey(); IMetaTileEntity nodeInside = node.getMetaTileEntity(); - long outputVoltageInjectable; - long outputVoltageConsumption; - if (overdriveToggle) { - outputVoltageInjectable = outputVoltage; - outputVoltageConsumption = getEnergyEfficiency(outputVoltage, Rx.getValue(), true); - } else { - outputVoltageInjectable = getEnergyEfficiency(outputVoltage, Rx.getValue(), false); - outputVoltageConsumption = outputVoltage; - } + long[] outputVoltageNow = getOutputVoltage(outputVoltage, Rx.getValue(), overdriveToggle); + long outputVoltageInjectable = outputVoltageNow[0]; + long outputVoltageConsumption = outputVoltageNow[1]; + if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) { GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; if (!nodeTesla.ePowerPass) { -- cgit From d44e0b0c61384ca1a63f0dc322715d8a4e57678a Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 13:01:44 +0200 Subject: Rework API --- .../definitions/dComplexAspectDefinition.java | 11 +- .../definitions/ePrimalAspectDefinition.java | 16 +- .../elementalMatter/core/cElementalDecay.java | 27 +-- .../core/cElementalDefinitionStackMap.java | 2 +- .../core/cElementalInstanceStackMap.java | 30 +-- .../core/cElementalMutableDefinitionStackMap.java | 5 +- .../elementalMatter/core/cElementalStackMap.java | 1 + .../elementalMatter/core/commands/GiveEM.java | 4 +- .../core/stacks/cElementalDefinitionStack.java | 23 ++- .../core/stacks/cElementalInstanceStack.java | 226 +++++++++++---------- .../core/stacks/iHasElementalDefinition.java | 6 +- .../core/templates/cElementalDefinition.java | 7 +- .../core/templates/cElementalPrimitive.java | 16 +- .../core/templates/iElementalDefinition.java | 18 +- .../definitions/complex/dAtomDefinition.java | 151 +++++++------- .../definitions/complex/dHadronDefinition.java | 68 ++++--- .../definitions/complex/iaeaNuclide.java | 75 ++++--- .../primitive/cPrimitiveDefinition.java | 12 +- .../definitions/primitive/eBosonDefinition.java | 14 +- .../definitions/primitive/eLeptonDefinition.java | 24 +-- .../definitions/primitive/eNeutrinoDefinition.java | 28 +-- .../definitions/primitive/eQuarkDefinition.java | 78 +++---- .../multi/GT_MetaTileEntity_EM_collider.java | 76 +++++-- .../github/technus/tectech/util/DoubleCount.java | 113 +++++++++++ 24 files changed, 611 insertions(+), 420 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/util/DoubleCount.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java index 070a05d7e9..ddef29b214 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java @@ -26,7 +26,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public final class dComplexAspectDefinition extends cElementalDefinition implements iElementalAspect { private final int hash; - public final float mass; + public final double mass; private static final byte nbtType = (byte) 'c'; @@ -74,6 +74,9 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) { return false; } + if((int)aspects.amount!=aspects.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } amount += aspects.amount; } return amount == 2; @@ -160,7 +163,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public float getRawTimeSpan(long currentEnergy) { + public double getRawTimeSpan(long currentEnergy) { return -1; } @@ -195,7 +198,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } @@ -230,7 +233,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public float getMass() { + public double getMass() { return mass; } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java index bcb6e3f6fc..02e7d2fe21 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java @@ -10,14 +10,14 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public final class ePrimalAspectDefinition extends cElementalPrimitive implements iElementalAspect { public static final ePrimalAspectDefinition - magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1F, 35), - magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9F, 34), - magic_fire = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3F, 33), - magic_water = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7F, 32), - magic_order = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5F, 30), - magic_entropy = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5F, 31); - - private ePrimalAspectDefinition(String name, String symbol, float mass, int ID) { + magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), + magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), + magic_fire = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), + magic_water = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), + magic_order = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), + magic_entropy = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); + + private ePrimalAspectDefinition(String name, String symbol, double mass, int ID) { super(name, symbol, 0, mass, 0, -1, ID); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java index 7d5e079876..3472f15cec 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.util.DoubleCount; /** * Created by danie_000 on 22.10.2016. @@ -15,50 +16,50 @@ public final class cElementalDecay { public static final cElementalDecay[] noProduct = new cElementalDecay[0]; //this in turn can be used to tell that the thing should just vanish public final cElementalDefinitionStackMap outputStacks; - public final float probability; + public final double probability; public cElementalDecay(iElementalDefinition... outSafe) { - this(2F, outSafe); + this(2D, outSafe); } - public cElementalDecay(float probability, iElementalDefinition... outSafe) { + public cElementalDecay(double probability, iElementalDefinition... outSafe) { cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; for (int i = 0; i < outArr.length; i++) { - outArr[i] = new cElementalDefinitionStack(outSafe[i], 1); + outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D); } outputStacks = new cElementalDefinitionStackMap(outArr); this.probability = probability; } public cElementalDecay(cElementalDefinitionStack... outSafe) { - this(2F, outSafe); + this(2D, outSafe); } - public cElementalDecay(float probability, cElementalDefinitionStack... out) { + public cElementalDecay(double probability, cElementalDefinitionStack... out) { outputStacks = new cElementalDefinitionStackMap(out); this.probability = probability; } public cElementalDecay(cElementalDefinitionStackMap tree) { - this(2F, tree); + this(2D, tree); } - public cElementalDecay(float probability, cElementalDefinitionStackMap tree) { + public cElementalDecay(double probability, cElementalDefinitionStackMap tree) { outputStacks = tree; this.probability = probability; } - public cElementalInstanceStackMap getResults(float lifeMult, long age, long energyTotalForProducts, long amountDecaying) { + public cElementalInstanceStackMap getResults(double lifeMult, double age, long energyTotalForProducts, double amountDecaying) { cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); if (outputStacks == null) { return decayResult;//This is to prevent null pointer exceptions. } //Deny decay code is in instance! - long qtty = 0; + double qtty = 0D; for (cElementalDefinitionStack stack : outputStacks.values()) { - qtty += stack.amount; + qtty= DoubleCount.add(qtty,stack.amount); } - if (qtty <= 0) { + if (qtty <= 0D) { return decayResult; } //energyTotalForProducts /= qtty; @@ -66,7 +67,7 @@ public final class cElementalDecay { for (cElementalDefinitionStack stack : outputStacks.values()) { decayResult.putUnify(new cElementalInstanceStack(stack.definition, amountDecaying * stack.amount, - lifeMult, age/*new products*/, energyTotalForProducts / Math.max(1, Math.abs(stack.amount))));//get instances from stack + lifeMult, age/*new products*/, (long)(energyTotalForProducts / Math.max(1D, Math.abs(stack.amount)))));//get instances from stack } return decayResult; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java index 294acfc479..ce0840bc8b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java @@ -13,7 +13,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p */ public final class cElementalDefinitionStackMap/*IMMUTABLE*/ extends cElementalStackMap {//Target class for construction of definitions/recipes //Constructors + Clone, all make a whole new OBJ. - public static final cElementalDefinitionStackMap empty = new cElementalDefinitionStackMap(); + public static final cElementalDefinitionStackMap EMPTY = new cElementalDefinitionStackMap(); private cElementalDefinitionStackMap() { map = new TreeMap<>(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index 5893ac1a1f..9544d8d7e5 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElement import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.util.DoubleCount; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -131,7 +132,7 @@ public final class cElementalInstanceStackMap implements Comparable= instance.amount; } else { - long diff = target.amount - instance.amount; + double diff = DoubleCount.sub(target.amount,instance.amount); if (diff > 0) { target.amount = diff; return true; @@ -151,7 +152,7 @@ public final class cElementalInstanceStackMap implements Comparable= stack.getAmount(); } else { - long diff = target.amount - stack.getAmount(); + double diff = DoubleCount.sub(target.amount,stack.getAmount()); if (diff > 0) { target.amount = diff; return true; @@ -165,7 +166,7 @@ public final class cElementalInstanceStackMap implements Comparable stacksCount) { iElementalDefinition[] keys = keys(); @@ -364,24 +365,25 @@ public final class cElementalInstanceStackMap implements Comparable= instance.amount; } else { - long diff = target.amount - instance.amount; + double diff = DoubleCount.sub(target.amount,instance.amount); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -120,7 +121,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) { return target.amount >= stack.getAmount(); } else { - long diff = target.amount - stack.getAmount(); + double diff = DoubleCount.sub(target.amount,stack.getAmount()); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java index dbbfa7bf66..3e5a7f7b33 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java @@ -65,6 +65,7 @@ abstract class cElementalStackMap implements Comparable { return var.toArray(new iElementalDefinition[0]); } + @Deprecated public long getCountOfAllAmounts(){ long sum=0; for(cElementalDefinitionStack stack:map.values()){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java index de1934fed7..912d44ff43 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java @@ -50,7 +50,7 @@ public class GiveEM implements ICommand { cElementalDefinitionStack def= getDefinitionStack(list); if(def!=null) { - cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1, 0, Long.parseLong(energy)); + cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1D, 0D, Long.parseLong(energy)); sender.addChatMessage(new ChatComponentText(instanceStack.definition.getSymbol() + " - " + instanceStack.definition.getName())); @@ -73,7 +73,7 @@ public class GiveEM implements ICommand { args.remove(0); return null; } - long amount=Long.parseLong(args.remove(0)); + double amount=Double.parseDouble(args.remove(0)); try{ int id=Integer.parseInt(args.get(0)); args.remove(0); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java index 6b6fe35b41..2371b1b986 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.util.DoubleCount; import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; @@ -11,9 +12,9 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p */ public final class cElementalDefinitionStack implements iHasElementalDefinition { public final iElementalDefinition definition; - public final long amount; + public final double amount; - public cElementalDefinitionStack(iElementalDefinition def, long amount) { + public cElementalDefinitionStack(iElementalDefinition def, double amount) { definition = def == null ? null__ : def; this.amount = amount; } @@ -29,47 +30,47 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition } @Override - public long getAmount() { + public double getAmount() { return amount; } @Override - public long getCharge() { + public double getCharge() { return definition.getCharge() * amount; } @Override - public float getMass() { + public double getMass() { return definition.getMass() * amount; } public NBTTagCompound toNBT() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("d", definition.toNBT()); - nbt.setLong("q", amount); + nbt.setDouble("Q", amount); return nbt; } public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) { return new cElementalDefinitionStack( cElementalDefinition.fromNBT(nbt.getCompoundTag("d")), - nbt.getLong("q")); + nbt.getLong("q")+nbt.getDouble("Q")); } - public cElementalDefinitionStack addAmountIntoNewInstance(long amount) { + public cElementalDefinitionStack addAmountIntoNewInstance(double amount) { if(amount==0) { return this; } - return new cElementalDefinitionStack(definition, amount + this.amount); + return new cElementalDefinitionStack(definition, DoubleCount.add(amount,this.amount)); } public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) { if (other == null || other.length == 0) { return this; } - long l = 0; + double l = 0; for (cElementalDefinitionStack stack : other) { - l += stack.amount; + l=DoubleCount.add(l,stack.amount); } return addAmountIntoNewInstance(l); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index c108d8c8ae..fb4f0fed33 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -1,12 +1,13 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.util.DoubleCount; +import com.github.technus.tectech.util.Util; import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; @@ -14,36 +15,37 @@ import java.util.ArrayList; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static java.lang.Math.ulp; /** * Created by danie_000 on 22.10.2016. */ public final class cElementalInstanceStack implements iHasElementalDefinition { - public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16,DECAY_CALL_PER=144; + public static int MIN_MULTIPLE_DECAY_CALLS=16,MAX_MULTIPLE_DECAY_CALLS=64,DECAY_CALL_PER=144;//todo public final iElementalDefinition definition; //energy - if positive then particle should try to decay private long energy; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) private byte color; - public long age; - public long amount; - private float lifeTime; - private float lifeTimeMult; + public double age; + public double amount; + private double lifeTime; + private double lifeTimeMult; public cElementalInstanceStack(cElementalDefinitionStack stackSafe) { - this(stackSafe.definition, stackSafe.amount, 1F, 0, 0); + this(stackSafe.definition, stackSafe.amount, 1D, 0D, 0); } - public cElementalInstanceStack(cElementalDefinitionStack stackSafe, float lifeTimeMult, long age, long energy) { + public cElementalInstanceStack(cElementalDefinitionStack stackSafe, double lifeTimeMult, double age, long energy) { this(stackSafe.definition, stackSafe.amount, lifeTimeMult, age, energy); } - public cElementalInstanceStack(iElementalDefinition defSafe, long amount) { - this(defSafe, amount, 1F, 0, 0); + public cElementalInstanceStack(iElementalDefinition defSafe, double amount) { + this(defSafe, amount, 1D, 0D, 0); } - public cElementalInstanceStack(iElementalDefinition defSafe, long amount, float lifeTimeMult, long age, long energy) { + public cElementalInstanceStack(iElementalDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { definition = defSafe == null ? null__ : defSafe; byte bColor = definition.getColor(); if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color @@ -75,17 +77,17 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } @Override - public long getAmount() { + public double getAmount() { return amount; } @Override - public long getCharge() { + public double getCharge() { return definition.getCharge() * amount; } @Override - public float getMass() { + public double getMass() { return definition.getMass() * amount; } @@ -98,11 +100,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { setLifeTimeMultiplier(getLifeTimeMultiplier()); } - public float getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ + public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ return definition.getEnergyDiffBetweenStates(currentEnergyLevel,newEnergyLevel)*amount; } - public float getEnergySettingCost(long newEnergyLevel){ + public double getEnergySettingCost(long newEnergyLevel){ return definition.getEnergyDiffBetweenStates(energy,newEnergyLevel)*amount; } @@ -133,11 +135,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return color = (byte) TecTech.RANDOM.nextInt(3); } - public float getLifeTime() { + public double getLifeTime() { return lifeTime; } - public float setLifeTimeMultiplier(float mult) { + public double setLifeTimeMultiplier(double mult) { if(mult<=0) //since infinity*0=nan { throw new IllegalArgumentException("multiplier must be >0"); @@ -150,15 +152,15 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return lifeTime; } - public float getLifeTimeMultiplier() { + public double getLifeTimeMultiplier() { return lifeTimeMult; } - public cElementalInstanceStackMap tickStackByOneSecond(float lifeTimeMult, int postEnergize){ - return tickStack(lifeTimeMult,postEnergize,1); + public cElementalInstanceStackMap tickStackByOneSecond(double lifeTimeMult, int postEnergize){ + return tickStack(lifeTimeMult,postEnergize,1D); } - public cElementalInstanceStackMap tickStack(float lifeTimeMult, int postEnergize, int seconds){ + public cElementalInstanceStackMap tickStack(double lifeTimeMult, int postEnergize, double seconds){ cElementalInstanceStackMap newInstances = decay(lifeTimeMult, age += seconds, postEnergize); if (newInstances == null) { nextColor(); @@ -171,14 +173,14 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } public cElementalInstanceStackMap decay() { - return decay(1F, age, 0);//try to decay without changes + return decay(1D, age, 0);//try to decay without changes } - public cElementalInstanceStackMap decay(long apparentAge, long postEnergize) { - return decay(1F,apparentAge,postEnergize); + public cElementalInstanceStackMap decay(double apparentAge, long postEnergize) { + return decay(1D,apparentAge,postEnergize); } - public cElementalInstanceStackMap decay(float lifeTimeMult, long apparentAge, long postEnergize) { + public cElementalInstanceStackMap decay(double lifeTimeMult, double apparentAge, long postEnergize) { long newEnergyLevel = postEnergize + energy; if (newEnergyLevel > 0) { newEnergyLevel -= 1; @@ -186,10 +188,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { newEnergyLevel += 1; } if(definition.usesMultipleDecayCalls(energy)){ - long amountTemp=amount; - long decayCnt=Math.min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); - long amountPer=amount/decayCnt; - amount-=amountPer*(--decayCnt); + double amountTemp=amount; + long decayCnt=(long) Math.min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); + double amountPer= DoubleCount.div(amount,decayCnt); + amount=DoubleCount.sub(amount,amountPer*(--decayCnt)); cElementalInstanceStackMap output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(output==null){ amount=amountTemp; @@ -211,29 +213,28 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } } - private cElementalInstanceStackMap decayMechanics(float lifeTimeMult, long apparentAge, long newEnergyLevel) { + private cElementalInstanceStackMap decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) { if (energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) { setLifeTimeMultiplier(getLifeTimeMultiplier()); - return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1, newEnergyLevel); + return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); } else if (definition.getRawTimeSpan(energy) < 0) { return null;//return null, decay cannot be achieved } else if (definition.isTimeSpanHalfLife()) { - return exponentialDecayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, -1, newEnergyLevel); + return exponentialDecayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, -1D, newEnergyLevel); } else { - if (1F > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getNaturalDecayInstant(), lifeTimeMult, 0, newEnergyLevel); - } else if ((float) apparentAge > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, 0, newEnergyLevel); + if (1 > lifeTime) { + return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel); + } else if (apparentAge > lifeTime) { + return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, 0D, newEnergyLevel); } } return null;//return null since decay cannot be achieved } //Use to get direct decay output providing correct decay array - private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long newEnergyLevel) { - double decayInverseRatio=Math.pow(2d,1d/* 1 second *//(double)lifeTime); - double newAmount=(double)amount/decayInverseRatio; - long amountRemaining= (long)Math.floor(newAmount) +(TecTech.RANDOM.nextDouble()<=newAmount-Math.floor(newAmount)?1:0); + private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + double decayInverseRatio=Math.pow(2D,1D/* 1 second *//lifeTime); + double newAmount=DoubleCount.div(amount,decayInverseRatio+ulp(decayInverseRatio)); //if(definition.getSymbol().startsWith("U ")) { // System.out.println("newAmount = " + newAmount); // System.out.println("amountRemaining = " + amountRemaining); @@ -244,23 +245,24 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { // } // } //} - if(amountRemaining==amount) { - return null;//nothing decayed - } else if(amountRemaining<=0) { - return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); - } + //if(newAmount==amount) {//no longer needed + // return null;//nothing decayed + //} else if(newAmount<=0) {//no longer needed + // return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + //}//no longer needed + //split to non decaying and decaying part - long amount=this.amount; - this.amount-=amountRemaining; + double amount=this.amount; + this.amount=DoubleCount.sub(this.amount,newAmount); cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); - this.amount=amountRemaining; + this.amount=newAmount; products.putUnify(clone()); this.amount=amount; return products; } //Use to get direct decay output providing correct decay array - private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long newEnergyLevel) { + private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { if (decays == null) { return null;//Can not decay so it wont } @@ -299,51 +301,55 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } else { cElementalInstanceStackMap output = new cElementalInstanceStackMap(); int differentDecays = decays.length; - long[] qttyOfDecay = new long[differentDecays]; - long amountRemaining = this.amount, amount = this.amount; - float remainingProbability = 1F; - - for (int i = 0; i < differentDecays; i++) { - if (decays[i].probability >= 1F) { - long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); - if (thisDecayAmount > 0) { - if (thisDecayAmount <= amountRemaining) { - amountRemaining -= thisDecayAmount; - qttyOfDecay[i] += thisDecayAmount; - }else {//in case too much was made - qttyOfDecay[i] += amountRemaining; - amountRemaining = 0; - //remainingProbability=0; - } - } - break; - } - long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); - if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made - amountRemaining -= thisDecayAmount; - qttyOfDecay[i] += thisDecayAmount; - } else if (thisDecayAmount > amountRemaining) {//too much was made - qttyOfDecay[i] += amountRemaining; - amountRemaining = 0; - //remainingProbability=0; - break; - } - remainingProbability -= decays[i].probability; - if(remainingProbability<=0) { - break; - } - } - - for (int i = 0; i < amountRemaining; i++) { - double rand = TecTech.RANDOM.nextDouble(); - for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into - rand -= decays[j].probability; - if (rand <= 0D) { - qttyOfDecay[j]++; - break; - } - } + double[] probabilities=new double[differentDecays]; + for (int i = 0; i < probabilities.length; i++) { + probabilities[i]=decays[i].probability; } + double[] qttyOfDecay = DoubleCount.distribute(this.amount, probabilities); + //long amountRemaining = this.amount, amount = this.amount; + //float remainingProbability = 1D; +// + //for (int i = 0; i < differentDecays; i++) { + // if (decays[i].probability >= 1D) { + // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); + // if (thisDecayAmount > 0) { + // if (thisDecayAmount <= amountRemaining) { + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // }else {//in case too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // } + // } + // break; + // } + // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); + // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // } else if (thisDecayAmount > amountRemaining) {//too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // break; + // } + // remainingProbability -= decays[i].probability; + // if(remainingProbability<=0) { + // break; + // } + //} + + //for (int i = 0; i < amountRemaining; i++) { + // double rand = TecTech.RANDOM.nextDouble(); + // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into + // rand -= decays[j].probability; + // if (rand <= 0D) { + // qttyOfDecay[j]++; + // break; + // } + // } + //} if(definition.decayMakesEnergy(this.energy)){ for (int i = 0; i < differentDecays; i++) { @@ -394,14 +400,14 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return this; } //returns with the definition from the first object passed - double energy = this.energy * amount; + double energyTotal = this.energy * amount; long maxEnergy=this.energy; - float lifeTimeMul = lifeTimeMult; + double lifeTimeMul = lifeTimeMult; for (cElementalInstanceStack instance : instances) { if (instance != null && compareTo(instance) == 0) { - amount += instance.amount; - energy += instance.energy * instance.amount; + amount=DoubleCount.add(amount,instance.amount); + energyTotal += instance.energy * instance.amount; if(instance.energy>maxEnergy){ maxEnergy=instance.energy; } @@ -411,12 +417,16 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } if (amount != 0) { - energy /= Math.abs(amount); + energyTotal /= Math.abs(amount); } - double wholeParts=Math.floor(energy); - energy=Math.min(energy-wholeParts,1)+(wholeParts>=0?-0.11709966304863834:0.11709966304863834); - setEnergy(Math.min(maxEnergy,(long)wholeParts+(energy>TecTech.RANDOM.nextDouble()?1:0))); + double wholeParts=Math.floor(energyTotal); + energyTotal=Math.min(energyTotal-wholeParts,1D)+(wholeParts>=0?-0.11709966304863834D:0.11709966304863834D); + long energy=(long) wholeParts + ((energyTotal > TecTech.RANDOM.nextDouble()) ? 1 : 0); + if(energy*energyTotal<0){ + energy=0; + } + setEnergy(Math.min(maxEnergy,energy)); return this; } @@ -483,11 +493,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { public NBTTagCompound toNBT() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("d", definition.toNBT()); - nbt.setLong("q", amount); + nbt.setDouble("Q", amount); nbt.setLong("e", energy); nbt.setByte("c", color); - nbt.setLong("a", age); - nbt.setFloat("m", lifeTimeMult); + nbt.setDouble("A", age); + nbt.setDouble("M", lifeTimeMult); return nbt; } @@ -495,9 +505,9 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { NBTTagCompound definition = nbt.getCompoundTag("d"); cElementalInstanceStack instance = new cElementalInstanceStack( cElementalDefinition.fromNBT(definition), - nbt.getLong("q"), - nbt.getFloat("m"), - nbt.getLong("a"), + nbt.getLong("q")+nbt.getDouble("Q"), + nbt.getFloat("m")+nbt.getDouble("M"), + nbt.getLong("a")+nbt.getDouble("A"), nbt.getLong("e")); instance.setColor(nbt.getByte("c")); return instance; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java index 480707d570..1d8af7bab7 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java @@ -8,11 +8,11 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElem public interface iHasElementalDefinition extends Comparable,Cloneable { iElementalDefinition getDefinition(); - long getAmount(); + double getAmount(); - long getCharge(); + double getCharge(); - float getMass(); + double getMass(); iHasElementalDefinition clone(); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java index de8ccb7b2b..0061550ace 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java @@ -100,8 +100,8 @@ public abstract class cElementalDefinition extends iElementalDefinition { } @Override - public final cElementalDefinitionStack getStackForm(long i) { - return new cElementalDefinitionStack(this,i); + public final cElementalDefinitionStack getStackForm(double amount) { + return new cElementalDefinitionStack(this, amount); } @Override @@ -122,7 +122,8 @@ public abstract class cElementalDefinition extends iElementalDefinition { public int hashCode() {//Internal amounts should be also hashed int hash = -(getSubParticles().size() << 4); for (cElementalDefinitionStack stack : getSubParticles().values()) { - hash += ((stack.amount & 0x1) == 0 ? -stack.amount : stack.amount) + stack.definition.hashCode(); + int amount=(int)stack.amount; + hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.definition.hashCode(); } return hash; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java index 701682cdaa..65446548e6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java @@ -37,7 +37,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { public final String name; public final String symbol; //float-mass in eV/c^2 - public final float mass; + public final double mass; //int -electric charge in 1/3rds of electron charge for optimization public final byte charge; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) @@ -49,7 +49,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { private cElementalDecay[] elementalDecays; private byte naturalDecayInstant; private byte energeticDecayInstant; - private float rawLifeTime; + private double rawLifeTime; public final int ID; @@ -57,7 +57,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { // _ at end - anti particle // __ at end - self is antiparticle - protected cElementalPrimitive(String name, String symbol, int type, float mass, int charge, int color, int ID) { + protected cElementalPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { this.name = name; this.symbol = symbol; this.type = (byte) type; @@ -72,7 +72,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } // - protected void init(cElementalPrimitive antiParticle, float rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { + protected void init(cElementalPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { anti = antiParticle; this.rawLifeTime = rawLifeTime; naturalDecayInstant = (byte) naturalInstant; @@ -111,7 +111,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } @Override - public float getMass() { + public double getMass() { return mass; } @@ -136,7 +136,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @@ -166,7 +166,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } @Override - public float getRawTimeSpan(long currentEnergy) { + public double getRawTimeSpan(long currentEnergy) { return rawLifeTime; } @@ -234,7 +234,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { lines.add("SYMBOL = "+getSymbol()); } if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); + lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(areBitsSet(SCAN_GET_COLOR,capabilities)) { lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java index 08be835cdf..90ac2eb339 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java @@ -14,10 +14,10 @@ import java.util.ArrayList; * Created by danie_000 on 11.11.2016. */ public abstract class iElementalDefinition implements Comparable,Cloneable {//IMMUTABLE - public static final float STABLE_RAW_LIFE_TIME =1.5e36f; - public static final float NO_DECAY_RAW_LIFE_TIME=-1; + public static final double STABLE_RAW_LIFE_TIME =1.5e36D; + public static final double NO_DECAY_RAW_LIFE_TIME=-1D; public static final long DEFAULT_ENERGY_LEVEL=0; - public static final float DEFAULT_ENERGY_REQUIREMENT=25000;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels + public static final double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels //Nomenclature public abstract String getName(); @@ -43,24 +43,24 @@ public abstract class iElementalDefinition implements Comparable> stableIsotopes = new HashMap<>(); private static final Map stableAtoms = new HashMap<>(); - private static Map> mostStableUnstableIsotopes = new HashMap<>(); + private static Map> mostStableUnstableIsotopes = new HashMap<>(); private static final Map unstableAtoms = new HashMap<>(); private static cElementalDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; - private static final HashMap lifetimeOverrides = new HashMap<>(); + private static final HashMap lifetimeOverrides = new HashMap<>(); public final iaeaNuclide iaea; @@ -61,17 +61,17 @@ public final class dAtomDefinition extends cElementalDefinition { } private static final ArrayList overrides = new ArrayList<>(); - public static void addOverride(dAtomDefinition atom, float rawLifeTime){ + public static void addOverride(dAtomDefinition atom, double rawLifeTime){ lifetimeOverrides.put(atom,rawLifeTime); } //float-mass in eV/c^2 - public final float mass; + public final double mass; //public final int charge; public final int charge; //int -electric charge in 1/3rds of electron charge for optimization public final int chargeLeptons; - private float rawLifeTime; + private double rawLifeTime; //generation max present inside - minus if contains any anti quark public final byte type; @@ -115,7 +115,7 @@ public final class dAtomDefinition extends cElementalDefinition { } elementalStacks = things; - float mass = 0; + double mass = 0; int cLeptons = 0; int cNucleus = 0; int neutralCount = 0, element = 0; @@ -124,6 +124,9 @@ public final class dAtomDefinition extends cElementalDefinition { for (cElementalDefinitionStack stack : elementalStacks.values()) { iElementalDefinition def = stack.definition; int amount = (int)stack.amount; + if((int)stack.amount!=stack.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } mass += stack.getMass(); if (def.getType() < 0) { containsAnti = true; @@ -160,36 +163,36 @@ public final class dAtomDefinition extends cElementalDefinition { xstr.setSeed((element + 1L) * (neutralCount + 100L)); iaea =iaeaNuclide.get(element,neutralCount); if(iaea!=null){ - if(Float.isNaN(iaea.mass)) { + if(Double.isNaN(iaea.mass)) { this.mass = mass; } else { this.mass = iaea.mass; } - if(Float.isNaN(iaea.halfTime)) { - Float overriddenLifeTime= lifetimeOverrides.get(this); - float rawLifeTimeTemp; + if(Double.isNaN(iaea.halfTime)) { + Double overriddenLifeTime= lifetimeOverrides.get(this); + double rawLifeTimeTemp; if(overriddenLifeTime!=null) { rawLifeTimeTemp = overriddenLifeTime; } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - rawLifeTime =rawLifeTimeTemp> iElementalDefinition.STABLE_RAW_LIFE_TIME ? iElementalDefinition.STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; + rawLifeTime = Math.min(rawLifeTimeTemp, iElementalDefinition.STABLE_RAW_LIFE_TIME); }else { - rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21f * (1f + xstr.nextFloat() * 9f) : iaea.halfTime; + rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : iaea.halfTime; } iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1; }else{ this.mass=mass; - Float overriddenLifeTime= lifetimeOverrides.get(this); - float rawLifeTimeTemp; + Double overriddenLifeTime= lifetimeOverrides.get(this); + double rawLifeTimeTemp; if(overriddenLifeTime!=null) { rawLifeTimeTemp = overriddenLifeTime; } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - rawLifeTime =rawLifeTimeTemp> iElementalDefinition.STABLE_RAW_LIFE_TIME ? iElementalDefinition.STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; + rawLifeTime = Math.min(rawLifeTimeTemp, iElementalDefinition.STABLE_RAW_LIFE_TIME); iaeaDefinitionExistsAndHasEnergyLevels =false; } @@ -209,50 +212,50 @@ public final class dAtomDefinition extends cElementalDefinition { } private static int stableIzoCurve(int element) { - return (int) Math.round(-1.19561E-06 * Math.pow(element, 4D) + - 1.60885E-04 * Math.pow(element, 3D) + - 3.76604E-04 * Math.pow(element, 2D) + - 1.08418E+00 * (double) element); + return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) + + 1.60885E-04D * Math.pow(element, 3D) + + 3.76604E-04D * Math.pow(element, 2D) + + 1.08418E+00D * (double) element); } - private static float calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { - float rawLifeTime; + private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { + double rawLifeTime; if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { - rawLifeTime = containsAnti ? 2.381e4f * (1f + xstr.nextFloat() * 9f) : (1f + xstr.nextFloat() * 9f) * 1.5347e25F; + rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); } else { //Y = (X-A)/(B-A) * (D-C) + C - float unstabilityEXP; + double unstabilityEXP; if (element == 0) { - return 1e-35f; + return 1e-35D; } else if (element == 1) { - unstabilityEXP = 1.743f - Math.abs(izoDiff - 1) * 9.743f; + unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; } else if (element == 2) { switch (isotope) { case 4: - unstabilityEXP = 1.61f; + unstabilityEXP = 1.61D; break; case 5: - unstabilityEXP = -7.523F; + unstabilityEXP = -7.523D; break; case 6: - unstabilityEXP = -1.51f; + unstabilityEXP = -1.51D; break; default: - unstabilityEXP = -(izoDiffAbs * 6.165F); + unstabilityEXP = -(izoDiffAbs * 6.165D); break; } } else if (element <= 83 || isotope <= 127 && element <= 120) { - float elementPow4 = (float) Math.pow(element, 4f); + double elementPow4 = Math.pow(element, 4); - unstabilityEXP = Math.min(element / 2.4f, 6 + ((element + 1) % 2) * 3e6F / elementPow4) + (float) -izoDiff * elementPow4 / 1e8F - Math.abs(izoDiff - 1 + element / 60F) * (3f - element / 12.5f + element * element / 1500f); + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5F - (element - 85) / 3F) - Math.abs(izoDiff) * (3f - element / 13f + element * element / 1600f); + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); } else { return -1; } if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { - unstabilityEXP -= 1.8f; + unstabilityEXP -= 1.8D; } if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { unstabilityEXP += 6; @@ -260,14 +263,14 @@ public final class dAtomDefinition extends cElementalDefinition { if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) { unstabilityEXP += 6; } - rawLifeTime = (containsAnti ? 1e-8f : 1f) * (float) Math.pow(10F, unstabilityEXP) * (1f + xstr.nextFloat() * 9f); + rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); } - if (rawLifeTime < 8e-15) { - return 1e-35f; + if (rawLifeTime < 8e-15D) { + return 1e-35D; } - if (rawLifeTime > 8e28) { - return 8e30f; + if (rawLifeTime > 8e28D) { + return 8e30D; } return rawLifeTime; } @@ -284,6 +287,9 @@ public final class dAtomDefinition extends cElementalDefinition { } else if (!(stack.definition instanceof eLeptonDefinition)) { return false; } + if((int)stack.amount!=stack.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } qty+=stack.amount; } return nuclei && qty decaysList,int decayMode,boolean tryAnti) { + private cElementalDecay[] getDecayArray(ArrayList decaysList,int decayMode,boolean tryAnti) {//todo? if (type == 1) { switch (decayMode) { case -2: @@ -981,14 +987,13 @@ public final class dAtomDefinition extends cElementalDefinition { case "IT": case "IT?": case "G": { if(energy>0){ decaysList.add(new cElementalDecay(decay.chance, this, boson_Y__)); - return true; }else{ if(DEBUG_MODE) { TecTech.LOGGER.info("Tried to emit Gamma from ground state"); } decaysList.add(new cElementalDecay(decay.chance, this)); - return true; } + return true; } //break; case "IT+EC+B+": { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ @@ -1022,7 +1027,7 @@ public final class dAtomDefinition extends cElementalDefinition { cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, emit)) { try { - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), emit)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), emit)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1037,7 +1042,7 @@ public final class dAtomDefinition extends cElementalDefinition { cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { try { - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), alpha)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), alpha)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1053,7 +1058,7 @@ public final class dAtomDefinition extends cElementalDefinition { if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { try { tree.putUnify(dHadronDefinition.hadron_p1); - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1069,7 +1074,7 @@ public final class dAtomDefinition extends cElementalDefinition { if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1085,7 +1090,7 @@ public final class dAtomDefinition extends cElementalDefinition { if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1096,7 +1101,7 @@ public final class dAtomDefinition extends cElementalDefinition { return false; } - private boolean Fission(ArrayList decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,float probability,boolean spontaneousCheck) { + private boolean Fission(ArrayList decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,double probability,boolean spontaneousCheck) { cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); double[] liquidDrop= liquidDropFunction(Math.abs(element)<=97); @@ -1124,7 +1129,7 @@ public final class dAtomDefinition extends cElementalDefinition { //} }else{ int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[0]); - if(heavy_cnt%2==1 && XSTR_INSTANCE.nextFloat()>0.05f) { + if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { heavy_cnt--; } cElementalDefinitionStack new_stack=new cElementalDefinitionStack(stack.definition, heavy_cnt); @@ -1198,9 +1203,9 @@ public final class dAtomDefinition extends cElementalDefinition { } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { if(iaeaDefinitionExistsAndHasEnergyLevels){ - float result=0; + double result=0; boolean backwards=newEnergyLevel entry:lifetimeOverrides.entrySet()){ + for(Map.Entry entry:lifetimeOverrides.entrySet()){ try { lifetimeOverrides.put(new dAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); }catch (tElementalException e){ @@ -1375,7 +1380,7 @@ public final class dAtomDefinition extends cElementalDefinition { int StableIsotope = stableIzoCurve(element); int izoDiff = isotope - StableIsotope; int izoDiffAbs = Math.abs(izoDiff); - float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); iaeaNuclide nuclide = iaeaNuclide.get(element, isotope); if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.halfTime >= STABLE_RAW_LIFE_TIME) { TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); @@ -1392,8 +1397,8 @@ public final class dAtomDefinition extends cElementalDefinition { int Isotope = stableIzoCurve(element); int izoDiff = isotope - Isotope; int izoDiffAbs = Math.abs(izoDiff); - float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); isotopes.put(rawLifeTime, isotope); } } @@ -1408,7 +1413,7 @@ public final class dAtomDefinition extends cElementalDefinition { TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); } } - for (Map.Entry> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { + for (Map.Entry> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { unstableAtoms.put(integerTreeMapEntry.getKey(), new dAtomDefinition( new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), @@ -1468,7 +1473,7 @@ public final class dAtomDefinition extends cElementalDefinition { public static void setTransformation(){ /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * 144F; + refMass = getFirstStableIsotope(1).getMass() * 144D; transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), 144),Materials.Hydrogen.mGas.getID(),144); transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), 144),Materials.Helium.mGas.getID(), 144); @@ -1554,7 +1559,7 @@ public final class dAtomDefinition extends cElementalDefinition { transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), 144), dust, Materials.Lead,1); /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(82).getMass() * 144F; + refUnstableMass = getFirstStableIsotope(82).getMass() * 144D; transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), 144), dust, Materials.Bismuth,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),144),OrePrefixes.dust, Materials.Polonium,1); @@ -1585,7 +1590,7 @@ public final class dAtomDefinition extends cElementalDefinition { ); transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Uranium/*238*/,1); - float tempMass=temp.getMass(); + double tempMass=temp.getMass(); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), @@ -1664,7 +1669,7 @@ public final class dAtomDefinition extends cElementalDefinition { lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); + lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 96ee5cc3db..ce5e4a50aa 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -41,17 +41,17 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public static final Map NAME_MAP =new HashMap<>(); public static dHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; public static cElementalDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; - private static float protonMass = 0F; - private static float neutronMass = 0F; - private static final float actualProtonMass=938272081.3f; - private static final float actualNeutronMass=939565413.3f; + private static double protonMass = 0D; + private static double neutronMass = 0D; + private static final double actualProtonMass=938272081.3D; + private static final double actualNeutronMass=939565413.3D; //float-mass in eV/c^2 - public final float mass; + public final double mass; //int -electric charge in 1/3rds of electron charge for optimization public final int charge; - public final float rawLifeTime; - public final byte amount; + public final double rawLifeTime; + public final int amount; //generation max present inside - minus if contains any antiquark public final byte type; //private final FluidStack fluidThing; @@ -87,13 +87,16 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } quarkStacks = quarks; - byte amount = 0; + int amount = 0; int charge = 0; int type = 0; boolean containsAnti = false; - float mass = 0; + double mass = 0; for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { amount += quarkStack.amount; + if((int)quarkStack.amount!=quarkStack.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } mass += quarkStack.getMass(); charge += quarkStack.getCharge(); type = Math.max(Math.abs(quarkStack.definition.getType()), type); @@ -104,22 +107,22 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi this.amount = amount; this.charge = charge; this.type = containsAnti ? (byte) -type : (byte) type; - int mult = this.amount * this.amount * (this.amount - 1); - mass = mass * 5.543F * (float) mult;//yes it becomes heavier + long mult = this.amount * this.amount * (this.amount - 1); + mass = mass * 5.543D * mult;//yes it becomes heavier if (mass == protonMass && this.amount == 3) { rawLifeTime = iElementalDefinition.STABLE_RAW_LIFE_TIME; mass=actualProtonMass; } else if (mass == neutronMass && this.amount == 3) { - rawLifeTime = 882F; + rawLifeTime = 882D; mass=actualNeutronMass; } else { if (this.amount == 3) { - rawLifeTime = 1.34F / mass * (float) Math.pow(9.81, charge); + rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); } else if (this.amount == 2) { - rawLifeTime = 1.21F / mass / (float) Math.pow(19.80, charge); + rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); } else { - rawLifeTime = 1.21F / mass / (float) Math.pow(9.80, charge); + rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); } } this.mass=mass; @@ -133,6 +136,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi if (!(quarks.definition instanceof eQuarkDefinition)) { return false; } + if((int)quarks.amount!=quarks.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } amount += quarks.amount; } return amount >= 2 && amount <= 12; @@ -229,7 +235,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } } return new cElementalDecay[]{ - new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[0])), + new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), eBosonDefinition.deadEnd }; } @@ -240,11 +246,11 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } - return new cElementalDecay[]{new cElementalDecay(0.75F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks + return new cElementalDecay[]{new cElementalDecay(0.75D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @@ -274,7 +280,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } else if (amount != 3) { - return new cElementalDecay[]{new cElementalDecay(0.95F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks + return new cElementalDecay[]{new cElementalDecay(0.95D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks } else { ArrayList newBaryon = new ArrayList<>(); iElementalDefinition[] Particles = new iElementalDefinition[2]; @@ -302,8 +308,8 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi try { return new cElementalDecay[]{ - new cElementalDecay(0.99F, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), - new cElementalDecay(0.001F, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), + new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), + new cElementalDecay(0.001D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), eBosonDefinition.deadEnd}; } catch (tElementalException e) { if (DEBUG_MODE) { @@ -315,7 +321,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public float getMass() { + public double getMass() { return mass; } @@ -325,7 +331,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public float getRawTimeSpan(long currentEnergy) { + public double getRawTimeSpan(long currentEnergy) { return rawLifeTime; } @@ -436,13 +442,13 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi protonMass = -1; neutronMass = -1; } - hadron_p1 = new cElementalDefinitionStack(hadron_p, 1); - hadron_n1 = new cElementalDefinitionStack(hadron_n, 1); - hadron_p2 = new cElementalDefinitionStack(hadron_p, 2); - hadron_n2 = new cElementalDefinitionStack(hadron_n, 2); - hadron_p3 = new cElementalDefinitionStack(hadron_p, 3); - hadron_n3 = new cElementalDefinitionStack(hadron_n, 3); - hadron_p5 = new cElementalDefinitionStack(hadron_p, 5); + hadron_p1 = new cElementalDefinitionStack(hadron_p, 1D); + hadron_n1 = new cElementalDefinitionStack(hadron_n, 1D); + hadron_p2 = new cElementalDefinitionStack(hadron_p, 2D); + hadron_n2 = new cElementalDefinitionStack(hadron_n, 2D); + hadron_p3 = new cElementalDefinitionStack(hadron_p, 3D); + hadron_n3 = new cElementalDefinitionStack(hadron_n, 3D); + hadron_p5 = new cElementalDefinitionStack(hadron_p, 5D); try { cElementalDefinition.addCreatorFromNBT(nbtType, dHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); @@ -497,7 +503,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); + lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java index 87a71b684f..410e53810e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java @@ -1,7 +1,5 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; -import com.github.technus.tectech.util.Util; - import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; @@ -10,6 +8,7 @@ import java.util.HashSet; import java.util.TreeMap; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.util.Util.splitButDifferent; public final class iaeaNuclide { public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D; @@ -28,7 +27,7 @@ public final class iaeaNuclide { BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclides.csv"))); ArrayList blockOfData=new ArrayList<>(4); while((line=reader.readLine())!=null) { - String[] split= Util.splitButDifferent(line,","); + String[] split= splitButDifferent(line,","); if(split.length!=19) { throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); } @@ -51,7 +50,7 @@ public final class iaeaNuclide { try { BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclidesTable.csv"))); while((line=reader.readLine())!=null) { - String[] split= Util.splitButDifferent(line,","); + String[] split= splitButDifferent(line,","); if(split.length!=47) { throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuvlidesTable database " + line); } @@ -66,7 +65,7 @@ public final class iaeaNuclide { try { BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("energyLevels.csv"))); while((line=reader.readLine())!=null) { - String[] split= Util.splitButDifferent(line,","); + String[] split= splitButDifferent(line,","); if(split.length!=27) { throw new Error("Invalid count (" + split.length + ") of separators in IAEA energyLevels database " + line); } @@ -88,10 +87,10 @@ public final class iaeaNuclide { } public final short N,Z; - public final float halfTime;//sec - public final float mass;//eV/c^2 + public final double halfTime;//sec + public final double mass;//eV/c^2 public final short discovery;//year - private TreeMap energeticStates; + private TreeMap energeticStates; public energeticState[] energeticStatesArray; @@ -100,14 +99,14 @@ public final class iaeaNuclide { Z=Short.parseShort(rows[1][0]); NUCLIDES.put(((int)Z <<16)+N,this); - String[] parts = Util.splitButDifferent(rows[0][16], "|"); + String[] parts = splitButDifferent(rows[0][16], "|"); double Mass=doubleOrNaN(parts[0],"mass"); if(!Double.isNaN(Mass)) { //System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); - mass = (float)(Mass* MICRO_AMU_TO_EV_DIV_C_C); + mass = Mass* MICRO_AMU_TO_EV_DIV_C_C; } else { - mass = Float.NaN; + mass = Double.NaN; } discovery=(short)doubleOrNaN(rows[0][18],"discovery"); @@ -115,8 +114,8 @@ public final class iaeaNuclide { if(rows[0][3].contains("STABLE")){ halfTime = STABLE_RAW_LIFE_TIME; }else{ - parts = Util.splitButDifferent(rows[0][4], "|"); - halfTime = (float)doubleOrNaN(parts[0],"half life"); + parts = splitButDifferent(rows[0][4], "|"); + halfTime = doubleOrNaN(parts[0],"half life"); } } @@ -126,7 +125,13 @@ public final class iaeaNuclide { // if (add(cells[17])) System.out.println(N + " " + Z); // if (add(cells[20])) System.out.println(N + " " + Z); //} - new energeticState(this, halfTime, getDecaysFixed(cells[14],doubleOrNaN(cells[15],"chance1"),cells[17],doubleOrNaN(cells[18],"chance1"),cells[20],doubleOrNaN(cells[21],"chance1"))); + new energeticState(this, halfTime, getDecaysFixed( + cells[14], + doubleOrNaN(cells[15],"chance1"), + cells[17], + doubleOrNaN(cells[18],"chance1"), + cells[20], + doubleOrNaN(cells[21],"chance1"))); } private static final energeticState[] empty=new energeticState[0]; @@ -156,11 +161,11 @@ public final class iaeaNuclide { } public static final class energeticState{ - public final float energy; - public final float Thalf; + public final double energy; + public final double Thalf; public final iaeaDecay[] decaymodes; - private energeticState(iaeaNuclide nuclide,float Thalf,iaeaDecay[] decaymodes){ + private energeticState(iaeaNuclide nuclide,double Thalf,iaeaDecay[] decaymodes){ energy=0; this.Thalf=Thalf; this.decaymodes=decaymodes; @@ -175,11 +180,11 @@ public final class iaeaNuclide { if(nuclide==null) { throw new Error("Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") + ' ' + (int) doubleOrNaN(cells[1], "neutrons")); } - energy =(float) (doubleOrNaN(cells[3],"energy level",nuclide)*1000f);//to eV + energy =doubleOrNaN(cells[3],"energy level",nuclide)*1000D;//to eV if(energy<0) { throw new Error("Invalid energy " + nuclide.N + ' ' + nuclide.Z + ' ' + cells[3]); } - Thalf =(float) doubleOrNaN(cells[10],"half life",nuclide); + Thalf =doubleOrNaN(cells[10],"half life",nuclide); if(nuclide.energeticStates==null) { new Exception("Should be initialized before doing this... "+ nuclide.N + ' ' +nuclide.Z).printStackTrace(); nuclide.energeticStates = new TreeMap<>(); @@ -190,7 +195,13 @@ public final class iaeaNuclide { // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); //} - decaymodes = getDecaysFixed(cells[12],doubleOrNaN(cells[13],"chance 1",nuclide),cells[15],doubleOrNaN(cells[16],"chance 2",nuclide),cells[18],doubleOrNaN(cells[19],"chance 3",nuclide)); + decaymodes = getDecaysFixed( + cells[12], + doubleOrNaN(cells[13],"chance 1",nuclide), + cells[15], + doubleOrNaN(cells[16],"chance 2",nuclide), + cells[18], + doubleOrNaN(cells[19],"chance 3",nuclide)); } private double doubleOrNaN(String s, String name){ @@ -231,40 +242,40 @@ public final class iaeaNuclide { do3= !decay3.isEmpty() && !Double.isNaN(chance3); TreeMap decays=new TreeMap<>(); if(do1 && do2 && chance1==100 && chance2==100 && chance3!=100){ - decays.put(1D, new iaeaDecay(1f, decay1)); + decays.put(1D, new iaeaDecay(1D, decay1)); if(do3) { chance3/=100d; - decays.put(chance3, new iaeaDecay((float) chance3, decay2)); + decays.put(chance3, new iaeaDecay(chance3, decay2)); chance2=1d-chance3; } chance2/=2d; - decays.put(chance2, new iaeaDecay((float) chance2, decay2)); + decays.put(chance2, new iaeaDecay(chance2, decay2)); }else if(do1 && chance1==100){ - decays.put(1D, new iaeaDecay(1f, decay1)); + decays.put(1D, new iaeaDecay(1D, decay1)); if(do2) { chance2/=100d; - decays.put(chance2, new iaeaDecay((float) chance2, decay2)); + decays.put(chance2, new iaeaDecay(chance2, decay2)); } if(do3) { chance3 /= 100d; if(do2) { chance3 *= chance2; } - decays.put(chance3, new iaeaDecay((float) chance3, decay3)); + decays.put(chance3, new iaeaDecay(chance3, decay3)); } }else{ double normalization= (do1?chance1:0) + (do2?chance2:0) + (do3?chance3:0); if(do1) { chance1/=normalization; - decays.put(chance1, new iaeaDecay((float) chance1, decay1)); + decays.put(chance1, new iaeaDecay(chance1, decay1)); } if(do2) { chance2/=normalization; - decays.put(chance2, new iaeaDecay((float) chance2, decay2)); + decays.put(chance2, new iaeaDecay(chance2, decay2)); } if(do3) { chance3/=normalization; - decays.put(chance3, new iaeaDecay((float) chance3, decay3)); + decays.put(chance3, new iaeaDecay(chance3, decay3)); } if(do1||do2||do3) { decays.put(1D, iaeaDecay.DEAD_END); @@ -277,10 +288,10 @@ public final class iaeaNuclide { } public static final class iaeaDecay{ - public final float chance; + public final double chance; public final String decayName; - public static final iaeaDecay DEAD_END=new iaeaDecay(1f,"DEAD_END"); - private iaeaDecay(float chance,String decayName){ + public static final iaeaDecay DEAD_END=new iaeaDecay(1D,"DEAD_END"); + private iaeaDecay(double chance,String decayName){ this.chance=chance; this.decayName=decayName; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java index a09fc60835..a3efe12b7e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java @@ -9,13 +9,13 @@ import static com.github.technus.tectech.mechanics.elementalMatter.core.cElement */ public final class cPrimitiveDefinition extends cElementalPrimitive { public static final cPrimitiveDefinition - nbtE__ = new cPrimitiveDefinition("NBT ERROR", "!", 0, 0f, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), - null__ = new cPrimitiveDefinition("NULL POINTER", ".", 0, 0F, -3, Integer.MAX_VALUE-10_000), - space__ = new cPrimitiveDefinition("Space", "_", 0, 0F, -4, 0), - magic = new cPrimitiveDefinition("Magic", "Ma", 4, 1e5F, 0, 1), - magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5F, 0, 2); + nbtE__ = new cPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), + null__ = new cPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), + space__ = new cPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), + magic = new cPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), + magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); - private cPrimitiveDefinition(String name, String symbol, int type, float mass, int color, int ID) { + private cPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { super(name, symbol, type, mass, 0, color, ID); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java index 3f314151f3..f1f740f665 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java @@ -9,23 +9,23 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem */ public final class eBosonDefinition extends cElementalPrimitive { public static final eBosonDefinition - boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18F, -1, 27), - boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9F, -2, 28); + boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), + boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); //deadEnd public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__, boson_Y__); public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__); public static final cElementalDefinitionStack boson_Y__1=new cElementalDefinitionStack(boson_Y__,1); - private eBosonDefinition(String name, String symbol, float mass, int color, int ID) { + private eBosonDefinition(String name, String symbol, double mass, int color, int ID) { super(name, symbol, 0, mass, 0, color, ID); } public static void run() { boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, cElementalDecay.noDecay); - boson_H__.init(null, 1.56e-22F, 0, 0, - new cElementalDecay(0.96F, new cElementalDefinitionStack(boson_Y__, 4)), - new cElementalDecay(0.02F, eLeptonDefinition.lepton_t, eLeptonDefinition.lepton_t_), - new cElementalDecay(0.01F, eQuarkDefinition.quark_b, eQuarkDefinition.quark_b_), + boson_H__.init(null, 1.56e-22D, 0, 0, + new cElementalDecay(0.96D, new cElementalDefinitionStack(boson_Y__, 4)), + new cElementalDecay(0.02D, eLeptonDefinition.lepton_t, eLeptonDefinition.lepton_t_), + new cElementalDecay(0.01D, eQuarkDefinition.quark_b, eQuarkDefinition.quark_b_), deadEnd); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java index 20132e2095..dd57d6875e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java @@ -9,19 +9,19 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem */ public final class eLeptonDefinition extends cElementalPrimitive { public static final eLeptonDefinition - lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6F, -3, 15), - lepton_m = new eLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6F, -3, 17), - lepton_t = new eLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6F, -3, 19), - lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6F, 3, 16), - lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6F, 3, 18), - lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6F, 3, 20); + lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), + lepton_m = new eLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), + lepton_t = new eLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), + lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), + lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), + lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); public static final cElementalDefinitionStack lepton_e1 = new cElementalDefinitionStack(lepton_e, 1); public static final cElementalDefinitionStack lepton_e2 = new cElementalDefinitionStack(lepton_e, 2); public static final cElementalDefinitionStack lepton_e_1 = new cElementalDefinitionStack(lepton_e_, 1); public static final cElementalDefinitionStack lepton_e_2 = new cElementalDefinitionStack(lepton_e_, 2); - private eLeptonDefinition(String name, String symbol, int type, float mass, int charge, int ID) { + private eLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { super(name, symbol, type, mass, charge, -1, ID); //this.itemThing=null; //this.fluidThing=null; @@ -31,12 +31,12 @@ public final class eLeptonDefinition extends cElementalPrimitive { lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, eBosonDefinition.deadEnd,//makes photons and don't care new cElementalDecay(lepton_e, eBosonDefinition.boson_Y__)); - lepton_m.init(lepton_m_, 2.197019e-6F, 0, 1, - new cElementalDecay(0.9F, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), + lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, + new cElementalDecay(0.9D, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), eBosonDefinition.deadEnd);//makes photons and don't care - lepton_t.init(lepton_t_, 2.906e-13F, 1, 3, - new cElementalDecay(0.8F, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_Y__), - new cElementalDecay(0.1F, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), + lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, + new cElementalDecay(0.8D, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_Y__), + new cElementalDecay(0.1D, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), new cElementalDecay(0.05F, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_H__), eBosonDefinition.deadEnd);//makes photons and don't care diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java index 5f6a4a7b5e..ba084af9a2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java @@ -9,38 +9,38 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem */ public final class eNeutrinoDefinition extends cElementalPrimitive { public static final eNeutrinoDefinition - lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0F, 21), - lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6F, 23), - lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6F, 25), - lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0F, 22), - lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6F, 24), - lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6F, 26); + lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), + lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), + lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), + lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), + lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), + lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); public static final cElementalDefinitionStack lepton_Ve1 = new cElementalDefinitionStack(lepton_Ve, 1); public static final cElementalDefinitionStack lepton_Ve2 = new cElementalDefinitionStack(lepton_Ve, 2); public static final cElementalDefinitionStack lepton_Ve_1 = new cElementalDefinitionStack(lepton_Ve_, 1); public static final cElementalDefinitionStack lepton_Ve_2 = new cElementalDefinitionStack(lepton_Ve_, 2); - private eNeutrinoDefinition(String name, String symbol, int type, float mass, int ID) { + private eNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { super(name, symbol, type, mass, 0, -1, ID); } public static void run() { - lepton_Ve.init(lepton_Ve_, 1F, -1, -1, + lepton_Ve.init(lepton_Ve_, 1D, -1, -1, cElementalDecay.noProduct); - lepton_Vm.init(lepton_Vm_, 1F, 1, 0, - new cElementalDecay(0.825F, nothing), + lepton_Vm.init(lepton_Vm_, 1D, 1, 0, + new cElementalDecay(0.825D, nothing), eBosonDefinition.deadEndHalf); - lepton_Vt.init(lepton_Vt_, 1F, 1, 0, + lepton_Vt.init(lepton_Vt_, 1, 1, 0, new cElementalDecay(0.75F, nothing), eBosonDefinition.deadEnd); - lepton_Ve_.init(lepton_Ve, 1F, -1, -1, + lepton_Ve_.init(lepton_Ve, 1, -1, -1, cElementalDecay.noProduct); - lepton_Vm_.init(lepton_Vm, 1F, 1, 0, + lepton_Vm_.init(lepton_Vm, 1, 1, 0, new cElementalDecay(0.825F, nothing), eBosonDefinition.deadEndHalf); - lepton_Vt_.init(lepton_Vt, 1F, 1, 0, + lepton_Vt_.init(lepton_Vt, 1, 1, 0, new cElementalDecay(0.75F, nothing), eBosonDefinition.deadEnd); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java index be6879d435..027b604dc5 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java @@ -8,62 +8,62 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem */ public final class eQuarkDefinition extends cElementalPrimitive { public static final eQuarkDefinition - quark_u = new eQuarkDefinition("Up", "u", 1, 2.3e6F, 2, 3), - quark_c = new eQuarkDefinition("Charm", "c", 2, 1.29e9F, 2, 9), - quark_t = new eQuarkDefinition("Top", "t", 3, 172.44e9F, 2, 13), - quark_d = new eQuarkDefinition("Down", "d", 1, 4.8e6F, -1, 5), - quark_s = new eQuarkDefinition("Strange", "s", 2, 95e6F, -1, 7), - quark_b = new eQuarkDefinition("Bottom", "b", 3, 4.65e9F, -1, 11), - quark_u_ = new eQuarkDefinition("AntiUp", "~u", -1, 2.3e6F, -2, 4), - quark_c_ = new eQuarkDefinition("AntiCharm", "~c", -2, 1.29e9F, -2, 10), - quark_t_ = new eQuarkDefinition("AntiTop", "~t", -3, 172.44e9F, -2, 14), - quark_d_ = new eQuarkDefinition("AntiDown", "~d", -1, 4.8e6F, 1, 6), - quark_s_ = new eQuarkDefinition("AntiStrange", "~s", -2, 95e6F, 1, 8), - quark_b_ = new eQuarkDefinition("AntiBottom", "~b", -3, 4.65e9F, 1, 12); + quark_u = new eQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), + quark_c = new eQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), + quark_t = new eQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), + quark_d = new eQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), + quark_s = new eQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), + quark_b = new eQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), + quark_u_ = new eQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), + quark_c_ = new eQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), + quark_t_ = new eQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), + quark_d_ = new eQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), + quark_s_ = new eQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), + quark_b_ = new eQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); - private eQuarkDefinition(String name, String symbol, int type, float mass, int charge, int ID) { + private eQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { super(name, symbol, type, mass, charge, 0, ID); } public static void run() { quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9F, quark_d, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.050778116F, quark_s/*,lepton_m_,lepton_Vm*/), - new cElementalDecay(1.23201e-5F, quark_b/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.9D, quark_d, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), + new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), + new cElementalDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), eBosonDefinition.deadEnd);//makes photons and don't care - quark_c.init(quark_c_, 0.5e-13F, 1, -1, - new cElementalDecay(0.9F, quark_s, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.05071504F, quark_d, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(0.00169744F, quark_b/*,lepton_t_,lepton_Vt*/), + quark_c.init(quark_c_, 0.5e-13D, 1, -1, + new cElementalDecay(0.9D, quark_s, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), + new cElementalDecay(0.05071504D, quark_d, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), + new cElementalDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), eBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26F, 2, -1, - new cElementalDecay(0.9F, quark_b, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.00163216F, quark_s, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(7.51689e-5F, quark_d, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), + quark_t.init(quark_t_, 2.5e-26D, 2, -1, + new cElementalDecay(0.9D, quark_b, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), + new cElementalDecay(0.00163216D, quark_s, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), + new cElementalDecay(7.51689e-5D, quark_d, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), eBosonDefinition.deadEnd);//makes photons and don't care quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9F, quark_u, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.05071504F, quark_c/*,lepton_m,lepton_Vm_*/), - new cElementalDecay(7.51689e-5F, quark_t/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.9D, quark_u, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), + new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), eBosonDefinition.deadEnd);//makes photons and don't care - quark_s.init(quark_s_, 0.6e-9F, 1, -1, - new cElementalDecay(0.9F, quark_c, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.050778116F, quark_u, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(0.00163216F, quark_t/*,lepton_t,lepton_Vt_*/), + quark_s.init(quark_s_, 0.6e-9D, 1, -1, + new cElementalDecay(0.9D, quark_c, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), + new cElementalDecay(0.050778116D, quark_u, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), + new cElementalDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), eBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13F, 2, -1, - new cElementalDecay(0.9F, quark_t, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.00169744F, quark_c, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(1.23201e-5F, quark_u, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), + quark_b.init(quark_b_, 0.7e-13D, 2, -1, + new cElementalDecay(0.9D, quark_t, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), + new cElementalDecay(0.00169744D, quark_c, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), + new cElementalDecay(1.23201e-5D, quark_u, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), eBosonDefinition.deadEnd);//makes photons and don't care quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9F, quark_d_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.050778116F, quark_s_/*,lepton_m,lepton_Vm_*/), - new cElementalDecay(1.23201e-5F, quark_b_/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.9D, quark_d_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), + new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), eBosonDefinition.deadEnd);//makes photons and don't care - quark_c_.init(quark_c, 0.5e-13F, 1, -1, + quark_c_.init(quark_c, 0.5e-13D, 1, -1, new cElementalDecay(0.9F, quark_s_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), new cElementalDecay(0.05071504F, quark_d_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 8f4e7969ee..e364e634bc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -36,6 +36,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -280,7 +281,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } return STATUS_WRONG; } - return STATUS_UNUSED; + return STATUS_OK; }; private static final INameFunction MODE_NAME = (base_EM, p) -> { if (base_EM.isMaster()) { @@ -298,9 +299,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //region structure //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition .builder() - .addShapeOldApi("main",new String[][]{ + .addShapeOldApi("main", new String[][]{ {"I0A0A0", "I00000", "I0A0A0",}, {"H0000000", "G001111100", "H0000000",}, {"F22223332222", "F41155555114", "F22223332222",}, @@ -323,23 +324,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, }) - .addElement('0', ofBlock(sBlockCasingsTT,4)) - .addElement('1', ofBlock(sBlockCasingsTT,7)) - .addElement('2', defer(t->(int)t.eTier,(t,item)->2-(item.stackSize&1), - error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,5))) - .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE,0)) - .addElement('4', defer(t->(int)t.eTier,(t,item)->2-(item.stackSize&1), - error(),ofBlock(sBlockCasingsTT,4),ofBlock(sBlockCasingsTT,6))) - .addElement('5', defer(t->(int)t.eTier,(t,item)->2-(item.stackSize&1), - error(),ofBlock(sBlockCasingsTT,8),ofBlock(sBlockCasingsTT,9))) + .addElement('0', ofBlock(sBlockCasingsTT, 4)) + .addElement('1', ofBlock(sBlockCasingsTT, 7)) + .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) + .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) + .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, - textureOffset,1,sBlockCasingsTT,0)) + textureOffset, 1, sBlockCasingsTT, 0)) .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, - textureOffset + 4,2,sBlockCasingsTT,4)) + textureOffset + 4, 2, sBlockCasingsTT, 4)) .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, - textureOffset + 4,3,sBlockCasingsTT,4)) + textureOffset + 4, 3, sBlockCasingsTT, 4)) .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, - textureOffset + 4,4,sBlockCasingsTT,4)) + textureOffset + 4, 4, sBlockCasingsTT, 4)) .build(); private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", @@ -405,6 +406,39 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 0; } + protected double collide(GT_MetaTileEntity_EM_collider partner) { + if (partner.stack != null && stack != null) {//todo add single event mode as an option + boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && + partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); + + cElementalInstanceStack stack2 = partner.stack; + double preMass = stack2.getMass() + stack.getMass(); + //System.out.println("preMass = " + preMass); + + cElementalInstanceStackMap map = new cElementalInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } else { + colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + for (cElementalInstanceStack newStack : map.values()) { + check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); + } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new cElementalInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return check ? preMass - map.getMass() : + Math.min(preMass - map.getMass(), 0); + } + return 0; + } + private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) { if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { colliderHandler.collide(stack2, stack, map); @@ -438,7 +472,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private void makeEU(double massDiff) { plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; - System.out.println("plasmaEnergy = " + plasmaEnergy); + if (DEBUG_MODE) { + System.out.println("plasmaEnergy = " + plasmaEnergy); + } } private cElementalInstanceStackMap tickStack() { @@ -476,7 +512,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB eTier = 0; return false; } - if (structureCheck_EM("main",11, 1, 18)) { + if (structureCheck_EM("main", 11, 1, 18)) { return true; } eTier = 0; @@ -541,7 +577,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB makeEU(fuse(partner)); break; case COLLIDE_MODE: - //collide(partner);//todo + collide(partner);//todo break; default: { outputEM = new cElementalInstanceStackMap[2]; @@ -675,7 +711,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12); } - structureBuild_EM("main",11, 1, 18,hintsOnly, stackSize); + structureBuild_EM("main", 11, 1, 18, hintsOnly, stackSize); } @Override diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java new file mode 100644 index 0000000000..e7ef18be08 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -0,0 +1,113 @@ +package com.github.technus.tectech.util; + +import java.util.Arrays; + +import static java.lang.Math.max; +import static java.lang.Math.ulp; + +public class DoubleCount { + public static double[] distribute(double count,double... probabilities){ + if(probabilities==null){ + return null; + }else if(count==0){ + return new double[probabilities.length]; + }else { + switch (probabilities.length){ + default: { + int size=probabilities.length; + double[] output=new double[size]; + size--; + double remaining=count,previous=probabilities[size],probability,out,sum=0; + for (int i = size - 1; i >= 0; i--) { + probability=probabilities[i]; + remaining-=out=count*probability; + sum+=output[i]=out-ulp(out); + if(previouscount){ + throw new ArithmeticException("Too much outputted: "+ Arrays.toString(output)+" "+sum+" / "+count); + } + return output; + } + case 1: return new double[]{count}; + case 0: return probabilities;//empty array at hand... + } + } + } + + public static double div(double count,double divisor){ + if (divisor == 0) { + throw new ArithmeticException("Divide by 0"); + }else if(count==0 || divisor==1){ + return count; + }else if(divisor==-1){ + return -count; + } else { + double result = count / divisor; + if(result*count<0){ + return 0; + } + return result-ulp(result); + } + } + + public static double mul(double count,double multiplier){ + if(count==0 || multiplier==1){ + return count; + }else if(multiplier==-1){ + return -count; + } else { + double result = count * multiplier; + if(result*count<0){ + return 0; + } + return result-ulp(result); + } + } + + public static double sub(double count,double value){ + if(value==0){ + return count; + } + if(count==0){ + return -value; + } + if(value==count){ + return 0; + } + return value < 0 ? addInternal(count, -value) : subInternal(count, value); + } + + public static double add(double count,double value){ + if(value==0){ + return count; + } + if(count==0){ + return value; + } + return value < 0 ? subInternal(count, -value) : addInternal(count, value); + } + + private static double subInternal(double count,double value){ + double result = count - max(value,ulp(count)); + if (result+value>count || value>count-result){ + result-=ulp(result); + } + return result; + } + + private static double addInternal(double count,double value){ + double result = count + value; + if (result-value>count || result-count>value){ + result-=ulp(result); + } + return result; + } +} -- cgit From 69c8841a2f201cafcea26073d5d2da0613cc4dc1 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 13:01:56 +0200 Subject: Rework machines --- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 6 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 20 +++---- .../multi/GT_MetaTileEntity_EM_decay.java | 2 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 4 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 4 +- .../multi/base/MultiblockControl.java | 68 +++++++++++----------- .../multi/em_machine/Behaviour_Centrifuge.java | 62 +++++++++++--------- 7 files changed, 87 insertions(+), 79 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index d0b9411773..bf84663058 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -43,7 +43,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta protected cElementalInstanceStackMap content = new cElementalInstanceStackMap(); //float lifeTimeMult=1f; public int postEnergize = 0; - public float overflowMatter = 0f; + public double overflowMatter = 0f; public short id = -1; private byte deathDelay = 2; @@ -80,7 +80,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta super.saveNBTData(aNBT); aNBT.setInteger("postEnergize", postEnergize); //aNBT.setFloat("lifeTimeMult",lifeTimeMult); - aNBT.setFloat("overflowMatter", overflowMatter); + aNBT.setDouble("OverflowMatter", overflowMatter); aNBT.setTag("eM_Stacks", content.toNBT()); aNBT.setShort("eID", id); } @@ -90,7 +90,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta super.loadNBTData(aNBT); postEnergize = aNBT.getInteger("postEnergize"); //lifeTimeMult=aNBT.getFloat("lifeTimeMult"); - overflowMatter = aNBT.getFloat("overflowMatter"); + overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); id = aNBT.getShort("eID"); try { content = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); 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 ad7f1fe159..a5e6dc4d5d 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 @@ -44,13 +44,13 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; public static Textures.BlockIcons.CustomIcon MufflerEM; public static Textures.BlockIcons.CustomIcon MufflerEMidle; - private float overflowMatter; - public final float overflowMax; - private final float overflowDisperse; + private double overflowMatter; + public final double overflowMax; + private final double overflowDisperse; private String clientLocale = "en_US"; - public GT_MetaTileEntity_Hatch_OverflowElemental(int aID, String aName, String aNameRegional, int aTier, float max) { + public GT_MetaTileEntity_Hatch_OverflowElemental(int aID, String aName, String aNameRegional, int aTier, double max) { super(aID, aName, aNameRegional, aTier, 0, translateToLocal("gt.blockmachines.hatch.emmuffler.desc.0"));//Disposes excess elemental Matter overflowMatter = max / 2; overflowMax = max; @@ -58,7 +58,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity Util.setTier(aTier, this); } - public GT_MetaTileEntity_Hatch_OverflowElemental(String aName, int aTier, float max, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_OverflowElemental(String aName, int aTier, double max, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); overflowMatter = max / 2; overflowMax = max; @@ -124,13 +124,13 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setFloat("overflowMatter", overflowMatter); + aNBT.setDouble("OverflowMatter", overflowMatter); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - overflowMatter = aNBT.getFloat("overflowMatter"); + overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); } @Override @@ -235,17 +235,17 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity } //Return - Should Explode - public boolean addOverflowMatter(float matter) { + public boolean addOverflowMatter(double matter) { overflowMatter += matter; return overflowMatter > overflowMax; } - public float getOverflowMatter() { + public double getOverflowMatter() { return overflowMatter; } //Return - Should Explode - public boolean setOverflowMatter(float overflowMatter) { + public boolean setOverflowMatter(double overflowMatter) { this.overflowMatter = overflowMatter; return overflowMatter > overflowMax; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index d8ddc2c5b5..b5dc211f3a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -144,7 +144,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase //System.out.println(stack.definition.getSymbol()+" "+stack.amount); } - float preMass = outputEM[0].getMass(); + double preMass = outputEM[0].getMass(); outputEM[0].tickContent(1, 0, 1); double energyDose = ((preMass - outputEM[0].getMass()) * URANIUM_MASS_TO_EU_PARTIAL); eAmpereFlow = (long) ampereFlow.get(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 1ba1389c80..11bc0fefd7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -74,8 +74,8 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo private void startRecipe(iHasElementalDefinition from, long energy) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - float mass = from.getMass(); - float euMult = Math.abs(mass / refMass); + double mass = from.getMass(); + double euMult = Math.abs(mass / refMass); eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); if (mass > refUnstableMass || from.getDefinition().getRawTimeSpan(energy) < STABLE_RAW_LIFE_TIME) { mEUt = (int) -V[8]; 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 a04a960bf1..d6ab35cd4b 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 @@ -155,8 +155,8 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private void startRecipe(iHasElementalDefinition into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - float mass = into.getMass(); - float euMult = Math.abs(mass / refMass); + double mass = into.getMass(); + double euMult = Math.abs(mass / refMass); eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); if (mass > refUnstableMass || into.getDefinition().getRawTimeSpan(DEFAULT_ENERGY_LEVEL) < STABLE_RAW_LIFE_TIME) { mEUt = (int) -V[8]; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java index 41bc0e5a37..8429bf4e67 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java @@ -5,68 +5,70 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; */ public class MultiblockControl{ - private final int[] controls=new int[7]; private final boolean shouldExplode; - private final T values; + private final T value; + private final int eUt; + private final int amperes; + private final int requiredData; + private final int effIncrease; + private final int maxProgressTime; + private final int pollutionToAdd; + private final double excessMass; - public MultiblockControl(T values, int EUt, int amperes, int requiredData, int effIncrease, int maxProgressTime){ - this.values = values; - controls[0]=EUt; - controls[1]=amperes; - controls[2]=requiredData; - controls[3]=effIncrease; - controls[4]=maxProgressTime; - shouldExplode=false; + public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime, int pollutionToAdd, double excessMass,boolean shouldExplode){ + this.value = value; + this.eUt = eUt; + this.amperes = amperes; + this.requiredData = requiredData; + this.effIncrease = effIncrease; + this.maxProgressTime = maxProgressTime; + this.pollutionToAdd = pollutionToAdd; + this.excessMass = excessMass; + this.shouldExplode=shouldExplode; } - public MultiblockControl(T values, int EUt, int amperes, int requiredData, int effIncrease, int maxProgressTime, int pollutionToAdd, float excessMass){ - this.values = values; - controls[0]=EUt; - controls[1]=amperes; - controls[2]=requiredData; - controls[3]=effIncrease; - controls[4]=maxProgressTime; - controls[5]=pollutionToAdd; - controls[6]=Float.floatToIntBits(excessMass); - shouldExplode=false; + public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime, int pollutionToAdd, double excessMass){ + this(value, eUt, amperes, requiredData, effIncrease, maxProgressTime,pollutionToAdd,excessMass,false); } - public MultiblockControl(float excessMass){ - this.values = null; - controls[6]=Float.floatToIntBits(excessMass); - shouldExplode=true; + public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime){ + this(value,eUt,amperes,requiredData,effIncrease,maxProgressTime,0,0); + } + + public MultiblockControl(double excessMass){ + this(null,0,0,0,0,0,0,excessMass,true); } public T getValue() { - return values; + return value; } public int getEUT(){ - return controls[0]; + return eUt; } public int getAmperage(){ - return controls[1]; + return amperes; } public int getRequiredData(){ - return controls[2]; + return requiredData; } public int getEffIncrease(){ - return controls[3]; + return effIncrease; } public int getMaxProgressTime(){ - return controls[4]; + return maxProgressTime; } public int getPollutionToAdd(){ - return controls[5]; + return pollutionToAdd; } - public float getExcessMass(){ - return Float.intBitsToFloat(controls[6]); + public double getExcessMass(){ + return excessMass; } public boolean shouldExplode() { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 9612426598..c44e5a3d42 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -8,6 +8,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.util.DoubleCount; import java.util.Arrays; @@ -20,7 +21,11 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat */ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehaviour { private final byte tier; - private float radius, maxRPM, maxRCF, maxForce, maxCapacity; + private double maxRPM; + private final double radius; + private final double maxRCF; + private final double maxForce; + private final double maxCapacity; private Parameters.Group.ParameterIn settingRPM, settingFraction; private final static INameFunction rpmName= (gt_metaTileEntity_em_machine, iParameter) -> "RPM Setting"; private final IStatusFunction rpmStatus= (gt_metaTileEntity_em_machine, iParameter) -> { @@ -65,12 +70,12 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav //6 to 12 recommended public Behaviour_Centrifuge(int desiredTier) { tier = (byte) desiredTier; - radius = 0.5f - (12 - tier) / 64f; - maxRCF = (float) (Math.pow(Math.E, tier) * 12); - maxRPM = (float) Math.sqrt(maxRCF / (0.001118 * radius)); - float maxSafeMass = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); + radius = 0.5D - (12D - tier) / 64D; + maxRCF = Math.pow(Math.E, tier) * 12D; + maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); + double maxSafeMass = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g - maxCapacity = maxSafeMass * 4f * radius;// eV/c^2 + maxCapacity = maxSafeMass * 4D * radius;// eV/c^2 } private double getRCF(double RPM) { @@ -78,19 +83,19 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - long amountPerFraction = me.amount / fractionCount; + double amountPerFraction = DoubleCount.div(me.amount,fractionCount); cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; for (int i = 0; i < fractionCount; i++) { stacks[i] = me.clone(); stacks[i].amount = amountPerFraction; toThis[i].putReplace(stacks[i]); } - int remainingAmount = (int) (me.amount % fractionCount); - while (remainingAmount > 0) { - int amountToAdd = TecTech.RANDOM.nextInt(remainingAmount) + 1; - stacks[TecTech.RANDOM.nextInt(fractionCount)].amount += amountToAdd; - remainingAmount -= amountToAdd; - } + //int remainingAmount = (int) (me.amount % fractionCount); + //while (remainingAmount > 0) { + // int amountToAdd = TecTech.RANDOM.nextInt(remainingAmount) + 1; + // stacks[TecTech.RANDOM.nextInt(fractionCount)].amount += amountToAdd; + // remainingAmount -= amountToAdd; + //} } @Override @@ -116,15 +121,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (cElementalInstanceStack stack : stacks) { inputMass += Math.abs(stack.getMass()); } - float excessMass = 0; + double excessMass = 0; while (inputMass > maxCapacity) { cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - int amountToRemove = TecTech.RANDOM.nextInt((int) randomStack.getAmount()) + 1; - randomStack.amount -= amountToRemove;//mutates the parent InstanceStackMap + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.amount=DoubleCount.sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); + stacks = input.values(); } - float mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; + double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; inputMass -= mass; } @@ -147,7 +153,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav TecTech.LOGGER.info("mixingFactor "+mixingFactor); } - int mEut = (int) (Math.pow(settingRPM.get() / maxRPM, 3f) * V[tier]); + int mEut = (int) (Math.pow(settingRPM.get() / maxRPM, 3D) * V[tier]); mEut = Math.max(mEut, 512); mEut = -mEut; int mTicks = (int) (20 * (inputMass / maxCapacity) * (fractionCount - 1)); @@ -158,8 +164,8 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav stacks = input.takeAllToNewMap().values();//cleanup stacks if (stacks.length > 1) { Arrays.sort(stacks, (o1, o2) -> { - float m1 = o1.definition.getMass(); - float m2 = o2.definition.getMass(); + double m1 = o1.definition.getMass(); + double m2 = o2.definition.getMass(); if (m1 < m2) return -1; if (m1 > m2) return 1; return o1.compareTo(o2); @@ -169,17 +175,17 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (cElementalInstanceStack stack : stacks) { double tempMass=Math.abs(stack.getMass()); if(tempMass!=0) { - long amount = stack.amount; - stack.amount *= mixingFactor; + double amount = stack.amount; + stack.amount =DoubleCount.mul(stack.amount,mixingFactor); addRandomly(stack, outputs, fractionCount); - stack.amount = amount - stack.amount; + stack.amount = DoubleCount.sub(amount,stack.amount); absMassPerOutput += tempMass; } } //if(DEBUG_MODE){ // TecTech.LOGGER.info("absMass "+absMassPerOutput); //} - absMassPerOutput /= fractionCount; + absMassPerOutput =DoubleCount.div(absMassPerOutput,fractionCount); if(DEBUG_MODE){ TecTech.LOGGER.info("absMassPerOutput "+absMassPerOutput); } @@ -190,7 +196,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (int stackNo = 0; stackNo < stacks.length; stackNo++) { if (stacks[stackNo] != null) { double stackMass = Math.abs(stacks[stackNo].getMass()); - long amount = (long) (remaining/Math.abs(stacks[stackNo].definition.getMass())); + double amount = DoubleCount.div(remaining,Math.abs(stacks[stackNo].definition.getMass())); //if(DEBUG_MODE){ // TecTech.LOGGER.info("stackMass "+stackMass); // TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass()); @@ -201,15 +207,15 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav addRandomly(stacks[stackNo], outputs, fractionCount); stacks[stackNo] = null; } else if (amount >= stacks[stackNo].amount) { - remaining -= stackMass; + remaining=DoubleCount.sub(remaining,stackMass); outputs[fraction].putUnify(stacks[stackNo]); stacks[stackNo] = null; } else if (amount > 0) { - remaining -= amount * stacks[stackNo].definition.getMass(); + remaining=DoubleCount.sub(remaining,DoubleCount.mul(amount,stacks[stackNo].definition.getMass())); cElementalInstanceStack clone = stacks[stackNo].clone(); clone.amount = amount; outputs[fraction].putUnify(clone); - stacks[stackNo].amount-=amount; + stacks[stackNo].amount=DoubleCount.sub(stacks[stackNo].amount,amount); //if(DEBUG_MODE){ // TecTech.LOGGER.info("remainingAfter "+remaining); // TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount); -- cgit From f482265e5978d03e6566e1f6543f60b405f2f40c Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 13:09:00 +0200 Subject: Implement cleanup --- .../mechanics/elementalMatter/core/cElementalInstanceStackMap.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java | 4 ++++ .../thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index 9544d8d7e5..ae76f5dc1c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -552,7 +552,7 @@ public final class cElementalInstanceStackMap implements Comparable entry:map.entrySet()){ - if(entry.getValue().amount<=0) { + if(entry.getValue().amount<1) { map.remove(entry.getKey()); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index bf84663058..69247d9e1a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -81,6 +81,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta aNBT.setInteger("postEnergize", postEnergize); //aNBT.setFloat("lifeTimeMult",lifeTimeMult); aNBT.setDouble("OverflowMatter", overflowMatter); + content.cleanUp(); aNBT.setTag("eM_Stacks", content.toNBT()); aNBT.setShort("eID", id); } @@ -109,8 +110,10 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta if (aBaseMetaTileEntity.isServerSide()) { byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { + content.cleanUp(); purgeOverflow(); content.tickContentByOneSecond(1, postEnergize);//Hatches don't life time mult things + content.cleanUp(); purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { @@ -151,6 +154,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } } else if (MOVE_AT == Tick) { if (content.hasStacks()) { + content.cleanUp(); moveAround(aBaseMetaTileEntity); } getBaseMetaTileEntity().setActive(content.hasStacks()); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index b81dd885a5..c86c06b2a0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -11,10 +11,10 @@ import static com.github.technus.tectech.util.CommonValues.V; */ public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehaviour { private final int tier; - private final float coeff; + private final double coeff; public Behaviour_Recycler(int tier){ this.tier=tier; - coeff=(float)(1/Math.pow(2,tier-4)); + coeff=(1D/Math.pow(2D,tier-4)); } @Override @@ -27,7 +27,7 @@ public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehavio @Override public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - float mass=0; + double mass=0; for (cElementalInstanceStackMap input : inputs) { if (input != null) { mass += input.getMass(); -- cgit From a45c43ea42bdd0911c2c05667695441f9e0e68a5 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 13:12:33 +0200 Subject: Fix cleanup method --- .../mechanics/elementalMatter/core/cElementalInstanceStackMap.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index ae76f5dc1c..dccc0f87ae 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -551,10 +551,6 @@ public final class cElementalInstanceStackMap implements Comparable entry:map.entrySet()){ - if(entry.getValue().amount<1) { - map.remove(entry.getKey()); - } - } + map.entrySet().removeIf(entry -> entry.getValue().amount < 1); } } -- cgit From ea07f135b704822d7ad26f20bdb2928d6cbb69e9 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 13:21:46 +0200 Subject: On demand static import --- .../elementalMatter/core/cElementalDecay.java | 5 +++-- .../core/cElementalInstanceStackMap.java | 10 +++++----- .../core/cElementalMutableDefinitionStackMap.java | 6 +++--- .../elementalMatter/core/cElementalStackMap.java | 9 +++++---- .../core/stacks/cElementalDefinitionStack.java | 6 +++--- .../core/stacks/cElementalInstanceStack.java | 14 +++++++------- .../multi/em_machine/Behaviour_Centrifuge.java | 22 +++++++++++----------- 7 files changed, 37 insertions(+), 35 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java index 3472f15cec..e00bf2d264 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java @@ -3,7 +3,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; + +import static com.github.technus.tectech.util.DoubleCount.add; /** * Created by danie_000 on 22.10.2016. @@ -57,7 +58,7 @@ public final class cElementalDecay { //Deny decay code is in instance! double qtty = 0D; for (cElementalDefinitionStack stack : outputStacks.values()) { - qtty= DoubleCount.add(qtty,stack.amount); + qtty= add(qtty,stack.amount); } if (qtty <= 0D) { return decayResult; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index dccc0f87ae..a712dc2c39 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -4,13 +4,14 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElement import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import java.util.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; +import static com.github.technus.tectech.util.DoubleCount.sub; /** * Created by danie_000 on 22.01.2017. @@ -132,7 +133,7 @@ public final class cElementalInstanceStackMap implements Comparable= instance.amount; } else { - double diff = DoubleCount.sub(target.amount,instance.amount); + double diff = sub(target.amount,instance.amount); if (diff > 0) { target.amount = diff; return true; @@ -152,7 +153,7 @@ public final class cElementalInstanceStackMap implements Comparable= stack.getAmount(); } else { - double diff = DoubleCount.sub(target.amount,stack.getAmount()); + double diff = sub(target.amount,stack.getAmount()); if (diff > 0) { target.amount = diff; return true; @@ -381,11 +382,10 @@ public final class cElementalInstanceStackMap implements Comparable= instance.amount; } else { - double diff = DoubleCount.sub(target.amount,instance.amount); + double diff = sub(target.amount,instance.amount); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -121,7 +121,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) { return target.amount >= stack.getAmount(); } else { - double diff = DoubleCount.sub(target.amount,stack.getAmount()); + double diff = sub(target.amount,stack.getAmount()); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java index 3e5a7f7b33..f8e7aa39e4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java @@ -9,6 +9,8 @@ import java.util.Collection; import java.util.Set; import java.util.TreeMap; +import static com.github.technus.tectech.util.DoubleCount.add; + /** * Created by Tec on 12.05.2017. */ @@ -65,11 +67,10 @@ abstract class cElementalStackMap implements Comparable { return var.toArray(new iElementalDefinition[0]); } - @Deprecated - public long getCountOfAllAmounts(){ - long sum=0; + public double getCountOfAllAmounts(){ + double sum=0; for(cElementalDefinitionStack stack:map.values()){ - sum+=stack.amount; + sum= add(sum,stack.amount); } return sum; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java index 2371b1b986..a2d22c30ed 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java @@ -2,10 +2,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.util.DoubleCount.add; /** * Created by danie_000 on 20.11.2016. @@ -61,7 +61,7 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition if(amount==0) { return this; } - return new cElementalDefinitionStack(definition, DoubleCount.add(amount,this.amount)); + return new cElementalDefinitionStack(definition, add(amount,this.amount)); } public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) { @@ -70,7 +70,7 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition } double l = 0; for (cElementalDefinitionStack stack : other) { - l=DoubleCount.add(l,stack.amount); + l= add(l,stack.amount); } return addAmountIntoNewInstance(l); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index fb4f0fed33..2a441150f7 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -6,7 +6,6 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefin import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import com.github.technus.tectech.util.Util; import net.minecraft.nbt.NBTTagCompound; @@ -15,6 +14,7 @@ import java.util.ArrayList; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.DoubleCount.*; import static java.lang.Math.ulp; /** @@ -190,8 +190,8 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { if(definition.usesMultipleDecayCalls(energy)){ double amountTemp=amount; long decayCnt=(long) Math.min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); - double amountPer= DoubleCount.div(amount,decayCnt); - amount=DoubleCount.sub(amount,amountPer*(--decayCnt)); + double amountPer= div(amount,decayCnt); + amount= sub(amount,amountPer*(--decayCnt)); cElementalInstanceStackMap output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(output==null){ amount=amountTemp; @@ -234,7 +234,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { //Use to get direct decay output providing correct decay array private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { double decayInverseRatio=Math.pow(2D,1D/* 1 second *//lifeTime); - double newAmount=DoubleCount.div(amount,decayInverseRatio+ulp(decayInverseRatio)); + double newAmount= div(amount,decayInverseRatio+ulp(decayInverseRatio)); //if(definition.getSymbol().startsWith("U ")) { // System.out.println("newAmount = " + newAmount); // System.out.println("amountRemaining = " + amountRemaining); @@ -253,7 +253,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { //split to non decaying and decaying part double amount=this.amount; - this.amount=DoubleCount.sub(this.amount,newAmount); + this.amount= sub(this.amount,newAmount); cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); this.amount=newAmount; products.putUnify(clone()); @@ -305,7 +305,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { for (int i = 0; i < probabilities.length; i++) { probabilities[i]=decays[i].probability; } - double[] qttyOfDecay = DoubleCount.distribute(this.amount, probabilities); + double[] qttyOfDecay = distribute(this.amount, probabilities); //long amountRemaining = this.amount, amount = this.amount; //float remainingProbability = 1D; // @@ -406,7 +406,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { for (cElementalInstanceStack instance : instances) { if (instance != null && compareTo(instance) == 0) { - amount=DoubleCount.add(amount,instance.amount); + amount= add(amount,instance.amount); energyTotal += instance.energy * instance.amount; if(instance.energy>maxEnergy){ maxEnergy=instance.energy; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index c44e5a3d42..4b0842be7b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -8,13 +8,13 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.util.DoubleCount; import java.util.Arrays; -import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.DoubleCount.*; /** * Created by danie_000 on 24.12.2017. @@ -83,7 +83,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - double amountPerFraction = DoubleCount.div(me.amount,fractionCount); + double amountPerFraction = div(me.amount,fractionCount); cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; for (int i = 0; i < fractionCount; i++) { stacks[i] = me.clone(); @@ -125,7 +125,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav while (inputMass > maxCapacity) { cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); - randomStack.amount=DoubleCount.sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap + randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); stacks = input.values(); @@ -176,16 +176,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav double tempMass=Math.abs(stack.getMass()); if(tempMass!=0) { double amount = stack.amount; - stack.amount =DoubleCount.mul(stack.amount,mixingFactor); + stack.amount = mul(stack.amount,mixingFactor); addRandomly(stack, outputs, fractionCount); - stack.amount = DoubleCount.sub(amount,stack.amount); + stack.amount = sub(amount,stack.amount); absMassPerOutput += tempMass; } } //if(DEBUG_MODE){ // TecTech.LOGGER.info("absMass "+absMassPerOutput); //} - absMassPerOutput =DoubleCount.div(absMassPerOutput,fractionCount); + absMassPerOutput = div(absMassPerOutput,fractionCount); if(DEBUG_MODE){ TecTech.LOGGER.info("absMassPerOutput "+absMassPerOutput); } @@ -196,7 +196,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (int stackNo = 0; stackNo < stacks.length; stackNo++) { if (stacks[stackNo] != null) { double stackMass = Math.abs(stacks[stackNo].getMass()); - double amount = DoubleCount.div(remaining,Math.abs(stacks[stackNo].definition.getMass())); + double amount = div(remaining,Math.abs(stacks[stackNo].definition.getMass())); //if(DEBUG_MODE){ // TecTech.LOGGER.info("stackMass "+stackMass); // TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass()); @@ -207,15 +207,15 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav addRandomly(stacks[stackNo], outputs, fractionCount); stacks[stackNo] = null; } else if (amount >= stacks[stackNo].amount) { - remaining=DoubleCount.sub(remaining,stackMass); + remaining= sub(remaining,stackMass); outputs[fraction].putUnify(stacks[stackNo]); stacks[stackNo] = null; } else if (amount > 0) { - remaining=DoubleCount.sub(remaining,DoubleCount.mul(amount,stacks[stackNo].definition.getMass())); + remaining= sub(remaining, mul(amount,stacks[stackNo].definition.getMass())); cElementalInstanceStack clone = stacks[stackNo].clone(); clone.amount = amount; outputs[fraction].putUnify(clone); - stacks[stackNo].amount=DoubleCount.sub(stacks[stackNo].amount,amount); + stacks[stackNo].amount= sub(stacks[stackNo].amount,amount); //if(DEBUG_MODE){ // TecTech.LOGGER.info("remainingAfter "+remaining); // TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount); -- cgit From f2cbb5c88aff3b3f0f3908601328c53ee652f9dd Mon Sep 17 00:00:00 2001 From: basdxz Date: Sat, 18 Jul 2020 12:35:36 +0100 Subject: Created Global Tesla List --- .../tectech/thing/cover/GT_Cover_TM_TeslaCoil.java | 17 ++++++++++++-- .../cover/GT_Cover_TM_TeslaCoil_Ultimate.java | 2 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 20 +++++++++++++--- .../single/GT_MetaTileEntity_TeslaCoil.java | 27 +++++++++++++++++++++- 4 files changed, 59 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java index 721f730960..8be875ff4f 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java @@ -1,16 +1,25 @@ package com.github.technus.tectech.thing.cover; import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil.teslaNodeSet; import static ic2.api.info.Info.DMG_ELECTRIC; public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior { public GT_Cover_TM_TeslaCoil() { } + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + if (aTileEntity.getEUCapacity() > 0) { + teslaNodeSet.add(aTileEntity.getIGregTechTileEntityOffset(0, 0, 0)); + } + return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); + } + public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return "Do not attempt to use screwdriver!"; } @@ -20,9 +29,13 @@ public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior { } public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if(aTileEntity.getStoredEU() > 0 && !GT_Utility.isWearingFullElectroHazmat(aPlayer)){ + if (aTileEntity.getStoredEU() > 0 && !GT_Utility.isWearingFullElectroHazmat(aPlayer)) { aPlayer.attackEntityFrom(DMG_ELECTRIC, 20); } return aCoverVariable; } -} \ No newline at end of file + + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return 200; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java index db7c751fc6..2b5db1f5c9 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java @@ -26,4 +26,4 @@ public class GT_Cover_TM_TeslaCoil_Ultimate extends GT_Cover_TM_TeslaCoil { public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 09f6d597ad..7d12302477 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -5,8 +5,8 @@ import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.spark.ThaumSpark; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; @@ -47,7 +47,6 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.Util.entriesSortedByValues; -import static com.github.technus.tectech.util.Util.map; import static gregtech.api.enums.GT_Values.E; import static java.lang.Math.max; import static java.lang.Math.min; @@ -74,8 +73,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs, so the tesla takes a second to 'cool' any plasma it would output as a gas + public static final HashSet teslaNodeSet = new HashSet<>(); //Targets for power transmission //TODO Make this fill more efficently and globally private final HashSet sparkList = new HashSet<>(); //Thaumcraft lighting coordinate pairs, so we can send them in bursts and save on lag - private final Map eTeslaMap = new HashMap<>(); //Targets for power transmission //TODO Make this fill more efficently and globally + private final Map eTeslaMap = new HashMap<>(); //Targets for power transmission private final ArrayList eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps private int scanTime = 0; //Scan timer used for tesla search intervals //TODO Replace with something that fetches from a global map @@ -519,6 +519,11 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { super.onRemoval(); + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + if (aBaseMetaTileEntity.isClientSide()) { + return; + } + teslaNodeSet.remove(aBaseMetaTileEntity); for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(false); @@ -592,6 +597,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); energyCapacity = aNBT.getLong("eEnergyCapacity"); + teslaNodeSet.add(this.getBaseMetaTileEntity()); } @Override @@ -607,6 +613,14 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock energyFractionDisplay.set(0); } + @Override + public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick_EM(aBaseMetaTileEntity); + if (!aBaseMetaTileEntity.isClientSide()) { + teslaNodeSet.add(aBaseMetaTileEntity); + } + } + @Override public boolean onRunningTick(ItemStack aStack) { IGregTechTileEntity mte = getBaseMetaTileEntity(); 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 0f73750d48..47625b999f 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 @@ -17,6 +17,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.reflect.FieldUtils; @@ -26,6 +27,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil.teslaNodeSet; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.Util.entriesSortedByValues; import static com.github.technus.tectech.util.Util.map; @@ -38,7 +40,7 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer { private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F - + public Map eTeslaMap = new HashMap<>();//Tesla Map to map them tesla bois! private final static HashSet sparkList = new HashSet<>(); private byte sparkCount = 0; @@ -229,6 +231,29 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return new long[]{outputVoltageInjectable, outputVoltageConsumption}; } + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick(aBaseMetaTileEntity); + if (!aBaseMetaTileEntity.isClientSide()) { + teslaNodeSet.add(aBaseMetaTileEntity); + } + } + + @Override + public void onRemoval() { + super.onRemoval(); + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + if (!aBaseMetaTileEntity.isClientSide()) { + teslaNodeSet.remove(aBaseMetaTileEntity); + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + teslaNodeSet.add(this.getBaseMetaTileEntity()); + } + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); -- cgit From e30e92732ae6ef0117db8c9be7e0f8b0eeab5e0b Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 17:02:45 +0200 Subject: Up atom counts by AVOGADRO_CONSTANT for more smooth compute --- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 53 ++--- .../entity/projectiles/projectileEM.java | 2 +- .../transformations/aFluidDequantizationInfo.java | 8 +- .../transformations/aFluidQuantizationInfo.java | 8 +- .../transformations/aItemDequantizationInfo.java | 2 +- .../transformations/aItemQuantizationInfo.java | 2 +- .../aOredictDequantizationInfo.java | 19 +- .../transformations/aOredictQuantizationInfo.java | 25 +-- .../core/transformations/bTransformationInfo.java | 22 +-- .../core/transformations/iExchangeInfo.java | 6 +- .../definitions/complex/dAtomDefinition.java | 220 ++++++++++----------- .../definitions/complex/dHadronDefinition.java | 9 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 11 +- .../multi/GT_MetaTileEntity_EM_collider.java | 3 +- .../multi/GT_MetaTileEntity_EM_decay.java | 3 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 53 ++--- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 22 ++- .../multi/em_machine/Behaviour_Centrifuge.java | 3 +- .../Behaviour_ElectromagneticSeparator.java | 47 +++-- 19 files changed, 246 insertions(+), 272 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index ad24f72cb0..333747d632 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -6,6 +6,7 @@ import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.*; public class GtppAtomLoader implements Runnable{ @@ -57,34 +58,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), 144), getFluid("NEON",144)); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); generate("GERMANIUM",true,true); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), 144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), 144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), 144), getFluid("BROMINE",144)); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), 144), getFluid("KRYPTON",144)); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), 144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), 144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), 144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), 144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), 144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), 144),getFluid("XENON",144)); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), 144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), 144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), 144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85),144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96),144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97),144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98),144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99),144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100),144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index e8163833ee..702ed77315 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -59,7 +59,7 @@ public class projectileEM extends LaserProjectile { avalableEM.clear(); } else { cElementalInstanceStack consumeFromThis=avalableEM.get(TecTech.RANDOM.nextInt(avalableEM.size())); - massFactor =consumeFromThis.definition.getMass()/ dHadronDefinition.hadron_n_.getMass(); + massFactor =(float) (consumeFromThis.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); if(consumeFromThis.definition.getType()>1 || consumeFromThis.definition.getType()<-1) { exotic = true; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java index 057d9cdb36..3d8b7a881f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 23.05.2017. */ -public class aFluidDequantizationInfo implements iExchangeInfo { +public class aFluidDequantizationInfo implements iExchangeInfo { private final iHasElementalDefinition in; private final FluidStack out; @@ -16,12 +16,6 @@ public class aFluidDequantizationInfo implements iExchangeInfo { out=fluidStackOut; } - @Deprecated - public aFluidDequantizationInfo(iHasElementalDefinition emIn ,int fluidID,int fluidAmount) { - in = emIn; - out = new FluidStack(fluidID, fluidAmount); - } - public aFluidDequantizationInfo(iHasElementalDefinition emIn, Fluid fluid, int fluidAmount){ in=emIn; out=new FluidStack(fluid,fluidAmount); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java index 57ce67bf6d..563b87f8ee 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 23.05.2017. */ -public class aFluidQuantizationInfo implements iExchangeInfo { +public class aFluidQuantizationInfo implements iExchangeInfo { private final FluidStack in; private final iHasElementalDefinition out; @@ -16,12 +16,6 @@ public class aFluidQuantizationInfo implements iExchangeInfo { out=emOut; } - @Deprecated - public aFluidQuantizationInfo(int fluidID,int fluidAmount, iHasElementalDefinition emOut){ - in=new FluidStack(fluidID,fluidAmount); - out=emOut; - } - public aFluidQuantizationInfo(Fluid fluid, int fluidAmount, iHasElementalDefinition emOut){ in=new FluidStack(fluid,fluidAmount); out=emOut; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java index b764f59863..8b42c61d6c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; /** * Created by Tec on 23.05.2017. */ -public class aItemDequantizationInfo implements iExchangeInfo { +public class aItemDequantizationInfo implements iExchangeInfo { private final iHasElementalDefinition in; private final ItemStack out; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java index 80179e1eb8..8f33f5096d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java @@ -11,7 +11,7 @@ import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class aItemQuantizationInfo implements iExchangeInfo { +public class aItemQuantizationInfo implements iExchangeInfo { private final ItemStack in; private final boolean skipNBT; private final iHasElementalDefinition out; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java index 51b1a6806d..bbf94682b4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java @@ -3,37 +3,30 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class aOredictDequantizationInfo implements iExchangeInfo { +public class aOredictDequantizationInfo implements iExchangeInfo { private final iHasElementalDefinition in; - public final int out; + public final String out; public final int amount; - public aOredictDequantizationInfo(iHasElementalDefinition emIn, int id, int qty) { - in = emIn; - out = id; - amount = qty; - } - public aOredictDequantizationInfo(iHasElementalDefinition emIn, String name, int qty) { in = emIn; - out = OreDictionary.getOreID(name); + out =name; amount = qty; } public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, Materials material, int qty) { in = emIn; - out = OreDictionary.getOreID(prefix.name() + material.mName); + out = prefix.name() + material.mName; amount = qty; } public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, String materialName, int qty) { in = emIn; - out = OreDictionary.getOreID(prefix.name() + materialName); + out = prefix.name() + materialName; amount = qty; } @@ -43,7 +36,7 @@ public class aOredictDequantizationInfo implements iExchangeInfo { } @Override - public Integer output() { + public String output() { return out; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java index 99e8589060..964d317b80 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java @@ -3,42 +3,35 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class aOredictQuantizationInfo implements iExchangeInfo { - public final int in; +public class aOredictQuantizationInfo implements iExchangeInfo { + public final String in; public final int amount; private final iHasElementalDefinition out; - public aOredictQuantizationInfo(int id, int qty, iHasElementalDefinition emOut){ - in=id; - amount=qty; - out=emOut; - } - public aOredictQuantizationInfo(String name, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(name); + in=name; amount=qty; out=emOut; } - public aOredictQuantizationInfo( OrePrefixes prefix, Materials material, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(prefix.name() + material.mName); + public aOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, iHasElementalDefinition emOut){ + in=prefix.name() + material.mName; amount=qty; out=emOut; } - public aOredictQuantizationInfo( OrePrefixes prefix, String materialName, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(prefix.name() + materialName); + public aOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, iHasElementalDefinition emOut){ + in=prefix.name() + materialName; amount=qty; out=emOut; } @Override - public Integer input() { + public String input() { return in; } @@ -49,7 +42,7 @@ public class aOredictQuantizationInfo implements iExchangeInfo { @Override public int hashCode() { - return in; + return in.hashCode(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java index c23894d6b1..24ae8d0481 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java @@ -17,13 +17,17 @@ import static com.github.technus.tectech.thing.item.DebugElementalInstanceContai * Created by Tec on 26.05.2017. */ public class bTransformationInfo { + public static final double AVOGADRO_CONSTANT =6.02214076e23D; + public static final double AVOGADRO_CONSTANT_144 =AVOGADRO_CONSTANT*144D; + public static final HashMap fluidQuantization=new HashMap<>(32); + public static final HashMap itemQuantization=new HashMap<>(32); + public static final HashMap oredictQuantization=new HashMap<>(32); + public HashMap fluidDequantization; - public static final HashMap itemQuantization=new HashMap<>(32); public HashMap itemDequantization; - public static final HashMap oredictQuantization=new HashMap<>(32); public HashMap oredictDequantization; public bTransformationInfo(int fluidCap,int itemCap, int oreCap){ @@ -45,13 +49,6 @@ public class bTransformationInfo { STACKS_REGISTERED.add(em.getDefinition().getAnti()); } - public void addFluid(iHasElementalDefinition em ,int fluidID,int fluidAmount) { - fluidQuantization.put(fluidID,new aFluidQuantizationInfo(fluidID,fluidAmount,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidID,fluidAmount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - public void addFluid(iHasElementalDefinition em, Fluid fluid, int fluidAmount){ fluidQuantization.put(fluid.getID(),new aFluidQuantizationInfo(fluid,fluidAmount,em)); fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluid,fluidAmount)); @@ -77,13 +74,6 @@ public class bTransformationInfo { STACKS_REGISTERED.add(em.getDefinition().getAnti()); } - public void addOredict(iHasElementalDefinition em, int id, int qty){ - oredictQuantization.put(id,new aOredictQuantizationInfo(id,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,id,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - public void addOredict(iHasElementalDefinition em, String name, int qty){ oredictQuantization.put(OreDictionary.getOreID(name),new aOredictQuantizationInfo(name,qty,em)); oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,name,qty)); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java index f4e77bfe2b..2e8ef92073 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java @@ -3,9 +3,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation /** * Created by Tec on 23.05.2017. */ -public interface iExchangeInfo { - Object output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. +public interface iExchangeInfo { + OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) - Object input();//same as above but for input + IN input();//same as above but for input } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index e2a3e9e542..b1801b9b25 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -25,6 +25,7 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @@ -41,7 +42,7 @@ public final class dAtomDefinition extends cElementalDefinition { private static final byte BYTE_OFFSET=32; private final int hash; - public static final bTransformationInfo transformation=new bTransformationInfo(16,0,64); + public static final bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(16,0,64); public static double refMass, refUnstableMass; private static final byte nbtType = (byte) 'a'; @@ -1319,17 +1320,17 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { - return transformation.fluidDequantization.get(this); + return TRANSFORMATION_INFO.fluidDequantization.get(this); } @Override public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; + return TRANSFORMATION_INFO.itemDequantization.get(this); } @Override public aOredictDequantizationInfo someAmountIntoOredictStack() { - return transformation.oredictDequantization.get(this); + return TRANSFORMATION_INFO.oredictDequantization.get(this); } private static final class Nomenclature { @@ -1473,122 +1474,121 @@ public final class dAtomDefinition extends cElementalDefinition { public static void setTransformation(){ /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * 144D; - - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), 144),Materials.Hydrogen.mGas.getID(),144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), 144),Materials.Helium.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), 144), dust, Materials.Lithium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), 144), dust, Materials.Beryllium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), 144), dust, Materials.Boron,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), 144), dust, Materials.Carbon,1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), 144),Materials.Nitrogen.mGas.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), 144),Materials.Oxygen.mGas.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), 144),Materials.Fluorine.mGas.getID(), 144); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), 144),Materials.Neon.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), 144), dust, Materials.Sodium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), 144), dust, Materials.Magnesium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), 144), dust, Materials.Aluminium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), 144), dust, Materials.Silicon,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), 144), dust, Materials.Phosphorus,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), 144), dust, Materials.Sulfur,1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), 144),Materials.Chlorine.mGas.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(18), 144),Materials.Argon.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), 144), dust, Materials.Potassium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), 144), dust, Materials.Calcium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), 144), dust, Materials.Scandium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), 144), dust, Materials.Titanium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), 144), dust, Materials.Vanadium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), 144), dust, Materials.Chrome,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), 144), dust, Materials.Manganese,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), 144), dust, Materials.Iron,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), 144), dust, Materials.Cobalt,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), 144), dust, Materials.Nickel,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), 144), dust, Materials.Copper,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), 144), dust, Materials.Zinc,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), 144), dust, Materials.Gallium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), 144),OrePrefixes.dust, Materials.Germanium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), 144), dust, Materials.Arsenic,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), 144),OrePrefixes.dust, Materials.Selenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), 144),OrePrefixes.dust, Materials.Bromine,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), 144),OrePrefixes.dust, Materials.Krypton,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), 144), dust, Materials.Rubidium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), 144), dust, Materials.Strontium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), 144), dust, Materials.Yttrium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), 144),OrePrefixes.dust, Materials.Zirconium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), 144), dust, Materials.Niobium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), 144), dust, Materials.Molybdenum,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), 144),OrePrefixes.dust, Materials.Technetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), 144),OrePrefixes.dust, Materials.Ruthenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), 144),OrePrefixes.dust, Materials.Rhodium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), 144), dust, Materials.Palladium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), 144), dust, Materials.Silver,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), 144), dust, Materials.Cadmium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), 144), dust, Materials.Indium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), 144), dust, Materials.Tin,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), 144), dust, Materials.Antimony,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), 144), dust, Materials.Tellurium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), 144),OrePrefixes.dust, Materials.Iodine,1); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), 144),Materials.Xenon.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), 144), dust, Materials.Caesium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), 144), dust, Materials.Barium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), 144), dust, Materials.Lanthanum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), 144), dust, Materials.Cerium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), 144), dust, Materials.Praseodymium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), 144), dust, Materials.Neodymium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), 144), dust, Materials.Promethium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), 144), dust, Materials.Samarium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), 144), dust, Materials.Europium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), 144), dust, Materials.Gadolinium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), 144), dust, Materials.Terbium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), 144), dust, Materials.Dysprosium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), 144), dust, Materials.Holmium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), 144), dust, Materials.Erbium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), 144), dust, Materials.Thulium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), 144), dust, Materials.Ytterbium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), 144), dust, Materials.Lutetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), 144),OrePrefixes.dust, Materials.Hafnum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), 144), dust, Materials.Tantalum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), 144), dust, Materials.Tungsten,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), 144),OrePrefixes.dust, Materials.Rhenium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), 144), dust, Materials.Osmium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), 144), dust, Materials.Iridium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), 144), dust, Materials.Platinum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), 144), dust, Materials.Gold,1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), 144),Materials.Mercury.mFluid.getID(), 144); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), 144),OrePrefixes.dust, Materials.Thallium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), 144), dust, Materials.Lead,1); + refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; + + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(82).getMass() * 144D; - - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), 144), dust, Materials.Bismuth,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),144),OrePrefixes.dust, Materials.Polonium,1); - //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),144),Materials.Astatine.mPlasma.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86),144),Materials.Radon.mGas.getID(), 144); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),144),OrePrefixes.dust, Materials.Francium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),144),OrePrefixes.dust, Materials.Radium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),144),OrePrefixes.dust, Materials.Actinium,1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90),144), dust, Materials.Thorium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),144),OrePrefixes.dust, Materials.Protactinium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),144), dust, Materials.Uranium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),144),OrePrefixes.dust, Materials.Neptunium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),144), dust, Materials.Plutonium,1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95),144), dust, Materials.Americium,1); + refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; + + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); + //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86),AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90),AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95),AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); try { dAtomDefinition temp; - transformation.addFluid(new cElementalDefinitionStack(deuterium.definition, 144),Materials.Deuterium.mGas.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - transformation.addFluid(new cElementalDefinitionStack(tritium.definition, 144),Materials.Tritium.mGas.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); - transformation.addFluid(new cElementalDefinitionStack(helium_3.definition, 144),Materials.Helium_3.mGas.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Uranium/*238*/,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); double tempMass=temp.getMass(); @@ -1597,7 +1597,7 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Uranium235,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); @@ -1606,14 +1606,14 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Plutonium/*239*/,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); somethingHeavy=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) ); - transformation.addOredict(new cElementalDefinitionStack(somethingHeavy, 144), dust, Materials.Plutonium241,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index ce5e4a50aa..6b5f41f1c1 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; @@ -13,6 +12,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import com.github.technus.tectech.util.Util; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.nbt.NBTTagCompound; @@ -24,7 +24,8 @@ import java.util.Map; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.transformation; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; @@ -464,8 +465,8 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public static void setTransformations(){ //Added to atom map, but should be in its own - cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 100000); - transformation.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); + cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000*AVOGADRO_CONSTANT_144); + TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); bTransformationInfo.oredictQuantization.put( OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 69247d9e1a..139b203551 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -23,8 +23,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static net.minecraft.util.StatCollector.translateToLocal; @@ -207,11 +208,11 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public int getMaxStacksCount() { - return mTier * 2; + return mTier * 16; } - public int getMaxStackSize() { - return mTier * (mTier - 7) * 1000; + public double getMaxStackSize() { + return mTier * (mTier - 7) * 64D * AVOGADRO_CONSTANT_144; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index e364e634bc..825b07f289 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -37,6 +37,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -367,7 +368,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07*AVOGADRO_CONSTANT);//mass diff MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; STARTUP_COST = -heliumPlasmaValue * 10000; KEEPUP_COST = -heliumPlasmaValue; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index b5dc211f3a..a46c407325 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -49,7 +50,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10; + public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10*AVOGADRO_CONSTANT; private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 11bc0fefd7..9814092710 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -4,10 +4,11 @@ import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.iExchangeInfo; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -99,32 +100,36 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { cElementalInstanceStackMap map = in.getContainerHandler(); for (cElementalInstanceStack stack : map.values()) { - iExchangeInfo info = stack.getDefinition().someAmountIntoFluidStack(); - if (info != null) { - if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { - mOutputFluids = new FluidStack[]{(FluidStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); - return true; + { + aFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); + if (info != null) { + if (map.removeAllAmounts(false, info.input())) { + mOutputFluids = new FluidStack[]{info.output()}; + startRecipe(info.input(), stack.getEnergy()); + return true; + } } } - - info = stack.getDefinition().someAmountIntoItemsStack(); - if (info != null) { - if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { - mOutputItems = new ItemStack[]{(ItemStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); - return true; + { + aItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); + if (info != null) { + if (map.removeAllAmounts(false, info.input())) { + mOutputItems = new ItemStack[]{info.output()}; + startRecipe(info.input(), stack.getEnergy()); + return true; + } } } - - info = stack.getDefinition().someAmountIntoOredictStack(); - if (info != null) { - if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { - ArrayList items = OreDictionary.getOres(((aOredictDequantizationInfo) info).out); - if (items != null && !items.isEmpty()) { - mOutputItems = new ItemStack[]{items.get(0)}; - startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); - return true; + { + aOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); + if (info != null) { + if (map.removeAllAmounts(false, info.input())) { + ArrayList items = OreDictionary.getOres(info.out); + if (items != null && !items.isEmpty()) { + mOutputItems = new ItemStack[]{items.get(0)}; + startRecipe(info.input(), stack.getEnergy()); + return true; + } } } } 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 28c90b58d0..9e508f9e7e 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 @@ -14,9 +14,9 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; 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; @@ -49,7 +49,9 @@ import java.util.ArrayList; 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 java.lang.Math.min; /** * Created by danie_000 on 27.10.2016. @@ -1374,12 +1376,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (voider.overflowMax < voider.getOverflowMatter()) { continue; } - float remaining = voider.overflowMax - voider.getOverflowMatter(); + double remaining = voider.overflowMax - voider.getOverflowMatter(); for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { for (cElementalInstanceStack instance : in.getContainerHandler().values()) { - long qty = (long) Math.floor(remaining / instance.definition.getMass()); + double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { - qty = Math.min(qty, instance.amount); + qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } @@ -1389,9 +1391,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - long qty = (long) Math.floor(remaining / instance.definition.getMass()); + double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { - qty = Math.min(qty, instance.amount); + qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } @@ -1496,7 +1498,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mEfficiencyIncrease = 0; if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); + mEfficiency = Math.max(0, min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); } else { afterRecipeCheckFailed(); } @@ -1511,7 +1513,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } else if (RECIPE_AT == Tick || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); + mEfficiency = Math.max(0, min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); } else { afterRecipeCheckFailed(); } @@ -1684,7 +1686,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } } - setEUVar(Math.min(getEUVar() + euVar, maxEUStore())); + setEUVar(min(getEUVar() + euVar, maxEUStore())); return false; } @@ -1863,7 +1865,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt cleanMassEM_EM(target.getMass()); } - public void cleanMassEM_EM(float mass) { + public void cleanMassEM_EM(double mass) { if (mass > 0) { if (eMufflerHatches.size() < 1) { TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), mass); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 4b0842be7b..1ed1278bce 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -12,6 +12,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.DoubleCount.*; @@ -75,7 +76,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); double maxSafeMass = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g - maxCapacity = maxSafeMass * 4D * radius;// eV/c^2 + maxCapacity = maxSafeMass * AVOGADRO_CONSTANT_144 * radius;// eV/c^2 } private double getRCF(double RPM) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index c79087d051..558ae03e67 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -9,8 +9,11 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.DoubleCount.mul; +import static com.github.technus.tectech.util.DoubleCount.sub; /** * Created by danie_000 on 24.12.2017. @@ -19,8 +22,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ private final byte tier; private int ticks; private byte precisionFull,precisionMinimal; - private float maxCapacity; - private long maxCharge; + private double maxCapacity; + private double maxCharge; private int offsetMax; private Parameters.Group.ParameterIn fullSetting,minimalSetting,offsetSetting; private final static INameFunction fullName= (gt_metaTileEntity_em_machine, iParameter) -> "Full Precision Input [e/3]"; @@ -85,8 +88,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; ticks =Math.max(20,(1<<(12-desiredTier))*20); - maxCapacity= dAtomDefinition.getSomethingHeavy().getMass()*(2< maxCapacity) { cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - int amountToRemove = TecTech.RANDOM.nextInt((int) randomStack.getAmount()) + 1; - randomStack.amount -= amountToRemove;//mutates the parent InstanceStackMap + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); } - float mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; + double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; inputMass -= mass; } - long totalCharge=Math.abs(input.getCharge()); + double totalCharge=Math.abs(input.getCharge()); if (totalCharge>maxCharge) return new MultiblockControl<>(excessMass);//AND THEN IT EXPLODES - int mEut=(int)(((double)totalCharge/(double) maxCharge)*V[tier]); + int mEut=(int)((totalCharge/ maxCharge)*V[tier]); mEut = Math.max(mEut, 512); int mTicks=(int)(ticks*(inputMass/maxCapacity)); mTicks=Math.max(mTicks,20); @@ -192,24 +195,18 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ }else if(charge<=-precisionFullIn){ outputs[0].putReplace(stack); }else{ - long amount=(long)(stack.amount*((Math.abs(charge)-precisionMinimalIn+1)/levelsCountPlus1));//todo check - if(amount>=stack.amount){ - if(charge>0){ - outputs[2].putReplace(stack); - }else { - outputs[0].putReplace(stack); - } - }else { - cElementalInstanceStack clone=stack.clone(); - clone.amount-=amount; + double amount=mul(stack.amount,(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check + if (amount < stack.amount) { + cElementalInstanceStack clone = stack.clone(); + clone.amount = sub(clone.amount, amount); outputs[1].putReplace(clone); - stack.amount=amount; - if(charge>0){ - outputs[2].putReplace(stack); - }else { - outputs[0].putReplace(stack); - } + stack.amount = amount; + } + if(charge>0){ + outputs[2].putReplace(stack); + }else { + outputs[0].putReplace(stack); } } } -- cgit From 20104da170a9698e5e7ec491bdc62a3e6cc82461 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 17:11:52 +0200 Subject: Adjust debug containers --- .../tectech/thing/item/DebugElementalInstanceContainer_EM.java | 8 +++++--- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main') 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 b23a580bbf..1c63008ec3 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 @@ -31,6 +31,8 @@ import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -141,9 +143,9 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE that.setTagCompound(new NBTTagCompound()); list.add(that); for(iElementalDefinition defintion: STACKS_REGISTERED){ - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+1),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+144),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+1000),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1000)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT_144),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,144)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT*1000),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1000)))); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 24fbb9e423..06476fb62e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -35,6 +35,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + //todo CHECK VALUES private static final double NEUTRONIUM_BLOCK_MASS = 4.1E17; private static final double NEUTRONIUM_BLOCK_ATOM_COUNT = 2.4478671E44; private static final double NEUTRONIUM_BLOCK_TO_EU_INSTANT = URANIUM_MASS_TO_EU_INSTANT * NEUTRONIUM_BLOCK_MASS / (URANIUM_INGOT_MASS_DIFF * 1.78266191e-36);//~ 5.314e40 -- cgit From 5c68b296e1b499ca83d78f24837768ac3a75df62 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 17:14:38 +0200 Subject: Change amounts --- .../tectech/thing/item/DebugElementalInstanceContainer_EM.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') 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 1c63008ec3..8e9266f060 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 @@ -143,9 +143,9 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE that.setTagCompound(new NBTTagCompound()); list.add(that); for(iElementalDefinition defintion: STACKS_REGISTERED){ - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT_144),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT*1000),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1000)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,AVOGADRO_CONSTANT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT_144),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,AVOGADRO_CONSTANT_144)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT*1000),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,AVOGADRO_CONSTANT*1000)))); } } -- cgit From 11e50eb56f6750d6bdfe15b986eef55e27452211 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 18 Jul 2020 22:49:35 +0200 Subject: Implement big float, transition to molarity --- .../java/ch/obermuhlner/math/big/BigComplex.java | 556 ++++++ .../ch/obermuhlner/math/big/BigComplexMath.java | 413 +++++ .../ch/obermuhlner/math/big/BigDecimalMath.java | 1671 +++++++++++++++++ .../java/ch/obermuhlner/math/big/BigFloat.java | 1947 ++++++++++++++++++++ .../java/ch/obermuhlner/math/big/BigRational.java | 1103 +++++++++++ .../math/big/DefaultBigDecimalMath.java | 736 ++++++++ .../math/big/internal/AsinCalculator.java | 46 + .../math/big/internal/AtanhCalculator.java | 40 + .../math/big/internal/CosCalculator.java | 48 + .../math/big/internal/CoshCalculator.java | 43 + .../math/big/internal/ExpCalculator.java | 42 + .../math/big/internal/PowerIterator.java | 28 + .../math/big/internal/PowerNIterator.java | 33 + .../math/big/internal/PowerTwoNIterator.java | 33 + .../big/internal/PowerTwoNMinusOneIterator.java | 35 + .../big/internal/PowerTwoNPlusOneIterator.java | 33 + .../math/big/internal/SeriesCalculator.java | 127 ++ .../math/big/internal/SinCalculator.java | 49 + .../math/big/internal/SinhCalculator.java | 44 + .../math/big/stream/BigDecimalStream.java | 219 +++ .../math/big/stream/BigFloatStream.java | 214 +++ .../tectech/compatibility/gtpp/GtppAtomLoader.java | 24 +- .../core/cElementalInstanceStackMap.java | 18 +- .../core/stacks/cElementalInstanceStack.java | 53 +- .../core/templates/cElementalDefinition.java | 5 + .../core/transformations/bTransformationInfo.java | 5 +- .../definitions/complex/dAtomDefinition.java | 6 +- .../definitions/complex/dHadronDefinition.java | 2 +- .../item/DebugElementalInstanceContainer_EM.java | 8 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 2 +- .../multi/GT_MetaTileEntity_EM_collider.java | 2 +- .../multi/GT_MetaTileEntity_EM_decay.java | 2 +- .../Behaviour_ElectromagneticSeparator.java | 2 +- 33 files changed, 7540 insertions(+), 49 deletions(-) create mode 100644 src/main/java/ch/obermuhlner/math/big/BigComplex.java create mode 100644 src/main/java/ch/obermuhlner/math/big/BigComplexMath.java create mode 100644 src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java create mode 100644 src/main/java/ch/obermuhlner/math/big/BigFloat.java create mode 100644 src/main/java/ch/obermuhlner/math/big/BigRational.java create mode 100644 src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java create mode 100644 src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java create mode 100644 src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java (limited to 'src/main') diff --git a/src/main/java/ch/obermuhlner/math/big/BigComplex.java b/src/main/java/ch/obermuhlner/math/big/BigComplex.java new file mode 100644 index 0000000000..a4620ff53b --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/BigComplex.java @@ -0,0 +1,556 @@ +package ch.obermuhlner.math.big; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.util.Objects; + +/** + * Represents a complex number consisting of a real and an imaginary {@link BigDecimal} part in the form {@code a + bi}. + * + *

It generally follows the design of {@link BigDecimal} with some convenience improvements like overloaded operator methods.

+ * + *

The biggest difference to {@link BigDecimal} is that {@link BigComplex#equals(Object) BigComplex.equals(Object)} implements the mathematical equality + * and not the strict technical equality. + * This was a difficult decision because it means that {@code BigComplex} behaves slightly different than {@link BigDecimal} + * but considering that the strange equality of {@link BigDecimal} is a major source of bugs we + * decided it was worth the slight inconsistency. + * If you need the strict equality use {@link BigComplex#strictEquals(Object)}`.

+ * + *

This class is immutable and therefore inherently thread safe.

+ */ +public final class BigComplex { + + /** + * Zero represented as complex number. + */ + public static final BigComplex ZERO = new BigComplex(BigDecimal.ZERO, BigDecimal.ZERO); + + /** + * Real 1 represented as complex number. + */ + public static final BigComplex ONE = new BigComplex(BigDecimal.ONE, BigDecimal.ZERO); + + /** + * Imaginary 1 represented as complex number. + */ + public static final BigComplex I = new BigComplex(BigDecimal.ZERO, BigDecimal.ONE); + + /** + * The real {@link BigDecimal} part of this complex number. + */ + public final BigDecimal re; + + /** + * The imaginary {@link BigDecimal} part of this complex number. + */ + public final BigDecimal im; + + private BigComplex(BigDecimal re, BigDecimal im) { + this.re = re; + this.im = im; + } + + /** + * Calculates the addition of the given complex value to this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigComplex} value to add + * @return the calculated {@link BigComplex} result + */ + public BigComplex add(BigComplex value) { + return valueOf( + re.add(value.re), + im.add(value.im)); + } + + /** + * Calculates the addition of the given complex value to this complex number using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigComplex} value to add + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex add(BigComplex value, MathContext mathContext) { + return valueOf( + re.add(value.re, mathContext), + im.add(value.im, mathContext)); + } + + /** + * Calculates the addition of the given real {@link BigDecimal} value to this complex number using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@link BigDecimal} value to add + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex add(BigDecimal value, MathContext mathContext) { + return valueOf( + re.add(value, mathContext), + im); + } + + /** + * Calculates the addition of the given real {@link BigDecimal} value to this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@link BigDecimal} value to add + * @return the calculated {@link BigComplex} result + */ + public BigComplex add(BigDecimal value) { + return valueOf( + re.add(value), + im); + } + + /** + * Calculates the addition of the given real {@code double} value to this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@code double} value to add + * @return the calculated {@link BigComplex} result + */ + public BigComplex add(double value) { + return add(BigDecimal.valueOf(value)); + } + + /** + * Calculates the subtraction of the given complex value from this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigComplex} value to subtract + * @return the calculated {@link BigComplex} result + */ + public BigComplex subtract(BigComplex value) { + return valueOf( + re.subtract(value.re), + im.subtract(value.im)); + } + + /** + * Calculates the subtraction of the given complex value from this complex number using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigComplex} value to subtract + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex subtract(BigComplex value, MathContext mathContext) { + return valueOf( + re.subtract(value.re, mathContext), + im.subtract(value.im, mathContext)); + } + + /** + * Calculates the subtraction of the given real {@link BigDecimal} value from this complex number using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@link BigDecimal} value to add + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex subtract(BigDecimal value, MathContext mathContext) { + return valueOf( + re.subtract(value, mathContext), + im); + } + + /** + * Calculates the subtraction of the given real {@link BigDecimal} value from this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@link BigDecimal} value to subtract + * @return the calculated {@link BigComplex} result + */ + public BigComplex subtract(BigDecimal value) { + return valueOf( + re.subtract(value), + im); + } + + /** + * Calculates the subtraction of the given real {@code double} value from this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@code double} value to subtract + * @return the calculated {@link BigComplex} result + */ + public BigComplex subtract(double value) { + return subtract(BigDecimal.valueOf(value)); + } + + /** + * Calculates the multiplication of the given complex value to this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigComplex} value to multiply + * @return the calculated {@link BigComplex} result + */ + public BigComplex multiply(BigComplex value) { + return valueOf( + re.multiply(value.re).subtract(im.multiply(value.im)), + re.multiply(value.im).add(im.multiply(value.re))); + } + + /** + * Calculates the multiplication of the given complex value with this complex number using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigComplex} value to multiply + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex multiply(BigComplex value, MathContext mathContext) { + return valueOf( + re.multiply(value.re, mathContext).subtract(im.multiply(value.im, mathContext), mathContext), + re.multiply(value.im, mathContext).add(im.multiply(value.re, mathContext), mathContext)); + } + + /** + * Calculates the multiplication of the given real {@link BigDecimal} value with this complex number using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@link BigDecimal} value to multiply + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex multiply(BigDecimal value, MathContext mathContext) { + return valueOf( + re.multiply(value, mathContext), + im.multiply(value, mathContext)); + } + + /** + * Calculates the multiplication of the given real {@link BigDecimal} value with this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@link BigDecimal} value to multiply + * @return the calculated {@link BigComplex} result + */ + public BigComplex multiply(BigDecimal value) { + return valueOf( + re.multiply(value), + im.multiply(value)); + } + + /** + * Calculates the multiplication of the given real {@code double} value with this complex number. + * + *

This methods does not modify this instance.

+ * + * @param value the real {@code double} value to multiply + * @return the calculated {@link BigComplex} result + */ + public BigComplex multiply(double value) { + return multiply(BigDecimal.valueOf(value)); + } + + /** + * Calculates this complex number divided by the given complex value using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigComplex} value to divide by + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex divide(BigComplex value, MathContext mathContext) { + return multiply(value.reciprocal(mathContext), mathContext); + } + + /** + * Calculates this complex number divided by the given real {@link BigDecimal} value using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the {@link BigDecimal} value to divide by + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex divide(BigDecimal value, MathContext mathContext) { + return valueOf( + re.divide(value, mathContext), + im.divide(value, mathContext)); + } + + /** + * Calculates this complex number divided by the given real {@code double} value using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param value the {@code double} value to divide by + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex divide(double value, MathContext mathContext) { + return divide(BigDecimal.valueOf(value), mathContext); + } + + /** + * Calculates the reciprocal of this complex number using the specified {@link MathContext}. + * + *

This methods does not modify this instance.

+ * + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigComplex reciprocal(MathContext mathContext) { + BigDecimal scale = absSquare(mathContext); + return valueOf( + re.divide(scale, mathContext), + im.negate().divide(scale, mathContext)); + } + + /** + * Calculates the conjugate {@code a - bi} of this complex number. + * + *

This methods does not modify this instance.

+ * + * @return the calculated {@link BigComplex} result + */ + public BigComplex conjugate() { + return valueOf(re, im.negate()); + } + + /** + * Calculates the negation {@code -a - bi} of this complex number. + * + *

This methods does not modify this instance.

+ * + * @return the calculated {@link BigComplex} result + */ + public BigComplex negate() { + return valueOf(re.negate(), im.negate()); + } + + /** + * Calculates the absolute value (also known as magnitude, length or radius) of this complex number. + * + *

This method is slower than {@link #absSquare(MathContext)} since it needs to calculate the {@link BigDecimalMath#sqrt(BigDecimal, MathContext)}.

+ * + *

This methods does not modify this instance.

+ * + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + * @see #absSquare(MathContext) + */ + public BigDecimal abs(MathContext mathContext) { + return BigDecimalMath.sqrt(absSquare(mathContext), mathContext); + } + + /** + * Calculates the angle in radians (also known as argument) of this complex number. + * + *

This methods does not modify this instance.

+ * + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + */ + public BigDecimal angle(MathContext mathContext) { + return BigDecimalMath.atan2(im, re, mathContext); + } + + /** + * Calculates the square of the absolute value of this complex number. + * + *

This method is faster than {@link #abs(MathContext)} since it does not need to calculate the {@link BigDecimalMath#sqrt(BigDecimal, MathContext)}.

+ * + *

This methods does not modify this instance.

+ * + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + * @see #abs(MathContext) + */ + public BigDecimal absSquare(MathContext mathContext) { + return re.multiply(re, mathContext).add(im.multiply(im, mathContext), mathContext); + } + + /** + * Returns whether this complex number only has a real part (the imaginary part is 0). + * + * @return {@code true} if this complex number only has a real part, {@code false} if the imaginary part is not 0 + */ + public boolean isReal() { + return im.signum() == 0; + } + + /** + * Returns the real part of this complex number as {@link BigComplex} number. + * + * @return the real part as as {@link BigComplex} number + */ + public BigComplex re() { + return valueOf(re, BigDecimal.ZERO); + } + + /** + * Returns the imaginary part of this complex number as {@link BigComplex} number. + * + * @return the imaginary part as as {@link BigComplex} number + */ + public BigComplex im() { + return valueOf(BigDecimal.ZERO, im); + } + + /** + * Returns this complex nuber rounded to the specified precision. + * + *

This methods does not modify this instance.

+ * + * @param mathContext the {@link MathContext} used to calculate the result + * @return the rounded {@link BigComplex} result + */ + public BigComplex round(MathContext mathContext) { + return valueOf(re.round(mathContext), im.round(mathContext)); + } + + @Override + public int hashCode() { + return Objects.hash(re, im); + } + + /** + * {@inheritDoc} + * + *

Contrary to {@link BigDecimal#equals(Object)} this method implements mathematical equality + * (by calling {@link BigDecimal#compareTo(BigDecimal)} on the real and imaginary parts) + * instead of strict equality.

+ * + * @see #strictEquals(Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BigComplex other = (BigComplex) obj; + + return re.compareTo(other.re) == 0 && im.compareTo(other.im) == 0; + } + + /** + * Returns whether the real and imaginary parts of this complex number are strictly equal. + * + *

This method uses the strict equality as defined by {@link BigDecimal#equals(Object)} on the real and imaginary parts.

+ *

Please note that {@link #equals(Object) BigComplex.equals(Object)} implements mathematical equality instead + * (by calling {@link BigDecimal#compareTo(BigDecimal) on the real and imaginary parts}).

+ * + * @param obj the object to compare for strict equality + * @return {@code true} if the specified object is strictly equal to this complex number + * @see #equals(Object) + */ + public boolean strictEquals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BigComplex other = (BigComplex) obj; + + return re.equals(other.re) && im.equals(other.im); + } + + @Override + public String toString() { + if (im.signum() >= 0) { + return "(" + re + " + " + im + " i)"; + } else { + return "(" + re + " - " + im.negate() + " i)"; + } + } + + /** + * Returns a complex number with the specified real {@link BigDecimal} part. + * + * @param real the real {@link BigDecimal} part + * @return the complex number + */ + public static BigComplex valueOf(BigDecimal real) { + return valueOf(real, BigDecimal.ZERO); + } + + /** + * Returns a complex number with the specified real {@code double} part. + * + * @param real the real {@code double} part + * @return the complex number + */ + public static BigComplex valueOf(double real) { + return valueOf(BigDecimal.valueOf(real), BigDecimal.ZERO); + } + + /** + * Returns a complex number with the specified real and imaginary {@code double} parts. + * + * @param real the real {@code double} part + * @param imaginary the imaginary {@code double} part + * @return the complex number + */ + public static BigComplex valueOf(double real, double imaginary) { + return valueOf(BigDecimal.valueOf(real), BigDecimal.valueOf(imaginary)); + } + + /** + * Returns a complex number with the specified real and imaginary {@link BigDecimal} parts. + * + * @param real the real {@link BigDecimal} part + * @param imaginary the imaginary {@link BigDecimal} part + * @return the complex number + */ + public static BigComplex valueOf(BigDecimal real, BigDecimal imaginary) { + if (real.signum() == 0) { + if (imaginary.signum() == 0) { + return ZERO; + } + if (imaginary.compareTo(BigDecimal.ONE) == 0) { + return I; + } + } + if (imaginary.signum() == 0 && real.compareTo(BigDecimal.ONE) == 0) { + return ONE; + } + + return new BigComplex(real, imaginary); + } + + /** + * Returns a complex number with the specified polar {@link BigDecimal} radius and angle using the specified {@link MathContext}. + * + * @param radius the {@link BigDecimal} radius of the polar representation + * @param angle the {@link BigDecimal} angle in radians of the polar representation + * @param mathContext the {@link MathContext} used to calculate the result + * @return the complex number + */ + public static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext) { + if (radius.signum() == 0) { + return ZERO; + } + + return valueOf( + radius.multiply(BigDecimalMath.cos(angle, mathContext), mathContext), + radius.multiply(BigDecimalMath.sin(angle, mathContext), mathContext)); + } + + public static BigComplex valueOfPolar(double radius, double angle, MathContext mathContext) { + return valueOfPolar(BigDecimal.valueOf(radius), BigDecimal.valueOf(angle), mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java b/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java new file mode 100644 index 0000000000..a73d9bccdd --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java @@ -0,0 +1,413 @@ +package ch.obermuhlner.math.big; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.util.List; + +import static ch.obermuhlner.math.big.BigComplex.I; + +/** + * Provides advanced functions operating on {@link BigComplex}s. + */ +public class BigComplexMath { + + private static final BigDecimal TWO = BigDecimal.valueOf(2); + + /** + * Calculates the reciprocal of the given complex number using the specified {@link MathContext}. + * + * @param x the complex number to calculate the reciprocal + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + * @see BigComplex#reciprocal(MathContext) + */ + public static BigComplex reciprocal(BigComplex x, MathContext mathContext) { + return x.reciprocal(mathContext); + } + + /** + * Calculates the conjugate of the given complex number using the specified {@link MathContext}. + * + * @param x the complex number to calculate the conjugate + * @return the calculated {@link BigComplex} result + * @see BigComplex#conjugate() + */ + public static BigComplex conjugate(BigComplex x) { + return x.conjugate(); + } + + /** + * Calculates the absolute value (also known as magnitude, length or radius) of the given complex number using the specified {@link MathContext}. + * + * @param x the complex number to calculate the absolute value + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + * @see BigComplex#abs(MathContext) + */ + public static BigDecimal abs(BigComplex x, MathContext mathContext) { + return x.abs(mathContext); + } + + /** + * Calculates the square of the absolute value (also known as magnitude, length or radius) of the given complex number using the specified {@link MathContext}. + * + * @param x the complex number to calculate the square of the absolute value + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} result + * @see BigComplex#absSquare(MathContext) + */ + public static BigDecimal absSquare(BigComplex x, MathContext mathContext) { + return x.absSquare(mathContext); + } + + /** + * Calculates the angle in radians of the given complex number using the specified {@link MathContext}. + * + * @param x the complex number to calculate the angle + * @param mathContext the {@link MathContext} used to calculate the result + * @return the calculated {@link BigComplex} angle in radians + * @see BigComplex#angle(MathContext) + */ + public static BigDecimal angle(BigComplex x, MathContext mathContext) { + return x.angle(mathContext); + } + + /** + * Calculates the factorial of the specified {@link BigComplex}. + * + *

This implementation uses + * Spouge's approximation + * to calculate the factorial for non-integer values.

+ * + *

This involves calculating a series of constants that depend on the desired precision. + * Since this constant calculation is quite expensive (especially for higher precisions), + * the constants for a specific precision will be cached + * and subsequent calls to this method with the same precision will be much faster.

+ * + *

It is therefore recommended to do one call to this method with the standard precision of your application during the startup phase + * and to avoid calling it with many different precisions.

+ * + *

See: Wikipedia: Factorial - Extension of factorial to non-integer values of argument

+ * + * @param x the {@link BigComplex} + * @param mathContext the {@link MathContext} used for the result + * @return the factorial {@link BigComplex} + * @throws ArithmeticException if x is a negative integer value (-1, -2, -3, ...) + * @see BigDecimalMath#factorial(BigDecimal, MathContext) + * @see #gamma(BigComplex, MathContext) + */ + public static BigComplex factorial(BigComplex x, MathContext mathContext) { + if (x.isReal() && BigDecimalMath.isIntValue(x.re)) { + return BigComplex.valueOf(BigDecimalMath.factorial(x.re.intValueExact()).round(mathContext)); + } + + // https://en.wikipedia.org/wiki/Spouge%27s_approximation + MathContext mc = new MathContext(mathContext.getPrecision() * 2, mathContext.getRoundingMode()); + + int a = mathContext.getPrecision() * 13 / 10; + List constants = BigDecimalMath.getSpougeFactorialConstants(a); + + BigDecimal bigA = BigDecimal.valueOf(a); + + boolean negative = false; + BigComplex factor = BigComplex.valueOf(constants.get(0)); + for (int k = 1; k < a; k++) { + BigDecimal bigK = BigDecimal.valueOf(k); + factor = factor.add(BigComplex.valueOf(constants.get(k)).divide(x.add(bigK), mc), mc); + negative = !negative; + } + + BigComplex result = pow(x.add(bigA, mc), x.add(BigDecimal.valueOf(0.5), mc), mc); + result = result.multiply(exp(x.negate().subtract(bigA, mc), mc), mc); + result = result.multiply(factor, mc); + + return result.round(mathContext); + } + + /** + * Calculates the gamma function of the specified {@link BigComplex}. + * + *

This implementation uses {@link #factorial(BigComplex, MathContext)} internally, + * therefore the performance implications described there apply also for this method. + * + *

See: Wikipedia: Gamma function

+ * + * @param x the {@link BigComplex} + * @param mathContext the {@link MathContext} used for the result + * @return the gamma {@link BigComplex} + * @throws ArithmeticException if x-1 is a negative integer value (-1, -2, -3, ...) + * @see BigDecimalMath#gamma(BigDecimal, MathContext) + * @see #factorial(BigComplex, MathContext) + */ + public static BigComplex gamma(BigComplex x, MathContext mathContext) { + return factorial(x.subtract(BigComplex.ONE), mathContext); + } + + + /** + * Calculates the natural exponent of {@link BigComplex} x (ex) in the complex domain. + * + *

See: Wikipedia: Exponent (Complex plane)

+ * + * @param x the {@link BigComplex} to calculate the exponent for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated exponent {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex exp(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + BigDecimal expRe = BigDecimalMath.exp(x.re, mc); + return BigComplex.valueOf( + expRe.multiply(BigDecimalMath.cos(x.im, mc), mc).round(mathContext), + expRe.multiply(BigDecimalMath.sin(x.im, mc), mc)).round(mathContext); + } + + /** + * Calculates the sine (sinus) of {@link BigComplex} x in the complex domain. + * + *

See: Wikipedia: Sine (Sine with a complex argument)

+ * + * @param x the {@link BigComplex} to calculate the sine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated sine {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex sin(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return BigComplex.valueOf( + BigDecimalMath.sin(x.re, mc).multiply(BigDecimalMath.cosh(x.im, mc), mc).round(mathContext), + BigDecimalMath.cos(x.re, mc).multiply(BigDecimalMath.sinh(x.im, mc), mc).round(mathContext)); + } + + /** + * Calculates the cosine (cosinus) of {@link BigComplex} x in the complex domain. + * + * @param x the {@link BigComplex} to calculate the cosine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated cosine {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex cos(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return BigComplex.valueOf( + BigDecimalMath.cos(x.re, mc).multiply(BigDecimalMath.cosh(x.im, mc), mc).round(mathContext), + BigDecimalMath.sin(x.re, mc).multiply(BigDecimalMath.sinh(x.im, mc), mc).negate().round(mathContext)); + } + + // + // http://scipp.ucsc.edu/~haber/archives/physics116A10/arc_10.pdf + + /** + * Calculates the tangens of {@link BigComplex} x in the complex domain. + * + * @param x the {@link BigComplex} to calculate the tangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated tangens {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex tan(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return sin(x, mc).divide(cos(x, mc), mc).round(mathContext); + } + + /** + * Calculates the arc tangens (inverted tangens) of {@link BigComplex} x in the complex domain. + * + *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

+ * + * @param x the {@link BigComplex} to calculate the arc tangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc tangens {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex atan(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return log(I.subtract(x, mc).divide(I.add(x, mc), mc), mc).divide(I, mc).divide(TWO, mc).round(mathContext); + } + + /** + * Calculates the arc cotangens (inverted cotangens) of {@link BigComplex} x in the complex domain. + * + *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

+ * + * @param x the {@link BigComplex} to calculate the arc cotangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc cotangens {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex acot(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return log(x.add(I, mc).divide(x.subtract(I, mc), mc), mc).divide(I, mc).divide(TWO, mc).round(mathContext); + } + + /** + * Calculates the arc sine (inverted sine) of {@link BigComplex} x in the complex domain. + * + *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

+ * + * @param x the {@link BigComplex} to calculate the arc sine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc sine {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex asin(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return I.negate().multiply(log(I.multiply(x, mc).add(sqrt(BigComplex.ONE.subtract(x.multiply(x, mc), mc), mc), mc), mc), mc).round(mathContext); + } + + /** + * Calculates the arc cosine (inverted cosine) of {@link BigComplex} x in the complex domain. + * + *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

+ * + * @param x the {@link BigComplex} to calculate the arc cosine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc cosine {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex acos(BigComplex x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return I.negate().multiply(log(x.add(sqrt(x.multiply(x, mc).subtract(BigComplex.ONE, mc), mc), mc), mc), mc).round(mathContext); + } + + /** + * Calculates the square root of {@link BigComplex} x in the complex domain (sqrt x). + * + *

See Wikipedia: Square root (Square root of an imaginary number)

+ * + * @param x the {@link BigComplex} to calculate the square root for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated square root {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex sqrt(BigComplex x, MathContext mathContext) { + // https://math.stackexchange.com/questions/44406/how-do-i-get-the-square-root-of-a-complex-number + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + BigDecimal magnitude = x.abs(mc); + + BigComplex a = x.add(magnitude, mc); + return a.divide(a.abs(mc), mc).multiply(BigDecimalMath.sqrt(magnitude, mc), mc).round(mathContext); + } + + /** + * Calculates the natural logarithm of {@link BigComplex} x in the complex domain. + * + *

See: Wikipedia: Complex logarithm

+ * + * @param x the {@link BigComplex} to calculate the natural logarithm for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated natural logarithm {@link BigComplex} with the precision specified in the mathContext + */ + public static BigComplex log(BigComplex x, MathContext mathContext) { + // https://en.wikipedia.org/wiki/Complex_logarithm + MathContext mc1 = new MathContext(mathContext.getPrecision() + 20, mathContext.getRoundingMode()); + MathContext mc2 = new MathContext(mathContext.getPrecision() + 5, mathContext.getRoundingMode()); + + return BigComplex.valueOf( + BigDecimalMath.log(x.abs(mc1), mc1).round(mathContext), + x.angle(mc2)).round(mathContext); + } + + /** + * Calculates {@link BigComplex} x to the power of long y (xy). + * + *

The implementation tries to minimize the number of multiplications of {@link BigComplex x} (using squares whenever possible).

+ * + *

See: Wikipedia: Exponentiation - efficient computation

+ * + * @param x the {@link BigComplex} value to take to the power + * @param y the long value to serve as exponent + * @param mathContext the {@link MathContext} used for the result + * @return the calculated x to the power of y with the precision specified in the mathContext + */ + public static BigComplex pow(BigComplex x, long y, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); + + if (y < 0) { + return BigComplex.ONE.divide(pow(x, -y, mc), mc).round(mathContext); + } + + BigComplex result = BigComplex.ONE; + while (y > 0) { + if ((y & 1) == 1) { + // odd exponent -> multiply result with x + result = result.multiply(x, mc); + y -= 1; + } + + if (y > 0) { + // even exponent -> square x + x = x.multiply(x, mc); + } + + y >>= 1; + } + + return result.round(mathContext); + } + + /** + * Calculates {@link BigComplex} x to the power of {@link BigDecimal} y (xy). + * + * @param x the {@link BigComplex} value to take to the power + * @param y the {@link BigDecimal} value to serve as exponent + * @param mathContext the {@link MathContext} used for the result + * @return the calculated x to the power of y with the precision specified in the mathContext + */ + public static BigComplex pow(BigComplex x, BigDecimal y, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + BigDecimal angleTimesN = x.angle(mc).multiply(y, mc); + return BigComplex.valueOf( + BigDecimalMath.cos(angleTimesN, mc), + BigDecimalMath.sin(angleTimesN, mc)).multiply(BigDecimalMath.pow(x.abs(mc), y, mc), mc).round(mathContext); + } + + /** + * Calculates {@link BigComplex} x to the power of {@link BigComplex} y (xy). + * + * @param x the {@link BigComplex} value to take to the power + * @param y the {@link BigComplex} value to serve as exponent + * @param mathContext the {@link MathContext} used for the result + * @return the calculated x to the power of y with the precision specified in the mathContext + */ + public static BigComplex pow(BigComplex x, BigComplex y, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return exp(y.multiply(log(x, mc), mc), mc).round(mathContext); + } + + /** + * Calculates the {@link BigDecimal} n'th root of {@link BigComplex} x (nsqrt x). + * + *

See Wikipedia: Square root

+ * @param x the {@link BigComplex} value to calculate the n'th root + * @param n the {@link BigDecimal} defining the root + * @param mathContext the {@link MathContext} used for the result + * + * @return the calculated n'th root of x with the precision specified in the mathContext + */ + public static BigComplex root(BigComplex x, BigDecimal n, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return pow(x, BigDecimal.ONE.divide(n, mc), mc).round(mathContext); + } + + /** + * Calculates the {@link BigComplex} n'th root of {@link BigComplex} x (nsqrt x). + * + *

See Wikipedia: Square root

+ * @param x the {@link BigComplex} value to calculate the n'th root + * @param n the {@link BigComplex} defining the root + * @param mathContext the {@link MathContext} used for the result + * + * @return the calculated n'th root of x with the precision specified in the mathContext + */ + public static BigComplex root(BigComplex x, BigComplex n, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + return pow(x, BigComplex.ONE.divide(n, mc), mc).round(mathContext); + } + + // TODO add root() for the k'th root - https://math.stackexchange.com/questions/322481/principal-nth-root-of-a-complex-number +} diff --git a/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java b/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java new file mode 100644 index 0000000000..552331f3b4 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java @@ -0,0 +1,1671 @@ +package ch.obermuhlner.math.big; + +import static java.math.BigDecimal.ONE; +import static java.math.BigDecimal.TEN; +import static java.math.BigDecimal.ZERO; +import static java.math.BigDecimal.valueOf; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.util.*; + +import ch.obermuhlner.math.big.internal.AsinCalculator; +import ch.obermuhlner.math.big.internal.CosCalculator; +import ch.obermuhlner.math.big.internal.CoshCalculator; +import ch.obermuhlner.math.big.internal.ExpCalculator; +import ch.obermuhlner.math.big.internal.SinCalculator; +import ch.obermuhlner.math.big.internal.SinhCalculator; + +/** + * Provides advanced functions operating on {@link BigDecimal}s. + */ +public class BigDecimalMath { + + private static final BigDecimal TWO = valueOf(2); + private static final BigDecimal THREE = valueOf(3); + private static final BigDecimal MINUS_ONE = valueOf(-1); + private static final BigDecimal ONE_HALF = valueOf(0.5); + + private static final BigDecimal DOUBLE_MAX_VALUE = BigDecimal.valueOf(Double.MAX_VALUE); + + private static volatile BigDecimal log2Cache; + private static final Object log2CacheLock = new Object(); + + private static volatile BigDecimal log3Cache; + private static final Object log3CacheLock = new Object(); + + private static volatile BigDecimal log10Cache; + private static final Object log10CacheLock = new Object(); + + private static volatile BigDecimal piCache; + private static final Object piCacheLock = new Object(); + + private static volatile BigDecimal eCache; + private static final Object eCacheLock = new Object(); + + private static final BigDecimal ROUGHLY_TWO_PI = new BigDecimal("3.141592653589793").multiply(TWO); + + private static final int EXPECTED_INITIAL_PRECISION = 15; + + private static BigDecimal[] factorialCache = new BigDecimal[100]; + + static { + BigDecimal result = ONE; + factorialCache[0] = result; + for (int i = 1; i < factorialCache.length; i++) { + result = result.multiply(valueOf(i)); + factorialCache[i] = result; + } + } + + private static final Map> spougeFactorialConstantsCache = new HashMap<>(); + private static final Object spougeFactorialConstantsCacheLock = new Object(); + + private BigDecimalMath() { + // prevent instances + } + + /** + * Creates a {@link BigDecimal} from the specified String representation. + * + *

This method is equivalent to the String constructor {@link BigDecimal#BigDecimal(String)} + * but has been optimized for large strings (several thousand digits).

+ * + * @param string the String representation + * @return the created {@link BigDecimal} + * @throws NumberFormatException if string is not a valid representation of a {@link BigDecimal} + * @see BigDecimal#BigDecimal(String) + * @see #toBigDecimal(String, MathContext) + */ + public static BigDecimal toBigDecimal(String string) { + return toBigDecimal(string, MathContext.UNLIMITED); + } + + /** + * Creates a {@link BigDecimal} from the specified String representation. + * + *

This method is equivalent to the String constructor {@link BigDecimal#BigDecimal(String, MathContext)} + * but has been optimized for large strings (several thousand digits).

+ * + * @param string the string representation + * @param mathContext the {@link MathContext} used for the result + * @return the created {@link BigDecimal} + * @throws NumberFormatException if string is not a valid representation of a {@link BigDecimal} + * @throws ArithmeticException if the result is inexact but the rounding mode is {@code UNNECESSARY} + * @see BigDecimal#BigDecimal(String, MathContext) + * @see #toBigDecimal(String) + */ + public static BigDecimal toBigDecimal(String string, MathContext mathContext) { + int len = string.length(); + if (len < 600) { + return new BigDecimal(string, mathContext); + } + + int splitLength = len / (len >= 10000 ? 8 : 5); + return toBigDecimal(string, mathContext, splitLength); + } + + static BigDecimal toBigDecimal(String string, MathContext mathContext, int splitLength) { + int len = string.length(); + + if (len < splitLength) { + return new BigDecimal(string, mathContext); + } + + char[] chars = string.toCharArray(); + + boolean numberHasSign = false; + boolean negative = false; + int numberIndex = 0; + int dotIndex = -1; + int expIndex = -1; + boolean expHasSign = false; + int scale = 0; + + for (int i = 0; i < len; i++) { + char c = chars[i]; + switch (c) { + case '+': + if (expIndex >= 0) { + if (expHasSign) { + throw new NumberFormatException("Multiple signs in exponent"); + } + expHasSign = true; + } else { + if (numberHasSign) { + throw new NumberFormatException("Multiple signs in number"); + } + numberHasSign = true; + numberIndex = i + 1; + } + break; + case '-': + if (expIndex >= 0) { + if (expHasSign) { + throw new NumberFormatException("Multiple signs in exponent"); + } + expHasSign = true; + } else { + if (numberHasSign) { + throw new NumberFormatException("Multiple signs in number"); + } + numberHasSign = true; + negative = true; + numberIndex = i + 1; + } + break; + case 'e': + case 'E': + if (expIndex >= 0) { + throw new NumberFormatException("Multiple exponent markers"); + } + expIndex = i; + break; + case '.': + if (dotIndex >= 0) { + throw new NumberFormatException("Multiple decimal points"); + } + dotIndex = i; + break; + default: + if (dotIndex >= 0 && expIndex == -1) { + scale++; + } + } + } + + int numberEndIndex; + int exp = 0; + if (expIndex >= 0) { + numberEndIndex = expIndex; + String expString = new String(chars, expIndex + 1, len - expIndex - 1); + exp = Integer.parseInt(expString); + scale = adjustScale(scale, exp); + } else { + numberEndIndex = len; + } + + BigDecimal result; + + if (dotIndex >= 0) { + int leftLength = dotIndex - numberIndex; + BigDecimal bigDecimalLeft = toBigDecimalRecursive(chars, numberIndex, leftLength, exp, splitLength); + int rightLength = numberEndIndex - dotIndex - 1; + BigDecimal bigDecimalRight = toBigDecimalRecursive(chars, dotIndex + 1, rightLength, exp-rightLength, splitLength); + result = bigDecimalLeft.add(bigDecimalRight); + } else { + result = toBigDecimalRecursive(chars, numberIndex, numberEndIndex - numberIndex, exp, splitLength); + } + + if (scale != 0) { + result = result.setScale(scale); + } + + if (negative) { + result = result.negate(); + } + + if (mathContext.getPrecision() != 0) { + result = result.round(mathContext); + } + + return result; + } + + private static int adjustScale(int scale, long exp) { + long adjustedScale = scale - exp; + if (adjustedScale > Integer.MAX_VALUE || adjustedScale < Integer.MIN_VALUE) + throw new NumberFormatException("Scale out of range: " + adjustedScale + " while adjusting scale " + scale + " to exponent " + exp); + return (int) adjustedScale; + } + + private static BigDecimal toBigDecimalRecursive(char[] chars, int offset, int length, int scale, int splitLength) { + if (length > splitLength) { + int mid = length / 2; + BigDecimal bigDecimalLeft = toBigDecimalRecursive(chars, offset, mid, scale + length - mid, splitLength); + BigDecimal bigDecimalRight = toBigDecimalRecursive(chars, offset + mid, length - mid, scale, splitLength); + return bigDecimalLeft.add(bigDecimalRight); + } + if (length == 0) { + return BigDecimal.ZERO; + } + return new BigDecimal(chars, offset, length).movePointRight(scale); + } + + /** + * Returns whether the specified {@link BigDecimal} value can be represented as int. + * + *

If this returns true you can call {@link BigDecimal#intValueExact()} without fear of an {@link ArithmeticException}.

+ * + * @param value the {@link BigDecimal} to check + * @return true if the value can be represented as int value + */ + public static boolean isIntValue(BigDecimal value) { + // TODO impl isIntValue() without exceptions + try { + value.intValueExact(); + return true; + } catch (ArithmeticException ex) { + // ignored + } + return false; + } + + /** + * Returns whether the specified {@link BigDecimal} value can be represented as long. + * + *

If this returns true you can call {@link BigDecimal#longValueExact()} without fear of an {@link ArithmeticException}.

+ * + * @param value the {@link BigDecimal} to check + * @return true if the value can be represented as long value + */ + public static boolean isLongValue(BigDecimal value) { + // TODO impl isLongValue() without exceptions + try { + value.longValueExact(); + return true; + } catch (ArithmeticException ex) { + // ignored + } + return false; + } + + /** + * Returns whether the specified {@link BigDecimal} value can be represented as double. + * + *

If this returns true you can call {@link BigDecimal#doubleValue()} + * without fear of getting {@link Double#POSITIVE_INFINITY} or {@link Double#NEGATIVE_INFINITY} as result.

+ * + *

Example: BigDecimalMath.isDoubleValue(new BigDecimal("1E309")) returns false, + * because new BigDecimal("1E309").doubleValue() returns Infinity.

+ * + *

Note: This method does not check for possible loss of precision.

+ * + *

For example BigDecimalMath.isDoubleValue(new BigDecimal("1.23400000000000000000000000000000001")) will return true, + * because new BigDecimal("1.23400000000000000000000000000000001").doubleValue() returns a valid double value, + * although it loses precision and returns 1.234.

+ * + *

BigDecimalMath.isDoubleValue(new BigDecimal("1E-325")) will return true + * although this value is smaller than {@link Double#MIN_VALUE} (and therefore outside the range of values that can be represented as double) + * because new BigDecimal("1E-325").doubleValue() returns 0 which is a legal value with loss of precision.

+ * + * @param value the {@link BigDecimal} to check + * @return true if the value can be represented as double value + */ + public static boolean isDoubleValue(BigDecimal value) { + if (value.compareTo(DOUBLE_MAX_VALUE) > 0) { + return false; + } + if (value.compareTo(DOUBLE_MAX_VALUE.negate()) < 0) { + return false; + } + + return true; + } + + /** + * Returns the mantissa of the specified {@link BigDecimal} written as mantissa * 10exponent. + * + *

The mantissa is defined as having exactly 1 digit before the decimal point.

+ * + * @param value the {@link BigDecimal} + * @return the mantissa + * @see #exponent(BigDecimal) + */ + public static BigDecimal mantissa(BigDecimal value) { + int exponent = exponent(value); + if (exponent == 0) { + return value; + } + + return value.movePointLeft(exponent); + } + + /** + * Returns the exponent of the specified {@link BigDecimal} written as mantissa * 10exponent. + * + *

The mantissa is defined as having exactly 1 digit before the decimal point.

+ * + * @param value the {@link BigDecimal} + * @return the exponent + * @see #mantissa(BigDecimal) + */ + public static int exponent(BigDecimal value) { + return value.precision() - value.scale() - 1; + } + + /** + * Returns the number of significant digits of the specified {@link BigDecimal}. + * + *

The result contains the number of all digits before the decimal point and + * all digits after the decimal point excluding trailing zeroes.

+ * + *

Examples:

+ *
    + *
  • significantDigits(new BigDecimal("12300.00")) returns 5
  • + *
  • significantDigits(new BigDecimal("1.23000")) returns 3
  • + *
  • significantDigits(new BigDecimal("0.00012300")) returns 3
  • + *
  • significantDigits(new BigDecimal("12300.4500")) returns 7
  • + *
+ * + *

See: Wikipedia: Significant figures

+ * + * @param value the {@link BigDecimal} + * @return the number of significant digits + * @see BigDecimal#stripTrailingZeros() + * @see BigDecimal#precision() + */ + public static int significantDigits(BigDecimal value) { + BigDecimal stripped = value.stripTrailingZeros(); + if (stripped.scale() >= 0) { + return stripped.precision(); + } else { + return stripped.precision() - stripped.scale(); + } + } + + /** + * Returns the integral part of the specified {@link BigDecimal} (left of the decimal point). + * + * @param value the {@link BigDecimal} + * @return the integral part + * @see #fractionalPart(BigDecimal) + */ + public static BigDecimal integralPart(BigDecimal value) { + return value.setScale(0, BigDecimal.ROUND_DOWN); + } + + /** + * Returns the fractional part of the specified {@link BigDecimal} (right of the decimal point). + * + * @param value the {@link BigDecimal} + * @return the fractional part + * @see #integralPart(BigDecimal) + */ + public static BigDecimal fractionalPart(BigDecimal value) { + return value.subtract(integralPart(value)); + } + + /** + * Rounds the specified {@link BigDecimal} to the precision of the specified {@link MathContext}. + * + *

This method calls {@link BigDecimal#round(MathContext)}.

+ * + * @param value the {@link BigDecimal} to round + * @param mathContext the {@link MathContext} used for the result + * @return the rounded {@link BigDecimal} value + * @see BigDecimal#round(MathContext) + * @see BigDecimalMath#roundWithTrailingZeroes(BigDecimal, MathContext) + */ + public static BigDecimal round(BigDecimal value, MathContext mathContext) { + return value.round(mathContext); + } + + /** + * Rounds the specified {@link BigDecimal} to the precision of the specified {@link MathContext} including trailing zeroes. + * + *

This method is similar to {@link BigDecimal#round(MathContext)} but does not remove the trailing zeroes.

+ * + *

Example:

+
+MathContext mc = new MathContext(5);
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.234567"), mc));    // 1.2346
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("123.4567"), mc));    // 123.46
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.001234567"), mc)); // 0.0012346
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.23"), mc));        // 1.2300
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.230000"), mc));    // 1.2300
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.00123"), mc));     // 0.0012300
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0"), mc));           // 0.0000
+System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.00000000"), mc));  // 0.0000
+
+ * + * @param value the {@link BigDecimal} to round + * @param mathContext the {@link MathContext} used for the result + * @return the rounded {@link BigDecimal} value including trailing zeroes + * @see BigDecimal#round(MathContext) + * @see BigDecimalMath#round(BigDecimal, MathContext) + */ + public static BigDecimal roundWithTrailingZeroes(BigDecimal value, MathContext mathContext) { + if (value.precision() == mathContext.getPrecision()) { + return value; + } + if (value.signum() == 0) { + return BigDecimal.ZERO.setScale(mathContext.getPrecision() - 1); + } + + try { + BigDecimal stripped = value.stripTrailingZeros(); + int exponentStripped = exponent(stripped); // value.precision() - value.scale() - 1; + + BigDecimal zero; + if (exponentStripped < -1) { + zero = BigDecimal.ZERO.setScale(mathContext.getPrecision() - exponentStripped); + } else { + zero = BigDecimal.ZERO.setScale(mathContext.getPrecision() + exponentStripped + 1); + } + return stripped.add(zero, mathContext); + } catch (ArithmeticException ex) { + return value.round(mathContext); + } + } + + /** + * Calculates the reciprocal of the specified {@link BigDecimal}. + * + * @param x the {@link BigDecimal} + * @param mathContext the {@link MathContext} used for the result + * @return the reciprocal {@link BigDecimal} + * @throws ArithmeticException if x = 0 + * @throws ArithmeticException if the result is inexact but the + * rounding mode is {@code UNNECESSARY} or + * {@code mc.precision == 0} and the quotient has a + * non-terminating decimal expansion. + */ + public static BigDecimal reciprocal(BigDecimal x, MathContext mathContext) { + return BigDecimal.ONE.divide(x, mathContext); + } + + /** + * Calculates the factorial of the specified integer argument. + * + *

factorial = 1 * 2 * 3 * ... n

+ * + * @param n the {@link BigDecimal} + * @return the factorial {@link BigDecimal} + * @throws ArithmeticException if x < 0 + */ + public static BigDecimal factorial(int n) { + if (n < 0) { + throw new ArithmeticException("Illegal factorial(n) for n < 0: n = " + n); + } + if (n < factorialCache.length) { + return factorialCache[n]; + } + + BigDecimal result = factorialCache[factorialCache.length - 1]; + return result.multiply(factorialRecursion(factorialCache.length, n)); + } + + private static BigDecimal factorialLoop(int n1, final int n2) { + final long limit = Long.MAX_VALUE / n2; + long accu = 1; + BigDecimal result = BigDecimal.ONE; + while (n1 <= n2) { + if (accu <= limit) { + accu *= n1; + } else { + result = result.multiply(BigDecimal.valueOf(accu)); + accu = n1; + } + n1++; + } + return result.multiply(BigDecimal.valueOf(accu)); + } + + private static BigDecimal factorialRecursion(final int n1, final int n2) { + int threshold = n1 > 200 ? 80 : 150; + if (n2 - n1 < threshold) { + return factorialLoop(n1, n2); + } + final int mid = (n1 + n2) >> 1; + return factorialRecursion(mid + 1, n2).multiply(factorialRecursion(n1, mid)); + } + + /** + * Calculates the factorial of the specified {@link BigDecimal}. + * + *

This implementation uses + * Spouge's approximation + * to calculate the factorial for non-integer values.

+ * + *

This involves calculating a series of constants that depend on the desired precision. + * Since this constant calculation is quite expensive (especially for higher precisions), + * the constants for a specific precision will be cached + * and subsequent calls to this method with the same precision will be much faster.

+ * + *

It is therefore recommended to do one call to this method with the standard precision of your application during the startup phase + * and to avoid calling it with many different precisions.

+ * + *

See: Wikipedia: Factorial - Extension of factorial to non-integer values of argument

+ * + * @param x the {@link BigDecimal} + * @param mathContext the {@link MathContext} used for the result + * @return the factorial {@link BigDecimal} + * @throws ArithmeticException if x is a negative integer value (-1, -2, -3, ...) + * @throws UnsupportedOperationException if x is a non-integer value and the {@link MathContext} has unlimited precision + * @see #factorial(int) + * @see #gamma(BigDecimal, MathContext) + */ + public static BigDecimal factorial(BigDecimal x, MathContext mathContext) { + if (isIntValue(x)) { + return round(factorial(x.intValueExact()), mathContext); + } + + // https://en.wikipedia.org/wiki/Spouge%27s_approximation + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() << 1, mathContext.getRoundingMode()); + + int a = mathContext.getPrecision() * 13 / 10; + List constants = getSpougeFactorialConstants(a); + + BigDecimal bigA = BigDecimal.valueOf(a); + + boolean negative = false; + BigDecimal factor = constants.get(0); + for (int k = 1; k < a; k++) { + BigDecimal bigK = BigDecimal.valueOf(k); + factor = factor.add(constants.get(k).divide(x.add(bigK), mc)); + negative = !negative; + } + + BigDecimal result = pow(x.add(bigA), x.add(BigDecimal.valueOf(0.5)), mc); + result = result.multiply(exp(x.negate().subtract(bigA), mc)); + result = result.multiply(factor); + + return round(result, mathContext); + } + + static List getSpougeFactorialConstants(int a) { + synchronized (spougeFactorialConstantsCacheLock) { + return spougeFactorialConstantsCache.computeIfAbsent(a, key -> { + List constants = new ArrayList<>(a); + MathContext mc = new MathContext(a * 15 / 10); + + BigDecimal c0 = sqrt(pi(mc).multiply(TWO, mc), mc); + constants.add(c0); + + boolean negative = false; + for (int k = 1; k < a; k++) { + BigDecimal bigK = BigDecimal.valueOf(k); + long deltaAK = (long)a - k; + BigDecimal ck = pow(BigDecimal.valueOf(deltaAK), bigK.subtract(ONE_HALF), mc); + ck = ck.multiply(exp(BigDecimal.valueOf(deltaAK), mc), mc); + ck = ck.divide(factorial(k - 1), mc); + if (negative) { + ck = ck.negate(); + } + constants.add(ck); + + negative = !negative; + } + + return Collections.unmodifiableList(constants); + }); + } + } + + /** + * Calculates the gamma function of the specified {@link BigDecimal}. + * + *

This implementation uses {@link #factorial(BigDecimal, MathContext)} internally, + * therefore the performance implications described there apply also for this method. + * + *

See: Wikipedia: Gamma function

+ * + * @param x the {@link BigDecimal} + * @param mathContext the {@link MathContext} used for the result + * @return the gamma {@link BigDecimal} + * @throws ArithmeticException if x-1 is a negative integer value (-1, -2, -3, ...) + * @throws UnsupportedOperationException if x is a non-integer value and the {@link MathContext} has unlimited precision + * @see #factorial(BigDecimal, MathContext) + */ + public static BigDecimal gamma(BigDecimal x, MathContext mathContext) { + return factorial(x.subtract(ONE), mathContext); + } + + /** + * Calculates the Bernoulli number for the specified index. + * + *

This function calculates the first Bernoulli numbers and therefore bernoulli(1) returns -0.5

+ *

Note that bernoulli(x) for all odd x > 1 returns 0

+ *

See: Wikipedia: Bernoulli number

+ * + * @param n the index of the Bernoulli number to be calculated (starting at 0) + * @param mathContext the {@link MathContext} used for the result + * @return the Bernoulli number for the specified index + * @throws ArithmeticException if x < 0 + * @throws ArithmeticException if the result is inexact but the + * rounding mode is {@code UNNECESSARY} or + * {@code mc.precision == 0} and the quotient has a + * non-terminating decimal expansion. + */ + public static BigDecimal bernoulli(int n, MathContext mathContext) { + if (n < 0) { + throw new ArithmeticException("Illegal bernoulli(n) for n < 0: n = " + n); + } + + BigRational b = BigRational.bernoulli(n); + return b.toBigDecimal(mathContext); + } + + /** + * Calculates {@link BigDecimal} x to the power of {@link BigDecimal} y (xy). + * + * @param x the {@link BigDecimal} value to take to the power + * @param y the {@link BigDecimal} value to serve as exponent + * @param mathContext the {@link MathContext} used for the result + * @return the calculated x to the power of y with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + * @see #pow(BigDecimal, long, MathContext) + */ + public static BigDecimal pow(BigDecimal x, BigDecimal y, MathContext mathContext) { + checkMathContext(mathContext); + if (x.signum() == 0) { + switch (y.signum()) { + case 0 : return round(ONE, mathContext); + case 1 : return round(ZERO, mathContext); + } + } + + // TODO optimize y=0, y=1, y=10^k, y=-1, y=-10^k + + try { + long longValue = y.longValueExact(); + return pow(x, longValue, mathContext); + } catch (ArithmeticException ex) { + // ignored + } + + if (fractionalPart(y).signum() == 0) { + return powInteger(x, y, mathContext); + } + + // x^y = exp(y*log(x)) + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + BigDecimal result = exp(y.multiply(log(x, mc), mc), mc); + + return round(result, mathContext); + } + + /** + * Calculates {@link BigDecimal} x to the power of long y (xy). + * + *

The implementation tries to minimize the number of multiplications of {@link BigDecimal x} (using squares whenever possible).

+ * + *

See: Wikipedia: Exponentiation - efficient computation

+ * + * @param x the {@link BigDecimal} value to take to the power + * @param y the long value to serve as exponent + * @param mathContext the {@link MathContext} used for the result + * @return the calculated x to the power of y with the precision specified in the mathContext + * @throws ArithmeticException if y is negative and the result is inexact but the + * rounding mode is {@code UNNECESSARY} or + * {@code mc.precision == 0} and the quotient has a + * non-terminating decimal expansion. + * @throws ArithmeticException if the rounding mode is + * {@code UNNECESSARY} and the + * {@code BigDecimal} operation would require rounding. + */ + public static BigDecimal pow(BigDecimal x, long y, MathContext mathContext) { + MathContext mc = mathContext.getPrecision() == 0 ? mathContext : new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); + + // TODO optimize y=0, y=1, y=10^k, y=-1, y=-10^k + + if (y < 0) { + BigDecimal value = reciprocal(pow(x, -y, mc), mc); + return round(value, mathContext); + } + + BigDecimal result = ONE; + while (y > 0) { + if ((y & 1) == 1) { + // odd exponent -> multiply result with x + result = result.multiply(x, mc); + y -= 1; + } + + if (y > 0) { + // even exponent -> square x + x = x.multiply(x, mc); + } + + y >>= 1; + } + + return round(result, mathContext); + } + + /** + * Calculates {@link BigDecimal} x to the power of the integer value y (xy). + * + *

The value y MUST be an integer value.

+ * + * @param x the {@link BigDecimal} value to take to the power + * @param integerY the {@link BigDecimal} integer value to serve as exponent + * @param mathContext the {@link MathContext} used for the result + * @return the calculated x to the power of y with the precision specified in the mathContext + * @see #pow(BigDecimal, long, MathContext) + */ + private static BigDecimal powInteger(BigDecimal x, BigDecimal integerY, MathContext mathContext) { + if (fractionalPart(integerY).signum() != 0) { + throw new IllegalArgumentException("Not integer value: " + integerY); + } + + if (integerY.signum() < 0) { + return ONE.divide(powInteger(x, integerY.negate(), mathContext), mathContext); + } + + MathContext mc = new MathContext(Math.max(mathContext.getPrecision(), -integerY.scale()) + 30, mathContext.getRoundingMode()); + + BigDecimal result = ONE; + while (integerY.signum() > 0) { + BigDecimal halfY = integerY.divide(TWO, mc); + + if (fractionalPart(halfY).signum() != 0) { + // odd exponent -> multiply result with x + result = result.multiply(x, mc); + integerY = integerY.subtract(ONE); + halfY = integerY.divide(TWO, mc); + } + + if (halfY.signum() > 0) { + // even exponent -> square x + x = x.multiply(x, mc); + } + + integerY = halfY; + } + + return round(result, mathContext); + } + + /** + * Calculates the square root of {@link BigDecimal} x. + * + *

See Wikipedia: Square root

+ * + * @param x the {@link BigDecimal} value to calculate the square root + * @param mathContext the {@link MathContext} used for the result + * @return the calculated square root of x with the precision specified in the mathContext + * @throws ArithmeticException if x < 0 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal sqrt(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + switch (x.signum()) { + case 0: + return ZERO; + case -1: + throw new ArithmeticException("Illegal sqrt(x) for x < 0: x = " + x); + } + + int maxPrecision = mathContext.getPrecision() + 6; + BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1); + + BigDecimal result; + int adaptivePrecision; + if (isDoubleValue(x)) { + result = BigDecimal.valueOf(Math.sqrt(x.doubleValue())); + adaptivePrecision = EXPECTED_INITIAL_PRECISION; + } else { + result = x.multiply(ONE_HALF, mathContext); + adaptivePrecision = 1; + } + + BigDecimal last; + + if (adaptivePrecision < maxPrecision) { + if (result.multiply(result).compareTo(x) == 0) { + return round(result, mathContext); // early exit if x is a square number + } + + do { + last = result; + adaptivePrecision <<= 1; + if (adaptivePrecision > maxPrecision) { + adaptivePrecision = maxPrecision; + } + MathContext mc = new MathContext(adaptivePrecision, mathContext.getRoundingMode()); + result = x.divide(result, mc).add(last).multiply(ONE_HALF, mc); + } + while (adaptivePrecision < maxPrecision || result.subtract(last).abs().compareTo(acceptableError) > 0); + } + + return round(result, mathContext); + } + + /** + * Calculates the n'th root of {@link BigDecimal} x. + * + *

See Wikipedia: Square root

+ * @param x the {@link BigDecimal} value to calculate the n'th root + * @param n the {@link BigDecimal} defining the root + * @param mathContext the {@link MathContext} used for the result + * + * @return the calculated n'th root of x with the precision specified in the mathContext + * @throws ArithmeticException if x < 0 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal root(BigDecimal x, BigDecimal n, MathContext mathContext) { + checkMathContext(mathContext); + switch (x.signum()) { + case 0: + return ZERO; + case -1: + throw new ArithmeticException("Illegal root(x) for x < 0: x = " + x); + } + + if (n.compareTo(BigDecimal.ONE) <= 0) { + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + return pow(x, BigDecimal.ONE.divide(n, mc), mathContext); + } + + int maxPrecision = mathContext.getPrecision() + 4; + BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1); + + BigDecimal nMinus1 = n.subtract(ONE); + BigDecimal result = x.divide(TWO, MathContext.DECIMAL32); + int adaptivePrecision = 2; // first approximation has really bad precision + BigDecimal step; + + do { + adaptivePrecision *= 3; + if (adaptivePrecision > maxPrecision) { + adaptivePrecision = maxPrecision; + } + MathContext mc = new MathContext(adaptivePrecision, mathContext.getRoundingMode()); + + step = x.divide(pow(result, nMinus1, mc), mc).subtract(result).divide(n, mc); + result = result.add(step); + } while (adaptivePrecision < maxPrecision || step.abs().compareTo(acceptableError) > 0); + + return round(result, mathContext); + } + + /** + * Calculates the natural logarithm of {@link BigDecimal} x. + * + *

See: Wikipedia: Natural logarithm

+ * + * @param x the {@link BigDecimal} to calculate the natural logarithm for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated natural logarithm {@link BigDecimal} with the precision specified in the mathContext + * @throws ArithmeticException if x <= 0 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal log(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + if (x.signum() <= 0) { + throw new ArithmeticException("Illegal log(x) for x <= 0: x = " + x); + } + if (x.compareTo(ONE) == 0) { + return ZERO; + } + + BigDecimal result; + switch (x.compareTo(TEN)) { + case 0: + result = logTen(mathContext); + break; + case 1: + result = logUsingExponent(x, mathContext); + break; + default : + result = logUsingTwoThree(x, mathContext); + } + + return round(result, mathContext); + } + + /** + * Calculates the logarithm of {@link BigDecimal} x to the base 2. + * + * @param x the {@link BigDecimal} to calculate the logarithm base 2 for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated natural logarithm {@link BigDecimal} to the base 2 with the precision specified in the mathContext + * @throws ArithmeticException if x <= 0 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal log2(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + + BigDecimal result = log(x, mc).divide(logTwo(mc), mc); + return round(result, mathContext); + } + + /** + * Calculates the logarithm of {@link BigDecimal} x to the base 10. + * + * @param x the {@link BigDecimal} to calculate the logarithm base 10 for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated natural logarithm {@link BigDecimal} to the base 10 with the precision specified in the mathContext + * @throws ArithmeticException if x <= 0 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal log10(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 2, mathContext.getRoundingMode()); + + BigDecimal result = log(x, mc).divide(logTen(mc), mc); + return round(result, mathContext); + } + + private static BigDecimal logUsingNewton(BigDecimal x, MathContext mathContext) { + // https://en.wikipedia.org/wiki/Natural_logarithm in chapter 'High Precision' + // y = y + 2 * (x-exp(y)) / (x+exp(y)) + + int maxPrecision = mathContext.getPrecision() + 20; + BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1); + //System.out.println("logUsingNewton(" + x + " " + mathContext + ") precision " + maxPrecision); + + BigDecimal result; + int adaptivePrecision; + double doubleX = x.doubleValue(); + if (doubleX > 0.0 && isDoubleValue(x)) { + result = BigDecimal.valueOf(Math.log(doubleX)); + adaptivePrecision = EXPECTED_INITIAL_PRECISION; + } else { + result = x.divide(TWO, mathContext); + adaptivePrecision = 1; + } + + BigDecimal step; + + do { + adaptivePrecision *= 3; + if (adaptivePrecision > maxPrecision) { + adaptivePrecision = maxPrecision; + } + MathContext mc = new MathContext(adaptivePrecision, mathContext.getRoundingMode()); + + BigDecimal expY = BigDecimalMath.exp(result, mc); + step = TWO.multiply(x.subtract(expY)).divide(x.add(expY), mc); + //System.out.println(" step " + step + " adaptivePrecision=" + adaptivePrecision); + result = result.add(step); + } while (adaptivePrecision < maxPrecision || step.abs().compareTo(acceptableError) > 0); + + return result; + } + + private static BigDecimal logUsingExponent(BigDecimal x, MathContext mathContext) { + MathContext mcDouble = new MathContext(mathContext.getPrecision() << 1, mathContext.getRoundingMode()); + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + //System.out.println("logUsingExponent(" + x + " " + mathContext + ") precision " + mc); + + int exponent = exponent(x); + BigDecimal mantissa = mantissa(x); + + BigDecimal result = logUsingTwoThree(mantissa, mc); + if (exponent != 0) { + result = result.add(valueOf(exponent).multiply(logTen(mcDouble), mc)); + } + return result; + } + + private static BigDecimal logUsingTwoThree(BigDecimal x, MathContext mathContext) { + MathContext mcDouble = new MathContext(mathContext.getPrecision() << 1, mathContext.getRoundingMode()); + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + //System.out.println("logUsingTwoThree(" + x + " " + mathContext + ") precision " + mc); + + int factorOfTwo = 0; + int powerOfTwo = 1; + int factorOfThree = 0; + int powerOfThree = 1; + + double value = x.doubleValue(); + if (value < 0.01) { + // do nothing + } else if (value < 0.1) { // never happens when called by logUsingExponent() + while (value < 0.6) { + value *= 2; + factorOfTwo--; + powerOfTwo <<= 1; + } + } + else if (value < 0.115) { // (0.1 - 0.11111 - 0.115) -> (0.9 - 1.0 - 1.035) + factorOfThree = -2; + powerOfThree = 9; + } + else if (value < 0.14) { // (0.115 - 0.125 - 0.14) -> (0.92 - 1.0 - 1.12) + factorOfTwo = -3; + powerOfTwo = 8; + } + else if (value < 0.2) { // (0.14 - 0.16667 - 0.2) - (0.84 - 1.0 - 1.2) + factorOfTwo = -1; + powerOfTwo = 2; + factorOfThree = -1; + powerOfThree = 3; + } + else if (value < 0.3) { // (0.2 - 0.25 - 0.3) -> (0.8 - 1.0 - 1.2) + factorOfTwo = -2; + powerOfTwo = 4; + } + else if (value < 0.42) { // (0.3 - 0.33333 - 0.42) -> (0.9 - 1.0 - 1.26) + factorOfThree = -1; + powerOfThree = 3; + } + else if (value < 0.7) { // (0.42 - 0.5 - 0.7) -> (0.84 - 1.0 - 1.4) + factorOfTwo = -1; + powerOfTwo = 2; + } + else if (value < 1.4) { // (0.7 - 1.0 - 1.4) -> (0.7 - 1.0 - 1.4) + // do nothing + } + else if (value < 2.5) { // (1.4 - 2.0 - 2.5) -> (0.7 - 1.0 - 1.25) + factorOfTwo = 1; + powerOfTwo = 2; + } + else if (value < 3.5) { // (2.5 - 3.0 - 3.5) -> (0.833333 - 1.0 - 1.166667) + factorOfThree = 1; + powerOfThree = 3; + } + else if (value < 5.0) { // (3.5 - 4.0 - 5.0) -> (0.875 - 1.0 - 1.25) + factorOfTwo = 2; + powerOfTwo = 4; + } + else if (value < 7.0) { // (5.0 - 6.0 - 7.0) -> (0.833333 - 1.0 - 1.166667) + factorOfThree = 1; + powerOfThree = 3; + factorOfTwo = 1; + powerOfTwo = 2; + } + else if (value < 8.5) { // (7.0 - 8.0 - 8.5) -> (0.875 - 1.0 - 1.0625) + factorOfTwo = 3; + powerOfTwo = 8; + } + else if (value < 10.0) { // (8.5 - 9.0 - 10.0) -> (0.94444 - 1.0 - 1.11111) + factorOfThree = 2; + powerOfThree = 9; + } + else { + while (value > 1.4) { // never happens when called by logUsingExponent() + value /= 2; + factorOfTwo++; + powerOfTwo <<= 1; + } + } + + BigDecimal correctedX = x; + BigDecimal result = ZERO; + + if (factorOfTwo > 0) { + correctedX = correctedX.divide(valueOf(powerOfTwo), mc); + result = result.add(logTwo(mcDouble).multiply(valueOf(factorOfTwo), mc)); + } + else if (factorOfTwo < 0) { + correctedX = correctedX.multiply(valueOf(powerOfTwo), mc); + result = result.subtract(logTwo(mcDouble).multiply(valueOf(-factorOfTwo), mc)); + } + + if (factorOfThree > 0) { + correctedX = correctedX.divide(valueOf(powerOfThree), mc); + result = result.add(logThree(mcDouble).multiply(valueOf(factorOfThree), mc)); + } + else if (factorOfThree < 0) { + correctedX = correctedX.multiply(valueOf(powerOfThree), mc); + result = result.subtract(logThree(mcDouble).multiply(valueOf(-factorOfThree), mc)); + } + + if (x == correctedX && result == ZERO) { + return logUsingNewton(x, mathContext); + } + + result = result.add(logUsingNewton(correctedX, mc), mc); + + return result; + } + + /** + * Returns the number pi. + * + *

See Wikipedia: Pi

+ * + * @param mathContext the {@link MathContext} used for the result + * @return the number pi with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal pi(MathContext mathContext) { + checkMathContext(mathContext); + BigDecimal result = null; + + synchronized (piCacheLock) { + if (piCache != null && mathContext.getPrecision() <= piCache.precision()) { + result = piCache; + } else { + piCache = piChudnovski(mathContext); + return piCache; + } + } + + return round(result, mathContext); + } + + private static BigDecimal piChudnovski(MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); + + final BigDecimal value24 = BigDecimal.valueOf(24); + final BigDecimal value640320 = BigDecimal.valueOf(640320); + final BigDecimal value13591409 = BigDecimal.valueOf(13591409); + final BigDecimal value545140134 = BigDecimal.valueOf(545140134); + final BigDecimal valueDivisor = value640320.pow(3).divide(value24, mc); + + BigDecimal sumA = BigDecimal.ONE; + BigDecimal sumB = BigDecimal.ZERO; + + BigDecimal a = BigDecimal.ONE; + long dividendTerm1 = 5; // -(6*k - 5) + long dividendTerm2 = -1; // 2*k - 1 + long dividendTerm3 = -1; // 6*k - 1 + BigDecimal kPower3 = BigDecimal.ZERO; + + long iterationCount = (mc.getPrecision()+13) / 14; + for (long k = 1; k <= iterationCount; k++) { + BigDecimal valueK = BigDecimal.valueOf(k); + dividendTerm1 += -6; + dividendTerm2 += 2; + dividendTerm3 += 6; + BigDecimal dividend = BigDecimal.valueOf(dividendTerm1).multiply(BigDecimal.valueOf(dividendTerm2)).multiply(BigDecimal.valueOf(dividendTerm3)); + kPower3 = valueK.pow(3); + BigDecimal divisor = kPower3.multiply(valueDivisor, mc); + a = a.multiply(dividend).divide(divisor, mc); + BigDecimal b = valueK.multiply(a, mc); + + sumA = sumA.add(a); + sumB = sumB.add(b); + } + + final BigDecimal value426880 = BigDecimal.valueOf(426880); + final BigDecimal value10005 = BigDecimal.valueOf(10005); + final BigDecimal factor = value426880.multiply(sqrt(value10005, mc)); + BigDecimal pi = factor.divide(value13591409.multiply(sumA, mc).add(value545140134.multiply(sumB, mc)), mc); + + return round(pi, mathContext); + } + + /** + * Returns the number e. + * + *

See Wikipedia: E (mathematical_constant)

+ * + * @param mathContext the {@link MathContext} used for the result + * @return the number e with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal e(MathContext mathContext) { + checkMathContext(mathContext); + BigDecimal result = null; + + synchronized (eCacheLock) { + if (eCache != null && mathContext.getPrecision() <= eCache.precision()) { + result = eCache; + } else { + eCache = exp(ONE, mathContext); + return eCache; + } + } + + return round(result, mathContext); + } + + private static BigDecimal logTen(MathContext mathContext) { + BigDecimal result = null; + + synchronized (log10CacheLock) { + if (log10Cache != null && mathContext.getPrecision() <= log10Cache.precision()) { + result = log10Cache; + } else { + log10Cache = logUsingNewton(BigDecimal.TEN, mathContext); + return log10Cache; + } + } + + return round(result, mathContext); + } + + private static BigDecimal logTwo(MathContext mathContext) { + BigDecimal result = null; + + synchronized (log2CacheLock) { + if (log2Cache != null && mathContext.getPrecision() <= log2Cache.precision()) { + result = log2Cache; + } else { + log2Cache = logUsingNewton(TWO, mathContext); + return log2Cache; + } + } + + return round(result, mathContext); + } + + private static BigDecimal logThree(MathContext mathContext) { + BigDecimal result = null; + + synchronized (log3CacheLock) { + if (log3Cache != null && mathContext.getPrecision() <= log3Cache.precision()) { + result = log3Cache; + } else { + log3Cache = logUsingNewton(THREE, mathContext); + return log3Cache; + } + } + + return round(result, mathContext); + } + + /** + * Calculates the natural exponent of {@link BigDecimal} x (ex). + * + *

See: Wikipedia: Exponent

+ * + * @param x the {@link BigDecimal} to calculate the exponent for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated exponent {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal exp(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + if (x.signum() == 0) { + return ONE; + } + + return expIntegralFractional(x, mathContext); + } + + private static BigDecimal expIntegralFractional(BigDecimal x, MathContext mathContext) { + BigDecimal integralPart = integralPart(x); + + if (integralPart.signum() == 0) { + return expTaylor(x, mathContext); + } + + BigDecimal fractionalPart = x.subtract(integralPart); + + MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); + + BigDecimal z = ONE.add(fractionalPart.divide(integralPart, mc)); + BigDecimal t = expTaylor(z, mc); + + BigDecimal result = pow(t, integralPart.intValueExact(), mc); + + return round(result, mathContext); + } + + private static BigDecimal expTaylor(BigDecimal x, MathContext mathContext) { + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + + x = x.divide(valueOf(256), mc); + + BigDecimal result = ExpCalculator.INSTANCE.calculate(x, mc); + result = BigDecimalMath.pow(result, 256, mc); + return round(result, mathContext); + } + + /** + * Calculates the sine (sinus) of {@link BigDecimal} x. + * + *

See: Wikipedia: Sine

+ * + * @param x the {@link BigDecimal} to calculate the sine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated sine {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal sin(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + + if (x.abs().compareTo(ROUGHLY_TWO_PI) > 0) { + MathContext mc2 = new MathContext(mc.getPrecision() + 4, mathContext.getRoundingMode()); + BigDecimal twoPi = TWO.multiply(pi(mc2)); + x = x.remainder(twoPi, mc2); + } + + BigDecimal result = SinCalculator.INSTANCE.calculate(x, mc); + return round(result, mathContext); + } + + /** + * Calculates the arc sine (inverted sine) of {@link BigDecimal} x. + * + *

See: Wikipedia: Arcsine

+ * + * @param x the {@link BigDecimal} to calculate the arc sine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc sine {@link BigDecimal} with the precision specified in the mathContext + * @throws ArithmeticException if x > 1 or x < -1 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal asin(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + if (x.compareTo(ONE) > 0) { + throw new ArithmeticException("Illegal asin(x) for x > 1: x = " + x); + } + if (x.compareTo(MINUS_ONE) < 0) { + throw new ArithmeticException("Illegal asin(x) for x < -1: x = " + x); + } + + if (x.signum() == -1) { + return asin(x.negate(), mathContext).negate(); + } + + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + + if (x.compareTo(BigDecimal.valueOf(0.707107)) >= 0) { + BigDecimal xTransformed = sqrt(ONE.subtract(x.multiply(x)), mc); + return acos(xTransformed, mathContext); + } + + BigDecimal result = AsinCalculator.INSTANCE.calculate(x, mc); + return round(result, mathContext); + } + + /** + * Calculates the cosine (cosinus) of {@link BigDecimal} x. + * + *

See: Wikipedia: Cosine

+ * + * @param x the {@link BigDecimal} to calculate the cosine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated cosine {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal cos(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + + if (x.abs().compareTo(ROUGHLY_TWO_PI) > 0) { + MathContext mc2 = new MathContext(mc.getPrecision() + 4, mathContext.getRoundingMode()); + BigDecimal twoPi = TWO.multiply(pi(mc2), mc2); + x = x.remainder(twoPi, mc2); + } + + BigDecimal result = CosCalculator.INSTANCE.calculate(x, mc); + return round(result, mathContext); + } + + /** + * Calculates the arc cosine (inverted cosine) of {@link BigDecimal} x. + * + *

See: Wikipedia: Arccosine

+ * + * @param x the {@link BigDecimal} to calculate the arc cosine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc sine {@link BigDecimal} with the precision specified in the mathContext + * @throws ArithmeticException if x > 1 or x < -1 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal acos(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + if (x.compareTo(ONE) > 0) { + throw new ArithmeticException("Illegal acos(x) for x > 1: x = " + x); + } + if (x.compareTo(MINUS_ONE) < 0) { + throw new ArithmeticException("Illegal acos(x) for x < -1: x = " + x); + } + + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + + BigDecimal result = pi(mc).divide(TWO, mc).subtract(asin(x, mc)); + return round(result, mathContext); + } + + /** + * Calculates the tangens of {@link BigDecimal} x. + * + *

See: Wikipedia: Tangens

+ * + * @param x the {@link BigDecimal} to calculate the tangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated tangens {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal tan(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + if (x.signum() == 0) { + return ZERO; + } + + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + BigDecimal result = sin(x, mc).divide(cos(x, mc), mc); + return round(result, mathContext); + } + + /** + * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} x. + * + *

See: Wikipedia: Arctangens

+ * + * @param x the {@link BigDecimal} to calculate the arc tangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal atan(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + + x = x.divide(sqrt(ONE.add(x.multiply(x, mc)), mc), mc); + + BigDecimal result = asin(x, mc); + return round(result, mathContext); + } + + /** + * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} y / x in the range -pi to pi. + * + *

This is useful to calculate the angle theta from the conversion of rectangular + * coordinates (xy) to polar coordinates (r, theta).

+ * + *

See: Wikipedia: Atan2

+ * + * @param y the {@link BigDecimal} + * @param x the {@link BigDecimal} + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the mathContext + * @throws ArithmeticException if x = 0 and y = 0 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal atan2(BigDecimal y, BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 3, mathContext.getRoundingMode()); + + if (x.signum() > 0) { // x > 0 + return atan(y.divide(x, mc), mathContext); + } else if (x.signum() < 0) { + if (y.signum() > 0) { // x < 0 && y > 0 + return atan(y.divide(x, mc), mc).add(pi(mc), mathContext); + } else if (y.signum() < 0) { // x < 0 && y < 0 + return atan(y.divide(x, mc), mc).subtract(pi(mc), mathContext); + } else { // x < 0 && y = 0 + return pi(mathContext); + } + } else { + if (y.signum() > 0) { // x == 0 && y > 0 + return pi(mc).divide(TWO, mathContext); + } else if (y.signum() < 0) { // x == 0 && y < 0 + return pi(mc).divide(TWO, mathContext).negate(); + } else { + throw new ArithmeticException("Illegal atan2(y, x) for x = 0; y = 0"); + } + } + } + + /** + * Calculates the cotangens of {@link BigDecimal} x. + * + *

See: Wikipedia: Cotangens

+ * + * @param x the {@link BigDecimal} to calculate the cotangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated cotanges {@link BigDecimal} with the precision specified in the mathContext + * @throws ArithmeticException if x = 0 + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal cot(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + if (x.signum() == 0) { + throw new ArithmeticException("Illegal cot(x) for x = 0"); + } + + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + BigDecimal result = cos(x, mc).divide(sin(x, mc), mc); + return round(result, mathContext); + } + + /** + * Calculates the inverse cotangens (arc cotangens) of {@link BigDecimal} x. + * + *

See: Wikipedia: Arccotangens

+ * + * @param x the {@link BigDecimal} to calculate the arc cotangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc cotangens {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal acot(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + BigDecimal result = pi(mc).divide(TWO, mc).subtract(atan(x, mc)); + return round(result, mathContext); + } + + /** + * Calculates the hyperbolic sine of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the hyperbolic sine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated hyperbolic sine {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal sinh(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + BigDecimal result = SinhCalculator.INSTANCE.calculate(x, mc); + return round(result, mathContext); + } + + /** + * Calculates the hyperbolic cosine of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the hyperbolic cosine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated hyperbolic cosine {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal cosh(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); + BigDecimal result = CoshCalculator.INSTANCE.calculate(x, mc); + return round(result, mathContext); + } + + /** + * Calculates the hyperbolic tangens of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the hyperbolic tangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated hyperbolic tangens {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal tanh(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + BigDecimal result = sinh(x, mc).divide(cosh(x, mc), mc); + return round(result, mathContext); + } + + /** + * Calculates the hyperbolic cotangens of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the hyperbolic cotangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated hyperbolic cotangens {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal coth(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + BigDecimal result = cosh(x, mc).divide(sinh(x, mc), mc); + return round(result, mathContext); + } + + /** + * Calculates the arc hyperbolic sine (inverse hyperbolic sine) of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic sine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc hyperbolic sine {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal asinh(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); + BigDecimal result = log(x.add(sqrt(x.multiply(x, mc).add(ONE, mc), mc)), mc); + return round(result, mathContext); + } + + /** + * Calculates the arc hyperbolic cosine (inverse hyperbolic cosine) of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic cosine for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc hyperbolic cosine {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal acosh(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + BigDecimal result = log(x.add(sqrt(x.multiply(x).subtract(ONE), mc)), mc); + return round(result, mathContext); + } + + /** + * Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal atanh(BigDecimal x, MathContext mathContext) { + if (x.compareTo(BigDecimal.ONE) >= 0) { + throw new ArithmeticException("Illegal atanh(x) for x >= 1: x = " + x); + } + if (x.compareTo(MINUS_ONE) <= 0) { + throw new ArithmeticException("Illegal atanh(x) for x <= -1: x = " + x); + } + + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + BigDecimal result = log(ONE.add(x).divide(ONE.subtract(x), mc), mc).multiply(ONE_HALF); + return round(result, mathContext); + } + + /** + * Calculates the arc hyperbolic cotangens (inverse hyperbolic cotangens) of {@link BigDecimal} x. + * + *

See: Wikipedia: Hyperbolic function

+ * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic cotangens for + * @param mathContext the {@link MathContext} used for the result + * @return the calculated arc hyperbolic cotangens {@link BigDecimal} with the precision specified in the mathContext + * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision + */ + public static BigDecimal acoth(BigDecimal x, MathContext mathContext) { + checkMathContext(mathContext); + MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); + BigDecimal result = log(x.add(ONE).divide(x.subtract(ONE), mc), mc).multiply(ONE_HALF); + return round(result, mathContext); + } + + private static void checkMathContext (MathContext mathContext) { + if (mathContext.getPrecision() == 0) { + throw new UnsupportedOperationException("Unlimited MathContext not supported"); + } + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/BigFloat.java b/src/main/java/ch/obermuhlner/math/big/BigFloat.java new file mode 100644 index 0000000000..eb8944f2c4 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/BigFloat.java @@ -0,0 +1,1947 @@ +package ch.obermuhlner.math.big; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; +import java.util.Objects; + +/** + * A wrapper around {@link BigDecimal} which simplifies the consistent usage of the {@link MathContext} + * and provides a simpler API for calculations. + * + *

Overview

+ * + *

Every {@link BigFloat} instance has a reference to a {@link Context} that specifies the {@link MathContext} to be used for all calculations and values.

+ * + *

The API for calculations is simplified and more consistent with the typical mathematical usage.

+ *
    + *
  • Factory methods for values: + *
      + *
    • valueOf(BigFloat)
    • + *
    • valueOf(BigDecimal)
    • + *
    • valueOf(int)
    • + *
    • valueOf(long)
    • + *
    • valueOf(double)
    • + *
    • valueOf(String)
    • + *
    • pi()
    • + *
    • e()
    • + *
    + *
  • + *
  • All standard operators: + *
      + *
    • add(x)
    • + *
    • subtract(x)
    • + *
    • multiply(x)
    • + *
    • remainder(x)
    • + *
    • pow(y)
    • + *
    • root(y)
    • + *
    + *
  • + *
  • Calculation methods are overloaded for different value types: + *
      + *
    • add(BigFloat)
    • + *
    • add(BigDecimal)
    • + *
    • add(int)
    • + *
    • add(long)
    • + *
    • add(double)
    • + *
    • ...
    • + *
    + *
  • + *
  • Mathematical functions are written as they are traditionally are written: + *
      + *
    • abs(x)
    • + *
    • log(x)
    • + *
    • sin(x)
    • + *
    • min(x1, x2, ...)
    • + *
    • max(x1, x2, ...)
    • + *
    • ...
    • + *
    + *
  • + *
  • Support for advanced mathematical functions: + *
      + *
    • sqrt(x)
    • + *
    • log(x)
    • + *
    • exp(x)
    • + *
    • sin(x)
    • + *
    • cos(x)
    • + *
    • tan(x)
    • + *
    • ...
    • + *
    + *
  • + *
  • Methods to access parts of a value: + *
      + *
    • getMantissa()
    • + *
    • getExponent()
    • + *
    • getIntegralPart()
    • + *
    • getFractionalPart()
    • + *
    + *
  • + *
  • Equals and Hashcode methods: + *
      + *
    • equals(Object) that returns whether two BigFloat values are mathematically the same
    • + *
    • hashCode() consistent with equals(Object)
    • + *
    + *
  • + *
  • Comparison methods: + *
      + *
    • isEqual(BigFloat)
    • + *
    • isLessThan(BigFloat)
    • + *
    • isLessThanOrEqual(BigFloat)
    • + *
    • isGreaterThan(BigFloat)
    • + *
    • isGreaterThanOrEqual(BigFloat)
    • + *
    + *
  • + *
+ * + *

Usage

+ * + *

Before doing any calculations you need to create a Context specifying the precision used for all calculations.

+ *
+ * Context context = BigFloat.context(100); // precision of 100 digits
+ * Context anotherContext = BigFloat.context(new MathContext(10, RoundingMode.HALF_UP); // precision of 10 digits, rounding half up
+ * 
+ * + *

The Context can then be used to create the first value of the calculation:

+ *
+ * BigFloat value1 = context.valueOf(640320);
+ * 
+ * + *

The BigFloat instance holds a reference to the Context. This context is then passed from calculation to calculation.

+ *
+ * BigFloat value2 = context.valueOf(640320).pow(3).divide(24);
+ * BigFloat value3 = BigFloat.sin(value2);
+ * 
+ * + *

The BigFloat result can be converted to other numerical types:

+ *
+ * BigDecimal bigDecimalValue = value3.toBigDecimal();
+ * double doubleValue = value3.toDouble();
+ * long longValue = value3.toLong();
+ * int intValue = value3.toInt();
+ * 
+ */ +@SuppressWarnings("WeakerAccess") +public class BigFloat implements Comparable, Serializable { + private static final long serialVersionUID = -7323679117445486894L; + + /** + * Represents a value that is not a number. + * @see Double#NaN + */ + public static final BigFloat NaN = new SpecialBigFloat(SpecialBigFloat.Type.NaN); + + /** + * Represents the positive infinity. + * @see Double#POSITIVE_INFINITY + */ + public static final BigFloat POSITIVE_INFINITY = new SpecialBigFloat(SpecialBigFloat.Type.POSITIVE_INFINITY); + + /** + * Represents the positive infinity. + * @see Double#NEGATIVE_INFINITY + */ + public static final BigFloat NEGATIVE_INFINITY = new SpecialBigFloat(SpecialBigFloat.Type.NEGATIVE_INFINITY); + + private final BigDecimal value; + private final Context context; + + private BigFloat(BigDecimal value, Context context) { + this.value = value; + this.context = context; + } + + /** + * Creates a {@link Context} with the specified precision and {@link RoundingMode#HALF_UP} rounding. + * + * @param precision the precision + * + * @return the {@link Context} + */ + public static Context context(int precision) { + return new Context(new MathContext(precision)); + } + + /** + * Creates a {@link Context} with the specified {@link MathContext}. + * + * @param mathContext the {@link MathContext} + * + * @return the {@link Context} + */ + public static Context context(MathContext mathContext) { + return new Context(mathContext); + } + + /** + * Returns the {@link BigFloat} that is this + x. + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param x the value to add + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#add(BigDecimal, MathContext) + */ + public BigFloat add(BigFloat x) { + if (x.isSpecial()) + return x.add(this); + Context c = max(context, x.context); + return c.valueOf(value.add(x.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is this + x. + * + * @param x the value to add + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#add(BigDecimal, MathContext) + */ + public BigFloat add(BigDecimal x) { + return add(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this + x. + * + * @param x the value to add + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#add(BigDecimal, MathContext) + */ + public BigFloat add(int x) { + return add(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this + x. + * + * @param x the value to add + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#add(BigDecimal, MathContext) + */ + public BigFloat add(long x) { + return add(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this + x. + * + * @param x the value to add + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#add(BigDecimal, MathContext) + */ + public BigFloat add(double x) { + return add(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this - x. + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param x the value to subtract + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#subtract(BigDecimal, MathContext) + */ + public BigFloat subtract(BigFloat x) { + if (x.isSpecial()) + return negate(x).add(this); + Context c = max(context, x.context); + return c.valueOf(value.subtract(x.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is this - x. + * + * @param x the value to subtract + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#subtract(BigDecimal, MathContext) + */ + public BigFloat subtract(BigDecimal x) { + return subtract(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this - x. + * + * @param x the value to subtract + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#subtract(BigDecimal, MathContext) + */ + public BigFloat subtract(int x) { + return subtract(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this - x. + * + * @param x the value to subtract + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#subtract(BigDecimal, MathContext) + */ + public BigFloat subtract(long x) { + return subtract(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this - x. + * + * @param x the value to subtract + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#subtract(BigDecimal, MathContext) + */ + public BigFloat subtract(double x) { + return subtract(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this * x. + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param x the value to multiply + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#multiply(BigDecimal, MathContext) + */ + public BigFloat multiply(BigFloat x) { + if (x.isSpecial()) + return x.multiply(this); + Context c = max(context, x.context); + return c.valueOf(value.multiply(x.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is this * x. + * + * @param x the value to multiply + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#multiply(BigDecimal, MathContext) + */ + public BigFloat multiply(BigDecimal x) { + return multiply(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this * x. + * + * @param x the value to multiply + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#multiply(BigDecimal, MathContext) + */ + public BigFloat multiply(int x) { + return multiply(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this * x. + * + * @param x the value to multiply + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#multiply(BigDecimal, MathContext) + */ + public BigFloat multiply(long x) { + return multiply(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this * x. + * + * @param x the value to multiply + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#multiply(BigDecimal, MathContext) + */ + public BigFloat multiply(double x) { + return multiply(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this / x. + * + *

If the two values do not have the same {@link Context}, + * the result will contain the {@link Context} with the larger precision.

+ * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#divide(BigDecimal, MathContext) + */ + public BigFloat divide(BigFloat x) { + if (x.isSpecial()) { + if (x == NaN) { + return NaN; + } else { + return context.valueOf(0); + } + } + if (this.isZero() && !x.isZero()) { + return context.valueOf(0); + } + if (x.isZero()) { + if (this.isZero()) { + return NaN; // 0 or -0 / 0 = NaN + } else if (this.isNegative()) { + return NEGATIVE_INFINITY;// -N / 0 = -INF + } else { + return POSITIVE_INFINITY;// N / 0 = +INF + } + } + + Context c = max(context, x.context); + return c.valueOf(value.divide(x.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is this / x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#divide(BigDecimal, MathContext) + */ + public BigFloat divide(BigDecimal x) { + return divide(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this / x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#divide(BigDecimal, MathContext) + */ + public BigFloat divide(int x) { + return divide(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this / x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#divide(BigDecimal, MathContext) + */ + public BigFloat divide(long x) { + return divide(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this / x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#divide(BigDecimal, MathContext) + */ + public BigFloat divide(double x) { + return divide(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is the remainder when dividing this by x. + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#remainder(BigDecimal, MathContext) + */ + public BigFloat remainder(BigFloat x) { + if (x.isSpecial()) { + if (x == NaN) { + return NaN; + } else { + return this; + } + } + if (this.isZero() && !x.isZero()) { + return context.valueOf(0); + } + if (x.isZero()) { + return NaN; + } + + Context c = max(context, x.context); + return c.valueOf(value.remainder(x.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is the remainder when dividing this by x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#remainder(BigDecimal, MathContext) + */ + public BigFloat remainder(BigDecimal x) { + return remainder(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is the remainder when dividing this by x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#remainder(BigDecimal, MathContext) + */ + public BigFloat remainder(int x) { + return remainder(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is the remainder when dividing this by x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#remainder(BigDecimal, MathContext) + */ + public BigFloat remainder(long x) { + return remainder(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is the remainder when dividing this by x. + * + * @param x the value to divide with + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#remainder(BigDecimal, MathContext) + */ + public BigFloat remainder(double x) { + return remainder(context.valueOf(x)); + } + + /** + * Returns the {@link BigFloat} that is this to the power of y. + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param y the value of the power + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat pow(BigFloat y) { + if (y.isSpecial()) { + if (this.isZero()) { + if (y == POSITIVE_INFINITY) { + return this; + } + if (y == NEGATIVE_INFINITY) { + return POSITIVE_INFINITY; + } + } + if (y == NEGATIVE_INFINITY) { + return context.ZERO; + } + return y; + } + if (this.isZero()) { + if (y.isNegative()) { + return POSITIVE_INFINITY; + } + } + + Context c = max(context, y.context); + return c.valueOf(BigDecimalMath.pow(this.value, y.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is this to the power of y. + * + * @param y the value of the power + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat pow(BigDecimal y) { + return pow(context.valueOf(y)); + } + + /** + * Returns the {@link BigFloat} that is this to the power of y. + * + * @param y the value of the power + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat pow(int y) { + return pow(context.valueOf(y)); + } + + /** + * Returns the {@link BigFloat} that is this to the power of y. + * + * @param y the value of the power + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat pow(long y) { + return pow(context.valueOf(y)); + } + + /** + * Returns the {@link BigFloat} that is this to the power of y. + * + * @param y the value of the power + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat pow(double y) { + return pow(context.valueOf(y)); + } + + /** + * Returns the {@link BigFloat} that is the yth root of this. + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param y the value of the root + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat root(BigFloat y) { + if (y.isSpecial()) + return y; + Context c = max(context, y.context); + return c.valueOf(BigDecimalMath.root(this.value, y.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is the yth root of this. + * + * @param y the value of the root + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat root(BigDecimal y) { + return root(context.valueOf(y)); + } + + /** + * Returns the {@link BigFloat} that is the yth root of this. + * + * @param y the value of the root + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat root(int y) { + return root(context.valueOf(y)); + } + + /** + * Returns the {@link BigFloat} that is the yth root of this. + * + * @param y the value of the root + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat root(long y) { + return root(context.valueOf(y)); + } + + /** + * Returns the {@link BigFloat} that is the yth root of this. + * + * @param y the value of the root + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) + */ + public BigFloat root(double y) { + return root(context.valueOf(y)); + } + + @Override + public int hashCode() { + return value.stripTrailingZeros().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BigFloat other = (BigFloat) obj; + + return value.compareTo(other.value) == 0; + //return Objects.equals(value, other.value) && Objects.equals(context, other.context); + } + + /** + * Returns the signum function of this {@link BigFloat}. + * + * @return -1, 0, or 1 as the value of this {@link BigDecimal} is negative, zero, or positive. + */ + public int signum() { + return value.signum(); + } + + /** + * Returns whether this {@link BigFloat} is negative. + * + * @return true if negative, false if 0 or positive + */ + public boolean isNegative() { + return value.signum() < 0; + } + + /** + * Returns whether this {@link BigFloat} is 0. + * + * @return true if 0, false if negative or positive + */ + public boolean isZero() { + return value.signum() == 0; + } + + /** + * Returns whether this {@link BigFloat} is positive. + * + * @return true if positive, false if 0 or negative + */ + public boolean isPositive() { + return value.signum() > 0; + } + + @Override + public int compareTo(BigFloat other) { + if (other.isSpecial()) { + return -other.compareTo(this); + } + return value.compareTo(other.value); + } + + /** + * Returns whether this value is mathematically equal to the other value. + * + * @param other the other {@link BigFloat} to compare with + * + * @return true if both values are mathematically equal (equivalent to this.compareTo(other) == 0 + * + * @see #compareTo(BigFloat) + */ + public boolean isEqual(BigFloat other) { + if (this == NaN || other == NaN) { + return false; + } + + return compareTo(other) == 0; + } + + /** + * Returns whether this value is mathematically less than to the other value. + * + * @param other the other {@link BigFloat} to compare with + * + * @return true this value is mathematically less than to the other value (equivalent to this.compareTo(other) < 0 + * + * @see #compareTo(BigFloat) + */ + public boolean isLessThan(BigFloat other) { + if (this == NaN || other == NaN) { + return false; + } + + return compareTo(other) < 0; + } + + /** + * Returns whether this value is mathematically greater than to the other value. + * + * @param other the other {@link BigFloat} to compare with + * + * @return true this value is mathematically greater than to the other value (equivalent to this.compareTo(other) > 0 + * + * @see #compareTo(BigFloat) + */ + public boolean isGreaterThan(BigFloat other) { + if (this == NaN || other == NaN) { + return false; + } + + return compareTo(other) > 0; + } + + /** + * Returns whether this value is mathematically less than or equal to the other value. + * + * @param other the other {@link BigFloat} to compare with + * + * @return true this value is mathematically less than or equal to the other value (equivalent to this.compareTo(other) <= 0 + * + * @see #compareTo(BigFloat) + * @see #isLessThan(BigFloat) + * @see #isEqual(BigFloat) + */ + public boolean isLessThanOrEqual(BigFloat other) { + if (this == NaN || other == NaN) { + return false; + } + + return compareTo(other) <= 0; + } + + /** + * Returns whether this value is mathematically greater than or equal to the other value. + * + * @param other the other {@link BigFloat} to compare with + * + * @return true this value is mathematically greater than or equal to the other value (equivalent to this.compareTo(other) >= 0 + * + * @see #compareTo(BigFloat) + * @see #isGreaterThan(BigFloat) + * @see #isEqual(BigFloat) + */ + public boolean isGreaterThanOrEqual(BigFloat other) { + if (this == NaN || other == NaN) { + return false; + } + + return compareTo(other) >= 0; + } + + /** + * Returns whether this value can be represented as int. + * + * @return true if the value can be represented as int value + * + * @see BigDecimalMath#isIntValue(BigDecimal) + */ + public boolean isIntValue() { + return BigDecimalMath.isIntValue(value); + } + + /** + * Returns whether this specified {@link BigDecimal} value can be represented as double. + * + * @return true if the value can be represented as double value + * + * @see BigDecimalMath#isDoubleValue(BigDecimal) + */ + public boolean isDoubleValue() { + return BigDecimalMath.isDoubleValue(value); + } + + /** + * Returns the mantissa of this value written as mantissa * 10exponent. + * + *

The mantissa is defined as having exactly 1 digit before the decimal point.

+ * + * @return the mantissa + * + * @see #getExponent() + * @see BigDecimalMath#mantissa(BigDecimal) + */ + public BigFloat getMantissa() { + return context.valueOf(BigDecimalMath.mantissa(value)); + } + + /** + * Returns the exponent of this value written as mantissa * 10exponent. + * + *

The mantissa is defined as having exactly 1 digit before the decimal point.

+ * + * @return the exponent + * + * @see #getMantissa() + * @see BigDecimalMath#exponent(BigDecimal) + */ + public BigFloat getExponent() { + return context.valueOf(BigDecimalMath.exponent(value)); + } + + /** + * Returns the integral part of this value (left of the decimal point). + * + * @return the integral part + * + * @see #getFractionalPart() + * @see BigDecimalMath#fractionalPart(BigDecimal) + */ + public BigFloat getIntegralPart() { + return context.valueOf(BigDecimalMath.integralPart(value)); + } + + /** + * Returns the fractional part of this value (right of the decimal point). + * + * @return the fractional part + * + * @see #getIntegralPart() + * @see BigDecimalMath#fractionalPart(BigDecimal) + */ + public BigFloat getFractionalPart() { + return context.valueOf(BigDecimalMath.fractionalPart(value)); + } + + /** + * Returns the {@link Context} of this value. + * + * @return the {@link Context} + */ + public Context getContext() { + return context; + } + + /** + * Returns this value as a {@link BigDecimal} value. + * + * @return the {@link BigDecimal} value + */ + public BigDecimal toBigDecimal() { + return value; + } + + /** + * Returns this value as a double value. + * + * @return the double value + * + * @see BigDecimal#doubleValue() + */ + public double toDouble() { + return value.doubleValue(); + } + + /** + * Returns this value as a long value. + * + * @return the long value + * + * @see BigDecimal#longValue() + */ + public long toLong() { + return value.longValue(); + } + + /** + * Returns this value as a int value. + * + * @return the int value + * + * @see BigDecimal#intValue() + */ + public int toInt() { + return value.intValue(); + } + + @Override + public String toString() { + return value.toString(); + } + + protected boolean isSpecial() { + return false; + } + + /** + * return special type of a value + * @return {@link SpecialBigFloat.Type} + */ + protected SpecialBigFloat.Type type() { + return SpecialBigFloat.Type.NORMAL; + } + + public boolean isNaN() { + return this == NaN; + } + + public boolean isInfinity() { + return this == POSITIVE_INFINITY || this == NEGATIVE_INFINITY; + } + + /** + * this class handle unrepresentable value in floating-point arithmetic + * + * @author Wireless4024 + */ + private static final class SpecialBigFloat extends BigFloat { + + private static final Context DUMMY_CONTEXT = BigFloat.context(MathContext.DECIMAL32); + + private final Type type; + + private SpecialBigFloat(Type type) { + super(null, DUMMY_CONTEXT); + this.type = type; + } + + @Override + protected boolean isSpecial() { + return true; + } + + @Override + protected Type type() { + return type; + } + + @Override + public BigFloat add(BigFloat x) { + if (!x.isSpecial()) { + return this; + } + if (this == POSITIVE_INFINITY && x == POSITIVE_INFINITY) { + return POSITIVE_INFINITY; + } + if (this == NEGATIVE_INFINITY && x == NEGATIVE_INFINITY) { + return NEGATIVE_INFINITY; + } + return NaN; + } + + @Override + public BigFloat subtract(BigFloat x) { + if (!x.isSpecial()) { + return this; + } + if (this == POSITIVE_INFINITY && x == NEGATIVE_INFINITY) { + return POSITIVE_INFINITY; + } + if (this == NEGATIVE_INFINITY && x == POSITIVE_INFINITY) { + return NEGATIVE_INFINITY; + } + return NaN; + } + + @Override + public BigFloat subtract(BigDecimal x) { + return this; + } + + @Override + public BigFloat multiply(BigFloat x) { + if (x.isZero() || x == NaN) { + return NaN; + } else if (x.isNegative()) { + return negate(this); + } else { + return this; + } + } + + @Override + public BigFloat divide(BigFloat x) { + if (x == NaN || (this.isInfinity() && x.isInfinity())) { + return NaN; + } else if (x.isNegative()) { + return negate(this); + } else { + return this; + } + } + + @Override + public BigFloat remainder(BigFloat x) { + return NaN; + } + + @Override + public BigFloat pow(BigFloat y) { + if (y.isZero()) { + return y.context.ONE; + } + if (y == NaN) { + return NaN; + } + if (this.isInfinity() && y.isNegative()) { + return y.context.ZERO; + } + if (this == NEGATIVE_INFINITY && y.isPositive()) { + return POSITIVE_INFINITY; + } + return this; + } + + @Override + public BigFloat root(BigFloat y) { + return this; + } + + @Override + public int hashCode() { + return type.hashCode; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + return obj instanceof BigFloat && ((BigFloat) obj).isSpecial() && ((BigFloat) obj).type() == this.type; + } + + @Override + public int signum() { + return type == Type.POSITIVE_INFINITY ? 1 : -1; + } + + @Override + public boolean isNegative() { + return signum() < 0; + } + + @Override + public boolean isZero() { + return false;//nan or infinity is not a zero + } + + @Override + public boolean isPositive() { + return signum() > 0; + } + + @Override + public int compareTo(BigFloat other) { + return Type.compare(type, other.type()); + } + + @Override + public boolean isIntValue() { + return false; + } + + @Override + public boolean isDoubleValue() { + return false; + } + + @Override + public BigFloat getMantissa() { + return this; + } + + @Override + public BigFloat getExponent() { + return this; + } + + @Override + public BigFloat getIntegralPart() { + return this; + } + + @Override + public BigFloat getFractionalPart() { + return this; + } + + @Override + public Context getContext() { + throw new UnsupportedOperationException(type + " has no context"); + } + + @Override + public BigDecimal toBigDecimal() { + throw new UnsupportedOperationException(type + " has no corresponding BigDecimal representation"); + } + + @Override + public double toDouble() { + return type.toDouble(); + } + + @Override + public long toLong() { + return (long) toDouble(); + } + + @Override + public int toInt() { + return (int) toDouble(); + } + + @Override + public String toString() { + return type.toString(); + } + + //optional static + enum Type { + NaN(Objects.hashCode(Double.NaN)), + POSITIVE_INFINITY(Objects.hashCode(Double.POSITIVE_INFINITY)), + NORMAL(Objects.hashCode(0)), + NEGATIVE_INFINITY(Objects.hashCode(Double.NEGATIVE_INFINITY)); + + final int hashCode; + + Type(int hashCode){ + this.hashCode=hashCode; + } + + public static int compare(Type a, Type b) { + //we can use double to compare + //if (a == NaN && b == NaN) + // return 0;//cuz NaN equals nothing even itself + return Double.compare(a.toDouble(),b.toDouble()); + } + + /** + * convert type to double + * @return double value that equivalent to {@link Type} + */ + public double toDouble() { + switch (this) { + case POSITIVE_INFINITY: + return Double.POSITIVE_INFINITY; + case NEGATIVE_INFINITY: + return Double.NEGATIVE_INFINITY; + case NaN: + return Double.NaN; + default: + return 0; + } + } + } + } + + /** + * Manages the {@link MathContext} and provides factory methods for {@link BigFloat} values. + */ + public static class Context implements Serializable{ + private static final long serialVersionUID = -5787473786808803161L; + public final BigFloat NEGATIVE_ONE; + public final BigFloat ZERO; + public final BigFloat ONE; + + private final MathContext mathContext; + + private Context(MathContext mathContext) { + this.mathContext = mathContext; + NEGATIVE_ONE = this.valueOf(-1); + ZERO = this.valueOf(0); + ONE = this.valueOf(1); + } + + /** + * Returns the {@link MathContext} of this context. + * + * @return the {@link MathContext} + */ + public MathContext getMathContext() { + return mathContext; + } + + /** + * Returns the precision of this context. + *

+ * This is equivalent to calling getMathContext().getPrecision(). + * + * @return the precision + */ + public int getPrecision() { + return mathContext.getPrecision(); + } + + /** + * Returns the {@link RoundingMode} of this context. + *

+ * This is equivalent to calling getMathContext().getRoundingMode(). + * + * @return the {@link RoundingMode} + */ + public RoundingMode getRoundingMode() { + return mathContext.getRoundingMode(); + } + + /** + * Creates a {@link BigFloat} value with this context. + * + * @param value the source {@link BigFloat} value + * + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + */ + public BigFloat valueOf(BigFloat value) { + return value.isSpecial() ? value : new BigFloat(value.value.round(mathContext), this);//they are final + } + + /** + * Creates a {@link BigFloat} value with this context. + * + * @param value the source {@link BigDecimal} value + * + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + */ + public BigFloat valueOf(BigDecimal value) { + return new BigFloat(value.round(mathContext), this); + } + + /** + * Creates a {@link BigFloat} value with this context. + * + * @param value the source int value + * + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + */ + public BigFloat valueOf(int value) { + return new BigFloat(new BigDecimal(value, mathContext), this); + } + + /** + * parse unsigned value with this logic

value & 4294967295
+ * @param value an int value + * @param unsigned if true value will parse as unsigned integer + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + */ + public BigFloat valueOf(int value, boolean unsigned) { + if (!unsigned) { + return new BigFloat(new BigDecimal(value, mathContext), this); + } else { + if (value > -1) + return valueOf(value, false); + return new BigFloat(new BigDecimal(Integer.MAX_VALUE) + .add(new BigDecimal(value & Integer.MAX_VALUE)) + .add(BigDecimal.ONE), this); + } + } + + /** + * Creates a {@link BigFloat} value with this context. + * + * @param value the source long value + * + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + */ + public BigFloat valueOf(long value) { + return new BigFloat(new BigDecimal(value, mathContext), this); + } + + /** + * parse unsigned value with this logic
value & 18446744073709551615
+ * @param value an int value + * @param unsigned if true value will parse as unsigned integer + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + */ + public BigFloat valueOf(long value, boolean unsigned) { + if (!unsigned) { + return new BigFloat(new BigDecimal(value, mathContext), this); + } else { + if (value > -1) + return valueOf(value, false); + return new BigFloat(new BigDecimal(Long.MAX_VALUE) + .add(new BigDecimal(value & Long.MAX_VALUE)) + .add(BigDecimal.ONE), this); + } + } + + /** + * Creates a {@link BigFloat} value with this context. + * + * @param value the source double value + * + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + */ + public BigFloat valueOf(double value) { + if (Double.isInfinite(value)) + return value == Double.POSITIVE_INFINITY ? POSITIVE_INFINITY : NEGATIVE_INFINITY; + else if (Double.isNaN(value)) + return NaN; + return new BigFloat(new BigDecimal(String.valueOf(value), mathContext), this); + } + + /** + * Creates a {@link BigFloat} value with this context. + * + * @param value the source String value + * + * @return the {@link BigFloat} value with this context (rounded to the precision of this context) + * + * @throws NumberFormatException if the value is not a valid number. + */ + public BigFloat valueOf(String value) { + return new BigFloat(new BigDecimal(value, mathContext), this); + } + + /** + * Returns the constant pi with this context. + * + * @return pi with this context (rounded to the precision of this context) + * + * @see BigDecimalMath#pi(MathContext) + */ + public BigFloat pi() { + return valueOf(BigDecimalMath.pi(mathContext)); + } + + /** + * Returns the constant e with this context. + * + * @return e with this context (rounded to the precision of this context) + * + * @see BigDecimalMath#e(MathContext) + */ + public BigFloat e() { + return valueOf(BigDecimalMath.e(mathContext)); + } + + /** + * Returns the factorial of n with this context. + * + * @param n the value to calculate + * + * @return the factorial of n with this context (rounded to the precision of this context) + * + * @see BigDecimalMath#factorial(int) + */ + public BigFloat factorial(int n) { + return valueOf(BigDecimalMath.factorial(n)); + } + + @Override + public int hashCode() { + return mathContext.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Context other = (Context) obj; + return mathContext.equals(other.mathContext); + } + + @Override + public String toString() { + return mathContext.toString(); + } + } + /** + * Returns the {@link BigFloat} that is - this. + * + * @param x the value to negate + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#negate(MathContext) + */ + public static BigFloat negate(BigFloat x) { + if (x.isSpecial()) + if (x.isInfinity()) + return x == POSITIVE_INFINITY ? NEGATIVE_INFINITY : POSITIVE_INFINITY; + else + return NaN; + return x.context.valueOf(x.value.negate()); + } + + /** + * Returns the {@link BigFloat} that is the abs(this) (absolute value). + * + * @param x the value to make absolute + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimal#abs(MathContext) + */ + public static BigFloat abs(BigFloat x) { + if (x.isSpecial()) + return x.isInfinity() ? POSITIVE_INFINITY : NaN; + return x.context.valueOf(x.value.abs()); + } + + /** + * Returns the the maximum of two {@link BigFloat} values. + * + * @param value1 the first {@link BigFloat} value to compare + * @param value2 the second {@link BigFloat} value to compare + * + * @return the maximum {@link BigFloat} value + */ + public static BigFloat max(BigFloat value1, BigFloat value2) { + return value1.compareTo(value2) >= 0 ? value1 : value2; + } + + /** + * Returns the the maximum of n {@link BigFloat} values. + * + * @param value1 the first {@link BigFloat} value to compare + * @param values the other {@link BigFloat}s value to compare + * + * @return the maximum {@link BigFloat} value + */ + public static BigFloat max(BigFloat value1, BigFloat... values) { + BigFloat result = value1; + + for (BigFloat other : values) { + result = max(result, other); + } + + return result; + } + + /** + * Returns the the minimum of two {@link BigFloat} values. + * + * @param value1 the first {@link BigFloat} value to compare + * @param value2 the second {@link BigFloat} value to compare + * + * @return the minimum {@link BigFloat} value + */ + public static BigFloat min(BigFloat value1, BigFloat value2) { + return value1.compareTo(value2) < 0 ? value1 : value2; + } + + /** + * Returns the the minimum of n {@link BigFloat} values. + * + * @param value1 the first {@link BigFloat} value to compare + * @param values the other {@link BigFloat}s value to compare + * + * @return the minimum {@link BigFloat} value + */ + public static BigFloat min(BigFloat value1, BigFloat... values) { + BigFloat result = value1; + + for (BigFloat other : values) { + result = min(result, other); + } + + return result; + } + + private static BigFloat logSpecial(BigFloat val){ + if (val.isNaN() || val.isNegative()) + return NaN; + if (val == POSITIVE_INFINITY) + return POSITIVE_INFINITY; + if (val.isZero()) + return NEGATIVE_INFINITY; + return null; + } + + /** + * Returns the {@link BigFloat} that is log(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#log(BigDecimal, MathContext) + */ + public static BigFloat log(BigFloat x) { + BigFloat temp = logSpecial(x); + return temp != null ? temp : x.context.valueOf(BigDecimalMath.log(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is log2(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#log2(BigDecimal, MathContext) + */ + public static BigFloat log2(BigFloat x) { + BigFloat temp = logSpecial(x); + return temp != null ? temp : x.context.valueOf(BigDecimalMath.log2(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is log10(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#log10(BigDecimal, MathContext) + */ + public static BigFloat log10(BigFloat x) { + BigFloat temp = logSpecial(x); + return temp != null ? temp : x.context.valueOf(BigDecimalMath.log10(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is exp(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#exp(BigDecimal, MathContext) + */ + public static BigFloat exp(BigFloat x) { + if(x.isSpecial()) + return x != NEGATIVE_INFINITY ? x : x.context.ZERO; + return x.context.valueOf(BigDecimalMath.exp(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is sqrt(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#sqrt(BigDecimal, MathContext) + */ + public static BigFloat sqrt(BigFloat x) { + if (x.isNaN() || x.isNegative()) + return NaN; + if (x.isZero() || x.isInfinity()) + return x; + return x.context.valueOf(BigDecimalMath.sqrt(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is pow(x, y). + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param x the {@link BigFloat} value to take to the power + * @param y the {@link BigFloat} value to serve as exponent + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public static BigFloat pow(BigFloat x, BigFloat y) { + Context c = max(x.context, y.context); + return c.valueOf(BigDecimalMath.pow(x.value, y.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is root(x, y). + * + *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

+ * + * @param x the {@link BigFloat} value to calculate the n'th root + * @param y the {@link BigFloat} defining the root + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public static BigFloat root(BigFloat x, BigFloat y) { + Context c = max(x.context, y.context); + return c.valueOf(BigDecimalMath.root(x.value, y.value, c.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is sin(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#sin(BigDecimal, MathContext) + */ + public static BigFloat sin(BigFloat x) { + if(x.isSpecial()) + return NaN; + if(x.isZero()) + return x; + return x.context.valueOf(BigDecimalMath.sin(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is cos(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#cos(BigDecimal, MathContext) + */ + public static BigFloat cos(BigFloat x) { + if(x.isSpecial()) + return NaN; + return x.context.valueOf(BigDecimalMath.cos(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is tan(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#tan(BigDecimal, MathContext) + */ + public static BigFloat tan(BigFloat x) { + if(x.isSpecial()) + return NaN; + if(x.isZero()) + return x; + return x.context.valueOf(BigDecimalMath.tan(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is cot(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#cot(BigDecimal, MathContext) + */ + public static BigFloat cot(BigFloat x) { + if(x.isSpecial()) + return x; + if(x.isZero()) + return POSITIVE_INFINITY; + return x.context.valueOf(BigDecimalMath.cot(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is asin(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#asin(BigDecimal, MathContext) + */ + public static BigFloat asin(BigFloat x) { + if (x.isZero()) + return x; + return x.isNaN() || (!isRangeAbs1(x)) ? NaN : + x.context.valueOf(BigDecimalMath.asin(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is acos(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#acos(BigDecimal, MathContext) + */ + public static BigFloat acos(BigFloat x) { + return x.isNaN() || (!isRangeAbs1(x)) ? NaN : + x.context.valueOf(BigDecimalMath.acos(x.value, x.context.mathContext)); + } + + /** + * @param x a bigfloat + * @return if abs(x) <= 1 + */ + private static boolean isRangeAbs1(BigFloat x) { + return isBetween(x.context.NEGATIVE_ONE, x.context.ONE, x); + } + + /** + * Returns the {@link BigFloat} that is atan(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#atan(BigDecimal, MathContext) + */ + public static BigFloat atan(BigFloat x) { + return x.isSpecial() || x.isZero() ? x : x.context.valueOf(BigDecimalMath.atan(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is acot(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#acot(BigDecimal, MathContext) + */ + public static BigFloat acot(BigFloat x) { + return x.isSpecial() ? x : x.context.valueOf(BigDecimalMath.acot(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is sinh(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#sinh(BigDecimal, MathContext) + */ + public static BigFloat sinh(BigFloat x) { + if (x.isSpecial() || x.isZero()) + return x; + return x.context.valueOf(BigDecimalMath.sinh(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is cosh(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#cosh(BigDecimal, MathContext) + */ + public static BigFloat cosh(BigFloat x) { + if (x.isNaN()) + return NaN; + if (x.isInfinity()) + return POSITIVE_INFINITY; + if (x.isZero()) + return x.context.ONE; + return x.context.valueOf(BigDecimalMath.cosh(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is tanh(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#tanh(BigDecimal, MathContext) + */ + public static BigFloat tanh(BigFloat x) { + if (x.isNaN() || x.isZero()) + return x; + if (x.isInfinity()) + return x == POSITIVE_INFINITY ? x.context.ONE : x.context.NEGATIVE_ONE; + return x.context.valueOf(BigDecimalMath.tanh(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is coth(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#coth(BigDecimal, MathContext) + */ + public static BigFloat coth(BigFloat x) { + if(x.isSpecial()) + return x; + return x.context.valueOf(BigDecimalMath.coth(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is asinh(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#asinh(BigDecimal, MathContext) + */ + public static BigFloat asinh(BigFloat x) { + if(x.isSpecial()) + return x; + return x.context.valueOf(BigDecimalMath.asinh(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is acosh(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#acosh(BigDecimal, MathContext) + */ + public static BigFloat acosh(BigFloat x) { + return x.context.valueOf(BigDecimalMath.acosh(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is atanh(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#atanh(BigDecimal, MathContext) + */ + public static BigFloat atanh(BigFloat x) { + if(x.isSpecial()) + return x; + return x.context.valueOf(BigDecimalMath.atanh(x.value, x.context.mathContext)); + } + + /** + * Returns the {@link BigFloat} that is acoth(x). + * + * @param x the value + * + * @return the resulting {@link BigFloat} + * + * @see BigDecimalMath#acoth(BigDecimal, MathContext) + */ + public static BigFloat acoth(BigFloat x) { + if(x.isSpecial()) + return x; + return x.context.valueOf(BigDecimalMath.acoth(x.value, x.context.mathContext)); + } + + public static boolean isBetween(BigFloat min, BigFloat max, BigFloat value) { + return value.compareTo(min) >= 0 && value.compareTo(max) <= 0; + } + + private static Context max(Context left, Context right) { + return left.mathContext.getPrecision() > right.mathContext.getPrecision() ? left : right; + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/BigRational.java b/src/main/java/ch/obermuhlner/math/big/BigRational.java new file mode 100644 index 0000000000..2d7389c7de --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/BigRational.java @@ -0,0 +1,1103 @@ +package ch.obermuhlner.math.big; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.MathContext; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.IntStream; + +/** + * A rational number represented as a quotient of two values. + * + *

Basic calculations with rational numbers (+ - * /) have no loss of precision. + * This allows to use {@link BigRational} as a replacement for {@link BigDecimal} if absolute accuracy is desired.

+ * + *

Wikipedia: Rational number

+ * + *

The values are internally stored as {@link BigDecimal} (for performance optimizations) but represented + * as {@link BigInteger} (for mathematical correctness) + * when accessed with {@link #getNumeratorBigInteger()} and {@link #getDenominatorBigInteger()}.

+ * + *

The following basic calculations have no loss of precision:

+ *
    + *
  • {@link #add(BigRational)}
  • + *
  • {@link #subtract(BigRational)}
  • + *
  • {@link #multiply(BigRational)}
  • + *
  • {@link #divide(BigRational)}
  • + *
  • {@link #pow(int)}
  • + *
+ * + *

The following calculations are special cases of the ones listed above and have no loss of precision:

+ *
    + *
  • {@link #negate()}
  • + *
  • {@link #reciprocal()}
  • + *
  • {@link #increment()}
  • + *
  • {@link #decrement()}
  • + *
+ * + *

Any {@link BigRational} value can be converted into an arbitrary {@link #withPrecision(int) precision} (number of significant digits) + * or {@link #withScale(int) scale} (number of digits after the decimal point).

+ */ +public class BigRational implements Comparable { + + /** + * The value 0 as {@link BigRational}. + */ + public static final BigRational ZERO = new BigRational(0); + /** + * The value 1 as {@link BigRational}. + */ + public static final BigRational ONE = new BigRational(1); + /** + * The value 2 as {@link BigRational}. + */ + public static final BigRational TWO = new BigRational(2); + /** + * The value 10 as {@link BigRational}. + */ + public static final BigRational TEN = new BigRational(10); + + private final BigDecimal numerator; + + private final BigDecimal denominator; + + private BigRational(int value) { + this(BigDecimal.valueOf(value), BigDecimal.ONE); + } + + private BigRational(BigDecimal num, BigDecimal denom) { + BigDecimal n = num; + BigDecimal d = denom; + + if (d.signum() == 0) { + throw new ArithmeticException("Divide by zero"); + } + + if (d.signum() < 0) { + n = n.negate(); + d = d.negate(); + } + + numerator = n; + denominator = d; + } + + /** + * Returns the numerator of this rational number as BigInteger. + * + * @return the numerator as BigInteger + */ + public BigInteger getNumeratorBigInteger() { + return numerator.toBigInteger(); + } + + /** + * Returns the numerator of this rational number as BigDecimal. + * + * @return the numerator as BigDecimal + */ + public BigDecimal getNumerator() { + return numerator; + } + + /** + * Returns the denominator of this rational number as BigInteger. + * + *

Guaranteed to not be 0.

+ *

Guaranteed to be positive.

+ * + * @return the denominator as BigInteger + */ + public BigInteger getDenominatorBigInteger() { + return denominator.toBigInteger(); + } + + /** + * Returns the denominator of this rational number as BigDecimal. + * + *

Guaranteed to not be 0.

+ *

Guaranteed to be positive.

+ * + * @return the denominator as BigDecimal + */ + public BigDecimal getDenominator() { + return denominator; + } + + /** + * Reduces this rational number to the smallest numerator/denominator with the same value. + * + * @return the reduced rational number + */ + public BigRational reduce() { + BigInteger n = numerator.toBigInteger(); + BigInteger d = denominator.toBigInteger(); + + BigInteger gcd = n.gcd(d); + n = n.divide(gcd); + d = d.divide(gcd); + + return valueOf(n, d); + } + + /** + * Returns the integer part of this rational number. + * + *

Examples:

+ *
    + *
  • BigRational.valueOf(3.5).integerPart() returns BigRational.valueOf(3)
  • + *
+ * + * @return the integer part of this rational number + */ + public BigRational integerPart() { + return of(numerator.subtract(numerator.remainder(denominator)), denominator); + } + + /** + * Returns the fraction part of this rational number. + * + *

Examples:

+ *
    + *
  • BigRational.valueOf(3.5).integerPart() returns BigRational.valueOf(0.5)
  • + *
+ * + * @return the fraction part of this rational number + */ + public BigRational fractionPart() { + return of(numerator.remainder(denominator), denominator); + } + + /** + * Negates this rational number (inverting the sign). + * + *

The result has no loss of precision.

+ * + *

Examples:

+ *
    + *
  • BigRational.valueOf(3.5).negate() returns BigRational.valueOf(-3.5)
  • + *
+ * + * @return the negated rational number + */ + public BigRational negate() { + if (isZero()) { + return this; + } + + return of(numerator.negate(), denominator); + } + + /** + * Calculates the reciprocal of this rational number (1/x). + * + *

The result has no loss of precision.

+ * + *

Examples:

+ *
    + *
  • BigRational.valueOf(0.5).reciprocal() returns BigRational.valueOf(2)
  • + *
  • BigRational.valueOf(-2).reciprocal() returns BigRational.valueOf(-0.5)
  • + *
+ * + * @return the reciprocal rational number + * @throws ArithmeticException if this number is 0 (division by zero) + */ + public BigRational reciprocal() { + return of(denominator, numerator); + } + + /** + * Returns the absolute value of this rational number. + * + *

The result has no loss of precision.

+ * + *

Examples:

+ *
    + *
  • BigRational.valueOf(-2).abs() returns BigRational.valueOf(2)
  • + *
  • BigRational.valueOf(2).abs() returns BigRational.valueOf(2)
  • + *
+ * + * @return the absolute rational number (positive, or 0 if this rational is 0) + */ + public BigRational abs() { + return isPositive() ? this : negate(); + } + + /** + * Returns the signum function of this rational number. + * + * @return -1, 0 or 1 as the value of this rational number is negative, zero or positive. + */ + public int signum() { + return numerator.signum(); + } + + /** + * Calculates the increment of this rational number (+ 1). + * + *

This is functionally identical to + * this.add(BigRational.ONE) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @return the incremented rational number + */ + public BigRational increment() { + return of(numerator.add(denominator), denominator); + } + + /** + * Calculates the decrement of this rational number (- 1). + * + *

This is functionally identical to + * this.subtract(BigRational.ONE) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @return the decremented rational number + */ + public BigRational decrement() { + return of(numerator.subtract(denominator), denominator); + } + + /** + * Calculates the addition (+) of this rational number and the specified argument. + * + *

The result has no loss of precision.

+ * + * @param value the rational number to add + * @return the resulting rational number + */ + public BigRational add(BigRational value) { + if (denominator.equals(value.denominator)) { + return of(numerator.add(value.numerator), denominator); + } + + BigDecimal n = numerator.multiply(value.denominator).add(value.numerator.multiply(denominator)); + BigDecimal d = denominator.multiply(value.denominator); + return of(n, d); + } + + private BigRational add(BigDecimal value) { + return of(numerator.add(value.multiply(denominator)), denominator); + } + + /** + * Calculates the addition (+) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.add(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the {@link BigInteger} to add + * @return the resulting rational number + */ + public BigRational add(BigInteger value) { + if (value.equals(BigInteger.ZERO)) { + return this; + } + return add(new BigDecimal(value)); + } + + /** + * Calculates the addition (+) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.add(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the int value to add + * @return the resulting rational number + */ + public BigRational add(int value) { + if (value == 0) { + return this; + } + return add(BigInteger.valueOf(value)); + } + + /** + * Calculates the subtraction (-) of this rational number and the specified argument. + * + *

The result has no loss of precision.

+ * + * @param value the rational number to subtract + * @return the resulting rational number + */ + public BigRational subtract(BigRational value) { + if (denominator.equals(value.denominator)) { + return of(numerator.subtract(value.numerator), denominator); + } + + BigDecimal n = numerator.multiply(value.denominator).subtract(value.numerator.multiply(denominator)); + BigDecimal d = denominator.multiply(value.denominator); + return of(n, d); + } + + private BigRational subtract(BigDecimal value) { + return of(numerator.subtract(value.multiply(denominator)), denominator); + } + + /** + * Calculates the subtraction (-) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.subtract(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the {@link BigInteger} to subtract + * @return the resulting rational number + */ + public BigRational subtract(BigInteger value) { + if (value.equals(BigInteger.ZERO)) { + return this; + } + return subtract(new BigDecimal(value)); + } + + /** + * Calculates the subtraction (-) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.subtract(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the int value to subtract + * @return the resulting rational number + */ + public BigRational subtract(int value) { + if (value == 0) { + return this; + } + return subtract(BigInteger.valueOf(value)); + } + + /** + * Calculates the multiplication (*) of this rational number and the specified argument. + * + *

The result has no loss of precision.

+ * + * @param value the rational number to multiply + * @return the resulting rational number + */ + public BigRational multiply(BigRational value) { + if (isZero() || value.isZero()) { + return ZERO; + } + if (equals(ONE)) { + return value; + } + if (value.equals(ONE)) { + return this; + } + + BigDecimal n = numerator.multiply(value.numerator); + BigDecimal d = denominator.multiply(value.denominator); + return of(n, d); + } + + // private, because we want to hide that we use BigDecimal internally + private BigRational multiply(BigDecimal value) { + BigDecimal n = numerator.multiply(value); + BigDecimal d = denominator; + return of(n, d); + } + + /** + * Calculates the multiplication (*) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.multiply(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the {@link BigInteger} to multiply + * @return the resulting rational number + */ + public BigRational multiply(BigInteger value) { + if (isZero() || value.signum() == 0) { + return ZERO; + } + if (equals(ONE)) { + return valueOf(value); + } + if (value.equals(BigInteger.ONE)) { + return this; + } + + return multiply(new BigDecimal(value)); + } + + /** + * Calculates the multiplication (*) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.multiply(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the int value to multiply + * @return the resulting rational number + */ + public BigRational multiply(int value) { + return multiply(BigInteger.valueOf(value)); + } + + /** + * Calculates the division (/) of this rational number and the specified argument. + * + *

The result has no loss of precision.

+ * + * @param value the rational number to divide (0 is not allowed) + * @return the resulting rational number + * @throws ArithmeticException if the argument is 0 (division by zero) + */ + public BigRational divide(BigRational value) { + if (value.equals(ONE)) { + return this; + } + + BigDecimal n = numerator.multiply(value.denominator); + BigDecimal d = denominator.multiply(value.numerator); + return of(n, d); + } + + private BigRational divide(BigDecimal value) { + BigDecimal n = numerator; + BigDecimal d = denominator.multiply(value); + return of(n, d); + } + + /** + * Calculates the division (/) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.divide(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the {@link BigInteger} to divide (0 is not allowed) + * @return the resulting rational number + * @throws ArithmeticException if the argument is 0 (division by zero) + */ + public BigRational divide(BigInteger value) { + if (value.equals(BigInteger.ONE)) { + return this; + } + + return divide(new BigDecimal(value)); + } + + /** + * Calculates the division (/) of this rational number and the specified argument. + * + *

This is functionally identical to + * this.divide(BigRational.valueOf(value)) + * but slightly faster.

+ * + *

The result has no loss of precision.

+ * + * @param value the int value to divide (0 is not allowed) + * @return the resulting rational number + * @throws ArithmeticException if the argument is 0 (division by zero) + */ + public BigRational divide(int value) { + return divide(BigInteger.valueOf(value)); + } + + /** + * Returns whether this rational number is zero. + * + * @return true if this rational number is zero (0), false if it is not zero + */ + public boolean isZero() { + return numerator.signum() == 0; + } + + private boolean isPositive() { + return numerator.signum() > 0; + } + + /** + * Returns whether this rational number is an integer number without fraction part. + * + * @return true if this rational number is an integer number, false if it has a fraction part + */ + public boolean isInteger() { + return isIntegerInternal() || reduce().isIntegerInternal(); + } + + /** + * Returns whether this rational number is an integer number without fraction part. + * + *

Will return false if this number is not reduced to the integer representation yet (e.g. 4/4 or 4/2)

+ * + * @return true if this rational number is an integer number, false if it has a fraction part + * @see #isInteger() + */ + private boolean isIntegerInternal() { + return denominator.compareTo(BigDecimal.ONE) == 0; + } + + /** + * Calculates this rational number to the power (xy) of the specified argument. + * + *

The result has no loss of precision.

+ * + * @param exponent exponent to which this rational number is to be raised + * @return the resulting rational number + */ + public BigRational pow(int exponent) { + if (exponent == 0) { + return ONE; + } + if (exponent == 1) { + return this; + } + + final BigInteger n; + final BigInteger d; + if (exponent > 0) { + n = numerator.toBigInteger().pow(exponent); + d = denominator.toBigInteger().pow(exponent); + } + else { + n = denominator.toBigInteger().pow(-exponent); + d = numerator.toBigInteger().pow(-exponent); + } + return valueOf(n, d); + } + + /** + * Finds the minimum (smaller) of two rational numbers. + * + * @param value the rational number to compare with + * @return the minimum rational number, either this or the argument value + */ + private BigRational min(BigRational value) { + return compareTo(value) <= 0 ? this : value; + } + + /** + * Finds the maximum (larger) of two rational numbers. + * + * @param value the rational number to compare with + * @return the minimum rational number, either this or the argument value + */ + private BigRational max(BigRational value) { + return compareTo(value) >= 0 ? this : value; + } + + /** + * Returns a rational number with approximatively this value and the specified precision. + * + * @param precision the precision (number of significant digits) of the calculated result, or 0 for unlimited precision + * @return the calculated rational number with the specified precision + */ + public BigRational withPrecision(int precision) { + return valueOf(toBigDecimal(new MathContext(precision))); + } + + /** + * Returns a rational number with approximatively this value and the specified scale. + * + * @param scale the scale (number of digits after the decimal point) of the calculated result + * @return the calculated rational number with the specified scale + */ + public BigRational withScale(int scale) { + return valueOf(toBigDecimal().setScale(scale, RoundingMode.HALF_UP)); + } + + private static int countDigits(BigInteger number) { + double factor = Math.log(2) / Math.log(10); + int digitCount = (int) (factor * number.bitLength() + 1); + if (BigInteger.TEN.pow(digitCount - 1).compareTo(number) > 0) { + return digitCount - 1; + } + return digitCount; + } + + // TODO what is precision of a rational? + private int precision() { + return countDigits(numerator.toBigInteger()) + countDigits(denominator.toBigInteger()); + } + + /** + * Returns this rational number as a double value. + * + * @return the double value + */ + public double toDouble() { + // TODO best accuracy or maybe bigDecimalValue().doubleValue() is better? + return numerator.doubleValue() / denominator.doubleValue(); + } + + /** + * Returns this rational number as a float value. + * + * @return the float value + */ + public float toFloat() { + return numerator.floatValue() / denominator.floatValue(); + } + + /** + * Returns this rational number as a {@link BigDecimal}. + * + * @return the {@link BigDecimal} value + */ + public BigDecimal toBigDecimal() { + int precision = Math.max(precision(), MathContext.DECIMAL128.getPrecision()); + return toBigDecimal(new MathContext(precision)); + } + + /** + * Returns this rational number as a {@link BigDecimal} with the precision specified by the {@link MathContext}. + * + * @param mc the {@link MathContext} specifying the precision of the calculated result + * @return the {@link BigDecimal} + */ + public BigDecimal toBigDecimal(MathContext mc) { + return numerator.divide(denominator, mc); + } + + @Override + public int compareTo(BigRational other) { + if (this == other) { + return 0; + } + return numerator.multiply(other.denominator).compareTo(denominator.multiply(other.numerator)); + } + + @Override + public int hashCode() { + if (isZero()) { + return 0; + } + return numerator.hashCode() + denominator.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (!(obj instanceof BigRational)) { + return false; + } + + BigRational other = (BigRational) obj; + if (!numerator.equals(other.numerator)) { + return false; + } + return denominator.equals(other.denominator); + } + + @Override + public String toString() { + if (isZero()) { + return "0"; + } + if (isIntegerInternal()) { + return numerator.toString(); + } + return toBigDecimal().toString(); + } + + /** + * Returns a plain string representation of this rational number without any exponent. + * + * @return the plain string representation + * @see BigDecimal#toPlainString() + */ + public String toPlainString() { + if (isZero()) { + return "0"; + } + if (isIntegerInternal()) { + return numerator.toPlainString(); + } + return toBigDecimal().toPlainString(); + } + + /** + * Returns the string representation of this rational number in the form "numerator/denominator". + * + *

The resulting string is a valid input of the {@link #valueOf(String)} method.

+ * + *

Examples:

+ *
    + *
  • BigRational.valueOf(0.5).toRationalString() returns "1/2"
  • + *
  • BigRational.valueOf(2).toRationalString() returns "2"
  • + *
  • BigRational.valueOf(4, 4).toRationalString() returns "4/4" (not reduced)
  • + *
+ * + * @return the rational number string representation in the form "numerator/denominator", or "0" if the rational number is 0. + * @see #valueOf(String) + * @see #valueOf(int, int) + */ + public String toRationalString() { + if (isZero()) { + return "0"; + } + if (isIntegerInternal()) { + return numerator.toString(); + } + return numerator + "/" + denominator; + } + + /** + * Returns the string representation of this rational number as integer and fraction parts in the form "integerPart fractionNominator/fractionDenominator". + * + *

The integer part is omitted if it is 0 (when this absolute rational number is smaller than 1).

+ *

The fraction part is omitted it it is 0 (when this rational number is an integer).

+ *

If this rational number is 0, then "0" is returned.

+ * + *

Example: BigRational.valueOf(3.5).toIntegerRationalString() returns "3 1/2".

+ * + * @return the integer and fraction rational string representation + * @see #valueOf(int, int, int) + */ + public String toIntegerRationalString() { + BigDecimal fractionNumerator = numerator.remainder(denominator); + BigDecimal integerNumerator = numerator.subtract(fractionNumerator); + BigDecimal integerPart = integerNumerator.divide(denominator); + + StringBuilder result = new StringBuilder(); + if (integerPart.signum() != 0) { + result.append(integerPart); + } + if (fractionNumerator.signum() != 0) { + if (result.length() > 0) { + result.append(' '); + } + result.append(fractionNumerator.abs()); + result.append('/'); + result.append(denominator); + } + if (result.length() == 0) { + result.append('0'); + } + + return result.toString(); + } + + /** + * Creates a rational number of the specified int value. + * + * @param value the int value + * @return the rational number + */ + public static BigRational valueOf(int value) { + if (value == 0) { + return ZERO; + } + if (value == 1) { + return ONE; + } + return new BigRational(value); + } + + /** + * Creates a rational number of the specified numerator/denominator int values. + * + * @param numerator the numerator int value + * @param denominator the denominator int value (0 not allowed) + * @return the rational number + * @throws ArithmeticException if the denominator is 0 (division by zero) + */ + public static BigRational valueOf(int numerator, int denominator) { + return of(BigDecimal.valueOf(numerator), BigDecimal.valueOf(denominator)); + } + + /** + * Creates a rational number of the specified integer and fraction parts. + * + *

Useful to create numbers like 3 1/2 (= three and a half = 3.5) by calling + * BigRational.valueOf(3, 1, 2).

+ *

To create a negative rational only the integer part argument is allowed to be negative: + * to create -3 1/2 (= minus three and a half = -3.5) call BigRational.valueOf(-3, 1, 2).

+ * + * @param integer the integer part int value + * @param fractionNumerator the fraction part numerator int value (negative not allowed) + * @param fractionDenominator the fraction part denominator int value (0 or negative not allowed) + * @return the rational number + * @throws ArithmeticException if the fraction part denominator is 0 (division by zero), + * or if the fraction part numerator or denominator is negative + */ + public static BigRational valueOf(int integer, int fractionNumerator, int fractionDenominator) { + if (fractionNumerator < 0 || fractionDenominator < 0) { + throw new ArithmeticException("Negative value"); + } + + BigRational integerPart = valueOf(integer); + BigRational fractionPart = valueOf(fractionNumerator, fractionDenominator); + return integerPart.isPositive() ? integerPart.add(fractionPart) : integerPart.subtract(fractionPart); + } + + /** + * Creates a rational number of the specified numerator/denominator BigInteger values. + * + * @param numerator the numerator {@link BigInteger} value + * @param denominator the denominator {@link BigInteger} value (0 not allowed) + * @return the rational number + * @throws ArithmeticException if the denominator is 0 (division by zero) + */ + public static BigRational valueOf(BigInteger numerator, BigInteger denominator) { + return of(new BigDecimal(numerator), new BigDecimal(denominator)); + } + + /** + * Creates a rational number of the specified {@link BigInteger} value. + * + * @param value the {@link BigInteger} value + * @return the rational number + */ + public static BigRational valueOf(BigInteger value) { + if (value.compareTo(BigInteger.ZERO) == 0) { + return ZERO; + } + if (value.compareTo(BigInteger.ONE) == 0) { + return ONE; + } + return valueOf(value, BigInteger.ONE); + } + + /** + * Creates a rational number of the specified double value. + * + * @param value the double value + * @return the rational number + * @throws NumberFormatException if the double value is Infinite or NaN. + */ + public static BigRational valueOf(double value) { + if (value == 0.0) { + return ZERO; + } + if (value == 1.0) { + return ONE; + } + if (Double.isInfinite(value)) { + throw new NumberFormatException("Infinite"); + } + if (Double.isNaN(value)) { + throw new NumberFormatException("NaN"); + } + return valueOf(new BigDecimal(String.valueOf(value))); + } + + /** + * Creates a rational number of the specified {@link BigDecimal} value. + * + * @param value the double value + * @return the rational number + */ + public static BigRational valueOf(BigDecimal value) { + if (value.compareTo(BigDecimal.ZERO) == 0) { + return ZERO; + } + if (value.compareTo(BigDecimal.ONE) == 0) { + return ONE; + } + + int scale = value.scale(); + if (scale == 0) { + return new BigRational(value, BigDecimal.ONE); + } else if (scale < 0) { + BigDecimal n = new BigDecimal(value.unscaledValue()).multiply(BigDecimal.ONE.movePointLeft(value.scale())); + return new BigRational(n, BigDecimal.ONE); + } + else { + BigDecimal n = new BigDecimal(value.unscaledValue()); + BigDecimal d = BigDecimal.ONE.movePointRight(value.scale()); + return new BigRational(n, d); + } + } + + /** + * Creates a rational number of the specified string representation. + * + *

The accepted string representations are:

+ *
    + *
  • Output of {@link BigRational#toString()} : "integerPart.fractionPart"
  • + *
  • Output of {@link BigRational#toRationalString()} : "numerator/denominator"
  • + *
  • Output of toString() of {@link BigDecimal}, {@link BigInteger}, {@link Integer}, ...
  • + *
  • Output of toString() of {@link Double}, {@link Float} - except "Infinity", "-Infinity" and "NaN"
  • + *
+ * + * @param string the string representation to convert + * @return the rational number + * @throws ArithmeticException if the denominator is 0 (division by zero) + */ + public static BigRational valueOf(String string) { + String[] strings = string.split("/"); + BigRational result = valueOfSimple(strings[0]); + for (int i = 1; i < strings.length; i++) { + result = result.divide(valueOfSimple(strings[i])); + } + return result; + } + + private static BigRational valueOfSimple(String string) { + return valueOf(new BigDecimal(string)); + } + + public static BigRational valueOf(boolean positive, String integerPart, String fractionPart, String fractionRepeatPart, String exponentPart) { + BigRational result = ZERO; + + if (fractionRepeatPart != null && fractionRepeatPart.length() > 0) { + BigInteger lotsOfNines = BigInteger.TEN.pow(fractionRepeatPart.length()).subtract(BigInteger.ONE); + result = valueOf(new BigInteger(fractionRepeatPart), lotsOfNines); + } + + if (fractionPart != null && fractionPart.length() > 0) { + result = result.add(valueOf(new BigInteger(fractionPart))); + result = result.divide(BigInteger.TEN.pow(fractionPart.length())); + } + + if (integerPart != null && integerPart.length() > 0) { + result = result.add(new BigInteger(integerPart)); + } + + if (exponentPart != null && exponentPart.length() > 0) { + int exponent = Integer.parseInt(exponentPart); + BigInteger powerOfTen = BigInteger.TEN.pow(Math.abs(exponent)); + result = exponent >= 0 ? result.multiply(powerOfTen) : result.divide(powerOfTen); + } + + if (!positive) { + result = result.negate(); + } + + return result; + } + + /** + * Creates a rational number of the specified numerator/denominator BigDecimal values. + * + * @param numerator the numerator {@link BigDecimal} value + * @param denominator the denominator {@link BigDecimal} value (0 not allowed) + * @return the rational number + * @throws ArithmeticException if the denominator is 0 (division by zero) + */ + public static BigRational valueOf(BigDecimal numerator, BigDecimal denominator) { + return valueOf(numerator).divide(valueOf(denominator)); + } + + private static BigRational of(BigDecimal numerator, BigDecimal denominator) { + if (numerator.signum() == 0 && denominator.signum() != 0) { + return ZERO; + } + if (numerator.compareTo(BigDecimal.ONE) == 0 && denominator.compareTo(BigDecimal.ONE) == 0) { + return ONE; + } + return new BigRational(numerator, denominator); + } + + /** + * Returns the smallest of the specified rational numbers. + * + * @param values the rational numbers to compare + * @return the smallest rational number, 0 if no numbers are specified + */ + public static BigRational min(BigRational... values) { + if (values.length == 0) { + return BigRational.ZERO; + } + BigRational result = values[0]; + for (int i = 1; i < values.length; i++) { + result = result.min(values[i]); + } + return result; + } + + /** + * Returns the largest of the specified rational numbers. + * + * @param values the rational numbers to compare + * @return the largest rational number, 0 if no numbers are specified + * @see #max(BigRational) + */ + public static BigRational max(BigRational... values) { + if (values.length == 0) { + return BigRational.ZERO; + } + BigRational result = values[0]; + for (int i = 1; i < values.length; i++) { + result = result.max(values[i]); + } + return result; + } + + private static List bernoulliCache = new ArrayList<>(); + + /** + * Calculates the Bernoulli number for the specified index. + * + *

This function calculates the first Bernoulli numbers and therefore bernoulli(1) returns -0.5

+ *

Note that bernoulli(x) for all odd x > 1 returns 0

+ *

See: Wikipedia: Bernoulli number

+ * + * @param n the index of the Bernoulli number to be calculated (starting at 0) + * @return the Bernoulli number for the specified index + * @throws ArithmeticException if x is lesser than 0 + */ + public static BigRational bernoulli(int n) { + if (n < 0) { + throw new ArithmeticException("Illegal bernoulli(n) for n < 0: n = " + n); + } + if (n == 1) { + return valueOf(-1, 2); + } else if (n % 2 == 1) { + return ZERO; + } + + synchronized (bernoulliCache) { + int index = n / 2; + + if (bernoulliCache.size() <= index) { + for (int i = bernoulliCache.size(); i <= index; i++) { + BigRational b = calculateBernoulli(i * 2); + bernoulliCache.add(b); + } + } + + return bernoulliCache.get(index); + } + } + + private static BigRational calculateBernoulli(int n) { + return IntStream.rangeClosed(0, n).parallel().mapToObj(k -> { + BigRational jSum = ZERO ; + BigRational bin = ONE ; + for(int j=0 ; j <= k ; j++) { + BigRational jPowN = valueOf(j).pow(n); + if (j % 2 == 0) { + jSum = jSum.add(bin.multiply(jPowN)) ; + } else { + jSum = jSum.subtract(bin.multiply(jPowN)) ; + } + + bin = bin.multiply(valueOf(k-j).divide(valueOf(j+1))); + } + return jSum.divide(valueOf(k+1)); + }).reduce(ZERO, BigRational::add); + } + +} diff --git a/src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java b/src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java new file mode 100644 index 0000000000..d6dca31ecf --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java @@ -0,0 +1,736 @@ +package ch.obermuhlner.math.big; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; +import java.util.*; + +/** + * A wrapper around {@link BigDecimalMath} that passes a current {@link MathContext} to the + * functions that need a {@link MathContext} argument. + * + *

The initial default {@link MathContext} is equivalent to {@link MathContext#DECIMAL128} + * but this can be overridden by setting the following system properties:

+ *
    + *
  • ch.obermuhlner.math.big.default.precision to a positive integer precision (default=34)
  • + *
  • ch.obermuhlner.math.big.default.rounding to a {@link RoundingMode} name (default=HALF_UP)
  • + *
+ * + *

It is also possible to programmatically set the default {@link MathContext} using {@link #setDefaultMathContext(MathContext)}. + * It is recommended to set the desired precision in the {@link MathContext} very early in the startup of the application and to not change it afterwards.

+ * + *

Important: Avoid the pitfall of setting the precision temporarily using {@link #setDefaultMathContext(MathContext)} for a calculation. + * This can lead to race conditions and calculations with the wrong precision + * if other threads in your application do the same thing.

+ * + *

To set a temporary {@link MathContext} you have to choice to use either: + *

    + *
  • DefaultBigDecimalMath.createLocalMathContext() in a try-with-resources statement
  • + *
  • DefaultBigDecimalMath.withLocalMathContext() with a lambda function
  • + *
+ * + * Example code using DefaultBigDecimalMath.createLocalMathContext(): + *
+System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
+try (DefaultBigDecimalMath.LocalMathContext context = DefaultBigDecimalMath.createLocalMathContext(5)) {
+    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
+    try (DefaultBigDecimalMath.LocalMathContext context2 = DefaultBigDecimalMath.createLocalMathContext(10)) {
+        System.out.println("Pi[10]: " + DefaultBigDecimalMath.pi());
+    }
+    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
+}
+System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
+ 
+ * + * Example code using DefaultBigDecimalMath.withLocalMathContext(): + *
+System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
+DefaultBigDecimalMath.withPrecision(5, () -> {
+    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
+    DefaultBigDecimalMath.withPrecision(10, () -> {
+        System.out.println("Pi[10]: " + DefaultBigDecimalMath.pi());
+    });
+    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
+});
+System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
+
+ * + * Both snippets with give the following ouput: + *
+Pi[default]: 3.141592653589793238462643383279503
+Pi[5]: 3.1416
+Pi[10]: 3.141592654
+Pi[5]: 3.1416
+Pi[default]: 3.141592653589793238462643383279503
+
+ *

The temporary {@link MathContext} are stored in {@link ThreadLocal} variables + * and will therefore not conflict with each other when used in multi-threaded use case.

+ * + *

Important: Due to the {@link ThreadLocal} variables the local {@link MathContext} will + * not be available in other threads. + * This includes streams using parallel(), thread pools and manually started threads. + * If you need temporary {@link MathContext} for calculations then you must + * set the local {@link MathContext} inside every separate thread.

+ * + *
+try (DefaultBigDecimalMath.LocalMathContext context = DefaultBigDecimalMath.createLocalMathContext(5)) {
+    BigDecimalStream.range(0.0, 1.0, 0.01, DefaultBigDecimalMath.currentMathContext())
+        .map(b -> DefaultBigDecimalMath.cos(b))
+        .map(b -> "sequential " + Thread.currentThread().getName() + " [5]: " + b)
+        .forEach(System.out::println);
+
+    BigDecimalStream.range(0.0, 1.0, 0.01, DefaultBigDecimalMath.currentMathContext())
+        .parallel()
+        .map(b -> {
+            try (DefaultBigDecimalMath.LocalMathContext context2 = DefaultBigDecimalMath.createLocalMathContext(5)) {
+                return DefaultBigDecimalMath.cos(b);
+            }
+        })
+        .map(b -> "parallel " + Thread.currentThread().getName() + " [5]: " + b)
+        .forEach(System.out::println);
+}
+
+ */ +public class DefaultBigDecimalMath { + + private static MathContext defaultMathContext = createDefaultMathContext(); + private static ThreadLocal> mathContextStack = new ThreadLocal<>(); + + private static MathContext createDefaultMathContext () { + int precision = getIntSystemProperty("ch.obermuhlner.math.big.default.precision", MathContext.DECIMAL128.getPrecision()); + RoundingMode rounding = getRoundingModeSystemProperty("ch.obermuhlner.math.big.default.rounding", MathContext.DECIMAL128.getRoundingMode()); + + return new MathContext(precision, rounding); + } + + private static void pushMathContext(MathContext mathContext) { + Deque mathContexts = mathContextStack.get(); + if (mathContexts == null) { + mathContexts = new ArrayDeque<>(); + mathContextStack.set(mathContexts); + }; + mathContexts.addLast(mathContext); + } + + private static MathContext popMathContext() { + Deque mathContexts = mathContextStack.get(); + MathContext poppedMathContext = mathContexts.removeLast(); + if (mathContexts.isEmpty()) { + mathContextStack.remove(); + } + return poppedMathContext; + } + + private static int getIntSystemProperty(String propertyKey, int defaultValue) { + String propertyValue = System.getProperty(propertyKey, Integer.toString(defaultValue)); + try { + return Integer.parseInt(propertyValue); + } catch(NumberFormatException ex) { + return propertyException(propertyKey,propertyValue,defaultValue); + } + } + + private static RoundingMode getRoundingModeSystemProperty(String propertyKey, RoundingMode defaultValue) { + String propertyValue = System.getProperty(propertyKey, defaultValue.name()); + try { + return RoundingMode.valueOf(propertyValue); + } catch(IllegalArgumentException ex) { + return propertyException(propertyKey,propertyValue,defaultValue); + } + } + + private static T propertyException(String propertyKey,String propertyValue,T defaultValue){ + System.err.println("Property '" + propertyKey + "' is not valid: " + propertyValue + " (using " + defaultValue + " instead)"); + return defaultValue; + } + + /** + * Sets the default {@link MathContext} used if no other {@link MathContext} is defined using {@link #withLocalMathContext(MathContext, Runnable)}. + * + * @param defaultMathContext the default {@link MathContext} + * @see #currentMathContext() + * @see #withLocalMathContext(int, Runnable) + * @see #withLocalMathContext(int, RoundingMode, Runnable) + * @see #withLocalMathContext(MathContext, Runnable) + */ + public static void setDefaultMathContext(MathContext defaultMathContext) { + Objects.requireNonNull(defaultMathContext); + DefaultBigDecimalMath.defaultMathContext = defaultMathContext; + } + + /** + * Returns the default {@link MathContext} used for all mathematical functions in this class. + * + * @return the default {@link MathContext} + */ + public static MathContext getDefaultMathContext() { + return defaultMathContext; + } + + /** + * Executes the given {@link Runnable} using the specified precision. + * + * @param precision the precision to use for calculations in the runnable + * @param runnable the {@link Runnable} to execute + */ + public static void withLocalMathContext(int precision, Runnable runnable) { + withLocalMathContext(new MathContext(precision), runnable); + } + + /** + * Executes the given {@link Runnable} using the specified precision and {@link RoundingMode}. + * + * @param precision the precision to use for calculations in the runnable + * @param roundingMode the {@link RoundingMode} to use for calculations in the runnable + * @param runnable the {@link Runnable} to execute + */ + public static void withLocalMathContext(int precision, RoundingMode roundingMode, Runnable runnable) { + withLocalMathContext(new MathContext(precision, roundingMode), runnable); + } + + /** + * Executes the given {@link Runnable} using the specified {@link MathContext}. + * + * @param mathContext the {@link MathContext} to use for calculations in the runnable + * @param runnable the {@link Runnable} to execute + */ + public static void withLocalMathContext(MathContext mathContext, Runnable runnable) { + try (LocalMathContext context = createLocalMathContext(mathContext)) { + runnable.run(); + } + } + + /** + * Executes the given {@link Runnable} using the specified precision. + * + * @param precision the precision to use for calculations + * @return the created {@link LocalMathContext} to be used in a try-with-resources statement + */ + public static LocalMathContext createLocalMathContext(int precision) { + return createLocalMathContext(new MathContext(precision)); + } + + /** + * Executes the given {@link Runnable} using the specified precision and {@link RoundingMode}. + * + * @param precision the precision to use for calculations + * @param roundingMode the {@link RoundingMode} to use for calculations in the runnable + * @return the created {@link LocalMathContext} to be used in a try-with-resources statement + */ + public static LocalMathContext createLocalMathContext(int precision, RoundingMode roundingMode) { + return createLocalMathContext(new MathContext(precision, roundingMode)); + } + + /** + * Executes the given {@link Runnable} using the specified {@link MathContext}. + * + * @param mathContext the {@link MathContext} to use for calculations + * @return the created {@link LocalMathContext} to be used in a try-with-resources statement + */ + public static LocalMathContext createLocalMathContext(MathContext mathContext) { + return new LocalMathContext(mathContext); + } + + /** + * Returns the current {@link MathContext} used for all mathematical functions in this class. + * + *

The current {@link MathContext} is the last {@link MathContext} specified + * using {@link #withLocalMathContext(MathContext, Runnable)} + * or the default {@link MathContext} if none was specified.

+ * + * @return the current {@link MathContext} + * @see #currentMathContext() + * @see #withLocalMathContext(int, Runnable) + * @see #withLocalMathContext(int, RoundingMode, Runnable) + * @see #withLocalMathContext(MathContext, Runnable) + */ + public static MathContext currentMathContext() { + Deque mathContexts = mathContextStack.get(); + if (mathContexts == null || mathContexts.isEmpty()) { + return defaultMathContext; + } + + return mathContexts.getLast(); + } + + /** + * Rounds the specified {@link BigDecimal} to the precision of the current {@link MathContext}. + * + * @param value the {@link BigDecimal} to round + * @return the rounded {@link BigDecimal} value + * @see #currentMathContext() + * @see BigDecimalMath#round(BigDecimal, MathContext) + */ + public static BigDecimal round(BigDecimal value) { + return BigDecimalMath.round(value, defaultMathContext); + } + + /** + * Rounds the specified {@link BigDecimal} to the precision of the current {@link MathContext} including trailing zeroes. + * + * @param value the {@link BigDecimal} to round + * @return the rounded {@link BigDecimal} value including trailing zeroes + * @see #currentMathContext() + * @see BigDecimalMath#roundWithTrailingZeroes(BigDecimal, MathContext) + */ + public static BigDecimal roundWithTrailingZeroes(BigDecimal value) { + return BigDecimalMath.roundWithTrailingZeroes(value, currentMathContext()); + } + + /** + * Returns the {@link BigDecimal} that is x + y using the current {@link MathContext}. + * + * @param x the x value + * @param y the y value to add + * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimal#add(BigDecimal, MathContext) + */ + public static BigDecimal add(BigDecimal x, BigDecimal y) { + return x.add(y, currentMathContext()); + } + + /** + * Returns the {@link BigDecimal} that is x - y using the current {@link MathContext}. + * + * @param x the x value + * @param y the y value to subtract + * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimal#subtract(BigDecimal, MathContext) + */ + public static BigDecimal subtract(BigDecimal x, BigDecimal y) { + return x.subtract(y, currentMathContext()); + } + + /** + * Returns the {@link BigDecimal} that is x * y using the current {@link MathContext}. + * + * @param x the x value + * @param y the y value to multiply + * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimal#multiply(BigDecimal, MathContext) + */ + public static BigDecimal multiply(BigDecimal x, BigDecimal y) { + return x.multiply(y, currentMathContext()); + } + + /** + * Returns the {@link BigDecimal} that is x / y using the current {@link MathContext}. + * + * @param x the x value + * @param y the y value to divide + * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimal#divide(BigDecimal, MathContext) + */ + public static BigDecimal divide(BigDecimal x, BigDecimal y) { + return x.divide(y, currentMathContext()); + } + + /** + * Returns the {@link BigDecimal} that is x % y using the current {@link MathContext}. + * + * @param x the x value + * @param y the y value to divide + * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimal#remainder(BigDecimal, MathContext) + */ + public static BigDecimal remainder(BigDecimal x, BigDecimal y) { + return x.remainder(y, currentMathContext()); + } + + /** + * Calculates the reciprocal of the specified {@link BigDecimal} using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} + * @return the reciprocal {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#reciprocal(BigDecimal, MathContext) + */ + public static BigDecimal reciprocal(BigDecimal x) { + return BigDecimalMath.reciprocal(x, currentMathContext()); + } + + /** + * Calculates the factorial of the specified {@link BigDecimal} using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} + * @return the factorial {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#factorial(BigDecimal, MathContext) + */ + public static BigDecimal factorial(BigDecimal x) { + return BigDecimalMath.factorial(x, currentMathContext()); + } + + /** + * Calculates the gamma function of the specified {@link BigDecimal} using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} + * @return the gamma {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#gamma(BigDecimal, MathContext) + */ + public static BigDecimal gamma(BigDecimal x) { + return BigDecimalMath.gamma(x, currentMathContext()); + } + + /** + * Calculates the Bernoulli number for the specified index using the current {@link MathContext}. + * + * @param n the index of the Bernoulli number to be calculated (starting at 0) + * @return the Bernoulli number for the specified index with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#bernoulli(int, MathContext) + */ + public static BigDecimal bernoulli(int n) { + return BigDecimalMath.bernoulli(n, currentMathContext()); + } + + /** + * Calculates {@link BigDecimal} x to the power of {@link BigDecimal} y (xy) using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} value to take to the power + * @param y the {@link BigDecimal} value to serve as exponent + * @return the calculated x to the power of y with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) + */ + public static BigDecimal pow(BigDecimal x, BigDecimal y) { + return BigDecimalMath.pow(x, y, currentMathContext()); + } + + /** + * Calculates {@link BigDecimal} x to the power of long y (xy) using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} value to take to the power + * @param y the long value to serve as exponent + * @return the calculated x to the power of y with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#pow(BigDecimal, long, MathContext) + */ + public static BigDecimal pow(BigDecimal x, long y) { + return BigDecimalMath.pow(x, y, currentMathContext()); + } + + /** + * Calculates the square root of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} value to calculate the square root + * @return the calculated square root of x with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#sqrt(BigDecimal, MathContext) + */ + public static BigDecimal sqrt(BigDecimal x) { + return BigDecimalMath.sqrt(x, currentMathContext()); + } + + /** + * Calculates the n'th root of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} value to calculate the n'th root + * @param n the {@link BigDecimal} defining the root + * + * @return the calculated n'th root of x with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) + */ + public static BigDecimal root(BigDecimal x, BigDecimal n) { + return BigDecimalMath.root(x, n, currentMathContext()); + } + + /** + * Calculates the natural logarithm of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the natural logarithm for + * @return the calculated natural logarithm {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#log(BigDecimal, MathContext) + */ + public static BigDecimal log(BigDecimal x) { + return BigDecimalMath.log(x, currentMathContext()); + } + + /** + * Calculates the logarithm of {@link BigDecimal} x to the base 2 using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the logarithm base 2 for + * @return the calculated natural logarithm {@link BigDecimal} to the base 2 with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#log2(BigDecimal, MathContext) + */ + public static BigDecimal log2(BigDecimal x) { + return BigDecimalMath.log2(x, currentMathContext()); + } + + /** + * Calculates the logarithm of {@link BigDecimal} x to the base 10 using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the logarithm base 10 for + * @return the calculated natural logarithm {@link BigDecimal} to the base 10 with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#log10(BigDecimal, MathContext) + */ + public static BigDecimal log10(BigDecimal x) { + return BigDecimalMath.log10(x, currentMathContext()); + } + + /** + * Returns the number pi using the current {@link MathContext}. + * + * @return the number pi with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#pi(MathContext) + */ + public static BigDecimal pi() { + return BigDecimalMath.pi(currentMathContext()); + } + + /** + * Returns the number e using the current {@link MathContext}. + * + * @return the number e with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#e(MathContext) + */ + public static BigDecimal e() { + return BigDecimalMath.e(currentMathContext()); + } + + /** + * Calculates the natural exponent of {@link BigDecimal} x (ex) using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the exponent for + * @return the calculated exponent {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#exp(BigDecimal, MathContext) + */ + public static BigDecimal exp(BigDecimal x) { + return BigDecimalMath.exp(x, currentMathContext()); + } + + /** + * Calculates the sine (sinus) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the sine for + * @return the calculated sine {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#sin(BigDecimal, MathContext) + */ + public static BigDecimal sin(BigDecimal x) { + return BigDecimalMath.sin(x, currentMathContext()); + } + + /** + * Calculates the arc sine (inverted sine) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc sine for + * @return the calculated arc sine {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#asin(BigDecimal, MathContext) + */ + public static BigDecimal asin(BigDecimal x) { + return BigDecimalMath.asin(x, currentMathContext()); + } + + /** + * Calculates the cosine (cosinus) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the cosine for + * @return the calculated cosine {@link BigDecimal} with the precision specified in the current {@link MathContext} + */ + public static BigDecimal cos(BigDecimal x) { + return BigDecimalMath.cos(x, currentMathContext()); + } + + /** + * Calculates the arc cosine (inverted cosine) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc cosine for + * @return the calculated arc sine {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#acos(BigDecimal, MathContext) + */ + public static BigDecimal acos(BigDecimal x) { + return BigDecimalMath.acos(x, currentMathContext()); + } + + /** + * Calculates the tangens of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the tangens for + * @return the calculated tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#tan(BigDecimal, MathContext) + */ + public static BigDecimal tan(BigDecimal x) { + return BigDecimalMath.tan(x, currentMathContext()); + } + + /** + * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc tangens for + * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#atan(BigDecimal, MathContext) + */ + public static BigDecimal atan(BigDecimal x) { + return BigDecimalMath.atan(x, currentMathContext()); + } + + /** + * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} y / x in the range -pi to pi using the current {@link MathContext}. + * + * @param y the {@link BigDecimal} + * @param x the {@link BigDecimal} + * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see #atan2(BigDecimal, BigDecimal) + */ + public static BigDecimal atan2(BigDecimal y, BigDecimal x) { + return BigDecimalMath.atan2(y, x, currentMathContext()); + } + + /** + * Calculates the cotangens of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the cotangens for + * @return the calculated cotanges {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#cot(BigDecimal, MathContext) + */ + public static BigDecimal cot(BigDecimal x) { + return BigDecimalMath.cot(x, currentMathContext()); + } + + /** + * Calculates the inverse cotangens (arc cotangens) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc cotangens for + * @return the calculated arc cotangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#acot(BigDecimal, MathContext) + */ + public static BigDecimal acot(BigDecimal x) { + return BigDecimalMath.acot(x, currentMathContext()); + } + + /** + * Calculates the hyperbolic sine of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the hyperbolic sine for + * @return the calculated hyperbolic sine {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#sinh(BigDecimal, MathContext) + */ + public static BigDecimal sinh(BigDecimal x) { + return BigDecimalMath.sinh(x, currentMathContext()); + } + + /** + * Calculates the hyperbolic cosine of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the hyperbolic cosine for + * @return the calculated hyperbolic cosine {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#cosh(BigDecimal, MathContext) + */ + public static BigDecimal cosh(BigDecimal x) { + return BigDecimalMath.cosh(x, currentMathContext()); + } + + /** + * Calculates the hyperbolic tangens of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the hyperbolic tangens for + * @return the calculated hyperbolic tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#tanh(BigDecimal, MathContext) + */ + public static BigDecimal tanh(BigDecimal x) { + return BigDecimalMath.tanh(x, currentMathContext()); + } + + /** + * Calculates the hyperbolic cotangens of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the hyperbolic cotangens for + * @return the calculated hyperbolic cotangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#coth(BigDecimal, MathContext) + */ + public static BigDecimal coth(BigDecimal x) { + return BigDecimalMath.coth(x, currentMathContext()); + } + + /** + * Calculates the arc hyperbolic sine (inverse hyperbolic sine) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic sine for + * @return the calculated arc hyperbolic sine {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#asinh(BigDecimal, MathContext) + */ + public static BigDecimal asinh(BigDecimal x) { + return BigDecimalMath.asinh(x, currentMathContext()); + } + + /** + * Calculates the arc hyperbolic cosine (inverse hyperbolic cosine) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic cosine for + * @return the calculated arc hyperbolic cosine {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#acosh(BigDecimal, MathContext) + */ + public static BigDecimal acosh(BigDecimal x) { + return BigDecimalMath.acosh(x, currentMathContext()); + } + + /** + * Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for + * @return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#atanh(BigDecimal, MathContext) + */ + public static BigDecimal atanh(BigDecimal x) { + return BigDecimalMath.atanh(x, currentMathContext()); + } + + /** + * Calculates the arc hyperbolic cotangens (inverse hyperbolic cotangens) of {@link BigDecimal} x using the current {@link MathContext}. + * + * @param x the {@link BigDecimal} to calculate the arc hyperbolic cotangens for + * @return the calculated arc hyperbolic cotangens {@link BigDecimal} with the precision specified in the current {@link MathContext} + * @see #currentMathContext() + * @see BigDecimalMath#acoth(BigDecimal, MathContext) + */ + public static BigDecimal acoth(BigDecimal x) { + return BigDecimalMath.acoth(x, currentMathContext()); + } + + /** + * The local context used to push and pop a {@link MathContext} on the stack. + * + *

The recommended way to use this class is to use the try-with-resources.

+ */ + public static class LocalMathContext implements AutoCloseable { + public final MathContext mathContext; + + LocalMathContext(MathContext mathContext) { + this.mathContext = mathContext; + pushMathContext(mathContext); + } + + @Override + public void close() { + popMathContext(); + } + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java new file mode 100644 index 0000000000..f8bcd4837b --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java @@ -0,0 +1,46 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +import ch.obermuhlner.math.big.BigRational; + +/** + * Calculates arc sinus using the Maclaurin series. + * + *

See Wikipedia: Taylorreihe

+ * + *

No argument checking or optimizations are done. + * This implementation is not intended to be called directly.

+ */ +public class AsinCalculator extends SeriesCalculator { + + public static final AsinCalculator INSTANCE = new AsinCalculator(); + + private int n = 0; + private BigRational factorial2n = BigRational.ONE; + private BigRational factorialN = BigRational.ONE; + private BigRational fourPowerN = BigRational.ONE; + + private AsinCalculator() { + } + + @Override + protected BigRational getCurrentFactor() { + BigRational factor = factorial2n.divide(fourPowerN.multiply(factorialN).multiply(factorialN).multiply(2 * n + 1)); + return factor; + } + + @Override + protected void calculateNextFactor() { + n++; + factorial2n = factorial2n.multiply(2 * n - 1).multiply(2 * n); + factorialN = factorialN.multiply(n); + fourPowerN = fourPowerN.multiply(4); + } + + @Override + protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { + return new PowerTwoNPlusOneIterator(x, mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java new file mode 100644 index 0000000000..a2f844a094 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java @@ -0,0 +1,40 @@ +package ch.obermuhlner.math.big.internal; + +import ch.obermuhlner.math.big.BigRational; + +import java.math.BigDecimal; +import java.math.MathContext; + +/** + * Calculates sinus hyperbolicus using the Taylor series. + * + *

See Wikipedia: Taylor series

+ * + *

No argument checking or optimizations are done. + * This implementation is not intended to be called directly.

+ */ +public class AtanhCalculator extends SeriesCalculator { + + public static final AtanhCalculator INSTANCE = new AtanhCalculator(); + + private int n = 0; + + private AtanhCalculator() { + super(true); + } + + @Override + protected BigRational getCurrentFactor() { + return BigRational.valueOf(1, 2 * n + 1); + } + + @Override + protected void calculateNextFactor() { + n++; + } + + @Override + protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { + return new PowerTwoNPlusOneIterator(x, mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java new file mode 100644 index 0000000000..bf9edbd691 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java @@ -0,0 +1,48 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +import ch.obermuhlner.math.big.BigRational; + +/** + * Calculates cosinus using the Maclaurin series. + * + *

See Wikipedia: Taylorreihe

+ * + *

No argument checking or optimizations are done. + * This implementation is not intended to be called directly.

+ */ +public class CosCalculator extends SeriesCalculator { + + public static final CosCalculator INSTANCE = new CosCalculator(); + + private int n = 0; + private boolean negative = false; + private BigRational factorial2n = BigRational.ONE; + + private CosCalculator() { + super(true); + } + + @Override + protected BigRational getCurrentFactor() { + BigRational factor = factorial2n.reciprocal(); + if (negative) { + factor = factor.negate(); + } + return factor; + } + + @Override + protected void calculateNextFactor() { + n++; + factorial2n = factorial2n.multiply(2 * n - 1).multiply(2 * n); + negative = !negative; + } + + @Override + protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { + return new PowerTwoNIterator(x, mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java new file mode 100644 index 0000000000..f22631e8ae --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java @@ -0,0 +1,43 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +import ch.obermuhlner.math.big.BigRational; + +/** + * Calculates cosinus hyperbolicus using the Taylor series. + * + *

See Wikipedia: Taylor series

+ * + *

No argument checking or optimizations are done. + * This implementation is not intended to be called directly.

+ */ +public class CoshCalculator extends SeriesCalculator { + + public static final CoshCalculator INSTANCE = new CoshCalculator(); + + private int n = 0; + + private BigRational factorial2n = BigRational.ONE; + + private CoshCalculator() { + super(true); + } + + @Override + protected BigRational getCurrentFactor() { + return factorial2n.reciprocal(); + } + + @Override + protected void calculateNextFactor() { + n++; + factorial2n = factorial2n.multiply(2 * n - 1).multiply(2 * n); + } + + @Override + protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { + return new PowerTwoNIterator(x, mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java new file mode 100644 index 0000000000..16c6e6ac21 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java @@ -0,0 +1,42 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +import ch.obermuhlner.math.big.BigRational; + +/** + * Calculates exp using the Maclaurin series. + * + *

See Wikipedia: Taylorreihe

+ * + *

No argument checking or optimizations are done. + * This implementation is not intended to be called directly.

+ */ +public class ExpCalculator extends SeriesCalculator { + + public static final ExpCalculator INSTANCE = new ExpCalculator(); + + private int n = 0; + private BigRational oneOverFactorialOfN = BigRational.ONE; + + private ExpCalculator() { + // prevent instances + } + + @Override + protected BigRational getCurrentFactor() { + return oneOverFactorialOfN; + } + + @Override + protected void calculateNextFactor() { + n++; + oneOverFactorialOfN = oneOverFactorialOfN.divide(n); + } + + @Override + protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { + return new PowerNIterator(x, mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java new file mode 100644 index 0000000000..def0f5f7ef --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java @@ -0,0 +1,28 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; + +/** + * Iterator over the powers of a value x. + * + *

This API allows to efficiently calculate the various powers of x in a taylor series by storing intermediate results.

+ *

For example xn can be calculated using one multiplication by storing the previously calculated xn-1 and x.

+ * + *

{@link #getCurrentPower()} will be called first to retrieve the initial value.

+ * + * For later iterations {@link #calculateNextPower()} will be called before {@link #getCurrentPower()}. + */ +public interface PowerIterator { + + /** + * Returns the current power. + * + * @return the current power. + */ + BigDecimal getCurrentPower(); + + /** + * Calculates the next power. + */ + void calculateNextPower(); +} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java new file mode 100644 index 0000000000..d6ef34e01e --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java @@ -0,0 +1,33 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +/** + * {@link PowerIterator} to calculate xn. + */ +public class PowerNIterator implements PowerIterator { + + private final BigDecimal x; + + private final MathContext mathContext; + + private BigDecimal powerOfX; + + public PowerNIterator(BigDecimal x, MathContext mathContext) { + this.x = x; + this.mathContext = mathContext; + + powerOfX = BigDecimal.ONE; + } + + @Override + public BigDecimal getCurrentPower() { + return powerOfX; + } + + @Override + public void calculateNextPower() { + powerOfX = powerOfX.multiply(x, mathContext); + } +} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java new file mode 100644 index 0000000000..839d617e16 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java @@ -0,0 +1,33 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +/** + * {@link PowerIterator} to calculate x2*n. + */ +public class PowerTwoNIterator implements PowerIterator { + + private final MathContext mathContext; + + private final BigDecimal xPowerTwo; + + private BigDecimal powerOfX; + + public PowerTwoNIterator(BigDecimal x, MathContext mathContext) { + this.mathContext = mathContext; + + xPowerTwo = x.multiply(x, mathContext); + powerOfX = BigDecimal.ONE; + } + + @Override + public BigDecimal getCurrentPower() { + return powerOfX; + } + + @Override + public void calculateNextPower() { + powerOfX = powerOfX.multiply(xPowerTwo, mathContext); + } +} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java new file mode 100644 index 0000000000..15ad0168c0 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java @@ -0,0 +1,35 @@ +package ch.obermuhlner.math.big.internal; + +import ch.obermuhlner.math.big.BigDecimalMath; + +import java.math.BigDecimal; +import java.math.MathContext; + +/** + * {@link PowerIterator} to calculate x2*n-1. + */ +public class PowerTwoNMinusOneIterator implements PowerIterator { + + private final MathContext mathContext; + + private final BigDecimal xPowerTwo; + + private BigDecimal powerOfX; + + public PowerTwoNMinusOneIterator(BigDecimal x, MathContext mathContext) { + this.mathContext = mathContext; + + xPowerTwo = x.multiply(x, mathContext); + powerOfX = BigDecimalMath.reciprocal(x, mathContext); + } + + @Override + public BigDecimal getCurrentPower() { + return powerOfX; + } + + @Override + public void calculateNextPower() { + powerOfX = powerOfX.multiply(xPowerTwo, mathContext); + } +} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java new file mode 100644 index 0000000000..57afa97634 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java @@ -0,0 +1,33 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +/** + * {@link PowerIterator} to calculate x2*n+1. + */ +public class PowerTwoNPlusOneIterator implements PowerIterator { + + private final MathContext mathContext; + + private final BigDecimal xPowerTwo; + + private BigDecimal powerOfX; + + public PowerTwoNPlusOneIterator(BigDecimal x, MathContext mathContext) { + this.mathContext = mathContext; + + xPowerTwo = x.multiply(x, mathContext); + powerOfX = x; + } + + @Override + public BigDecimal getCurrentPower() { + return powerOfX; + } + + @Override + public void calculateNextPower() { + powerOfX = powerOfX.multiply(xPowerTwo, mathContext); + } +} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java new file mode 100644 index 0000000000..117c2737d2 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java @@ -0,0 +1,127 @@ +package ch.obermuhlner.math.big.internal; + +import ch.obermuhlner.math.big.BigRational; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.util.ArrayList; +import java.util.List; + +import static java.util.Objects.requireNonNull; + +/** + * Utility class to calculate taylor series efficiently until the maximum error (as defined by the precision in the {@link MathContext} is reached. + * + *

Stores the factors of the taylor series terms so that future calculations will be faster.

+ */ +public abstract class SeriesCalculator { + + private final boolean calculateInPairs; + + private final List factors = new ArrayList<>(); + + /** + * Constructs a {@link SeriesCalculator} that calculates single terms. + */ + protected SeriesCalculator() { + this(false); + } + + /** + * Constructs a {@link SeriesCalculator} with control over whether the sum terms are calculated in pairs. + * + *

Calculation of pairs is useful for taylor series where the terms alternate the sign. + * In these cases it is more efficient to calculate two terms at once check then whether the acceptable error has been reached.

+ * + * @param calculateInPairs true to calculate the terms in pairs, false to calculate single terms + */ + protected SeriesCalculator(boolean calculateInPairs) { + this.calculateInPairs = calculateInPairs; + } + + /** + * Calculates the series for the specified value x and the precision defined in the {@link MathContext}. + * + * @param x the value x + * @param mathContext the {@link MathContext} + * @return the calculated result + */ + public BigDecimal calculate(BigDecimal x, MathContext mathContext) { + BigDecimal acceptableError = BigDecimal.ONE.movePointLeft(mathContext.getPrecision() + 1); + + PowerIterator powerIterator = createPowerIterator(x, mathContext); + + BigDecimal sum = BigDecimal.ZERO; + BigDecimal step; + int i = 0; + do { + BigRational factor; + BigDecimal xToThePower; + + factor = getFactor(i); + xToThePower = powerIterator.getCurrentPower(); + powerIterator.calculateNextPower(); + step = factor.getNumerator().multiply(xToThePower).divide(factor.getDenominator(), mathContext); + i++; + + if (calculateInPairs) { + factor = getFactor(i); + xToThePower = powerIterator.getCurrentPower(); + powerIterator.calculateNextPower(); + BigDecimal step2 = factor.getNumerator().multiply(xToThePower).divide(factor.getDenominator(), mathContext); + step = step.add(step2); + i++; + } + + sum = sum.add(step); + //System.out.println(sum + " " + step); + } while (step.abs().compareTo(acceptableError) > 0); + + return sum.round(mathContext); + } + + /** + * Creates the {@link PowerIterator} used for this series. + * + * @param x the value x + * @param mathContext the {@link MathContext} + * @return the {@link PowerIterator} + */ + protected abstract PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext); + + /** + * Returns the factor of the term with specified index. + * + * All mutable state of this class (and all its subclasses) must be modified in this method. + * This method is synchronized to allow thread-safe usage of this class. + * + * @param index the index (starting with 0) + * @return the factor of the specified term + */ + protected synchronized BigRational getFactor(int index) { + while (factors.size() <= index) { + BigRational factor = getCurrentFactor(); + addFactor(factor); + calculateNextFactor(); + } + return factors.get(index); + } + + private void addFactor(BigRational factor){ + factors.add(requireNonNull(factor, "Factor cannot be null")); + } + + /** + * Returns the factor of the highest term already calculated. + *

When called for the first time will return the factor of the first term (index 0).

+ *

After this call the method {@link #calculateNextFactor()} will be called to prepare for the next term.

+ * + * @return the factor of the highest term + */ + protected abstract BigRational getCurrentFactor(); + + /** + * Calculates the factor of the next term. + */ + protected abstract void calculateNextFactor(); +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java new file mode 100644 index 0000000000..471074fd6b --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java @@ -0,0 +1,49 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +import ch.obermuhlner.math.big.BigRational; + +/** + * Calculates sinus using the Maclaurin series. + * + *

See Wikipedia: Taylorreihe

+ * + *

No argument checking or optimizations are done. + * This implementation is not intended to be called directly.

+ */ +public class SinCalculator extends SeriesCalculator { + + public static final SinCalculator INSTANCE = new SinCalculator(); + + private int n = 0; + private boolean negative = false; + private BigRational factorial2nPlus1 = BigRational.ONE; + + private SinCalculator() { + super(true); + } + + @Override + protected BigRational getCurrentFactor() { + BigRational factor = factorial2nPlus1.reciprocal(); + if (negative) { + factor = factor.negate(); + } + return factor; + } + + @Override + protected void calculateNextFactor() { + n++; + factorial2nPlus1 = factorial2nPlus1.multiply(2 * n); + factorial2nPlus1 = factorial2nPlus1.multiply(2 * n + 1); + negative = !negative; + } + + @Override + protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { + return new PowerTwoNPlusOneIterator(x, mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java new file mode 100644 index 0000000000..9601735755 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java @@ -0,0 +1,44 @@ +package ch.obermuhlner.math.big.internal; + +import java.math.BigDecimal; +import java.math.MathContext; + +import ch.obermuhlner.math.big.BigRational; + +/** + * Calculates sinus hyperbolicus using the Taylor series. + * + *

See Wikipedia: Taylor series

+ * + *

No argument checking or optimizations are done. + * This implementation is not intended to be called directly.

+ */ +public class SinhCalculator extends SeriesCalculator { + + public static final SinhCalculator INSTANCE = new SinhCalculator(); + + private int n = 0; + + private BigRational factorial2nPlus1 = BigRational.ONE; + + private SinhCalculator() { + super(true); + } + + @Override + protected BigRational getCurrentFactor() { + return factorial2nPlus1.reciprocal(); + } + + @Override + protected void calculateNextFactor() { + n++; + factorial2nPlus1 = factorial2nPlus1.multiply(2 * n); + factorial2nPlus1 = factorial2nPlus1.multiply(2 * n + 1); + } + + @Override + protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { + return new PowerTwoNPlusOneIterator(x, mathContext); + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java b/src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java new file mode 100644 index 0000000000..05a45fd846 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java @@ -0,0 +1,219 @@ +package ch.obermuhlner.math.big.stream; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.util.Comparator; +import java.util.Spliterator; +import java.util.Spliterators.AbstractSpliterator; +import java.util.function.Consumer; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import ch.obermuhlner.math.big.BigDecimalMath; + +/** + * Provides constructor methods for streams of {@link BigDecimal} elements. + */ +public class BigDecimalStream { + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. + * + *

An equivalent sequence of increasing values can be produced + * sequentially using a {@code for} loop as follows: + *

for (BigDecimal i = startInclusive; i.compareTo(endExclusive) < 0; i = i.add(step, mathContext)) {
+    // ...
+}
+ * + * @param startInclusive the (inclusive) initial value + * @param endExclusive the exclusive upper bound + * @param step the step between elements + * @param mathContext the {@link MathContext} used for all mathematical operations + * @return a sequential {@code Stream} + */ + public static Stream range(BigDecimal startInclusive, BigDecimal endExclusive, BigDecimal step, MathContext mathContext) { + if (step.signum() == 0) { + throw new IllegalArgumentException("invalid step: 0"); + } + if (endExclusive.subtract(startInclusive).signum() != step.signum()) { + return Stream.empty(); + } + return StreamSupport.stream(new BigDecimalSpliterator(startInclusive, endExclusive, false, step, mathContext), false); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. + * + *

The {@code long} arguments are converted using {@link BigDecimal#valueOf(long)}.

+ * + * @param startInclusive the (inclusive) initial value + * @param endExclusive the exclusive upper bound + * @param step the step between elements + * @param mathContext the {@link MathContext} used for all mathematical operations + * @return a sequential {@code Stream} + * @see #range(BigDecimal, BigDecimal, BigDecimal, MathContext) + */ + public static Stream range(long startInclusive, long endExclusive, long step, MathContext mathContext) { + return range(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endExclusive), BigDecimal.valueOf(step), mathContext); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. + * + *

The {@code double} arguments are converted using {@link BigDecimal#valueOf(double)}.

+ * + * @param startInclusive the (inclusive) initial value + * @param endExclusive the exclusive upper bound + * @param step the step between elements + * @param mathContext the {@link MathContext} used for all mathematical operations + * @return a sequential {@code Stream} + * @see #range(BigDecimal, BigDecimal, BigDecimal, MathContext) + */ + public static Stream range(double startInclusive, double endExclusive, double step, MathContext mathContext) { + return range(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endExclusive), BigDecimal.valueOf(step), mathContext); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. + * + *

An equivalent sequence of increasing values can be produced + * sequentially using a {@code for} loop as follows: + *

for (BigDecimal i = startInclusive; i.compareTo(endInclusive) <= 0; i = i.add(step, mathContext)) {
+    // ...
+}
+ * + * @param startInclusive the (inclusive) initial value + * @param endInclusive the inclusive upper bound + * @param step the step between elements + * @param mathContext the {@link MathContext} used for all mathematical operations + * @return a sequential {@code Stream} + * @see #range(BigDecimal, BigDecimal, BigDecimal, MathContext) + */ + public static Stream rangeClosed(BigDecimal startInclusive, BigDecimal endInclusive, BigDecimal step, MathContext mathContext) { + if (step.signum() == 0) { + throw new IllegalArgumentException("invalid step: 0"); + } + if (endInclusive.subtract(startInclusive).signum() == -step.signum()) { + return Stream.empty(); + } + return StreamSupport.stream(new BigDecimalSpliterator(startInclusive, endInclusive, true, step, mathContext), false); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. + * + *

The {@code long} arguments are converted using {@link BigDecimal#valueOf(long)}.

+ * + * @param startInclusive the (inclusive) initial value + * @param endInclusive the inclusive upper bound + * @param step the step between elements + * @param mathContext the {@link MathContext} used for all mathematical operations + * @return a sequential {@code Stream} + * @see #rangeClosed(BigDecimal, BigDecimal, BigDecimal, MathContext) + */ + public static Stream rangeClosed(long startInclusive, long endInclusive, long step, MathContext mathContext) { + return rangeClosed(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endInclusive), BigDecimal.valueOf(step), mathContext); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. + * + *

The {@code double} arguments are converted using {@link BigDecimal#valueOf(double)}.

+ * + * @param startInclusive the (inclusive) initial value + * @param endInclusive the inclusive upper bound + * @param step the step between elements + * @param mathContext the {@link MathContext} used for all mathematical operations + * @return a sequential {@code Stream} + * @see #rangeClosed(BigDecimal, BigDecimal, BigDecimal, MathContext) + */ + public static Stream rangeClosed(double startInclusive, double endInclusive, double step, MathContext mathContext) { + return rangeClosed(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endInclusive), BigDecimal.valueOf(step), mathContext); + } + + private static class BigDecimalSpliterator extends AbstractSpliterator { + + private BigDecimal value; + private BigDecimal step; + private long count; + private MathContext mathContext; + + public BigDecimalSpliterator(BigDecimal startInclusive, BigDecimal step, long count, MathContext mathContext) { + super(count, + Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED | Spliterator.SORTED); + + this.value = startInclusive; + this.step = step; + this.count = count; + this.mathContext = mathContext; + } + + public BigDecimalSpliterator(BigDecimal startInclusive, BigDecimal end, boolean inclusive, BigDecimal step, MathContext mathContext) { + this(startInclusive, step, estimatedCount(startInclusive, end, inclusive, step, mathContext), mathContext); + } + + private static long estimatedCount(BigDecimal startInclusive, BigDecimal end, boolean inclusive, BigDecimal step, MathContext mathContext) { + BigDecimal count = end.subtract(startInclusive).divide(step, mathContext); + long result = count.longValue(); + if (BigDecimalMath.fractionalPart(count).signum() != 0) { + result++; + } else { + if (inclusive) { + result++; + } + } + return result; + } + + @Override + public Comparator getComparator() { + if (step.signum() < 0) { + return Comparator.reverseOrder(); + } + return null; + } + + @Override + public boolean tryAdvance(Consumer action) { + if (count == 0) { + return false; + } + + action.accept(value); + value = value.add(step, mathContext); + count--; + return true; + } + + @Override + public void forEachRemaining(Consumer action) { + while (count > 0) { + action.accept(value); + value = value.add(step, mathContext); + count--; + } + } + + @Override + public Spliterator trySplit() { + long firstHalfCount = count / 2; + + if (firstHalfCount == 0) { + return null; + } + + long secondHalfCount = count - firstHalfCount; + + count = firstHalfCount; + BigDecimal startSecondHalf = value.add(step.multiply(new BigDecimal(firstHalfCount), mathContext), mathContext); + + return new BigDecimalSpliterator(startSecondHalf, step, secondHalfCount, mathContext); + } + } +} diff --git a/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java b/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java new file mode 100644 index 0000000000..1c982302a6 --- /dev/null +++ b/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java @@ -0,0 +1,214 @@ +package ch.obermuhlner.math.big.stream; + +import java.util.Comparator; +import java.util.Spliterator; +import java.util.Spliterators.AbstractSpliterator; +import java.util.function.Consumer; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import ch.obermuhlner.math.big.BigFloat; +import ch.obermuhlner.math.big.BigFloat.Context; + +/** + * Provides constructor methods for streams of {@link BigFloat} elements. + */ +public class BigFloatStream { + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. + * + *

An equivalent sequence of increasing values can be produced + * sequentially using a {@code for} loop as follows: + *

for (BigFloat i = startInclusive; i.isLessThan(endExclusive); i = i.add(step)) {
+    // ...
+}
+ * + * @param startInclusive the (inclusive) initial value + * @param endExclusive the exclusive upper bound + * @param step the step between elements + * @return a sequential {@code Stream} + */ + public static Stream range(BigFloat startInclusive, BigFloat endExclusive, BigFloat step) { + if (step.isZero()) { + throw new IllegalArgumentException("invalid step: 0"); + } + if (endExclusive.subtract(startInclusive).signum() != step.signum()) { + return Stream.empty(); + } + return StreamSupport.stream(new BigFloatSpliterator(startInclusive, endExclusive, false, step), false); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. + * + *

{@link Context#valueOf(long)} is used to convert the {@code long} values.

+ * + * @param startInclusive the (inclusive) initial value + * @param endExclusive the exclusive upper bound + * @param step the step between elements + * @param context the {@link Context} used to convert the {@code long} values + * @return a sequential {@code Stream} + * @see #range(BigFloat, BigFloat, BigFloat) + */ + public static Stream range(long startInclusive, long endExclusive, long step, Context context) { + return range(context.valueOf(startInclusive), context.valueOf(endExclusive), context.valueOf(step)); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. + * + *

{@link Context#valueOf(double)} is used to convert the {@code double} values.

+ * + * @param startInclusive the (inclusive) initial value + * @param endExclusive the exclusive upper bound + * @param step the step between elements + * @param context the {@link Context} used to convert the {@code double} values + * @return a sequential {@code Stream} + * @see #range(BigFloat, BigFloat, BigFloat) + */ + public static Stream range(double startInclusive, double endExclusive, double step, Context context) { + return range(context.valueOf(startInclusive), context.valueOf(endExclusive), context.valueOf(step)); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. + * + *

An equivalent sequence of increasing values can be produced + * sequentially using a {@code for} loop as follows: + *

for (BigFloat i = startInclusive; i.isLessThanOrEqual(endInclusive); i = i.add(step)) {
+    //...
+}
+
+ * + * @param startInclusive the (inclusive) initial value + * @param endInclusive the inclusive upper bound + * @param step the step between elements + * @return a sequential {@code Stream} + */ + public static Stream rangeClosed(BigFloat startInclusive, BigFloat endInclusive, BigFloat step) { + if (step.isZero()) { + throw new IllegalArgumentException("invalid step: 0"); + } + if (endInclusive.subtract(startInclusive).signum() == -step.signum()) { + return Stream.empty(); + } + return StreamSupport.stream(new BigFloatSpliterator(startInclusive, endInclusive, true, step), false); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. + * + *

{@link Context#valueOf(long)} is used to convert the {@code long} values.

+ * + * @param startInclusive the (inclusive) initial value + * @param endInclusive the inclusive upper bound + * @param step the step between elements + * @param context the {@link Context} used to convert the {@code long} values + * @return a sequential {@code Stream} + * @see #rangeClosed(BigFloat, BigFloat, BigFloat) + */ + public static Stream rangeClosed(long startInclusive, long endInclusive, long step, Context context) { + return rangeClosed(context.valueOf(startInclusive), context.valueOf(endInclusive), context.valueOf(step)); + } + + /** + * Returns a sequential ordered {@code Stream} from {@code startInclusive} + * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. + * + *

{@link Context#valueOf(double)} is used to convert the {@code double} values.

+ * + * @param startInclusive the (inclusive) initial value + * @param endInclusive the inclusive upper bound + * @param step the step between elements + * @param context the {@link Context} used to convert the {@code double} values + * @return a sequential {@code Stream} + * @see #rangeClosed(BigFloat, BigFloat, BigFloat) + */ + public static Stream rangeClosed(double startInclusive, double endInclusive, double step, Context context) { + return rangeClosed(context.valueOf(startInclusive), context.valueOf(endInclusive), context.valueOf(step)); + } + + private static class BigFloatSpliterator extends AbstractSpliterator { + + private BigFloat value; + private BigFloat step; + private long count; + + public BigFloatSpliterator(BigFloat startInclusive, BigFloat step, long count) { + super(count, + Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED | Spliterator.SORTED); + + this.value = startInclusive; + this.step = step; + this.count = count; + } + + public BigFloatSpliterator(BigFloat startInclusive, BigFloat end, boolean inclusive, BigFloat step) { + this(startInclusive, step, estimatedCount(startInclusive, end, inclusive, step)); + } + + private static long estimatedCount(BigFloat startInclusive, BigFloat end, boolean inclusive, BigFloat step) { + BigFloat count = end.subtract(startInclusive).divide(step); + long result = count.toLong(); + if (count.getFractionalPart().signum() != 0) { + result++; + } else { + if (inclusive) { + result++; + } + } + return result; + } + + @Override + public Comparator getComparator() { + if (step.signum() < 0) { + return Comparator.reverseOrder(); + } + return null; + } + + @Override + public boolean tryAdvance(Consumer action) { + if (count == 0) { + return false; + } + + action.accept(value); + value = value.add(step); + count--; + return true; + } + + @Override + public void forEachRemaining(Consumer action) { + while (count > 0) { + action.accept(value); + value = value.add(step); + count--; + } + } + + @Override + public Spliterator trySplit() { + long firstHalfCount = count / 2; + + if (firstHalfCount == 0) { + return null; + } + + long secondHalfCount = count - firstHalfCount; + + count = firstHalfCount; + BigFloat startSecondHalf = value.add(step.multiply(firstHalfCount)); + + return new BigFloatSpliterator(startSecondHalf, step, secondHalfCount); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index 333747d632..32db2caed9 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -74,18 +74,18 @@ public class GtppAtomLoader implements Runnable{ TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100),AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index a712dc2c39..ad22f5123b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -9,6 +9,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.util.DoubleCount.add; import static com.github.technus.tectech.util.DoubleCount.sub; @@ -331,12 +333,12 @@ public final class cElementalInstanceStackMap implements Comparable entry.getValue().amount < 1); + map.entrySet().removeIf(entry -> entry.getValue().amount < AVOGADRO_CONSTANT_UNCERTAINTY); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index 2a441150f7..2aa6bb9711 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; +import ch.obermuhlner.math.big.BigFloat; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; @@ -11,10 +12,12 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.DoubleCount.*; +import static java.lang.Math.min; import static java.lang.Math.ulp; /** @@ -189,9 +192,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } if(definition.usesMultipleDecayCalls(energy)){ double amountTemp=amount; - long decayCnt=(long) Math.min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); + long decayCnt=(long) min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); double amountPer= div(amount,decayCnt); amount= sub(amount,amountPer*(--decayCnt)); + //todo decay mechanics should handle splitting! cElementalInstanceStackMap output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(output==null){ amount=amountTemp; @@ -233,8 +237,27 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { //Use to get direct decay output providing correct decay array private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + if(lifeTime<1){ + throw new ArithmeticException("Value would be too big..."); + } double decayInverseRatio=Math.pow(2D,1D/* 1 second *//lifeTime); - double newAmount= div(amount,decayInverseRatio+ulp(decayInverseRatio)); + double newAmount,decayedAmount; + if(decayInverseRatio>0.99999999D){ + //todo cache this... + BigFloat dir=BigFloat.context(50).valueOf(2).pow(1D/* 1 second *//lifeTime); + BigFloat na=BigFloat.context(50).valueOf(amount).divide(dir); + newAmount=na.toDouble(); + if(newAmount>=amount) { + decayedAmount=BigFloat.context(50).valueOf(amount).subtract(na).toDouble(); + newAmount=amount-ulp(amount); + }else { + decayedAmount=amount-newAmount; + } + }else{ + newAmount= div(amount,decayInverseRatio); + decayedAmount=amount-newAmount; + } + //if(definition.getSymbol().startsWith("U ")) { // System.out.println("newAmount = " + newAmount); // System.out.println("amountRemaining = " + amountRemaining); @@ -245,18 +268,20 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { // } // } //} - //if(newAmount==amount) {//no longer needed - // return null;//nothing decayed - //} else if(newAmount<=0) {//no longer needed - // return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); - //}//no longer needed + if(newAmount==amount) { + return null;//nothing decayed + } else if(newAmount<1) { + return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + } //split to non decaying and decaying part double amount=this.amount; - this.amount= sub(this.amount,newAmount); + this.amount= decayedAmount; cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); this.amount=newAmount; - products.putUnify(clone()); + if(products!=null){ + products.putUnify(clone()); + } this.amount=amount; return products; } @@ -411,7 +436,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { if(instance.energy>maxEnergy){ maxEnergy=instance.energy; } - lifeTimeMul = Math.min(lifeTimeMul, instance.lifeTimeMult); + lifeTimeMul = min(lifeTimeMul, instance.lifeTimeMult); age = Math.max(age, instance.age); } } @@ -421,12 +446,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } double wholeParts=Math.floor(energyTotal); - energyTotal=Math.min(energyTotal-wholeParts,1D)+(wholeParts>=0?-0.11709966304863834D:0.11709966304863834D); + energyTotal= min(energyTotal-wholeParts,1D)+(wholeParts>=0?-0.11709966304863834D:0.11709966304863834D); long energy=(long) wholeParts + ((energyTotal > TecTech.RANDOM.nextDouble()) ? 1 : 0); if(energy*energyTotal<0){ energy=0; } - setEnergy(Math.min(maxEnergy,energy)); + setEnergy(min(maxEnergy,energy)); return this; } @@ -468,7 +493,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { lines.add("ENERGY = " + energy); } if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) { - lines.add("AMOUNT = " + amount); + lines.add("AMOUNT = " + amount/ AVOGADRO_CONSTANT +" mol"); } scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); } @@ -537,6 +562,6 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { @Override public String toString() { - return definition.getName()+ '\n' + definition.getSymbol() + '\n' + amount + '\n' + getMass(); + return definition.toString() + '\n' + amount/ AVOGADRO_CONSTANT + " mol\n" + getMass(); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java index 0061550ace..51025148a7 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java @@ -127,4 +127,9 @@ public abstract class cElementalDefinition extends iElementalDefinition { } return hash; } + + @Override + public String toString() { + return getName()+ '\n' + getSymbol(); + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java index 24ae8d0481..964baff155 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java @@ -17,8 +17,9 @@ import static com.github.technus.tectech.thing.item.DebugElementalInstanceContai * Created by Tec on 26.05.2017. */ public class bTransformationInfo { - public static final double AVOGADRO_CONSTANT =6.02214076e23D; - public static final double AVOGADRO_CONSTANT_144 =AVOGADRO_CONSTANT*144D; + public static final double AVOGADRO_CONSTANT =6.02214076e23D;//CUBE LOL XD + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =1/6.02214076e23D;//CUBE LOL XD + public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; public static final HashMap fluidQuantization=new HashMap<>(32); public static final HashMap itemQuantization=new HashMap<>(32); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index b1801b9b25..b990adef15 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -1564,16 +1564,16 @@ public final class dAtomDefinition extends cElementalDefinition { TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86),AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90),AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95),AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); try { dAtomDefinition temp; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 6b5f41f1c1..6b9e56bbf1 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -465,7 +465,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public static void setTransformations(){ //Added to atom map, but should be in its own - cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000*AVOGADRO_CONSTANT_144); + cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); bTransformationInfo.oredictQuantization.put( OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), 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 8e9266f060..6850b24e0f 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 @@ -142,10 +142,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(iElementalDefinition defintion: STACKS_REGISTERED){ - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,AVOGADRO_CONSTANT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT_144),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,AVOGADRO_CONSTANT_144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+AVOGADRO_CONSTANT*1000),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,AVOGADRO_CONSTANT*1000)))); + for(iElementalDefinition definition: STACKS_REGISTERED){ + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 144 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_144)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT *1000)))); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 139b203551..10bd099366 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -208,7 +208,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public int getMaxStacksCount() { - return mTier * 16; + return mTier * 128; } public double getMaxStackSize() { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 825b07f289..e0398a8fcb 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -368,7 +368,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07*AVOGADRO_CONSTANT);//mass diff + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* AVOGADRO_CONSTANT);//mass diff MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; STARTUP_COST = -heliumPlasmaValue * 10000; KEEPUP_COST = -heliumPlasmaValue; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index a46c407325..37e121dd26 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -50,7 +50,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10*AVOGADRO_CONSTANT; + public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT; private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 558ae03e67..40e2942bab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -88,7 +88,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; ticks =Math.max(20,(1<<(12-desiredTier))*20); - maxCapacity= dAtomDefinition.getSomethingHeavy().getMass()*(2< Date: Sun, 19 Jul 2020 08:26:15 +0100 Subject: Implement Tesla Global List And then when I do it with lists the way Bart suggested it, I have Tec tell me to rewrite everything using interfaces --- .../technus/tectech/loader/TecTechConfig.java | 3 - .../tectech/thing/cover/GT_Cover_TM_TeslaCoil.java | 1 - .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 310 +++++++++------------ .../single/GT_MetaTileEntity_TeslaCoil.java | 56 ++-- 4 files changed, 145 insertions(+), 225 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index 030be65f3b..ae9da94b02 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -28,7 +28,6 @@ public class TecTechConfig extends ConfigManager { public int TESLA_MULTI_LOSS_PER_BLOCK_T1; public int TESLA_MULTI_LOSS_PER_BLOCK_T2; public float TESLA_MULTI_OVERDRIVE_LOSS_FACTOR; - public int TESLA_MULTI_SCAN_RANGE;//TODO delete public boolean TESLA_MULTI_GAS_OUTPUT; public int TESLA_SINGLE_LOSS_PER_BLOCK; public float TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR; @@ -54,7 +53,6 @@ public class TecTechConfig extends ConfigManager { TESLA_MULTI_LOSS_PER_BLOCK_T1 = 1; TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1; TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = 0.25F; - TESLA_MULTI_SCAN_RANGE = 40; TESLA_MULTI_GAS_OUTPUT = false; TESLA_SINGLE_LOSS_PER_BLOCK = 1; TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = 0.25F; @@ -93,7 +91,6 @@ public class TecTechConfig extends ConfigManager { TESLA_MULTI_LOSS_PER_BLOCK_T1 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T1, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using helium or nitrogen plasma"); TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T2, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using radon plasma"); TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaMultiOverdriveLossFactor", "Balance Tweaks", TESLA_MULTI_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Tower power loss per amp as a factor of the tier voltage"); - TESLA_MULTI_SCAN_RANGE = _mainConfig.getInt("TeslaMultiScanRange", "Balance Tweaks", TESLA_MULTI_SCAN_RANGE, 4, 256, "The horizontal radius scanned by the Tesla Tower"); TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean("TeslaMultiMoltenOutput", "Balance Tweaks", TESLA_MULTI_GAS_OUTPUT, "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio"); TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt("TeslaSingleLossPerBlock", "Balance Tweaks", TESLA_SINGLE_LOSS_PER_BLOCK, 0, Integer.MAX_VALUE, "Tesla Transceiver power transmission loss per block per amp"); TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaSingleOverdriveLossFactor", "Balance Tweaks", TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage"); diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java index 8be875ff4f..6442ba51b6 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.cover; import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 7d12302477..eca70ca63f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -48,8 +48,7 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.Util.entriesSortedByValues; import static gregtech.api.enums.GT_Values.E; -import static java.lang.Math.max; -import static java.lang.Math.min; +import static java.lang.Math.*; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { @@ -61,7 +60,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final int[] plasmaTierLoss = new int[]{TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T0, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T1, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T2}; private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F; - private static final int scanRangeXZ = TecTech.configTecTech.TESLA_MULTI_SCAN_RANGE;//Default is 40 private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false //Face icons @@ -73,12 +71,12 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs, so the tesla takes a second to 'cool' any plasma it would output as a gas - public static final HashSet teslaNodeSet = new HashSet<>(); //Targets for power transmission //TODO Make this fill more efficently and globally + public static final HashSet teslaNodeSet = new HashSet<>(); //Targets for power transmission private final HashSet sparkList = new HashSet<>(); //Thaumcraft lighting coordinate pairs, so we can send them in bursts and save on lag - private final Map eTeslaMap = new HashMap<>(); //Targets for power transmission + private Map teslaNodeMap = new HashMap<>(); //Targets for power transmission private final ArrayList eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps - private int scanTime = 0; //Scan timer used for tesla search intervals //TODO Replace with something that fetches from a global map + private int sortTime = 0; //Scan timer used for tesla search intervals private long energyCapacity = 0; //Total energy storage limited by capacitors private long outputVoltageMax = 0; //Tesla voltage output limited by capacitors @@ -88,11 +86,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //Prevents unnecessary offset calculation, saving on lag private byte oldRotation = -1; private byte oldOrientation = -1; - - //Coordinate Arrays - private final Vec3Impl[] scanPosOffsets = new Vec3Impl[10]; - private Vec3Impl posZap = Vec3Impl.NULL_VECTOR;//Location of the bottom middle of the tower, used as the power transfer origin - public Vec3Impl posTop = Vec3Impl.NULL_VECTOR;//Location of the center of the sphere on top of the tower, used as theThaumcraft lightning origin + //Location of the center of the sphere on top of the tower, used as the Thaumcraft lightning and origin + public Vec3Impl posTop = Vec3Impl.NULL_VECTOR; //endregion //region structure @@ -128,8 +123,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //endregion //region parameters - protected Parameters.Group.ParameterIn popogaSetting, histLowSetting, histHighSetting, transferRadiusTowerSetting, transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting, outputCurrentSetting, scanTimeMinSetting, overDriveSetting; - protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay, transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, scanTimeDisplay; + protected Parameters.Group.ParameterIn popogaSetting, histLowSetting, histHighSetting, transferRadiusTowerSetting, transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting, outputCurrentSetting, sortTimeMinSetting, overDriveSetting; + protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay, transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, sortTimeDisplay; private static final INameFunction HYSTERESIS_LOW_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0");//Hysteresis low setting private static final INameFunction HYSTERESIS_HIGH_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1");//Hysteresis high setting @@ -294,37 +289,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return 1F * plasmaBoost; } - private void scanForTransmissionTargets(Vec3Impl coordsMin, Vec3Impl coordsMax) { - //This makes sure the minimums are actually smaller than the maximums - int xMin = min(coordsMin.get0(), coordsMax.get0()); - int yMin = min(coordsMin.get1(), coordsMax.get1()); - int zMin = min(coordsMin.get2(), coordsMax.get2()); - //And vice versa - int xMax = max(coordsMin.get0(), coordsMax.get0()); - int yMax = max(coordsMin.get1(), coordsMax.get1()); - int zMax = max(coordsMin.get2(), coordsMax.get2()); - - for (int xPos = xMin; xPos <= xMax; xPos++) { - for (int yPos = yMin; yPos <= yMax; yPos++) { - for (int zPos = zMin; zPos <= zMax; zPos++) { - if (xPos == 0 && yPos == 0 && zPos == 0) { - continue; - } - IGregTechTileEntity node = getBaseMetaTileEntity().getIGregTechTileEntityOffset(xPos, yPos, zPos); - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil || - nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive() || - (node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil)) { - eTeslaMap.put(node, (int) Math.ceil(Math.sqrt(Math.pow(xPos, 2) + Math.pow(yPos, 2) + Math.pow(zPos, 2)))); - } - } - } - } - } - - } - private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { byte xR = (byte) (node.getXCoord() - posTop.get0()); byte yR = (byte) (node.getYCoord() - posTop.get1()); @@ -405,26 +369,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock oldOrientation = iGregTechTileEntity.getFrontFacing(); //Calculate coordinates of the middle bottom - posZap = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(getBaseMetaTileEntity()); + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(getBaseMetaTileEntity()); //Calculate coordinates of the top sphere posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(getBaseMetaTileEntity()); - - //Calculate offsets for scanning - scanPosOffsets[0] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, 0, scanRangeXZ + 3)); - scanPosOffsets[1] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -4, -1 * scanRangeXZ + 3)); - - scanPosOffsets[2] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -5, scanRangeXZ + 3)); - scanPosOffsets[3] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -8, -1 * scanRangeXZ + 3)); - - scanPosOffsets[4] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -9, scanRangeXZ + 3)); - scanPosOffsets[5] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -12, -1 * scanRangeXZ + 3)); - - scanPosOffsets[6] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -13, scanRangeXZ + 3)); - scanPosOffsets[7] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -16, -1 * scanRangeXZ + 3)); - - scanPosOffsets[8] = getExtendedFacing().getWorldOffset(new Vec3Impl(scanRangeXZ, -17, scanRangeXZ + 3)); - scanPosOffsets[9] = getExtendedFacing().getWorldOffset(new Vec3Impl(-1 * scanRangeXZ, -20, -1 * scanRangeXZ + 3)); } return true; } @@ -442,7 +390,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock !transferRadiusCoverUltimateSetting.getStatus(false).isOk || !outputVoltageSetting.getStatus(false).isOk || !outputCurrentSetting.getStatus(false).isOk || - !scanTimeMinSetting.getStatus(false).isOk || + !sortTimeMinSetting.getStatus(false).isOk || !overDriveSetting.getStatus(false).isOk ) return false; @@ -558,7 +506,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock popogaSetting = hatch_5.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); popogaSetting = hatch_6.makeInParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); popogaSetting = hatch_6.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - scanTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS); + sortTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS); popogaSetting = hatch_7.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); overDriveSetting = hatch_8.makeInParameter(0, 0, OVERDRIVE_SETTING_NAME, OVERDRIVE_STATUS); popogaSetting = hatch_8.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); @@ -579,7 +527,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock energyCapacityDisplay = hatch_5.makeOutParameter(1, 0, ENERGY_CAPACITY_DISPLAY_NAME, ENERGY_STATUS); energyStoredDisplay = hatch_6.makeOutParameter(0, 0, ENERGY_STORED_DISPLAY_NAME, ENERGY_STATUS); energyFractionDisplay = hatch_6.makeOutParameter(1, 0, ENERGY_FRACTION_DISPLAY_NAME, ENERGY_STATUS); - scanTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS); + sortTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS); popogaDisplay = hatch_7.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); popogaDisplay = hatch_8.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); popogaDisplay = hatch_8.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); @@ -621,120 +569,135 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } } - @Override - public boolean onRunningTick(ItemStack aStack) { - IGregTechTileEntity mte = getBaseMetaTileEntity(); - //Hysteresis based ePowerPass setting - long energyStored = getEUVar(); - float energyFrac = (float) energyStored / energyCapacity; + public static Map generateTeslaNodeMap(IGregTechTileEntity orgin){ + Map generatedNodeMap = new HashMap<>(); + IMetaTileEntity orginInside = orgin.getMetaTileEntity(); + int orginX; + int orginY; + int orginZ; + if (orginInside instanceof GT_MetaTileEntity_TM_teslaCoil) { + GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) orginInside; + orginX = teslaTower.posTop.get0(); + orginY = teslaTower.posTop.get1(); + orginZ = teslaTower.posTop.get2(); + } else { + orginX = orgin.getXCoord(); + orginY = orgin.getYCoord(); + orginZ = orgin.getZCoord(); + } - energyCapacityDisplay.set(energyCapacity); - energyStoredDisplay.set(energyStored); - energyFractionDisplay.set(energyFrac); + for (IGregTechTileEntity node : teslaNodeSet) { + if (node == null) { + //Technically, the Tesla Covers do not remove themselves from the list and this is the code that does + teslaNodeSet.remove(null); + continue; + } else if (node == orgin || orgin.getWorld().provider.dimensionId != node.getWorld().provider.dimensionId) { + //Skip if looking at myself and skip if not in the same dimention + //TODO, INTERDIM? + continue; + } - if (!ePowerPass && energyFrac > histHighSetting.get()) { - ePowerPass = true; - } else if (ePowerPass && energyFrac < histLowSetting.get()) { - ePowerPass = false; + //Makes the target coordinates the center of the sphere of the tower if it has one + IMetaTileEntity nodeInside = node.getMetaTileEntity(); + int targetX; + int targetY; + int targetZ; + if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil) { + GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; + targetX = teslaTower.posTop.get0(); + targetY = teslaTower.posTop.get1(); + targetZ = teslaTower.posTop.get2(); + } else { + targetX = node.getXCoord(); + targetY = node.getYCoord(); + targetZ = node.getZCoord(); + } + + //Find the xyz offsets and calculate the distance between us and the target + int xPosOffset = targetX - orginX; + int yPosOffset = targetY - orginY; + int zPosOffset = targetZ - orginZ; + int distance = (int) ceil(sqrt(pow(xPosOffset, 2) + pow(yPosOffset, 2) + pow(zPosOffset, 2))); + //Thought we need abs here, we don't. An Integer to the power of two is going to be either 0 or positive. + //We also can just put stuff here without further checks, as we always check the next section + generatedNodeMap.put(node, distance); } + return generatedNodeMap; + } + + public static Map cleanTeslaNodeMap(Map nodeMap, IGregTechTileEntity orgin) { + IMetaTileEntity orginInside = orgin.getMetaTileEntity(); + //Assumes that if the orgin is not a Tesla Tower, it mus be a single block. + boolean isMulti = orginInside instanceof GT_MetaTileEntity_TM_teslaCoil; - //Clean the eTeslaMap - for (Map.Entry Rx : eTeslaMap.entrySet()) { + for (Map.Entry Rx : nodeMap.entrySet()) { + //All the checks need to pass or the target gets removed from the transmission list IGregTechTileEntity node = Rx.getKey(); + //Null check if (node != null) { IMetaTileEntity nodeInside = node.getMetaTileEntity(); + //We need this in a try catch, just as a precaution that a chunk had unloaded or a machine was removed try { + //Is it an Active Tesla Tower with at least some energy capacity? + //Singles and Multis can send power here, so we don't check if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) { GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; if (teslaTower.maxEUStore() > 0) { continue; } - } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { + //Is it a Tesla Transceiver with at least one battery? + //Only multis can send power to singles + } else if (isMulti && nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { GT_MetaTileEntity_TeslaCoil teslaTransceiver = (GT_MetaTileEntity_TeslaCoil) nodeInside; if (teslaTransceiver.mBatteryCount > 0) { continue; } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) { + //Is it a tile entity with a Tesla Coil Cover? + //Only single can send power to non-Rich edition covers + //Since Rich edition inherits from regular, we need the final check + } else if (!isMulti && node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil && + node.getEUCapacity() > 0 && !(node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate)) { + continue; + //Is it a tile entity with a Tesla Coil Cover Rich edition? + //Only multis can send power to Rich edition covers + } else if (isMulti && node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate && node.getEUCapacity() > 0) { continue; } - } catch (Exception e) { + } catch (Exception ignored) { } } - eTeslaMap.remove(Rx.getKey()); + nodeMap.remove(Rx.getKey()); } + return nodeMap; + } - //Scan for transmission targets - switch (scanTime) { - case 0: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[0], scanPosOffsets[1]); - break; - case 20: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[2], scanPosOffsets[3]); - break; - case 40: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[4], scanPosOffsets[5]); - break; - case 60: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[6], scanPosOffsets[7]); - break; - case 80: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[8], scanPosOffsets[9]); - break; - default: - if (scanTime == (int) scanTimeMinSetting.get() - 1) { - scanTime = -1; - for (Map.Entry Rx : eTeslaMap.entrySet()) { - IGregTechTileEntity node = Rx.getKey(); - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - try { - if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { - GT_MetaTileEntity_TeslaCoil teslaCoil = (GT_MetaTileEntity_TeslaCoil) nodeInside; - - int tX = node.getXCoord(); - int tY = node.getYCoord(); - int tZ = node.getZCoord(); - - int tXN = posZap.get0(); - int tYN = posZap.get1(); - int tZN = posZap.get2(); - - int tOffset = (int) Math.ceil(Math.sqrt(Math.pow(tX - tXN, 2) + Math.pow(tY - tYN, 2) + Math.pow(tZ - tZN, 2))); - teslaCoil.eTeslaMap.put(mte, tOffset); - - for (Map.Entry RRx : eTeslaMap.entrySet()) { - IGregTechTileEntity nodeN = RRx.getKey(); - if (nodeN == node) { - continue; - } - tXN = nodeN.getXCoord(); - tYN = nodeN.getYCoord(); - tZN = nodeN.getZCoord(); - tOffset = (int) Math.ceil(Math.sqrt(Math.pow(tX - tXN, 2) + Math.pow(tY - tYN, 2) + Math.pow(tZ - tZN, 2))); - if (tOffset > 20) { - continue; - } - teslaCoil.eTeslaMap.put(nodeN, tOffset); - } - } - } catch (Exception e) { - eTeslaMap.remove(Rx.getKey()); - } - } - } - } - break; + @Override + public boolean onRunningTick(ItemStack aStack) { + IGregTechTileEntity mte = getBaseMetaTileEntity(); + + //Hysteresis based ePowerPass setting + float energyFrac = (float) getEUVar() / energyCapacity; + + energyCapacityDisplay.set(energyCapacity); + energyStoredDisplay.set(getEUVar()); + energyFractionDisplay.set(energyFrac); + + if (!ePowerPass && energyFrac > histHighSetting.get()) { + ePowerPass = true; + } else if (ePowerPass && energyFrac < histLowSetting.get()) { + ePowerPass = false; } - scanTime++; - scanTimeDisplay.set(scanTime); + //Create the teslaNodeMap + if (sortTime == sortTimeMinSetting.get()) { + sortTime = 0; + sortTimeDisplay.updateStatus(); + teslaNodeMap = generateTeslaNodeMap(mte); + } + sortTime++; + sortTimeDisplay.set(sortTime); //Power Limit Settings long outputVoltage; @@ -756,46 +719,23 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //Stuff to do if ePowerPass if (ePowerPass) { //Range calculation and display - float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac)); - int transferRadiusTower = (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac); + int transferRadiusTower = (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier)); transferRadiusTowerDisplay.set(transferRadiusTower); - int transferRadiusTransceiver = (int) (transferRadiusTransceiverSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac); + int transferRadiusTransceiver = (int) (transferRadiusTransceiverSetting.get() * getRangeMulti(mTier, vTier)); transferRadiusTransceiverDisplay.set(transferRadiusTransceiver); - int transferRadiusCoverUltimate = (int) (transferRadiusCoverUltimateSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac); + int transferRadiusCoverUltimate = (int) (transferRadiusCoverUltimateSetting.get() * getRangeMulti(mTier, vTier)); transferRadiusCoverUltimateDisplay.set(transferRadiusCoverUltimate); - //Clean the eTeslaMap - for (Map.Entry Rx : eTeslaMap.entrySet()) { - IGregTechTileEntity node = Rx.getKey(); - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - try { - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (teslaTower.maxEUStore() > 0) { - continue; - } - } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { - GT_MetaTileEntity_TeslaCoil teslaCoil = (GT_MetaTileEntity_TeslaCoil) nodeInside; - if (teslaCoil.getStoredEnergy()[1] > 0) { - continue; - } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) { - continue; - } - } catch (Exception e) { - } - } - eTeslaMap.remove(Rx.getKey()); - } + //Clean the teslaNodeMap + teslaNodeMap = cleanTeslaNodeMap(teslaNodeMap, mte); //Power transfer long sparks = outputCurrent; while (sparks > 0) { boolean overdriveToggle = overDriveSetting.get() > 0; boolean idle = true; - for (Map.Entry Rx : entriesSortedByValues(eTeslaMap)) { - if (energyStored >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) { + for (Map.Entry Rx : entriesSortedByValues(teslaNodeMap)) { + if (getEUVar() >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) { IGregTechTileEntity node = Rx.getKey(); IMetaTileEntity nodeInside = node.getMetaTileEntity(); @@ -845,12 +785,12 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } } outputCurrentDisplay.set(outputCurrent - sparks); - if (scanTime % 60 == 0 && !sparkList.isEmpty()) { + if (sortTime % 60 == 0 && !sparkList.isEmpty()) { NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), mte.getWorld().provider.dimensionId, - mte.getXCoord(), - mte.getYCoord(), - mte.getZCoord(), + posTop.get0(), + posTop.get1(), + posTop.get2(), 256); } sparkList.clear(); 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 47625b999f..657bf6b01a 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 @@ -27,32 +27,25 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil.teslaNodeSet; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.Util.entriesSortedByValues; -import static com.github.technus.tectech.util.Util.map; import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; import static java.lang.Math.round; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; - public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer { private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F - public Map eTeslaMap = new HashMap<>();//Tesla Map to map them tesla bois! + private Map teslaNodeMap = new HashMap<>();//Tesla Map to map them tesla bois! private final static HashSet sparkList = new HashSet<>(); private byte sparkCount = 0; - private final static int maxTier = 4; //Max tier of transceiver - private final static int minTier = 0; //Min tier of transceiver - - private final static int transferRadiusMax = 20; - private final static int transferRadiusMin = 4; - private final int transferRadiusLimitTop = (int) map(mTier + 1, minTier + 1, maxTier + 1, transferRadiusMin, transferRadiusMax); - private final static int transferRadiusLimitBottom = 1; //Minimum user configurable - private int transferRadius = transferRadiusLimitTop; //Default transferRadius setting + private final static int transferRadiusMax = 20; //Maximum user configurable + private final static int transferRadiusMin = 4; //Minimum user configurable + private int transferRadius = 16; //Default transferRadius setting public boolean powerPassToggle = false; //Power Pass for public viewing private final static int histSteps = 20; //Hysteresis Resolution @@ -68,6 +61,9 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB private String clientLocale = "en_US"; + private int sortTime = 0;//Sorting tick counter + private final static int sortTimeMax = 100;//Sorting tick counter limit, so we only sort once every 5 seconds + public GT_MetaTileEntity_TeslaCoil(int aID, String aName, String aNameRegional, int aTier, int aSlotCount) { super(aID, aName, aNameRegional, aTier, "", aSlotCount); Util.setTier(aTier, this); @@ -125,11 +121,11 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { - if (transferRadius > transferRadiusLimitBottom) { + if (transferRadius > transferRadiusMin) { transferRadius--; } } else { - if (transferRadius < 0) { + if (transferRadius < transferRadiusMax) { transferRadius++; } } @@ -171,13 +167,11 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; - for (byte i = -1; i < 16; ++i) { rTextures[0][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1]}; rTextures[1][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], TESLA_TRANSCEIVER_TOP_BA}; rTextures[2][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], this.mInventory.length == 16 ? OVERLAYS_ENERGY_OUT_POWER_TT[this.mTier] : (this.mInventory.length > 4 ? OVERLAYS_ENERGY_OUT_MULTI_TT[this.mTier] : OVERLAYS_ENERGY_OUT_TT[this.mTier])}; } - return rTextures; } @@ -273,6 +267,13 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB powerPassToggle = false; } + //Create the teslaNodeMap + if (sortTime == sortTimeMax) { + sortTime = 0; + teslaNodeMap = generateTeslaNodeMap(aBaseMetaTileEntity); + } + sortTime++; + //Stuff to do if ePowerPass if (powerPassToggle) { float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac)); @@ -282,30 +283,13 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB //Radius for transceiver to cover transfers int transferRadiusCover = (int) (transferRadiusTower / 1.25); - //Clean the eTeslaMap - for (Map.Entry Rx : eTeslaMap.entrySet()) { - IGregTechTileEntity node = Rx.getKey(); - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - try { - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (teslaTower.maxEUStore() > 0) { - continue; - } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) { - continue; - } - } catch (Exception e) { - } - } - eTeslaMap.remove(Rx.getKey()); - } + //Clean the teslaNodeMap + teslaNodeMap = cleanTeslaNodeMap(teslaNodeMap, aBaseMetaTileEntity); //Power transfer while (outputCurrent > 0) { boolean idle = true; - for (Map.Entry Rx : entriesSortedByValues(eTeslaMap)) { + for (Map.Entry Rx : entriesSortedByValues(teslaNodeMap)) { if (getEUVar() >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) { IGregTechTileEntity node = Rx.getKey(); IMetaTileEntity nodeInside = node.getMetaTileEntity(); -- cgit From 209aba66021d742a606e03f5c2691cd5fee92942 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 19 Jul 2020 10:18:09 +0100 Subject: Tweak tesla range and add more config --- .../technus/tectech/loader/TecTechConfig.java | 18 +++++ .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 78 +++++++++++++--------- .../single/GT_MetaTileEntity_TeslaCoil.java | 24 +++---- 3 files changed, 75 insertions(+), 45 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index ae9da94b02..cc6afd3f00 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -21,6 +21,11 @@ public class TecTechConfig extends ConfigManager { public boolean DISABLE_BLOCK_HARDNESS_NERF; public float TURRET_DAMAGE_FACTOR; public float TURRET_EXPLOSION_FACTOR; + public int TESLA_MULTI_TOWER_RANGE; + public int TESLA_MULTI_TRANSCEIVER_RANGE; + public int TESLA_MULTI_COVER_RANGE; + public int TESLA_MULTI_PLASMA_RANGE_MULTI_T1; + public int TESLA_MULTI_PLASMA_RANGE_MULTI_T2; public int TESLA_MULTI_HELIUM_PLASMA_PER_SECOND; public int TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND; public int TESLA_MULTI_RADON_PLASMA_PER_SECOND; @@ -29,6 +34,7 @@ public class TecTechConfig extends ConfigManager { public int TESLA_MULTI_LOSS_PER_BLOCK_T2; public float TESLA_MULTI_OVERDRIVE_LOSS_FACTOR; public boolean TESLA_MULTI_GAS_OUTPUT; + public int TESLA_SINGLE_RANGE; public int TESLA_SINGLE_LOSS_PER_BLOCK; public float TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR; @@ -46,6 +52,11 @@ public class TecTechConfig extends ConfigManager { DISABLE_MATERIAL_LOADING_FFS = false; TURRET_DAMAGE_FACTOR = 10; TURRET_EXPLOSION_FACTOR = 1; + TESLA_MULTI_TOWER_RANGE= 32; + TESLA_MULTI_TRANSCEIVER_RANGE= 16; + TESLA_MULTI_COVER_RANGE= 16; + TESLA_MULTI_PLASMA_RANGE_MULTI_T1= 2; + TESLA_MULTI_PLASMA_RANGE_MULTI_T2= 4; TESLA_MULTI_HELIUM_PLASMA_PER_SECOND = 100; TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND = 50; TESLA_MULTI_RADON_PLASMA_PER_SECOND = 50; @@ -54,6 +65,7 @@ public class TecTechConfig extends ConfigManager { TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1; TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = 0.25F; TESLA_MULTI_GAS_OUTPUT = false; + TESLA_SINGLE_RANGE = 20; TESLA_SINGLE_LOSS_PER_BLOCK = 1; TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = 0.25F; } @@ -84,6 +96,11 @@ public class TecTechConfig extends ConfigManager { DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS, "Set to true to disable gregtech material processing"); + TESLA_MULTI_TOWER_RANGE = _mainConfig.getInt("TeslaMultiTowerRange", "Balance Tweaks", TESLA_MULTI_TOWER_RANGE, 0, Integer.MAX_VALUE, "Tesla Tower to Tower max range"); + TESLA_MULTI_TRANSCEIVER_RANGE = _mainConfig.getInt("TeslaMultiTransceiverRange", "Balance Tweaks", TESLA_MULTI_TRANSCEIVER_RANGE, 0, Integer.MAX_VALUE, "Tesla Tower to Transceiver max range"); + TESLA_MULTI_COVER_RANGE = _mainConfig.getInt("TeslaMultiCoverRange", "Balance Tweaks", TESLA_MULTI_COVER_RANGE, 0, Integer.MAX_VALUE, "Tesla Tower to Tesla Coil Rich Edition Cover max range"); + TESLA_MULTI_PLASMA_RANGE_MULTI_T1 = _mainConfig.getInt("TeslaMultiPlasmaRangeMultiT1", "Balance Tweaks", TESLA_MULTI_PLASMA_RANGE_MULTI_T1, 0, Integer.MAX_VALUE, "Tesla Tower T1 Plasmas Range Multiplier"); + TESLA_MULTI_PLASMA_RANGE_MULTI_T2 = _mainConfig.getInt("TeslaMultiPlasmaRangeMultiT2", "Balance Tweaks", TESLA_MULTI_PLASMA_RANGE_MULTI_T2, 0, Integer.MAX_VALUE, "Tesla Tower T2 Plasmas Range Multiplier"); TESLA_MULTI_HELIUM_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiHeliumPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_HELIUM_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower helium plasma consumed each second the tesla tower is active"); TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiNitrogenPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower nitrogen plasma consumed each second the tesla tower is active"); TESLA_MULTI_RADON_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiRadonPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_RADON_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower radon plasma consumed each second the tesla tower is active"); @@ -92,6 +109,7 @@ public class TecTechConfig extends ConfigManager { TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T2, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using radon plasma"); TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaMultiOverdriveLossFactor", "Balance Tweaks", TESLA_MULTI_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Tower power loss per amp as a factor of the tier voltage"); TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean("TeslaMultiMoltenOutput", "Balance Tweaks", TESLA_MULTI_GAS_OUTPUT, "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio"); + TESLA_SINGLE_RANGE = _mainConfig.getInt("TeslaSingleRange", "Balance Tweaks", TESLA_SINGLE_RANGE, 0, Integer.MAX_VALUE, "Tesla Transceiver to max range"); TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt("TeslaSingleLossPerBlock", "Balance Tweaks", TESLA_SINGLE_LOSS_PER_BLOCK, 0, Integer.MAX_VALUE, "Tesla Transceiver power transmission loss per block per amp"); TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaSingleOverdriveLossFactor", "Balance Tweaks", TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage"); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index eca70ca63f..8ab6be3a50 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -53,6 +53,11 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables + private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_TOWER_RANGE;//Default is 32 + private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_TRANSCEIVER_RANGE;//Default is 16 + private static final int transferRadiusCoverUltimateFromConfig = TecTech.configTecTech.TESLA_MULTI_COVER_RANGE;//Default is 16 + private static final int plasmaRangeMultiT1 = TecTech.configTecTech.TESLA_MULTI_PLASMA_RANGE_MULTI_T1;//Default is 2 + private static final int plasmaRangeMultiT2 = TecTech.configTecTech.TESLA_MULTI_PLASMA_RANGE_MULTI_T2;//Default is 4 private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_HELIUM_PLASMA_PER_SECOND;//Default is 100 private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND;//Default is 50 private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_RADON_PLASMA_PER_SECOND;//Default is 50 @@ -168,17 +173,25 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; if (value < 0) return STATUS_TOO_LOW; - if (value > 40) return STATUS_TOO_HIGH; - if (value < 32) return STATUS_LOW; + if (value > transferRadiusTowerFromConfig) return STATUS_HIGH; + if (value < transferRadiusTowerFromConfig) return STATUS_LOW; return STATUS_OK; }; - private static final IStatusFunction TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS = (base, p) -> { + private static final IStatusFunction TRANSFER_RADIUS_TRANSCEIVER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; if (value < 0) return STATUS_TOO_LOW; - if (value > 20) return STATUS_TOO_HIGH; - if (value < 16) return STATUS_LOW; + if (value > transferRadiusTransceiverFromConfig) return STATUS_HIGH; + if (value < transferRadiusTransceiverFromConfig) return STATUS_LOW; + return STATUS_OK; + }; private static final IStatusFunction TRANSFER_RADIUS_COVER_ULTIMATE_STATUS = (base, p) -> { + double value = p.get(); + if (Double.isNaN(value)) return STATUS_WRONG; + value = (int) value; + if (value < 0) return STATUS_TOO_LOW; + if (value > transferRadiusCoverUltimateFromConfig) return STATUS_HIGH; + if (value < transferRadiusCoverUltimateFromConfig) return STATUS_LOW; return STATUS_OK; }; private static final IStatusFunction OUTPUT_VOLTAGE_OR_CURRENT_STATUS = (base, p) -> { @@ -215,7 +228,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; - if (value == 0 || value == 20 || value == 40 || value == 60 || value == 80) return STATUS_HIGH; + if (value == 0) return STATUS_HIGH; return STATUS_LOW; }; private static final IStatusFunction POWER_STATUS = (base, p) -> { @@ -268,15 +281,16 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } private float getRangeMulti(int mTier, int vTier) { + //By Default: //Helium and Nitrogen Plasmas will double the range //Radon will quadruple the range int plasmaBoost; switch (plasmaTier) { case 2: - plasmaBoost = 4; + plasmaBoost = plasmaRangeMultiT2; break; case 1: - plasmaBoost = 2; + plasmaBoost = plasmaRangeMultiT1; break; default: plasmaBoost = 1; @@ -351,7 +365,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock eCapacitorHatches.clear(); Vec3Impl xyzOffsets; - xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); if (mTier == 9){mTier = 6;}//Hacky remap because the ZPM coils were added later @@ -496,10 +509,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock popogaSetting = hatch_0.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); histHighSetting = hatch_1.makeInParameter(0, 0.75, HYSTERESIS_HIGH_SETTING_NAME, HYSTERESIS_HIGH_STATUS); popogaSetting = hatch_1.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTowerSetting = hatch_2.makeInParameter(0, 32, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS); + transferRadiusTowerSetting = hatch_2.makeInParameter(0, transferRadiusTowerFromConfig, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS); popogaSetting = hatch_2.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, 16, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, 16, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, transferRadiusTransceiverFromConfig, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_STATUS); + transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, transferRadiusCoverUltimateFromConfig, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_COVER_ULTIMATE_STATUS); outputVoltageSetting = hatch_4.makeInParameter(0, -1, OUTPUT_VOLTAGE_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); popogaSetting = hatch_4.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); outputCurrentSetting = hatch_5.makeInParameter(0, -1, OUTPUT_CURRENT_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); @@ -519,8 +532,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock popogaDisplay = hatch_1.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); transferRadiusTowerDisplay = hatch_2.makeOutParameter(0, 0, TRANSFER_RADIUS_TOWER_DISPLAY_NAME, TRANSFER_RADIUS_TOWER_STATUS); popogaDisplay = hatch_2.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_STATUS); + transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_COVER_ULTIMATE_STATUS); outputVoltageDisplay = hatch_4.makeOutParameter(0, 0, OUTPUT_VOLTAGE_DISPLAY_NAME, POWER_STATUS); popogaDisplay = hatch_4.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); outputCurrentDisplay = hatch_5.makeOutParameter(0, 0, OUTPUT_CURRENT_DISPLAY_NAME, POWER_STATUS); @@ -572,19 +585,19 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public static Map generateTeslaNodeMap(IGregTechTileEntity orgin){ Map generatedNodeMap = new HashMap<>(); - IMetaTileEntity orginInside = orgin.getMetaTileEntity(); - int orginX; - int orginY; - int orginZ; - if (orginInside instanceof GT_MetaTileEntity_TM_teslaCoil) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) orginInside; - orginX = teslaTower.posTop.get0(); - orginY = teslaTower.posTop.get1(); - orginZ = teslaTower.posTop.get2(); + IMetaTileEntity originInside = orgin.getMetaTileEntity(); + int originX; + int originY; + int originZ; + if (originInside instanceof GT_MetaTileEntity_TM_teslaCoil) { + GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) originInside; + originX = teslaTower.posTop.get0(); + originY = teslaTower.posTop.get1(); + originZ = teslaTower.posTop.get2(); } else { - orginX = orgin.getXCoord(); - orginY = orgin.getYCoord(); - orginZ = orgin.getZCoord(); + originX = orgin.getXCoord(); + originY = orgin.getYCoord(); + originZ = orgin.getZCoord(); } for (IGregTechTileEntity node : teslaNodeSet) { @@ -593,7 +606,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock teslaNodeSet.remove(null); continue; } else if (node == orgin || orgin.getWorld().provider.dimensionId != node.getWorld().provider.dimensionId) { - //Skip if looking at myself and skip if not in the same dimention + //Skip if looking at myself and skip if not in the same dimension //TODO, INTERDIM? continue; } @@ -615,9 +628,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } //Find the xyz offsets and calculate the distance between us and the target - int xPosOffset = targetX - orginX; - int yPosOffset = targetY - orginY; - int zPosOffset = targetZ - orginZ; + int xPosOffset = targetX - originX; + int yPosOffset = targetY - originY; + int zPosOffset = targetZ - originZ; int distance = (int) ceil(sqrt(pow(xPosOffset, 2) + pow(yPosOffset, 2) + pow(zPosOffset, 2))); //Thought we need abs here, we don't. An Integer to the power of two is going to be either 0 or positive. //We also can just put stuff here without further checks, as we always check the next section @@ -626,7 +639,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return generatedNodeMap; } - public static Map cleanTeslaNodeMap(Map nodeMap, IGregTechTileEntity orgin) { + public static void cleanTeslaNodeMap(Map nodeMap, IGregTechTileEntity orgin) { IMetaTileEntity orginInside = orgin.getMetaTileEntity(); //Assumes that if the orgin is not a Tesla Tower, it mus be a single block. boolean isMulti = orginInside instanceof GT_MetaTileEntity_TM_teslaCoil; @@ -669,7 +682,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } nodeMap.remove(Rx.getKey()); } - return nodeMap; } @@ -727,7 +739,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock transferRadiusCoverUltimateDisplay.set(transferRadiusCoverUltimate); //Clean the teslaNodeMap - teslaNodeMap = cleanTeslaNodeMap(teslaNodeMap, mte); + cleanTeslaNodeMap(teslaNodeMap, mte); //Power transfer long sparks = outputCurrent; 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 657bf6b01a..fcf85e26c3 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 @@ -36,6 +36,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer { + private final static int transferRadiusMax = TecTech.configTecTech.TESLA_SINGLE_RANGE;//Default is 20 private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F @@ -43,18 +44,17 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB private final static HashSet sparkList = new HashSet<>(); private byte sparkCount = 0; - private final static int transferRadiusMax = 20; //Maximum user configurable - private final static int transferRadiusMin = 4; //Minimum user configurable - private int transferRadius = 16; //Default transferRadius setting + private final static int transferRadiusMin = 4;//Minimum user configurable + private int transferRadius = transferRadiusMax;//Default transferRadius setting - public boolean powerPassToggle = false; //Power Pass for public viewing - private final static int histSteps = 20; //Hysteresis Resolution - private int histSettingLow = 3; //Hysteresis Low Limit - private int histSettingHigh = 15; //Hysteresis High Limit - private final static int histLowLimit = 1; //How low can you configure it? - private final static int histHighLimit = 19; //How high can you configure it? - private float histLow = (float) histSettingLow / histSteps; //Power pass is disabled if power is under this fraction - private float histHigh = (float) histSettingHigh / histSteps; //Power pass is enabled if power is over this fraction + public boolean powerPassToggle = false;//Power Pass for public viewing + private final static int histSteps = 20;//Hysteresis Resolution + private int histSettingLow = 3;//Hysteresis Low Limit + private int histSettingHigh = 15;//Hysteresis High Limit + private final static int histLowLimit = 1;//How low can you configure it? + private final static int histHighLimit = 19;//How high can you configure it? + private float histLow = (float) histSettingLow / histSteps;//Power pass is disabled if power is under this fraction + private float histHigh = (float) histSettingHigh / histSteps;//Power pass is enabled if power is over this fraction private final long outputVoltage = V[mTier]; private boolean overdriveToggle = false; @@ -284,7 +284,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB int transferRadiusCover = (int) (transferRadiusTower / 1.25); //Clean the teslaNodeMap - teslaNodeMap = cleanTeslaNodeMap(teslaNodeMap, aBaseMetaTileEntity); + cleanTeslaNodeMap(teslaNodeMap, aBaseMetaTileEntity); //Power transfer while (outputCurrent > 0) { -- cgit From fdb7847bcd0de41a3ff9dc96e5a51038a5e0f609 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Jul 2020 11:30:33 +0200 Subject: Update decay logic --- .../java/ch/obermuhlner/math/big/BigComplex.java | 556 ------ .../ch/obermuhlner/math/big/BigComplexMath.java | 413 ----- .../ch/obermuhlner/math/big/BigDecimalMath.java | 1671 ----------------- .../java/ch/obermuhlner/math/big/BigFloat.java | 1947 -------------------- .../java/ch/obermuhlner/math/big/BigRational.java | 1103 ----------- .../math/big/DefaultBigDecimalMath.java | 736 -------- .../math/big/internal/AsinCalculator.java | 46 - .../math/big/internal/AtanhCalculator.java | 40 - .../math/big/internal/CosCalculator.java | 48 - .../math/big/internal/CoshCalculator.java | 43 - .../math/big/internal/ExpCalculator.java | 42 - .../math/big/internal/PowerIterator.java | 28 - .../math/big/internal/PowerNIterator.java | 33 - .../math/big/internal/PowerTwoNIterator.java | 33 - .../big/internal/PowerTwoNMinusOneIterator.java | 35 - .../big/internal/PowerTwoNPlusOneIterator.java | 33 - .../math/big/internal/SeriesCalculator.java | 127 -- .../math/big/internal/SinCalculator.java | 49 - .../math/big/internal/SinhCalculator.java | 44 - .../math/big/stream/BigDecimalStream.java | 219 --- .../math/big/stream/BigFloatStream.java | 214 --- .../core/cElementalDecayResult.java | 41 + .../core/cElementalInstanceStackMap.java | 13 +- .../core/stacks/cElementalInstanceStack.java | 136 +- .../multi/GT_MetaTileEntity_EM_collider.java | 18 +- .../multi/GT_MetaTileEntity_EM_decay.java | 6 +- 26 files changed, 119 insertions(+), 7555 deletions(-) delete mode 100644 src/main/java/ch/obermuhlner/math/big/BigComplex.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/BigComplexMath.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/BigFloat.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/BigRational.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java delete mode 100644 src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java (limited to 'src/main') diff --git a/src/main/java/ch/obermuhlner/math/big/BigComplex.java b/src/main/java/ch/obermuhlner/math/big/BigComplex.java deleted file mode 100644 index a4620ff53b..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/BigComplex.java +++ /dev/null @@ -1,556 +0,0 @@ -package ch.obermuhlner.math.big; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.util.Objects; - -/** - * Represents a complex number consisting of a real and an imaginary {@link BigDecimal} part in the form {@code a + bi}. - * - *

It generally follows the design of {@link BigDecimal} with some convenience improvements like overloaded operator methods.

- * - *

The biggest difference to {@link BigDecimal} is that {@link BigComplex#equals(Object) BigComplex.equals(Object)} implements the mathematical equality - * and not the strict technical equality. - * This was a difficult decision because it means that {@code BigComplex} behaves slightly different than {@link BigDecimal} - * but considering that the strange equality of {@link BigDecimal} is a major source of bugs we - * decided it was worth the slight inconsistency. - * If you need the strict equality use {@link BigComplex#strictEquals(Object)}`.

- * - *

This class is immutable and therefore inherently thread safe.

- */ -public final class BigComplex { - - /** - * Zero represented as complex number. - */ - public static final BigComplex ZERO = new BigComplex(BigDecimal.ZERO, BigDecimal.ZERO); - - /** - * Real 1 represented as complex number. - */ - public static final BigComplex ONE = new BigComplex(BigDecimal.ONE, BigDecimal.ZERO); - - /** - * Imaginary 1 represented as complex number. - */ - public static final BigComplex I = new BigComplex(BigDecimal.ZERO, BigDecimal.ONE); - - /** - * The real {@link BigDecimal} part of this complex number. - */ - public final BigDecimal re; - - /** - * The imaginary {@link BigDecimal} part of this complex number. - */ - public final BigDecimal im; - - private BigComplex(BigDecimal re, BigDecimal im) { - this.re = re; - this.im = im; - } - - /** - * Calculates the addition of the given complex value to this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigComplex} value to add - * @return the calculated {@link BigComplex} result - */ - public BigComplex add(BigComplex value) { - return valueOf( - re.add(value.re), - im.add(value.im)); - } - - /** - * Calculates the addition of the given complex value to this complex number using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigComplex} value to add - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex add(BigComplex value, MathContext mathContext) { - return valueOf( - re.add(value.re, mathContext), - im.add(value.im, mathContext)); - } - - /** - * Calculates the addition of the given real {@link BigDecimal} value to this complex number using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the real {@link BigDecimal} value to add - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex add(BigDecimal value, MathContext mathContext) { - return valueOf( - re.add(value, mathContext), - im); - } - - /** - * Calculates the addition of the given real {@link BigDecimal} value to this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the real {@link BigDecimal} value to add - * @return the calculated {@link BigComplex} result - */ - public BigComplex add(BigDecimal value) { - return valueOf( - re.add(value), - im); - } - - /** - * Calculates the addition of the given real {@code double} value to this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the real {@code double} value to add - * @return the calculated {@link BigComplex} result - */ - public BigComplex add(double value) { - return add(BigDecimal.valueOf(value)); - } - - /** - * Calculates the subtraction of the given complex value from this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigComplex} value to subtract - * @return the calculated {@link BigComplex} result - */ - public BigComplex subtract(BigComplex value) { - return valueOf( - re.subtract(value.re), - im.subtract(value.im)); - } - - /** - * Calculates the subtraction of the given complex value from this complex number using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigComplex} value to subtract - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex subtract(BigComplex value, MathContext mathContext) { - return valueOf( - re.subtract(value.re, mathContext), - im.subtract(value.im, mathContext)); - } - - /** - * Calculates the subtraction of the given real {@link BigDecimal} value from this complex number using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the real {@link BigDecimal} value to add - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex subtract(BigDecimal value, MathContext mathContext) { - return valueOf( - re.subtract(value, mathContext), - im); - } - - /** - * Calculates the subtraction of the given real {@link BigDecimal} value from this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the real {@link BigDecimal} value to subtract - * @return the calculated {@link BigComplex} result - */ - public BigComplex subtract(BigDecimal value) { - return valueOf( - re.subtract(value), - im); - } - - /** - * Calculates the subtraction of the given real {@code double} value from this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the real {@code double} value to subtract - * @return the calculated {@link BigComplex} result - */ - public BigComplex subtract(double value) { - return subtract(BigDecimal.valueOf(value)); - } - - /** - * Calculates the multiplication of the given complex value to this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigComplex} value to multiply - * @return the calculated {@link BigComplex} result - */ - public BigComplex multiply(BigComplex value) { - return valueOf( - re.multiply(value.re).subtract(im.multiply(value.im)), - re.multiply(value.im).add(im.multiply(value.re))); - } - - /** - * Calculates the multiplication of the given complex value with this complex number using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigComplex} value to multiply - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex multiply(BigComplex value, MathContext mathContext) { - return valueOf( - re.multiply(value.re, mathContext).subtract(im.multiply(value.im, mathContext), mathContext), - re.multiply(value.im, mathContext).add(im.multiply(value.re, mathContext), mathContext)); - } - - /** - * Calculates the multiplication of the given real {@link BigDecimal} value with this complex number using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the real {@link BigDecimal} value to multiply - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex multiply(BigDecimal value, MathContext mathContext) { - return valueOf( - re.multiply(value, mathContext), - im.multiply(value, mathContext)); - } - - /** - * Calculates the multiplication of the given real {@link BigDecimal} value with this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the real {@link BigDecimal} value to multiply - * @return the calculated {@link BigComplex} result - */ - public BigComplex multiply(BigDecimal value) { - return valueOf( - re.multiply(value), - im.multiply(value)); - } - - /** - * Calculates the multiplication of the given real {@code double} value with this complex number. - * - *

This methods does not modify this instance.

- * - * @param value the real {@code double} value to multiply - * @return the calculated {@link BigComplex} result - */ - public BigComplex multiply(double value) { - return multiply(BigDecimal.valueOf(value)); - } - - /** - * Calculates this complex number divided by the given complex value using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigComplex} value to divide by - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex divide(BigComplex value, MathContext mathContext) { - return multiply(value.reciprocal(mathContext), mathContext); - } - - /** - * Calculates this complex number divided by the given real {@link BigDecimal} value using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the {@link BigDecimal} value to divide by - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex divide(BigDecimal value, MathContext mathContext) { - return valueOf( - re.divide(value, mathContext), - im.divide(value, mathContext)); - } - - /** - * Calculates this complex number divided by the given real {@code double} value using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param value the {@code double} value to divide by - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex divide(double value, MathContext mathContext) { - return divide(BigDecimal.valueOf(value), mathContext); - } - - /** - * Calculates the reciprocal of this complex number using the specified {@link MathContext}. - * - *

This methods does not modify this instance.

- * - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigComplex reciprocal(MathContext mathContext) { - BigDecimal scale = absSquare(mathContext); - return valueOf( - re.divide(scale, mathContext), - im.negate().divide(scale, mathContext)); - } - - /** - * Calculates the conjugate {@code a - bi} of this complex number. - * - *

This methods does not modify this instance.

- * - * @return the calculated {@link BigComplex} result - */ - public BigComplex conjugate() { - return valueOf(re, im.negate()); - } - - /** - * Calculates the negation {@code -a - bi} of this complex number. - * - *

This methods does not modify this instance.

- * - * @return the calculated {@link BigComplex} result - */ - public BigComplex negate() { - return valueOf(re.negate(), im.negate()); - } - - /** - * Calculates the absolute value (also known as magnitude, length or radius) of this complex number. - * - *

This method is slower than {@link #absSquare(MathContext)} since it needs to calculate the {@link BigDecimalMath#sqrt(BigDecimal, MathContext)}.

- * - *

This methods does not modify this instance.

- * - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - * @see #absSquare(MathContext) - */ - public BigDecimal abs(MathContext mathContext) { - return BigDecimalMath.sqrt(absSquare(mathContext), mathContext); - } - - /** - * Calculates the angle in radians (also known as argument) of this complex number. - * - *

This methods does not modify this instance.

- * - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - */ - public BigDecimal angle(MathContext mathContext) { - return BigDecimalMath.atan2(im, re, mathContext); - } - - /** - * Calculates the square of the absolute value of this complex number. - * - *

This method is faster than {@link #abs(MathContext)} since it does not need to calculate the {@link BigDecimalMath#sqrt(BigDecimal, MathContext)}.

- * - *

This methods does not modify this instance.

- * - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - * @see #abs(MathContext) - */ - public BigDecimal absSquare(MathContext mathContext) { - return re.multiply(re, mathContext).add(im.multiply(im, mathContext), mathContext); - } - - /** - * Returns whether this complex number only has a real part (the imaginary part is 0). - * - * @return {@code true} if this complex number only has a real part, {@code false} if the imaginary part is not 0 - */ - public boolean isReal() { - return im.signum() == 0; - } - - /** - * Returns the real part of this complex number as {@link BigComplex} number. - * - * @return the real part as as {@link BigComplex} number - */ - public BigComplex re() { - return valueOf(re, BigDecimal.ZERO); - } - - /** - * Returns the imaginary part of this complex number as {@link BigComplex} number. - * - * @return the imaginary part as as {@link BigComplex} number - */ - public BigComplex im() { - return valueOf(BigDecimal.ZERO, im); - } - - /** - * Returns this complex nuber rounded to the specified precision. - * - *

This methods does not modify this instance.

- * - * @param mathContext the {@link MathContext} used to calculate the result - * @return the rounded {@link BigComplex} result - */ - public BigComplex round(MathContext mathContext) { - return valueOf(re.round(mathContext), im.round(mathContext)); - } - - @Override - public int hashCode() { - return Objects.hash(re, im); - } - - /** - * {@inheritDoc} - * - *

Contrary to {@link BigDecimal#equals(Object)} this method implements mathematical equality - * (by calling {@link BigDecimal#compareTo(BigDecimal)} on the real and imaginary parts) - * instead of strict equality.

- * - * @see #strictEquals(Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BigComplex other = (BigComplex) obj; - - return re.compareTo(other.re) == 0 && im.compareTo(other.im) == 0; - } - - /** - * Returns whether the real and imaginary parts of this complex number are strictly equal. - * - *

This method uses the strict equality as defined by {@link BigDecimal#equals(Object)} on the real and imaginary parts.

- *

Please note that {@link #equals(Object) BigComplex.equals(Object)} implements mathematical equality instead - * (by calling {@link BigDecimal#compareTo(BigDecimal) on the real and imaginary parts}).

- * - * @param obj the object to compare for strict equality - * @return {@code true} if the specified object is strictly equal to this complex number - * @see #equals(Object) - */ - public boolean strictEquals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BigComplex other = (BigComplex) obj; - - return re.equals(other.re) && im.equals(other.im); - } - - @Override - public String toString() { - if (im.signum() >= 0) { - return "(" + re + " + " + im + " i)"; - } else { - return "(" + re + " - " + im.negate() + " i)"; - } - } - - /** - * Returns a complex number with the specified real {@link BigDecimal} part. - * - * @param real the real {@link BigDecimal} part - * @return the complex number - */ - public static BigComplex valueOf(BigDecimal real) { - return valueOf(real, BigDecimal.ZERO); - } - - /** - * Returns a complex number with the specified real {@code double} part. - * - * @param real the real {@code double} part - * @return the complex number - */ - public static BigComplex valueOf(double real) { - return valueOf(BigDecimal.valueOf(real), BigDecimal.ZERO); - } - - /** - * Returns a complex number with the specified real and imaginary {@code double} parts. - * - * @param real the real {@code double} part - * @param imaginary the imaginary {@code double} part - * @return the complex number - */ - public static BigComplex valueOf(double real, double imaginary) { - return valueOf(BigDecimal.valueOf(real), BigDecimal.valueOf(imaginary)); - } - - /** - * Returns a complex number with the specified real and imaginary {@link BigDecimal} parts. - * - * @param real the real {@link BigDecimal} part - * @param imaginary the imaginary {@link BigDecimal} part - * @return the complex number - */ - public static BigComplex valueOf(BigDecimal real, BigDecimal imaginary) { - if (real.signum() == 0) { - if (imaginary.signum() == 0) { - return ZERO; - } - if (imaginary.compareTo(BigDecimal.ONE) == 0) { - return I; - } - } - if (imaginary.signum() == 0 && real.compareTo(BigDecimal.ONE) == 0) { - return ONE; - } - - return new BigComplex(real, imaginary); - } - - /** - * Returns a complex number with the specified polar {@link BigDecimal} radius and angle using the specified {@link MathContext}. - * - * @param radius the {@link BigDecimal} radius of the polar representation - * @param angle the {@link BigDecimal} angle in radians of the polar representation - * @param mathContext the {@link MathContext} used to calculate the result - * @return the complex number - */ - public static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext) { - if (radius.signum() == 0) { - return ZERO; - } - - return valueOf( - radius.multiply(BigDecimalMath.cos(angle, mathContext), mathContext), - radius.multiply(BigDecimalMath.sin(angle, mathContext), mathContext)); - } - - public static BigComplex valueOfPolar(double radius, double angle, MathContext mathContext) { - return valueOfPolar(BigDecimal.valueOf(radius), BigDecimal.valueOf(angle), mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java b/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java deleted file mode 100644 index a73d9bccdd..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java +++ /dev/null @@ -1,413 +0,0 @@ -package ch.obermuhlner.math.big; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.util.List; - -import static ch.obermuhlner.math.big.BigComplex.I; - -/** - * Provides advanced functions operating on {@link BigComplex}s. - */ -public class BigComplexMath { - - private static final BigDecimal TWO = BigDecimal.valueOf(2); - - /** - * Calculates the reciprocal of the given complex number using the specified {@link MathContext}. - * - * @param x the complex number to calculate the reciprocal - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - * @see BigComplex#reciprocal(MathContext) - */ - public static BigComplex reciprocal(BigComplex x, MathContext mathContext) { - return x.reciprocal(mathContext); - } - - /** - * Calculates the conjugate of the given complex number using the specified {@link MathContext}. - * - * @param x the complex number to calculate the conjugate - * @return the calculated {@link BigComplex} result - * @see BigComplex#conjugate() - */ - public static BigComplex conjugate(BigComplex x) { - return x.conjugate(); - } - - /** - * Calculates the absolute value (also known as magnitude, length or radius) of the given complex number using the specified {@link MathContext}. - * - * @param x the complex number to calculate the absolute value - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - * @see BigComplex#abs(MathContext) - */ - public static BigDecimal abs(BigComplex x, MathContext mathContext) { - return x.abs(mathContext); - } - - /** - * Calculates the square of the absolute value (also known as magnitude, length or radius) of the given complex number using the specified {@link MathContext}. - * - * @param x the complex number to calculate the square of the absolute value - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} result - * @see BigComplex#absSquare(MathContext) - */ - public static BigDecimal absSquare(BigComplex x, MathContext mathContext) { - return x.absSquare(mathContext); - } - - /** - * Calculates the angle in radians of the given complex number using the specified {@link MathContext}. - * - * @param x the complex number to calculate the angle - * @param mathContext the {@link MathContext} used to calculate the result - * @return the calculated {@link BigComplex} angle in radians - * @see BigComplex#angle(MathContext) - */ - public static BigDecimal angle(BigComplex x, MathContext mathContext) { - return x.angle(mathContext); - } - - /** - * Calculates the factorial of the specified {@link BigComplex}. - * - *

This implementation uses - * Spouge's approximation - * to calculate the factorial for non-integer values.

- * - *

This involves calculating a series of constants that depend on the desired precision. - * Since this constant calculation is quite expensive (especially for higher precisions), - * the constants for a specific precision will be cached - * and subsequent calls to this method with the same precision will be much faster.

- * - *

It is therefore recommended to do one call to this method with the standard precision of your application during the startup phase - * and to avoid calling it with many different precisions.

- * - *

See: Wikipedia: Factorial - Extension of factorial to non-integer values of argument

- * - * @param x the {@link BigComplex} - * @param mathContext the {@link MathContext} used for the result - * @return the factorial {@link BigComplex} - * @throws ArithmeticException if x is a negative integer value (-1, -2, -3, ...) - * @see BigDecimalMath#factorial(BigDecimal, MathContext) - * @see #gamma(BigComplex, MathContext) - */ - public static BigComplex factorial(BigComplex x, MathContext mathContext) { - if (x.isReal() && BigDecimalMath.isIntValue(x.re)) { - return BigComplex.valueOf(BigDecimalMath.factorial(x.re.intValueExact()).round(mathContext)); - } - - // https://en.wikipedia.org/wiki/Spouge%27s_approximation - MathContext mc = new MathContext(mathContext.getPrecision() * 2, mathContext.getRoundingMode()); - - int a = mathContext.getPrecision() * 13 / 10; - List constants = BigDecimalMath.getSpougeFactorialConstants(a); - - BigDecimal bigA = BigDecimal.valueOf(a); - - boolean negative = false; - BigComplex factor = BigComplex.valueOf(constants.get(0)); - for (int k = 1; k < a; k++) { - BigDecimal bigK = BigDecimal.valueOf(k); - factor = factor.add(BigComplex.valueOf(constants.get(k)).divide(x.add(bigK), mc), mc); - negative = !negative; - } - - BigComplex result = pow(x.add(bigA, mc), x.add(BigDecimal.valueOf(0.5), mc), mc); - result = result.multiply(exp(x.negate().subtract(bigA, mc), mc), mc); - result = result.multiply(factor, mc); - - return result.round(mathContext); - } - - /** - * Calculates the gamma function of the specified {@link BigComplex}. - * - *

This implementation uses {@link #factorial(BigComplex, MathContext)} internally, - * therefore the performance implications described there apply also for this method. - * - *

See: Wikipedia: Gamma function

- * - * @param x the {@link BigComplex} - * @param mathContext the {@link MathContext} used for the result - * @return the gamma {@link BigComplex} - * @throws ArithmeticException if x-1 is a negative integer value (-1, -2, -3, ...) - * @see BigDecimalMath#gamma(BigDecimal, MathContext) - * @see #factorial(BigComplex, MathContext) - */ - public static BigComplex gamma(BigComplex x, MathContext mathContext) { - return factorial(x.subtract(BigComplex.ONE), mathContext); - } - - - /** - * Calculates the natural exponent of {@link BigComplex} x (ex) in the complex domain. - * - *

See: Wikipedia: Exponent (Complex plane)

- * - * @param x the {@link BigComplex} to calculate the exponent for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated exponent {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex exp(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - BigDecimal expRe = BigDecimalMath.exp(x.re, mc); - return BigComplex.valueOf( - expRe.multiply(BigDecimalMath.cos(x.im, mc), mc).round(mathContext), - expRe.multiply(BigDecimalMath.sin(x.im, mc), mc)).round(mathContext); - } - - /** - * Calculates the sine (sinus) of {@link BigComplex} x in the complex domain. - * - *

See: Wikipedia: Sine (Sine with a complex argument)

- * - * @param x the {@link BigComplex} to calculate the sine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated sine {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex sin(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return BigComplex.valueOf( - BigDecimalMath.sin(x.re, mc).multiply(BigDecimalMath.cosh(x.im, mc), mc).round(mathContext), - BigDecimalMath.cos(x.re, mc).multiply(BigDecimalMath.sinh(x.im, mc), mc).round(mathContext)); - } - - /** - * Calculates the cosine (cosinus) of {@link BigComplex} x in the complex domain. - * - * @param x the {@link BigComplex} to calculate the cosine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated cosine {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex cos(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return BigComplex.valueOf( - BigDecimalMath.cos(x.re, mc).multiply(BigDecimalMath.cosh(x.im, mc), mc).round(mathContext), - BigDecimalMath.sin(x.re, mc).multiply(BigDecimalMath.sinh(x.im, mc), mc).negate().round(mathContext)); - } - - // - // http://scipp.ucsc.edu/~haber/archives/physics116A10/arc_10.pdf - - /** - * Calculates the tangens of {@link BigComplex} x in the complex domain. - * - * @param x the {@link BigComplex} to calculate the tangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated tangens {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex tan(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return sin(x, mc).divide(cos(x, mc), mc).round(mathContext); - } - - /** - * Calculates the arc tangens (inverted tangens) of {@link BigComplex} x in the complex domain. - * - *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

- * - * @param x the {@link BigComplex} to calculate the arc tangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc tangens {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex atan(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return log(I.subtract(x, mc).divide(I.add(x, mc), mc), mc).divide(I, mc).divide(TWO, mc).round(mathContext); - } - - /** - * Calculates the arc cotangens (inverted cotangens) of {@link BigComplex} x in the complex domain. - * - *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

- * - * @param x the {@link BigComplex} to calculate the arc cotangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc cotangens {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex acot(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return log(x.add(I, mc).divide(x.subtract(I, mc), mc), mc).divide(I, mc).divide(TWO, mc).round(mathContext); - } - - /** - * Calculates the arc sine (inverted sine) of {@link BigComplex} x in the complex domain. - * - *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

- * - * @param x the {@link BigComplex} to calculate the arc sine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc sine {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex asin(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return I.negate().multiply(log(I.multiply(x, mc).add(sqrt(BigComplex.ONE.subtract(x.multiply(x, mc), mc), mc), mc), mc), mc).round(mathContext); - } - - /** - * Calculates the arc cosine (inverted cosine) of {@link BigComplex} x in the complex domain. - * - *

See: Wikipedia: Inverse trigonometric functions (Extension to complex plane)

- * - * @param x the {@link BigComplex} to calculate the arc cosine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc cosine {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex acos(BigComplex x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return I.negate().multiply(log(x.add(sqrt(x.multiply(x, mc).subtract(BigComplex.ONE, mc), mc), mc), mc), mc).round(mathContext); - } - - /** - * Calculates the square root of {@link BigComplex} x in the complex domain (sqrt x). - * - *

See Wikipedia: Square root (Square root of an imaginary number)

- * - * @param x the {@link BigComplex} to calculate the square root for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated square root {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex sqrt(BigComplex x, MathContext mathContext) { - // https://math.stackexchange.com/questions/44406/how-do-i-get-the-square-root-of-a-complex-number - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - BigDecimal magnitude = x.abs(mc); - - BigComplex a = x.add(magnitude, mc); - return a.divide(a.abs(mc), mc).multiply(BigDecimalMath.sqrt(magnitude, mc), mc).round(mathContext); - } - - /** - * Calculates the natural logarithm of {@link BigComplex} x in the complex domain. - * - *

See: Wikipedia: Complex logarithm

- * - * @param x the {@link BigComplex} to calculate the natural logarithm for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated natural logarithm {@link BigComplex} with the precision specified in the mathContext - */ - public static BigComplex log(BigComplex x, MathContext mathContext) { - // https://en.wikipedia.org/wiki/Complex_logarithm - MathContext mc1 = new MathContext(mathContext.getPrecision() + 20, mathContext.getRoundingMode()); - MathContext mc2 = new MathContext(mathContext.getPrecision() + 5, mathContext.getRoundingMode()); - - return BigComplex.valueOf( - BigDecimalMath.log(x.abs(mc1), mc1).round(mathContext), - x.angle(mc2)).round(mathContext); - } - - /** - * Calculates {@link BigComplex} x to the power of long y (xy). - * - *

The implementation tries to minimize the number of multiplications of {@link BigComplex x} (using squares whenever possible).

- * - *

See: Wikipedia: Exponentiation - efficient computation

- * - * @param x the {@link BigComplex} value to take to the power - * @param y the long value to serve as exponent - * @param mathContext the {@link MathContext} used for the result - * @return the calculated x to the power of y with the precision specified in the mathContext - */ - public static BigComplex pow(BigComplex x, long y, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); - - if (y < 0) { - return BigComplex.ONE.divide(pow(x, -y, mc), mc).round(mathContext); - } - - BigComplex result = BigComplex.ONE; - while (y > 0) { - if ((y & 1) == 1) { - // odd exponent -> multiply result with x - result = result.multiply(x, mc); - y -= 1; - } - - if (y > 0) { - // even exponent -> square x - x = x.multiply(x, mc); - } - - y >>= 1; - } - - return result.round(mathContext); - } - - /** - * Calculates {@link BigComplex} x to the power of {@link BigDecimal} y (xy). - * - * @param x the {@link BigComplex} value to take to the power - * @param y the {@link BigDecimal} value to serve as exponent - * @param mathContext the {@link MathContext} used for the result - * @return the calculated x to the power of y with the precision specified in the mathContext - */ - public static BigComplex pow(BigComplex x, BigDecimal y, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - BigDecimal angleTimesN = x.angle(mc).multiply(y, mc); - return BigComplex.valueOf( - BigDecimalMath.cos(angleTimesN, mc), - BigDecimalMath.sin(angleTimesN, mc)).multiply(BigDecimalMath.pow(x.abs(mc), y, mc), mc).round(mathContext); - } - - /** - * Calculates {@link BigComplex} x to the power of {@link BigComplex} y (xy). - * - * @param x the {@link BigComplex} value to take to the power - * @param y the {@link BigComplex} value to serve as exponent - * @param mathContext the {@link MathContext} used for the result - * @return the calculated x to the power of y with the precision specified in the mathContext - */ - public static BigComplex pow(BigComplex x, BigComplex y, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return exp(y.multiply(log(x, mc), mc), mc).round(mathContext); - } - - /** - * Calculates the {@link BigDecimal} n'th root of {@link BigComplex} x (nsqrt x). - * - *

See Wikipedia: Square root

- * @param x the {@link BigComplex} value to calculate the n'th root - * @param n the {@link BigDecimal} defining the root - * @param mathContext the {@link MathContext} used for the result - * - * @return the calculated n'th root of x with the precision specified in the mathContext - */ - public static BigComplex root(BigComplex x, BigDecimal n, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return pow(x, BigDecimal.ONE.divide(n, mc), mc).round(mathContext); - } - - /** - * Calculates the {@link BigComplex} n'th root of {@link BigComplex} x (nsqrt x). - * - *

See Wikipedia: Square root

- * @param x the {@link BigComplex} value to calculate the n'th root - * @param n the {@link BigComplex} defining the root - * @param mathContext the {@link MathContext} used for the result - * - * @return the calculated n'th root of x with the precision specified in the mathContext - */ - public static BigComplex root(BigComplex x, BigComplex n, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - return pow(x, BigComplex.ONE.divide(n, mc), mc).round(mathContext); - } - - // TODO add root() for the k'th root - https://math.stackexchange.com/questions/322481/principal-nth-root-of-a-complex-number -} diff --git a/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java b/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java deleted file mode 100644 index 552331f3b4..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java +++ /dev/null @@ -1,1671 +0,0 @@ -package ch.obermuhlner.math.big; - -import static java.math.BigDecimal.ONE; -import static java.math.BigDecimal.TEN; -import static java.math.BigDecimal.ZERO; -import static java.math.BigDecimal.valueOf; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.util.*; - -import ch.obermuhlner.math.big.internal.AsinCalculator; -import ch.obermuhlner.math.big.internal.CosCalculator; -import ch.obermuhlner.math.big.internal.CoshCalculator; -import ch.obermuhlner.math.big.internal.ExpCalculator; -import ch.obermuhlner.math.big.internal.SinCalculator; -import ch.obermuhlner.math.big.internal.SinhCalculator; - -/** - * Provides advanced functions operating on {@link BigDecimal}s. - */ -public class BigDecimalMath { - - private static final BigDecimal TWO = valueOf(2); - private static final BigDecimal THREE = valueOf(3); - private static final BigDecimal MINUS_ONE = valueOf(-1); - private static final BigDecimal ONE_HALF = valueOf(0.5); - - private static final BigDecimal DOUBLE_MAX_VALUE = BigDecimal.valueOf(Double.MAX_VALUE); - - private static volatile BigDecimal log2Cache; - private static final Object log2CacheLock = new Object(); - - private static volatile BigDecimal log3Cache; - private static final Object log3CacheLock = new Object(); - - private static volatile BigDecimal log10Cache; - private static final Object log10CacheLock = new Object(); - - private static volatile BigDecimal piCache; - private static final Object piCacheLock = new Object(); - - private static volatile BigDecimal eCache; - private static final Object eCacheLock = new Object(); - - private static final BigDecimal ROUGHLY_TWO_PI = new BigDecimal("3.141592653589793").multiply(TWO); - - private static final int EXPECTED_INITIAL_PRECISION = 15; - - private static BigDecimal[] factorialCache = new BigDecimal[100]; - - static { - BigDecimal result = ONE; - factorialCache[0] = result; - for (int i = 1; i < factorialCache.length; i++) { - result = result.multiply(valueOf(i)); - factorialCache[i] = result; - } - } - - private static final Map> spougeFactorialConstantsCache = new HashMap<>(); - private static final Object spougeFactorialConstantsCacheLock = new Object(); - - private BigDecimalMath() { - // prevent instances - } - - /** - * Creates a {@link BigDecimal} from the specified String representation. - * - *

This method is equivalent to the String constructor {@link BigDecimal#BigDecimal(String)} - * but has been optimized for large strings (several thousand digits).

- * - * @param string the String representation - * @return the created {@link BigDecimal} - * @throws NumberFormatException if string is not a valid representation of a {@link BigDecimal} - * @see BigDecimal#BigDecimal(String) - * @see #toBigDecimal(String, MathContext) - */ - public static BigDecimal toBigDecimal(String string) { - return toBigDecimal(string, MathContext.UNLIMITED); - } - - /** - * Creates a {@link BigDecimal} from the specified String representation. - * - *

This method is equivalent to the String constructor {@link BigDecimal#BigDecimal(String, MathContext)} - * but has been optimized for large strings (several thousand digits).

- * - * @param string the string representation - * @param mathContext the {@link MathContext} used for the result - * @return the created {@link BigDecimal} - * @throws NumberFormatException if string is not a valid representation of a {@link BigDecimal} - * @throws ArithmeticException if the result is inexact but the rounding mode is {@code UNNECESSARY} - * @see BigDecimal#BigDecimal(String, MathContext) - * @see #toBigDecimal(String) - */ - public static BigDecimal toBigDecimal(String string, MathContext mathContext) { - int len = string.length(); - if (len < 600) { - return new BigDecimal(string, mathContext); - } - - int splitLength = len / (len >= 10000 ? 8 : 5); - return toBigDecimal(string, mathContext, splitLength); - } - - static BigDecimal toBigDecimal(String string, MathContext mathContext, int splitLength) { - int len = string.length(); - - if (len < splitLength) { - return new BigDecimal(string, mathContext); - } - - char[] chars = string.toCharArray(); - - boolean numberHasSign = false; - boolean negative = false; - int numberIndex = 0; - int dotIndex = -1; - int expIndex = -1; - boolean expHasSign = false; - int scale = 0; - - for (int i = 0; i < len; i++) { - char c = chars[i]; - switch (c) { - case '+': - if (expIndex >= 0) { - if (expHasSign) { - throw new NumberFormatException("Multiple signs in exponent"); - } - expHasSign = true; - } else { - if (numberHasSign) { - throw new NumberFormatException("Multiple signs in number"); - } - numberHasSign = true; - numberIndex = i + 1; - } - break; - case '-': - if (expIndex >= 0) { - if (expHasSign) { - throw new NumberFormatException("Multiple signs in exponent"); - } - expHasSign = true; - } else { - if (numberHasSign) { - throw new NumberFormatException("Multiple signs in number"); - } - numberHasSign = true; - negative = true; - numberIndex = i + 1; - } - break; - case 'e': - case 'E': - if (expIndex >= 0) { - throw new NumberFormatException("Multiple exponent markers"); - } - expIndex = i; - break; - case '.': - if (dotIndex >= 0) { - throw new NumberFormatException("Multiple decimal points"); - } - dotIndex = i; - break; - default: - if (dotIndex >= 0 && expIndex == -1) { - scale++; - } - } - } - - int numberEndIndex; - int exp = 0; - if (expIndex >= 0) { - numberEndIndex = expIndex; - String expString = new String(chars, expIndex + 1, len - expIndex - 1); - exp = Integer.parseInt(expString); - scale = adjustScale(scale, exp); - } else { - numberEndIndex = len; - } - - BigDecimal result; - - if (dotIndex >= 0) { - int leftLength = dotIndex - numberIndex; - BigDecimal bigDecimalLeft = toBigDecimalRecursive(chars, numberIndex, leftLength, exp, splitLength); - int rightLength = numberEndIndex - dotIndex - 1; - BigDecimal bigDecimalRight = toBigDecimalRecursive(chars, dotIndex + 1, rightLength, exp-rightLength, splitLength); - result = bigDecimalLeft.add(bigDecimalRight); - } else { - result = toBigDecimalRecursive(chars, numberIndex, numberEndIndex - numberIndex, exp, splitLength); - } - - if (scale != 0) { - result = result.setScale(scale); - } - - if (negative) { - result = result.negate(); - } - - if (mathContext.getPrecision() != 0) { - result = result.round(mathContext); - } - - return result; - } - - private static int adjustScale(int scale, long exp) { - long adjustedScale = scale - exp; - if (adjustedScale > Integer.MAX_VALUE || adjustedScale < Integer.MIN_VALUE) - throw new NumberFormatException("Scale out of range: " + adjustedScale + " while adjusting scale " + scale + " to exponent " + exp); - return (int) adjustedScale; - } - - private static BigDecimal toBigDecimalRecursive(char[] chars, int offset, int length, int scale, int splitLength) { - if (length > splitLength) { - int mid = length / 2; - BigDecimal bigDecimalLeft = toBigDecimalRecursive(chars, offset, mid, scale + length - mid, splitLength); - BigDecimal bigDecimalRight = toBigDecimalRecursive(chars, offset + mid, length - mid, scale, splitLength); - return bigDecimalLeft.add(bigDecimalRight); - } - if (length == 0) { - return BigDecimal.ZERO; - } - return new BigDecimal(chars, offset, length).movePointRight(scale); - } - - /** - * Returns whether the specified {@link BigDecimal} value can be represented as int. - * - *

If this returns true you can call {@link BigDecimal#intValueExact()} without fear of an {@link ArithmeticException}.

- * - * @param value the {@link BigDecimal} to check - * @return true if the value can be represented as int value - */ - public static boolean isIntValue(BigDecimal value) { - // TODO impl isIntValue() without exceptions - try { - value.intValueExact(); - return true; - } catch (ArithmeticException ex) { - // ignored - } - return false; - } - - /** - * Returns whether the specified {@link BigDecimal} value can be represented as long. - * - *

If this returns true you can call {@link BigDecimal#longValueExact()} without fear of an {@link ArithmeticException}.

- * - * @param value the {@link BigDecimal} to check - * @return true if the value can be represented as long value - */ - public static boolean isLongValue(BigDecimal value) { - // TODO impl isLongValue() without exceptions - try { - value.longValueExact(); - return true; - } catch (ArithmeticException ex) { - // ignored - } - return false; - } - - /** - * Returns whether the specified {@link BigDecimal} value can be represented as double. - * - *

If this returns true you can call {@link BigDecimal#doubleValue()} - * without fear of getting {@link Double#POSITIVE_INFINITY} or {@link Double#NEGATIVE_INFINITY} as result.

- * - *

Example: BigDecimalMath.isDoubleValue(new BigDecimal("1E309")) returns false, - * because new BigDecimal("1E309").doubleValue() returns Infinity.

- * - *

Note: This method does not check for possible loss of precision.

- * - *

For example BigDecimalMath.isDoubleValue(new BigDecimal("1.23400000000000000000000000000000001")) will return true, - * because new BigDecimal("1.23400000000000000000000000000000001").doubleValue() returns a valid double value, - * although it loses precision and returns 1.234.

- * - *

BigDecimalMath.isDoubleValue(new BigDecimal("1E-325")) will return true - * although this value is smaller than {@link Double#MIN_VALUE} (and therefore outside the range of values that can be represented as double) - * because new BigDecimal("1E-325").doubleValue() returns 0 which is a legal value with loss of precision.

- * - * @param value the {@link BigDecimal} to check - * @return true if the value can be represented as double value - */ - public static boolean isDoubleValue(BigDecimal value) { - if (value.compareTo(DOUBLE_MAX_VALUE) > 0) { - return false; - } - if (value.compareTo(DOUBLE_MAX_VALUE.negate()) < 0) { - return false; - } - - return true; - } - - /** - * Returns the mantissa of the specified {@link BigDecimal} written as mantissa * 10exponent. - * - *

The mantissa is defined as having exactly 1 digit before the decimal point.

- * - * @param value the {@link BigDecimal} - * @return the mantissa - * @see #exponent(BigDecimal) - */ - public static BigDecimal mantissa(BigDecimal value) { - int exponent = exponent(value); - if (exponent == 0) { - return value; - } - - return value.movePointLeft(exponent); - } - - /** - * Returns the exponent of the specified {@link BigDecimal} written as mantissa * 10exponent. - * - *

The mantissa is defined as having exactly 1 digit before the decimal point.

- * - * @param value the {@link BigDecimal} - * @return the exponent - * @see #mantissa(BigDecimal) - */ - public static int exponent(BigDecimal value) { - return value.precision() - value.scale() - 1; - } - - /** - * Returns the number of significant digits of the specified {@link BigDecimal}. - * - *

The result contains the number of all digits before the decimal point and - * all digits after the decimal point excluding trailing zeroes.

- * - *

Examples:

- *
    - *
  • significantDigits(new BigDecimal("12300.00")) returns 5
  • - *
  • significantDigits(new BigDecimal("1.23000")) returns 3
  • - *
  • significantDigits(new BigDecimal("0.00012300")) returns 3
  • - *
  • significantDigits(new BigDecimal("12300.4500")) returns 7
  • - *
- * - *

See: Wikipedia: Significant figures

- * - * @param value the {@link BigDecimal} - * @return the number of significant digits - * @see BigDecimal#stripTrailingZeros() - * @see BigDecimal#precision() - */ - public static int significantDigits(BigDecimal value) { - BigDecimal stripped = value.stripTrailingZeros(); - if (stripped.scale() >= 0) { - return stripped.precision(); - } else { - return stripped.precision() - stripped.scale(); - } - } - - /** - * Returns the integral part of the specified {@link BigDecimal} (left of the decimal point). - * - * @param value the {@link BigDecimal} - * @return the integral part - * @see #fractionalPart(BigDecimal) - */ - public static BigDecimal integralPart(BigDecimal value) { - return value.setScale(0, BigDecimal.ROUND_DOWN); - } - - /** - * Returns the fractional part of the specified {@link BigDecimal} (right of the decimal point). - * - * @param value the {@link BigDecimal} - * @return the fractional part - * @see #integralPart(BigDecimal) - */ - public static BigDecimal fractionalPart(BigDecimal value) { - return value.subtract(integralPart(value)); - } - - /** - * Rounds the specified {@link BigDecimal} to the precision of the specified {@link MathContext}. - * - *

This method calls {@link BigDecimal#round(MathContext)}.

- * - * @param value the {@link BigDecimal} to round - * @param mathContext the {@link MathContext} used for the result - * @return the rounded {@link BigDecimal} value - * @see BigDecimal#round(MathContext) - * @see BigDecimalMath#roundWithTrailingZeroes(BigDecimal, MathContext) - */ - public static BigDecimal round(BigDecimal value, MathContext mathContext) { - return value.round(mathContext); - } - - /** - * Rounds the specified {@link BigDecimal} to the precision of the specified {@link MathContext} including trailing zeroes. - * - *

This method is similar to {@link BigDecimal#round(MathContext)} but does not remove the trailing zeroes.

- * - *

Example:

-
-MathContext mc = new MathContext(5);
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.234567"), mc));    // 1.2346
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("123.4567"), mc));    // 123.46
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.001234567"), mc)); // 0.0012346
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.23"), mc));        // 1.2300
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("1.230000"), mc));    // 1.2300
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.00123"), mc));     // 0.0012300
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0"), mc));           // 0.0000
-System.out.println(BigDecimalMath.roundWithTrailingZeroes(new BigDecimal("0.00000000"), mc));  // 0.0000
-
- * - * @param value the {@link BigDecimal} to round - * @param mathContext the {@link MathContext} used for the result - * @return the rounded {@link BigDecimal} value including trailing zeroes - * @see BigDecimal#round(MathContext) - * @see BigDecimalMath#round(BigDecimal, MathContext) - */ - public static BigDecimal roundWithTrailingZeroes(BigDecimal value, MathContext mathContext) { - if (value.precision() == mathContext.getPrecision()) { - return value; - } - if (value.signum() == 0) { - return BigDecimal.ZERO.setScale(mathContext.getPrecision() - 1); - } - - try { - BigDecimal stripped = value.stripTrailingZeros(); - int exponentStripped = exponent(stripped); // value.precision() - value.scale() - 1; - - BigDecimal zero; - if (exponentStripped < -1) { - zero = BigDecimal.ZERO.setScale(mathContext.getPrecision() - exponentStripped); - } else { - zero = BigDecimal.ZERO.setScale(mathContext.getPrecision() + exponentStripped + 1); - } - return stripped.add(zero, mathContext); - } catch (ArithmeticException ex) { - return value.round(mathContext); - } - } - - /** - * Calculates the reciprocal of the specified {@link BigDecimal}. - * - * @param x the {@link BigDecimal} - * @param mathContext the {@link MathContext} used for the result - * @return the reciprocal {@link BigDecimal} - * @throws ArithmeticException if x = 0 - * @throws ArithmeticException if the result is inexact but the - * rounding mode is {@code UNNECESSARY} or - * {@code mc.precision == 0} and the quotient has a - * non-terminating decimal expansion. - */ - public static BigDecimal reciprocal(BigDecimal x, MathContext mathContext) { - return BigDecimal.ONE.divide(x, mathContext); - } - - /** - * Calculates the factorial of the specified integer argument. - * - *

factorial = 1 * 2 * 3 * ... n

- * - * @param n the {@link BigDecimal} - * @return the factorial {@link BigDecimal} - * @throws ArithmeticException if x < 0 - */ - public static BigDecimal factorial(int n) { - if (n < 0) { - throw new ArithmeticException("Illegal factorial(n) for n < 0: n = " + n); - } - if (n < factorialCache.length) { - return factorialCache[n]; - } - - BigDecimal result = factorialCache[factorialCache.length - 1]; - return result.multiply(factorialRecursion(factorialCache.length, n)); - } - - private static BigDecimal factorialLoop(int n1, final int n2) { - final long limit = Long.MAX_VALUE / n2; - long accu = 1; - BigDecimal result = BigDecimal.ONE; - while (n1 <= n2) { - if (accu <= limit) { - accu *= n1; - } else { - result = result.multiply(BigDecimal.valueOf(accu)); - accu = n1; - } - n1++; - } - return result.multiply(BigDecimal.valueOf(accu)); - } - - private static BigDecimal factorialRecursion(final int n1, final int n2) { - int threshold = n1 > 200 ? 80 : 150; - if (n2 - n1 < threshold) { - return factorialLoop(n1, n2); - } - final int mid = (n1 + n2) >> 1; - return factorialRecursion(mid + 1, n2).multiply(factorialRecursion(n1, mid)); - } - - /** - * Calculates the factorial of the specified {@link BigDecimal}. - * - *

This implementation uses - * Spouge's approximation - * to calculate the factorial for non-integer values.

- * - *

This involves calculating a series of constants that depend on the desired precision. - * Since this constant calculation is quite expensive (especially for higher precisions), - * the constants for a specific precision will be cached - * and subsequent calls to this method with the same precision will be much faster.

- * - *

It is therefore recommended to do one call to this method with the standard precision of your application during the startup phase - * and to avoid calling it with many different precisions.

- * - *

See: Wikipedia: Factorial - Extension of factorial to non-integer values of argument

- * - * @param x the {@link BigDecimal} - * @param mathContext the {@link MathContext} used for the result - * @return the factorial {@link BigDecimal} - * @throws ArithmeticException if x is a negative integer value (-1, -2, -3, ...) - * @throws UnsupportedOperationException if x is a non-integer value and the {@link MathContext} has unlimited precision - * @see #factorial(int) - * @see #gamma(BigDecimal, MathContext) - */ - public static BigDecimal factorial(BigDecimal x, MathContext mathContext) { - if (isIntValue(x)) { - return round(factorial(x.intValueExact()), mathContext); - } - - // https://en.wikipedia.org/wiki/Spouge%27s_approximation - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() << 1, mathContext.getRoundingMode()); - - int a = mathContext.getPrecision() * 13 / 10; - List constants = getSpougeFactorialConstants(a); - - BigDecimal bigA = BigDecimal.valueOf(a); - - boolean negative = false; - BigDecimal factor = constants.get(0); - for (int k = 1; k < a; k++) { - BigDecimal bigK = BigDecimal.valueOf(k); - factor = factor.add(constants.get(k).divide(x.add(bigK), mc)); - negative = !negative; - } - - BigDecimal result = pow(x.add(bigA), x.add(BigDecimal.valueOf(0.5)), mc); - result = result.multiply(exp(x.negate().subtract(bigA), mc)); - result = result.multiply(factor); - - return round(result, mathContext); - } - - static List getSpougeFactorialConstants(int a) { - synchronized (spougeFactorialConstantsCacheLock) { - return spougeFactorialConstantsCache.computeIfAbsent(a, key -> { - List constants = new ArrayList<>(a); - MathContext mc = new MathContext(a * 15 / 10); - - BigDecimal c0 = sqrt(pi(mc).multiply(TWO, mc), mc); - constants.add(c0); - - boolean negative = false; - for (int k = 1; k < a; k++) { - BigDecimal bigK = BigDecimal.valueOf(k); - long deltaAK = (long)a - k; - BigDecimal ck = pow(BigDecimal.valueOf(deltaAK), bigK.subtract(ONE_HALF), mc); - ck = ck.multiply(exp(BigDecimal.valueOf(deltaAK), mc), mc); - ck = ck.divide(factorial(k - 1), mc); - if (negative) { - ck = ck.negate(); - } - constants.add(ck); - - negative = !negative; - } - - return Collections.unmodifiableList(constants); - }); - } - } - - /** - * Calculates the gamma function of the specified {@link BigDecimal}. - * - *

This implementation uses {@link #factorial(BigDecimal, MathContext)} internally, - * therefore the performance implications described there apply also for this method. - * - *

See: Wikipedia: Gamma function

- * - * @param x the {@link BigDecimal} - * @param mathContext the {@link MathContext} used for the result - * @return the gamma {@link BigDecimal} - * @throws ArithmeticException if x-1 is a negative integer value (-1, -2, -3, ...) - * @throws UnsupportedOperationException if x is a non-integer value and the {@link MathContext} has unlimited precision - * @see #factorial(BigDecimal, MathContext) - */ - public static BigDecimal gamma(BigDecimal x, MathContext mathContext) { - return factorial(x.subtract(ONE), mathContext); - } - - /** - * Calculates the Bernoulli number for the specified index. - * - *

This function calculates the first Bernoulli numbers and therefore bernoulli(1) returns -0.5

- *

Note that bernoulli(x) for all odd x > 1 returns 0

- *

See: Wikipedia: Bernoulli number

- * - * @param n the index of the Bernoulli number to be calculated (starting at 0) - * @param mathContext the {@link MathContext} used for the result - * @return the Bernoulli number for the specified index - * @throws ArithmeticException if x < 0 - * @throws ArithmeticException if the result is inexact but the - * rounding mode is {@code UNNECESSARY} or - * {@code mc.precision == 0} and the quotient has a - * non-terminating decimal expansion. - */ - public static BigDecimal bernoulli(int n, MathContext mathContext) { - if (n < 0) { - throw new ArithmeticException("Illegal bernoulli(n) for n < 0: n = " + n); - } - - BigRational b = BigRational.bernoulli(n); - return b.toBigDecimal(mathContext); - } - - /** - * Calculates {@link BigDecimal} x to the power of {@link BigDecimal} y (xy). - * - * @param x the {@link BigDecimal} value to take to the power - * @param y the {@link BigDecimal} value to serve as exponent - * @param mathContext the {@link MathContext} used for the result - * @return the calculated x to the power of y with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - * @see #pow(BigDecimal, long, MathContext) - */ - public static BigDecimal pow(BigDecimal x, BigDecimal y, MathContext mathContext) { - checkMathContext(mathContext); - if (x.signum() == 0) { - switch (y.signum()) { - case 0 : return round(ONE, mathContext); - case 1 : return round(ZERO, mathContext); - } - } - - // TODO optimize y=0, y=1, y=10^k, y=-1, y=-10^k - - try { - long longValue = y.longValueExact(); - return pow(x, longValue, mathContext); - } catch (ArithmeticException ex) { - // ignored - } - - if (fractionalPart(y).signum() == 0) { - return powInteger(x, y, mathContext); - } - - // x^y = exp(y*log(x)) - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - BigDecimal result = exp(y.multiply(log(x, mc), mc), mc); - - return round(result, mathContext); - } - - /** - * Calculates {@link BigDecimal} x to the power of long y (xy). - * - *

The implementation tries to minimize the number of multiplications of {@link BigDecimal x} (using squares whenever possible).

- * - *

See: Wikipedia: Exponentiation - efficient computation

- * - * @param x the {@link BigDecimal} value to take to the power - * @param y the long value to serve as exponent - * @param mathContext the {@link MathContext} used for the result - * @return the calculated x to the power of y with the precision specified in the mathContext - * @throws ArithmeticException if y is negative and the result is inexact but the - * rounding mode is {@code UNNECESSARY} or - * {@code mc.precision == 0} and the quotient has a - * non-terminating decimal expansion. - * @throws ArithmeticException if the rounding mode is - * {@code UNNECESSARY} and the - * {@code BigDecimal} operation would require rounding. - */ - public static BigDecimal pow(BigDecimal x, long y, MathContext mathContext) { - MathContext mc = mathContext.getPrecision() == 0 ? mathContext : new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); - - // TODO optimize y=0, y=1, y=10^k, y=-1, y=-10^k - - if (y < 0) { - BigDecimal value = reciprocal(pow(x, -y, mc), mc); - return round(value, mathContext); - } - - BigDecimal result = ONE; - while (y > 0) { - if ((y & 1) == 1) { - // odd exponent -> multiply result with x - result = result.multiply(x, mc); - y -= 1; - } - - if (y > 0) { - // even exponent -> square x - x = x.multiply(x, mc); - } - - y >>= 1; - } - - return round(result, mathContext); - } - - /** - * Calculates {@link BigDecimal} x to the power of the integer value y (xy). - * - *

The value y MUST be an integer value.

- * - * @param x the {@link BigDecimal} value to take to the power - * @param integerY the {@link BigDecimal} integer value to serve as exponent - * @param mathContext the {@link MathContext} used for the result - * @return the calculated x to the power of y with the precision specified in the mathContext - * @see #pow(BigDecimal, long, MathContext) - */ - private static BigDecimal powInteger(BigDecimal x, BigDecimal integerY, MathContext mathContext) { - if (fractionalPart(integerY).signum() != 0) { - throw new IllegalArgumentException("Not integer value: " + integerY); - } - - if (integerY.signum() < 0) { - return ONE.divide(powInteger(x, integerY.negate(), mathContext), mathContext); - } - - MathContext mc = new MathContext(Math.max(mathContext.getPrecision(), -integerY.scale()) + 30, mathContext.getRoundingMode()); - - BigDecimal result = ONE; - while (integerY.signum() > 0) { - BigDecimal halfY = integerY.divide(TWO, mc); - - if (fractionalPart(halfY).signum() != 0) { - // odd exponent -> multiply result with x - result = result.multiply(x, mc); - integerY = integerY.subtract(ONE); - halfY = integerY.divide(TWO, mc); - } - - if (halfY.signum() > 0) { - // even exponent -> square x - x = x.multiply(x, mc); - } - - integerY = halfY; - } - - return round(result, mathContext); - } - - /** - * Calculates the square root of {@link BigDecimal} x. - * - *

See Wikipedia: Square root

- * - * @param x the {@link BigDecimal} value to calculate the square root - * @param mathContext the {@link MathContext} used for the result - * @return the calculated square root of x with the precision specified in the mathContext - * @throws ArithmeticException if x < 0 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal sqrt(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - switch (x.signum()) { - case 0: - return ZERO; - case -1: - throw new ArithmeticException("Illegal sqrt(x) for x < 0: x = " + x); - } - - int maxPrecision = mathContext.getPrecision() + 6; - BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1); - - BigDecimal result; - int adaptivePrecision; - if (isDoubleValue(x)) { - result = BigDecimal.valueOf(Math.sqrt(x.doubleValue())); - adaptivePrecision = EXPECTED_INITIAL_PRECISION; - } else { - result = x.multiply(ONE_HALF, mathContext); - adaptivePrecision = 1; - } - - BigDecimal last; - - if (adaptivePrecision < maxPrecision) { - if (result.multiply(result).compareTo(x) == 0) { - return round(result, mathContext); // early exit if x is a square number - } - - do { - last = result; - adaptivePrecision <<= 1; - if (adaptivePrecision > maxPrecision) { - adaptivePrecision = maxPrecision; - } - MathContext mc = new MathContext(adaptivePrecision, mathContext.getRoundingMode()); - result = x.divide(result, mc).add(last).multiply(ONE_HALF, mc); - } - while (adaptivePrecision < maxPrecision || result.subtract(last).abs().compareTo(acceptableError) > 0); - } - - return round(result, mathContext); - } - - /** - * Calculates the n'th root of {@link BigDecimal} x. - * - *

See Wikipedia: Square root

- * @param x the {@link BigDecimal} value to calculate the n'th root - * @param n the {@link BigDecimal} defining the root - * @param mathContext the {@link MathContext} used for the result - * - * @return the calculated n'th root of x with the precision specified in the mathContext - * @throws ArithmeticException if x < 0 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal root(BigDecimal x, BigDecimal n, MathContext mathContext) { - checkMathContext(mathContext); - switch (x.signum()) { - case 0: - return ZERO; - case -1: - throw new ArithmeticException("Illegal root(x) for x < 0: x = " + x); - } - - if (n.compareTo(BigDecimal.ONE) <= 0) { - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - return pow(x, BigDecimal.ONE.divide(n, mc), mathContext); - } - - int maxPrecision = mathContext.getPrecision() + 4; - BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1); - - BigDecimal nMinus1 = n.subtract(ONE); - BigDecimal result = x.divide(TWO, MathContext.DECIMAL32); - int adaptivePrecision = 2; // first approximation has really bad precision - BigDecimal step; - - do { - adaptivePrecision *= 3; - if (adaptivePrecision > maxPrecision) { - adaptivePrecision = maxPrecision; - } - MathContext mc = new MathContext(adaptivePrecision, mathContext.getRoundingMode()); - - step = x.divide(pow(result, nMinus1, mc), mc).subtract(result).divide(n, mc); - result = result.add(step); - } while (adaptivePrecision < maxPrecision || step.abs().compareTo(acceptableError) > 0); - - return round(result, mathContext); - } - - /** - * Calculates the natural logarithm of {@link BigDecimal} x. - * - *

See: Wikipedia: Natural logarithm

- * - * @param x the {@link BigDecimal} to calculate the natural logarithm for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated natural logarithm {@link BigDecimal} with the precision specified in the mathContext - * @throws ArithmeticException if x <= 0 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal log(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - if (x.signum() <= 0) { - throw new ArithmeticException("Illegal log(x) for x <= 0: x = " + x); - } - if (x.compareTo(ONE) == 0) { - return ZERO; - } - - BigDecimal result; - switch (x.compareTo(TEN)) { - case 0: - result = logTen(mathContext); - break; - case 1: - result = logUsingExponent(x, mathContext); - break; - default : - result = logUsingTwoThree(x, mathContext); - } - - return round(result, mathContext); - } - - /** - * Calculates the logarithm of {@link BigDecimal} x to the base 2. - * - * @param x the {@link BigDecimal} to calculate the logarithm base 2 for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated natural logarithm {@link BigDecimal} to the base 2 with the precision specified in the mathContext - * @throws ArithmeticException if x <= 0 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal log2(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - - BigDecimal result = log(x, mc).divide(logTwo(mc), mc); - return round(result, mathContext); - } - - /** - * Calculates the logarithm of {@link BigDecimal} x to the base 10. - * - * @param x the {@link BigDecimal} to calculate the logarithm base 10 for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated natural logarithm {@link BigDecimal} to the base 10 with the precision specified in the mathContext - * @throws ArithmeticException if x <= 0 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal log10(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 2, mathContext.getRoundingMode()); - - BigDecimal result = log(x, mc).divide(logTen(mc), mc); - return round(result, mathContext); - } - - private static BigDecimal logUsingNewton(BigDecimal x, MathContext mathContext) { - // https://en.wikipedia.org/wiki/Natural_logarithm in chapter 'High Precision' - // y = y + 2 * (x-exp(y)) / (x+exp(y)) - - int maxPrecision = mathContext.getPrecision() + 20; - BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1); - //System.out.println("logUsingNewton(" + x + " " + mathContext + ") precision " + maxPrecision); - - BigDecimal result; - int adaptivePrecision; - double doubleX = x.doubleValue(); - if (doubleX > 0.0 && isDoubleValue(x)) { - result = BigDecimal.valueOf(Math.log(doubleX)); - adaptivePrecision = EXPECTED_INITIAL_PRECISION; - } else { - result = x.divide(TWO, mathContext); - adaptivePrecision = 1; - } - - BigDecimal step; - - do { - adaptivePrecision *= 3; - if (adaptivePrecision > maxPrecision) { - adaptivePrecision = maxPrecision; - } - MathContext mc = new MathContext(adaptivePrecision, mathContext.getRoundingMode()); - - BigDecimal expY = BigDecimalMath.exp(result, mc); - step = TWO.multiply(x.subtract(expY)).divide(x.add(expY), mc); - //System.out.println(" step " + step + " adaptivePrecision=" + adaptivePrecision); - result = result.add(step); - } while (adaptivePrecision < maxPrecision || step.abs().compareTo(acceptableError) > 0); - - return result; - } - - private static BigDecimal logUsingExponent(BigDecimal x, MathContext mathContext) { - MathContext mcDouble = new MathContext(mathContext.getPrecision() << 1, mathContext.getRoundingMode()); - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - //System.out.println("logUsingExponent(" + x + " " + mathContext + ") precision " + mc); - - int exponent = exponent(x); - BigDecimal mantissa = mantissa(x); - - BigDecimal result = logUsingTwoThree(mantissa, mc); - if (exponent != 0) { - result = result.add(valueOf(exponent).multiply(logTen(mcDouble), mc)); - } - return result; - } - - private static BigDecimal logUsingTwoThree(BigDecimal x, MathContext mathContext) { - MathContext mcDouble = new MathContext(mathContext.getPrecision() << 1, mathContext.getRoundingMode()); - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - //System.out.println("logUsingTwoThree(" + x + " " + mathContext + ") precision " + mc); - - int factorOfTwo = 0; - int powerOfTwo = 1; - int factorOfThree = 0; - int powerOfThree = 1; - - double value = x.doubleValue(); - if (value < 0.01) { - // do nothing - } else if (value < 0.1) { // never happens when called by logUsingExponent() - while (value < 0.6) { - value *= 2; - factorOfTwo--; - powerOfTwo <<= 1; - } - } - else if (value < 0.115) { // (0.1 - 0.11111 - 0.115) -> (0.9 - 1.0 - 1.035) - factorOfThree = -2; - powerOfThree = 9; - } - else if (value < 0.14) { // (0.115 - 0.125 - 0.14) -> (0.92 - 1.0 - 1.12) - factorOfTwo = -3; - powerOfTwo = 8; - } - else if (value < 0.2) { // (0.14 - 0.16667 - 0.2) - (0.84 - 1.0 - 1.2) - factorOfTwo = -1; - powerOfTwo = 2; - factorOfThree = -1; - powerOfThree = 3; - } - else if (value < 0.3) { // (0.2 - 0.25 - 0.3) -> (0.8 - 1.0 - 1.2) - factorOfTwo = -2; - powerOfTwo = 4; - } - else if (value < 0.42) { // (0.3 - 0.33333 - 0.42) -> (0.9 - 1.0 - 1.26) - factorOfThree = -1; - powerOfThree = 3; - } - else if (value < 0.7) { // (0.42 - 0.5 - 0.7) -> (0.84 - 1.0 - 1.4) - factorOfTwo = -1; - powerOfTwo = 2; - } - else if (value < 1.4) { // (0.7 - 1.0 - 1.4) -> (0.7 - 1.0 - 1.4) - // do nothing - } - else if (value < 2.5) { // (1.4 - 2.0 - 2.5) -> (0.7 - 1.0 - 1.25) - factorOfTwo = 1; - powerOfTwo = 2; - } - else if (value < 3.5) { // (2.5 - 3.0 - 3.5) -> (0.833333 - 1.0 - 1.166667) - factorOfThree = 1; - powerOfThree = 3; - } - else if (value < 5.0) { // (3.5 - 4.0 - 5.0) -> (0.875 - 1.0 - 1.25) - factorOfTwo = 2; - powerOfTwo = 4; - } - else if (value < 7.0) { // (5.0 - 6.0 - 7.0) -> (0.833333 - 1.0 - 1.166667) - factorOfThree = 1; - powerOfThree = 3; - factorOfTwo = 1; - powerOfTwo = 2; - } - else if (value < 8.5) { // (7.0 - 8.0 - 8.5) -> (0.875 - 1.0 - 1.0625) - factorOfTwo = 3; - powerOfTwo = 8; - } - else if (value < 10.0) { // (8.5 - 9.0 - 10.0) -> (0.94444 - 1.0 - 1.11111) - factorOfThree = 2; - powerOfThree = 9; - } - else { - while (value > 1.4) { // never happens when called by logUsingExponent() - value /= 2; - factorOfTwo++; - powerOfTwo <<= 1; - } - } - - BigDecimal correctedX = x; - BigDecimal result = ZERO; - - if (factorOfTwo > 0) { - correctedX = correctedX.divide(valueOf(powerOfTwo), mc); - result = result.add(logTwo(mcDouble).multiply(valueOf(factorOfTwo), mc)); - } - else if (factorOfTwo < 0) { - correctedX = correctedX.multiply(valueOf(powerOfTwo), mc); - result = result.subtract(logTwo(mcDouble).multiply(valueOf(-factorOfTwo), mc)); - } - - if (factorOfThree > 0) { - correctedX = correctedX.divide(valueOf(powerOfThree), mc); - result = result.add(logThree(mcDouble).multiply(valueOf(factorOfThree), mc)); - } - else if (factorOfThree < 0) { - correctedX = correctedX.multiply(valueOf(powerOfThree), mc); - result = result.subtract(logThree(mcDouble).multiply(valueOf(-factorOfThree), mc)); - } - - if (x == correctedX && result == ZERO) { - return logUsingNewton(x, mathContext); - } - - result = result.add(logUsingNewton(correctedX, mc), mc); - - return result; - } - - /** - * Returns the number pi. - * - *

See Wikipedia: Pi

- * - * @param mathContext the {@link MathContext} used for the result - * @return the number pi with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal pi(MathContext mathContext) { - checkMathContext(mathContext); - BigDecimal result = null; - - synchronized (piCacheLock) { - if (piCache != null && mathContext.getPrecision() <= piCache.precision()) { - result = piCache; - } else { - piCache = piChudnovski(mathContext); - return piCache; - } - } - - return round(result, mathContext); - } - - private static BigDecimal piChudnovski(MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); - - final BigDecimal value24 = BigDecimal.valueOf(24); - final BigDecimal value640320 = BigDecimal.valueOf(640320); - final BigDecimal value13591409 = BigDecimal.valueOf(13591409); - final BigDecimal value545140134 = BigDecimal.valueOf(545140134); - final BigDecimal valueDivisor = value640320.pow(3).divide(value24, mc); - - BigDecimal sumA = BigDecimal.ONE; - BigDecimal sumB = BigDecimal.ZERO; - - BigDecimal a = BigDecimal.ONE; - long dividendTerm1 = 5; // -(6*k - 5) - long dividendTerm2 = -1; // 2*k - 1 - long dividendTerm3 = -1; // 6*k - 1 - BigDecimal kPower3 = BigDecimal.ZERO; - - long iterationCount = (mc.getPrecision()+13) / 14; - for (long k = 1; k <= iterationCount; k++) { - BigDecimal valueK = BigDecimal.valueOf(k); - dividendTerm1 += -6; - dividendTerm2 += 2; - dividendTerm3 += 6; - BigDecimal dividend = BigDecimal.valueOf(dividendTerm1).multiply(BigDecimal.valueOf(dividendTerm2)).multiply(BigDecimal.valueOf(dividendTerm3)); - kPower3 = valueK.pow(3); - BigDecimal divisor = kPower3.multiply(valueDivisor, mc); - a = a.multiply(dividend).divide(divisor, mc); - BigDecimal b = valueK.multiply(a, mc); - - sumA = sumA.add(a); - sumB = sumB.add(b); - } - - final BigDecimal value426880 = BigDecimal.valueOf(426880); - final BigDecimal value10005 = BigDecimal.valueOf(10005); - final BigDecimal factor = value426880.multiply(sqrt(value10005, mc)); - BigDecimal pi = factor.divide(value13591409.multiply(sumA, mc).add(value545140134.multiply(sumB, mc)), mc); - - return round(pi, mathContext); - } - - /** - * Returns the number e. - * - *

See Wikipedia: E (mathematical_constant)

- * - * @param mathContext the {@link MathContext} used for the result - * @return the number e with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal e(MathContext mathContext) { - checkMathContext(mathContext); - BigDecimal result = null; - - synchronized (eCacheLock) { - if (eCache != null && mathContext.getPrecision() <= eCache.precision()) { - result = eCache; - } else { - eCache = exp(ONE, mathContext); - return eCache; - } - } - - return round(result, mathContext); - } - - private static BigDecimal logTen(MathContext mathContext) { - BigDecimal result = null; - - synchronized (log10CacheLock) { - if (log10Cache != null && mathContext.getPrecision() <= log10Cache.precision()) { - result = log10Cache; - } else { - log10Cache = logUsingNewton(BigDecimal.TEN, mathContext); - return log10Cache; - } - } - - return round(result, mathContext); - } - - private static BigDecimal logTwo(MathContext mathContext) { - BigDecimal result = null; - - synchronized (log2CacheLock) { - if (log2Cache != null && mathContext.getPrecision() <= log2Cache.precision()) { - result = log2Cache; - } else { - log2Cache = logUsingNewton(TWO, mathContext); - return log2Cache; - } - } - - return round(result, mathContext); - } - - private static BigDecimal logThree(MathContext mathContext) { - BigDecimal result = null; - - synchronized (log3CacheLock) { - if (log3Cache != null && mathContext.getPrecision() <= log3Cache.precision()) { - result = log3Cache; - } else { - log3Cache = logUsingNewton(THREE, mathContext); - return log3Cache; - } - } - - return round(result, mathContext); - } - - /** - * Calculates the natural exponent of {@link BigDecimal} x (ex). - * - *

See: Wikipedia: Exponent

- * - * @param x the {@link BigDecimal} to calculate the exponent for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated exponent {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal exp(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - if (x.signum() == 0) { - return ONE; - } - - return expIntegralFractional(x, mathContext); - } - - private static BigDecimal expIntegralFractional(BigDecimal x, MathContext mathContext) { - BigDecimal integralPart = integralPart(x); - - if (integralPart.signum() == 0) { - return expTaylor(x, mathContext); - } - - BigDecimal fractionalPart = x.subtract(integralPart); - - MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); - - BigDecimal z = ONE.add(fractionalPart.divide(integralPart, mc)); - BigDecimal t = expTaylor(z, mc); - - BigDecimal result = pow(t, integralPart.intValueExact(), mc); - - return round(result, mathContext); - } - - private static BigDecimal expTaylor(BigDecimal x, MathContext mathContext) { - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - - x = x.divide(valueOf(256), mc); - - BigDecimal result = ExpCalculator.INSTANCE.calculate(x, mc); - result = BigDecimalMath.pow(result, 256, mc); - return round(result, mathContext); - } - - /** - * Calculates the sine (sinus) of {@link BigDecimal} x. - * - *

See: Wikipedia: Sine

- * - * @param x the {@link BigDecimal} to calculate the sine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated sine {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal sin(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - - if (x.abs().compareTo(ROUGHLY_TWO_PI) > 0) { - MathContext mc2 = new MathContext(mc.getPrecision() + 4, mathContext.getRoundingMode()); - BigDecimal twoPi = TWO.multiply(pi(mc2)); - x = x.remainder(twoPi, mc2); - } - - BigDecimal result = SinCalculator.INSTANCE.calculate(x, mc); - return round(result, mathContext); - } - - /** - * Calculates the arc sine (inverted sine) of {@link BigDecimal} x. - * - *

See: Wikipedia: Arcsine

- * - * @param x the {@link BigDecimal} to calculate the arc sine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc sine {@link BigDecimal} with the precision specified in the mathContext - * @throws ArithmeticException if x > 1 or x < -1 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal asin(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - if (x.compareTo(ONE) > 0) { - throw new ArithmeticException("Illegal asin(x) for x > 1: x = " + x); - } - if (x.compareTo(MINUS_ONE) < 0) { - throw new ArithmeticException("Illegal asin(x) for x < -1: x = " + x); - } - - if (x.signum() == -1) { - return asin(x.negate(), mathContext).negate(); - } - - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - - if (x.compareTo(BigDecimal.valueOf(0.707107)) >= 0) { - BigDecimal xTransformed = sqrt(ONE.subtract(x.multiply(x)), mc); - return acos(xTransformed, mathContext); - } - - BigDecimal result = AsinCalculator.INSTANCE.calculate(x, mc); - return round(result, mathContext); - } - - /** - * Calculates the cosine (cosinus) of {@link BigDecimal} x. - * - *

See: Wikipedia: Cosine

- * - * @param x the {@link BigDecimal} to calculate the cosine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated cosine {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal cos(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - - if (x.abs().compareTo(ROUGHLY_TWO_PI) > 0) { - MathContext mc2 = new MathContext(mc.getPrecision() + 4, mathContext.getRoundingMode()); - BigDecimal twoPi = TWO.multiply(pi(mc2), mc2); - x = x.remainder(twoPi, mc2); - } - - BigDecimal result = CosCalculator.INSTANCE.calculate(x, mc); - return round(result, mathContext); - } - - /** - * Calculates the arc cosine (inverted cosine) of {@link BigDecimal} x. - * - *

See: Wikipedia: Arccosine

- * - * @param x the {@link BigDecimal} to calculate the arc cosine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc sine {@link BigDecimal} with the precision specified in the mathContext - * @throws ArithmeticException if x > 1 or x < -1 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal acos(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - if (x.compareTo(ONE) > 0) { - throw new ArithmeticException("Illegal acos(x) for x > 1: x = " + x); - } - if (x.compareTo(MINUS_ONE) < 0) { - throw new ArithmeticException("Illegal acos(x) for x < -1: x = " + x); - } - - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - - BigDecimal result = pi(mc).divide(TWO, mc).subtract(asin(x, mc)); - return round(result, mathContext); - } - - /** - * Calculates the tangens of {@link BigDecimal} x. - * - *

See: Wikipedia: Tangens

- * - * @param x the {@link BigDecimal} to calculate the tangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated tangens {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal tan(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - if (x.signum() == 0) { - return ZERO; - } - - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - BigDecimal result = sin(x, mc).divide(cos(x, mc), mc); - return round(result, mathContext); - } - - /** - * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} x. - * - *

See: Wikipedia: Arctangens

- * - * @param x the {@link BigDecimal} to calculate the arc tangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal atan(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - - x = x.divide(sqrt(ONE.add(x.multiply(x, mc)), mc), mc); - - BigDecimal result = asin(x, mc); - return round(result, mathContext); - } - - /** - * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} y / x in the range -pi to pi. - * - *

This is useful to calculate the angle theta from the conversion of rectangular - * coordinates (xy) to polar coordinates (r, theta).

- * - *

See: Wikipedia: Atan2

- * - * @param y the {@link BigDecimal} - * @param x the {@link BigDecimal} - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the mathContext - * @throws ArithmeticException if x = 0 and y = 0 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal atan2(BigDecimal y, BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 3, mathContext.getRoundingMode()); - - if (x.signum() > 0) { // x > 0 - return atan(y.divide(x, mc), mathContext); - } else if (x.signum() < 0) { - if (y.signum() > 0) { // x < 0 && y > 0 - return atan(y.divide(x, mc), mc).add(pi(mc), mathContext); - } else if (y.signum() < 0) { // x < 0 && y < 0 - return atan(y.divide(x, mc), mc).subtract(pi(mc), mathContext); - } else { // x < 0 && y = 0 - return pi(mathContext); - } - } else { - if (y.signum() > 0) { // x == 0 && y > 0 - return pi(mc).divide(TWO, mathContext); - } else if (y.signum() < 0) { // x == 0 && y < 0 - return pi(mc).divide(TWO, mathContext).negate(); - } else { - throw new ArithmeticException("Illegal atan2(y, x) for x = 0; y = 0"); - } - } - } - - /** - * Calculates the cotangens of {@link BigDecimal} x. - * - *

See: Wikipedia: Cotangens

- * - * @param x the {@link BigDecimal} to calculate the cotangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated cotanges {@link BigDecimal} with the precision specified in the mathContext - * @throws ArithmeticException if x = 0 - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal cot(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - if (x.signum() == 0) { - throw new ArithmeticException("Illegal cot(x) for x = 0"); - } - - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - BigDecimal result = cos(x, mc).divide(sin(x, mc), mc); - return round(result, mathContext); - } - - /** - * Calculates the inverse cotangens (arc cotangens) of {@link BigDecimal} x. - * - *

See: Wikipedia: Arccotangens

- * - * @param x the {@link BigDecimal} to calculate the arc cotangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc cotangens {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal acot(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - BigDecimal result = pi(mc).divide(TWO, mc).subtract(atan(x, mc)); - return round(result, mathContext); - } - - /** - * Calculates the hyperbolic sine of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the hyperbolic sine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated hyperbolic sine {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal sinh(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - BigDecimal result = SinhCalculator.INSTANCE.calculate(x, mc); - return round(result, mathContext); - } - - /** - * Calculates the hyperbolic cosine of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the hyperbolic cosine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated hyperbolic cosine {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal cosh(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); - BigDecimal result = CoshCalculator.INSTANCE.calculate(x, mc); - return round(result, mathContext); - } - - /** - * Calculates the hyperbolic tangens of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the hyperbolic tangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated hyperbolic tangens {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal tanh(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - BigDecimal result = sinh(x, mc).divide(cosh(x, mc), mc); - return round(result, mathContext); - } - - /** - * Calculates the hyperbolic cotangens of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the hyperbolic cotangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated hyperbolic cotangens {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal coth(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - BigDecimal result = cosh(x, mc).divide(sinh(x, mc), mc); - return round(result, mathContext); - } - - /** - * Calculates the arc hyperbolic sine (inverse hyperbolic sine) of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic sine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc hyperbolic sine {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal asinh(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); - BigDecimal result = log(x.add(sqrt(x.multiply(x, mc).add(ONE, mc), mc)), mc); - return round(result, mathContext); - } - - /** - * Calculates the arc hyperbolic cosine (inverse hyperbolic cosine) of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic cosine for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc hyperbolic cosine {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal acosh(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - BigDecimal result = log(x.add(sqrt(x.multiply(x).subtract(ONE), mc)), mc); - return round(result, mathContext); - } - - /** - * Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal atanh(BigDecimal x, MathContext mathContext) { - if (x.compareTo(BigDecimal.ONE) >= 0) { - throw new ArithmeticException("Illegal atanh(x) for x >= 1: x = " + x); - } - if (x.compareTo(MINUS_ONE) <= 0) { - throw new ArithmeticException("Illegal atanh(x) for x <= -1: x = " + x); - } - - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - BigDecimal result = log(ONE.add(x).divide(ONE.subtract(x), mc), mc).multiply(ONE_HALF); - return round(result, mathContext); - } - - /** - * Calculates the arc hyperbolic cotangens (inverse hyperbolic cotangens) of {@link BigDecimal} x. - * - *

See: Wikipedia: Hyperbolic function

- * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic cotangens for - * @param mathContext the {@link MathContext} used for the result - * @return the calculated arc hyperbolic cotangens {@link BigDecimal} with the precision specified in the mathContext - * @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision - */ - public static BigDecimal acoth(BigDecimal x, MathContext mathContext) { - checkMathContext(mathContext); - MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); - BigDecimal result = log(x.add(ONE).divide(x.subtract(ONE), mc), mc).multiply(ONE_HALF); - return round(result, mathContext); - } - - private static void checkMathContext (MathContext mathContext) { - if (mathContext.getPrecision() == 0) { - throw new UnsupportedOperationException("Unlimited MathContext not supported"); - } - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/BigFloat.java b/src/main/java/ch/obermuhlner/math/big/BigFloat.java deleted file mode 100644 index eb8944f2c4..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/BigFloat.java +++ /dev/null @@ -1,1947 +0,0 @@ -package ch.obermuhlner.math.big; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; -import java.util.Objects; - -/** - * A wrapper around {@link BigDecimal} which simplifies the consistent usage of the {@link MathContext} - * and provides a simpler API for calculations. - * - *

Overview

- * - *

Every {@link BigFloat} instance has a reference to a {@link Context} that specifies the {@link MathContext} to be used for all calculations and values.

- * - *

The API for calculations is simplified and more consistent with the typical mathematical usage.

- *
    - *
  • Factory methods for values: - *
      - *
    • valueOf(BigFloat)
    • - *
    • valueOf(BigDecimal)
    • - *
    • valueOf(int)
    • - *
    • valueOf(long)
    • - *
    • valueOf(double)
    • - *
    • valueOf(String)
    • - *
    • pi()
    • - *
    • e()
    • - *
    - *
  • - *
  • All standard operators: - *
      - *
    • add(x)
    • - *
    • subtract(x)
    • - *
    • multiply(x)
    • - *
    • remainder(x)
    • - *
    • pow(y)
    • - *
    • root(y)
    • - *
    - *
  • - *
  • Calculation methods are overloaded for different value types: - *
      - *
    • add(BigFloat)
    • - *
    • add(BigDecimal)
    • - *
    • add(int)
    • - *
    • add(long)
    • - *
    • add(double)
    • - *
    • ...
    • - *
    - *
  • - *
  • Mathematical functions are written as they are traditionally are written: - *
      - *
    • abs(x)
    • - *
    • log(x)
    • - *
    • sin(x)
    • - *
    • min(x1, x2, ...)
    • - *
    • max(x1, x2, ...)
    • - *
    • ...
    • - *
    - *
  • - *
  • Support for advanced mathematical functions: - *
      - *
    • sqrt(x)
    • - *
    • log(x)
    • - *
    • exp(x)
    • - *
    • sin(x)
    • - *
    • cos(x)
    • - *
    • tan(x)
    • - *
    • ...
    • - *
    - *
  • - *
  • Methods to access parts of a value: - *
      - *
    • getMantissa()
    • - *
    • getExponent()
    • - *
    • getIntegralPart()
    • - *
    • getFractionalPart()
    • - *
    - *
  • - *
  • Equals and Hashcode methods: - *
      - *
    • equals(Object) that returns whether two BigFloat values are mathematically the same
    • - *
    • hashCode() consistent with equals(Object)
    • - *
    - *
  • - *
  • Comparison methods: - *
      - *
    • isEqual(BigFloat)
    • - *
    • isLessThan(BigFloat)
    • - *
    • isLessThanOrEqual(BigFloat)
    • - *
    • isGreaterThan(BigFloat)
    • - *
    • isGreaterThanOrEqual(BigFloat)
    • - *
    - *
  • - *
- * - *

Usage

- * - *

Before doing any calculations you need to create a Context specifying the precision used for all calculations.

- *
- * Context context = BigFloat.context(100); // precision of 100 digits
- * Context anotherContext = BigFloat.context(new MathContext(10, RoundingMode.HALF_UP); // precision of 10 digits, rounding half up
- * 
- * - *

The Context can then be used to create the first value of the calculation:

- *
- * BigFloat value1 = context.valueOf(640320);
- * 
- * - *

The BigFloat instance holds a reference to the Context. This context is then passed from calculation to calculation.

- *
- * BigFloat value2 = context.valueOf(640320).pow(3).divide(24);
- * BigFloat value3 = BigFloat.sin(value2);
- * 
- * - *

The BigFloat result can be converted to other numerical types:

- *
- * BigDecimal bigDecimalValue = value3.toBigDecimal();
- * double doubleValue = value3.toDouble();
- * long longValue = value3.toLong();
- * int intValue = value3.toInt();
- * 
- */ -@SuppressWarnings("WeakerAccess") -public class BigFloat implements Comparable, Serializable { - private static final long serialVersionUID = -7323679117445486894L; - - /** - * Represents a value that is not a number. - * @see Double#NaN - */ - public static final BigFloat NaN = new SpecialBigFloat(SpecialBigFloat.Type.NaN); - - /** - * Represents the positive infinity. - * @see Double#POSITIVE_INFINITY - */ - public static final BigFloat POSITIVE_INFINITY = new SpecialBigFloat(SpecialBigFloat.Type.POSITIVE_INFINITY); - - /** - * Represents the positive infinity. - * @see Double#NEGATIVE_INFINITY - */ - public static final BigFloat NEGATIVE_INFINITY = new SpecialBigFloat(SpecialBigFloat.Type.NEGATIVE_INFINITY); - - private final BigDecimal value; - private final Context context; - - private BigFloat(BigDecimal value, Context context) { - this.value = value; - this.context = context; - } - - /** - * Creates a {@link Context} with the specified precision and {@link RoundingMode#HALF_UP} rounding. - * - * @param precision the precision - * - * @return the {@link Context} - */ - public static Context context(int precision) { - return new Context(new MathContext(precision)); - } - - /** - * Creates a {@link Context} with the specified {@link MathContext}. - * - * @param mathContext the {@link MathContext} - * - * @return the {@link Context} - */ - public static Context context(MathContext mathContext) { - return new Context(mathContext); - } - - /** - * Returns the {@link BigFloat} that is this + x. - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param x the value to add - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#add(BigDecimal, MathContext) - */ - public BigFloat add(BigFloat x) { - if (x.isSpecial()) - return x.add(this); - Context c = max(context, x.context); - return c.valueOf(value.add(x.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is this + x. - * - * @param x the value to add - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#add(BigDecimal, MathContext) - */ - public BigFloat add(BigDecimal x) { - return add(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this + x. - * - * @param x the value to add - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#add(BigDecimal, MathContext) - */ - public BigFloat add(int x) { - return add(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this + x. - * - * @param x the value to add - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#add(BigDecimal, MathContext) - */ - public BigFloat add(long x) { - return add(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this + x. - * - * @param x the value to add - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#add(BigDecimal, MathContext) - */ - public BigFloat add(double x) { - return add(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this - x. - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param x the value to subtract - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#subtract(BigDecimal, MathContext) - */ - public BigFloat subtract(BigFloat x) { - if (x.isSpecial()) - return negate(x).add(this); - Context c = max(context, x.context); - return c.valueOf(value.subtract(x.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is this - x. - * - * @param x the value to subtract - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#subtract(BigDecimal, MathContext) - */ - public BigFloat subtract(BigDecimal x) { - return subtract(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this - x. - * - * @param x the value to subtract - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#subtract(BigDecimal, MathContext) - */ - public BigFloat subtract(int x) { - return subtract(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this - x. - * - * @param x the value to subtract - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#subtract(BigDecimal, MathContext) - */ - public BigFloat subtract(long x) { - return subtract(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this - x. - * - * @param x the value to subtract - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#subtract(BigDecimal, MathContext) - */ - public BigFloat subtract(double x) { - return subtract(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this * x. - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param x the value to multiply - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#multiply(BigDecimal, MathContext) - */ - public BigFloat multiply(BigFloat x) { - if (x.isSpecial()) - return x.multiply(this); - Context c = max(context, x.context); - return c.valueOf(value.multiply(x.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is this * x. - * - * @param x the value to multiply - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#multiply(BigDecimal, MathContext) - */ - public BigFloat multiply(BigDecimal x) { - return multiply(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this * x. - * - * @param x the value to multiply - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#multiply(BigDecimal, MathContext) - */ - public BigFloat multiply(int x) { - return multiply(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this * x. - * - * @param x the value to multiply - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#multiply(BigDecimal, MathContext) - */ - public BigFloat multiply(long x) { - return multiply(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this * x. - * - * @param x the value to multiply - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#multiply(BigDecimal, MathContext) - */ - public BigFloat multiply(double x) { - return multiply(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this / x. - * - *

If the two values do not have the same {@link Context}, - * the result will contain the {@link Context} with the larger precision.

- * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#divide(BigDecimal, MathContext) - */ - public BigFloat divide(BigFloat x) { - if (x.isSpecial()) { - if (x == NaN) { - return NaN; - } else { - return context.valueOf(0); - } - } - if (this.isZero() && !x.isZero()) { - return context.valueOf(0); - } - if (x.isZero()) { - if (this.isZero()) { - return NaN; // 0 or -0 / 0 = NaN - } else if (this.isNegative()) { - return NEGATIVE_INFINITY;// -N / 0 = -INF - } else { - return POSITIVE_INFINITY;// N / 0 = +INF - } - } - - Context c = max(context, x.context); - return c.valueOf(value.divide(x.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is this / x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#divide(BigDecimal, MathContext) - */ - public BigFloat divide(BigDecimal x) { - return divide(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this / x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#divide(BigDecimal, MathContext) - */ - public BigFloat divide(int x) { - return divide(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this / x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#divide(BigDecimal, MathContext) - */ - public BigFloat divide(long x) { - return divide(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this / x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#divide(BigDecimal, MathContext) - */ - public BigFloat divide(double x) { - return divide(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is the remainder when dividing this by x. - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#remainder(BigDecimal, MathContext) - */ - public BigFloat remainder(BigFloat x) { - if (x.isSpecial()) { - if (x == NaN) { - return NaN; - } else { - return this; - } - } - if (this.isZero() && !x.isZero()) { - return context.valueOf(0); - } - if (x.isZero()) { - return NaN; - } - - Context c = max(context, x.context); - return c.valueOf(value.remainder(x.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is the remainder when dividing this by x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#remainder(BigDecimal, MathContext) - */ - public BigFloat remainder(BigDecimal x) { - return remainder(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is the remainder when dividing this by x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#remainder(BigDecimal, MathContext) - */ - public BigFloat remainder(int x) { - return remainder(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is the remainder when dividing this by x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#remainder(BigDecimal, MathContext) - */ - public BigFloat remainder(long x) { - return remainder(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is the remainder when dividing this by x. - * - * @param x the value to divide with - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#remainder(BigDecimal, MathContext) - */ - public BigFloat remainder(double x) { - return remainder(context.valueOf(x)); - } - - /** - * Returns the {@link BigFloat} that is this to the power of y. - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param y the value of the power - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat pow(BigFloat y) { - if (y.isSpecial()) { - if (this.isZero()) { - if (y == POSITIVE_INFINITY) { - return this; - } - if (y == NEGATIVE_INFINITY) { - return POSITIVE_INFINITY; - } - } - if (y == NEGATIVE_INFINITY) { - return context.ZERO; - } - return y; - } - if (this.isZero()) { - if (y.isNegative()) { - return POSITIVE_INFINITY; - } - } - - Context c = max(context, y.context); - return c.valueOf(BigDecimalMath.pow(this.value, y.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is this to the power of y. - * - * @param y the value of the power - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat pow(BigDecimal y) { - return pow(context.valueOf(y)); - } - - /** - * Returns the {@link BigFloat} that is this to the power of y. - * - * @param y the value of the power - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat pow(int y) { - return pow(context.valueOf(y)); - } - - /** - * Returns the {@link BigFloat} that is this to the power of y. - * - * @param y the value of the power - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat pow(long y) { - return pow(context.valueOf(y)); - } - - /** - * Returns the {@link BigFloat} that is this to the power of y. - * - * @param y the value of the power - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat pow(double y) { - return pow(context.valueOf(y)); - } - - /** - * Returns the {@link BigFloat} that is the yth root of this. - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param y the value of the root - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat root(BigFloat y) { - if (y.isSpecial()) - return y; - Context c = max(context, y.context); - return c.valueOf(BigDecimalMath.root(this.value, y.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is the yth root of this. - * - * @param y the value of the root - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat root(BigDecimal y) { - return root(context.valueOf(y)); - } - - /** - * Returns the {@link BigFloat} that is the yth root of this. - * - * @param y the value of the root - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat root(int y) { - return root(context.valueOf(y)); - } - - /** - * Returns the {@link BigFloat} that is the yth root of this. - * - * @param y the value of the root - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat root(long y) { - return root(context.valueOf(y)); - } - - /** - * Returns the {@link BigFloat} that is the yth root of this. - * - * @param y the value of the root - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) - */ - public BigFloat root(double y) { - return root(context.valueOf(y)); - } - - @Override - public int hashCode() { - return value.stripTrailingZeros().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BigFloat other = (BigFloat) obj; - - return value.compareTo(other.value) == 0; - //return Objects.equals(value, other.value) && Objects.equals(context, other.context); - } - - /** - * Returns the signum function of this {@link BigFloat}. - * - * @return -1, 0, or 1 as the value of this {@link BigDecimal} is negative, zero, or positive. - */ - public int signum() { - return value.signum(); - } - - /** - * Returns whether this {@link BigFloat} is negative. - * - * @return true if negative, false if 0 or positive - */ - public boolean isNegative() { - return value.signum() < 0; - } - - /** - * Returns whether this {@link BigFloat} is 0. - * - * @return true if 0, false if negative or positive - */ - public boolean isZero() { - return value.signum() == 0; - } - - /** - * Returns whether this {@link BigFloat} is positive. - * - * @return true if positive, false if 0 or negative - */ - public boolean isPositive() { - return value.signum() > 0; - } - - @Override - public int compareTo(BigFloat other) { - if (other.isSpecial()) { - return -other.compareTo(this); - } - return value.compareTo(other.value); - } - - /** - * Returns whether this value is mathematically equal to the other value. - * - * @param other the other {@link BigFloat} to compare with - * - * @return true if both values are mathematically equal (equivalent to this.compareTo(other) == 0 - * - * @see #compareTo(BigFloat) - */ - public boolean isEqual(BigFloat other) { - if (this == NaN || other == NaN) { - return false; - } - - return compareTo(other) == 0; - } - - /** - * Returns whether this value is mathematically less than to the other value. - * - * @param other the other {@link BigFloat} to compare with - * - * @return true this value is mathematically less than to the other value (equivalent to this.compareTo(other) < 0 - * - * @see #compareTo(BigFloat) - */ - public boolean isLessThan(BigFloat other) { - if (this == NaN || other == NaN) { - return false; - } - - return compareTo(other) < 0; - } - - /** - * Returns whether this value is mathematically greater than to the other value. - * - * @param other the other {@link BigFloat} to compare with - * - * @return true this value is mathematically greater than to the other value (equivalent to this.compareTo(other) > 0 - * - * @see #compareTo(BigFloat) - */ - public boolean isGreaterThan(BigFloat other) { - if (this == NaN || other == NaN) { - return false; - } - - return compareTo(other) > 0; - } - - /** - * Returns whether this value is mathematically less than or equal to the other value. - * - * @param other the other {@link BigFloat} to compare with - * - * @return true this value is mathematically less than or equal to the other value (equivalent to this.compareTo(other) <= 0 - * - * @see #compareTo(BigFloat) - * @see #isLessThan(BigFloat) - * @see #isEqual(BigFloat) - */ - public boolean isLessThanOrEqual(BigFloat other) { - if (this == NaN || other == NaN) { - return false; - } - - return compareTo(other) <= 0; - } - - /** - * Returns whether this value is mathematically greater than or equal to the other value. - * - * @param other the other {@link BigFloat} to compare with - * - * @return true this value is mathematically greater than or equal to the other value (equivalent to this.compareTo(other) >= 0 - * - * @see #compareTo(BigFloat) - * @see #isGreaterThan(BigFloat) - * @see #isEqual(BigFloat) - */ - public boolean isGreaterThanOrEqual(BigFloat other) { - if (this == NaN || other == NaN) { - return false; - } - - return compareTo(other) >= 0; - } - - /** - * Returns whether this value can be represented as int. - * - * @return true if the value can be represented as int value - * - * @see BigDecimalMath#isIntValue(BigDecimal) - */ - public boolean isIntValue() { - return BigDecimalMath.isIntValue(value); - } - - /** - * Returns whether this specified {@link BigDecimal} value can be represented as double. - * - * @return true if the value can be represented as double value - * - * @see BigDecimalMath#isDoubleValue(BigDecimal) - */ - public boolean isDoubleValue() { - return BigDecimalMath.isDoubleValue(value); - } - - /** - * Returns the mantissa of this value written as mantissa * 10exponent. - * - *

The mantissa is defined as having exactly 1 digit before the decimal point.

- * - * @return the mantissa - * - * @see #getExponent() - * @see BigDecimalMath#mantissa(BigDecimal) - */ - public BigFloat getMantissa() { - return context.valueOf(BigDecimalMath.mantissa(value)); - } - - /** - * Returns the exponent of this value written as mantissa * 10exponent. - * - *

The mantissa is defined as having exactly 1 digit before the decimal point.

- * - * @return the exponent - * - * @see #getMantissa() - * @see BigDecimalMath#exponent(BigDecimal) - */ - public BigFloat getExponent() { - return context.valueOf(BigDecimalMath.exponent(value)); - } - - /** - * Returns the integral part of this value (left of the decimal point). - * - * @return the integral part - * - * @see #getFractionalPart() - * @see BigDecimalMath#fractionalPart(BigDecimal) - */ - public BigFloat getIntegralPart() { - return context.valueOf(BigDecimalMath.integralPart(value)); - } - - /** - * Returns the fractional part of this value (right of the decimal point). - * - * @return the fractional part - * - * @see #getIntegralPart() - * @see BigDecimalMath#fractionalPart(BigDecimal) - */ - public BigFloat getFractionalPart() { - return context.valueOf(BigDecimalMath.fractionalPart(value)); - } - - /** - * Returns the {@link Context} of this value. - * - * @return the {@link Context} - */ - public Context getContext() { - return context; - } - - /** - * Returns this value as a {@link BigDecimal} value. - * - * @return the {@link BigDecimal} value - */ - public BigDecimal toBigDecimal() { - return value; - } - - /** - * Returns this value as a double value. - * - * @return the double value - * - * @see BigDecimal#doubleValue() - */ - public double toDouble() { - return value.doubleValue(); - } - - /** - * Returns this value as a long value. - * - * @return the long value - * - * @see BigDecimal#longValue() - */ - public long toLong() { - return value.longValue(); - } - - /** - * Returns this value as a int value. - * - * @return the int value - * - * @see BigDecimal#intValue() - */ - public int toInt() { - return value.intValue(); - } - - @Override - public String toString() { - return value.toString(); - } - - protected boolean isSpecial() { - return false; - } - - /** - * return special type of a value - * @return {@link SpecialBigFloat.Type} - */ - protected SpecialBigFloat.Type type() { - return SpecialBigFloat.Type.NORMAL; - } - - public boolean isNaN() { - return this == NaN; - } - - public boolean isInfinity() { - return this == POSITIVE_INFINITY || this == NEGATIVE_INFINITY; - } - - /** - * this class handle unrepresentable value in floating-point arithmetic - * - * @author Wireless4024 - */ - private static final class SpecialBigFloat extends BigFloat { - - private static final Context DUMMY_CONTEXT = BigFloat.context(MathContext.DECIMAL32); - - private final Type type; - - private SpecialBigFloat(Type type) { - super(null, DUMMY_CONTEXT); - this.type = type; - } - - @Override - protected boolean isSpecial() { - return true; - } - - @Override - protected Type type() { - return type; - } - - @Override - public BigFloat add(BigFloat x) { - if (!x.isSpecial()) { - return this; - } - if (this == POSITIVE_INFINITY && x == POSITIVE_INFINITY) { - return POSITIVE_INFINITY; - } - if (this == NEGATIVE_INFINITY && x == NEGATIVE_INFINITY) { - return NEGATIVE_INFINITY; - } - return NaN; - } - - @Override - public BigFloat subtract(BigFloat x) { - if (!x.isSpecial()) { - return this; - } - if (this == POSITIVE_INFINITY && x == NEGATIVE_INFINITY) { - return POSITIVE_INFINITY; - } - if (this == NEGATIVE_INFINITY && x == POSITIVE_INFINITY) { - return NEGATIVE_INFINITY; - } - return NaN; - } - - @Override - public BigFloat subtract(BigDecimal x) { - return this; - } - - @Override - public BigFloat multiply(BigFloat x) { - if (x.isZero() || x == NaN) { - return NaN; - } else if (x.isNegative()) { - return negate(this); - } else { - return this; - } - } - - @Override - public BigFloat divide(BigFloat x) { - if (x == NaN || (this.isInfinity() && x.isInfinity())) { - return NaN; - } else if (x.isNegative()) { - return negate(this); - } else { - return this; - } - } - - @Override - public BigFloat remainder(BigFloat x) { - return NaN; - } - - @Override - public BigFloat pow(BigFloat y) { - if (y.isZero()) { - return y.context.ONE; - } - if (y == NaN) { - return NaN; - } - if (this.isInfinity() && y.isNegative()) { - return y.context.ZERO; - } - if (this == NEGATIVE_INFINITY && y.isPositive()) { - return POSITIVE_INFINITY; - } - return this; - } - - @Override - public BigFloat root(BigFloat y) { - return this; - } - - @Override - public int hashCode() { - return type.hashCode; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - return obj instanceof BigFloat && ((BigFloat) obj).isSpecial() && ((BigFloat) obj).type() == this.type; - } - - @Override - public int signum() { - return type == Type.POSITIVE_INFINITY ? 1 : -1; - } - - @Override - public boolean isNegative() { - return signum() < 0; - } - - @Override - public boolean isZero() { - return false;//nan or infinity is not a zero - } - - @Override - public boolean isPositive() { - return signum() > 0; - } - - @Override - public int compareTo(BigFloat other) { - return Type.compare(type, other.type()); - } - - @Override - public boolean isIntValue() { - return false; - } - - @Override - public boolean isDoubleValue() { - return false; - } - - @Override - public BigFloat getMantissa() { - return this; - } - - @Override - public BigFloat getExponent() { - return this; - } - - @Override - public BigFloat getIntegralPart() { - return this; - } - - @Override - public BigFloat getFractionalPart() { - return this; - } - - @Override - public Context getContext() { - throw new UnsupportedOperationException(type + " has no context"); - } - - @Override - public BigDecimal toBigDecimal() { - throw new UnsupportedOperationException(type + " has no corresponding BigDecimal representation"); - } - - @Override - public double toDouble() { - return type.toDouble(); - } - - @Override - public long toLong() { - return (long) toDouble(); - } - - @Override - public int toInt() { - return (int) toDouble(); - } - - @Override - public String toString() { - return type.toString(); - } - - //optional static - enum Type { - NaN(Objects.hashCode(Double.NaN)), - POSITIVE_INFINITY(Objects.hashCode(Double.POSITIVE_INFINITY)), - NORMAL(Objects.hashCode(0)), - NEGATIVE_INFINITY(Objects.hashCode(Double.NEGATIVE_INFINITY)); - - final int hashCode; - - Type(int hashCode){ - this.hashCode=hashCode; - } - - public static int compare(Type a, Type b) { - //we can use double to compare - //if (a == NaN && b == NaN) - // return 0;//cuz NaN equals nothing even itself - return Double.compare(a.toDouble(),b.toDouble()); - } - - /** - * convert type to double - * @return double value that equivalent to {@link Type} - */ - public double toDouble() { - switch (this) { - case POSITIVE_INFINITY: - return Double.POSITIVE_INFINITY; - case NEGATIVE_INFINITY: - return Double.NEGATIVE_INFINITY; - case NaN: - return Double.NaN; - default: - return 0; - } - } - } - } - - /** - * Manages the {@link MathContext} and provides factory methods for {@link BigFloat} values. - */ - public static class Context implements Serializable{ - private static final long serialVersionUID = -5787473786808803161L; - public final BigFloat NEGATIVE_ONE; - public final BigFloat ZERO; - public final BigFloat ONE; - - private final MathContext mathContext; - - private Context(MathContext mathContext) { - this.mathContext = mathContext; - NEGATIVE_ONE = this.valueOf(-1); - ZERO = this.valueOf(0); - ONE = this.valueOf(1); - } - - /** - * Returns the {@link MathContext} of this context. - * - * @return the {@link MathContext} - */ - public MathContext getMathContext() { - return mathContext; - } - - /** - * Returns the precision of this context. - *

- * This is equivalent to calling getMathContext().getPrecision(). - * - * @return the precision - */ - public int getPrecision() { - return mathContext.getPrecision(); - } - - /** - * Returns the {@link RoundingMode} of this context. - *

- * This is equivalent to calling getMathContext().getRoundingMode(). - * - * @return the {@link RoundingMode} - */ - public RoundingMode getRoundingMode() { - return mathContext.getRoundingMode(); - } - - /** - * Creates a {@link BigFloat} value with this context. - * - * @param value the source {@link BigFloat} value - * - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - */ - public BigFloat valueOf(BigFloat value) { - return value.isSpecial() ? value : new BigFloat(value.value.round(mathContext), this);//they are final - } - - /** - * Creates a {@link BigFloat} value with this context. - * - * @param value the source {@link BigDecimal} value - * - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - */ - public BigFloat valueOf(BigDecimal value) { - return new BigFloat(value.round(mathContext), this); - } - - /** - * Creates a {@link BigFloat} value with this context. - * - * @param value the source int value - * - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - */ - public BigFloat valueOf(int value) { - return new BigFloat(new BigDecimal(value, mathContext), this); - } - - /** - * parse unsigned value with this logic

value & 4294967295
- * @param value an int value - * @param unsigned if true value will parse as unsigned integer - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - */ - public BigFloat valueOf(int value, boolean unsigned) { - if (!unsigned) { - return new BigFloat(new BigDecimal(value, mathContext), this); - } else { - if (value > -1) - return valueOf(value, false); - return new BigFloat(new BigDecimal(Integer.MAX_VALUE) - .add(new BigDecimal(value & Integer.MAX_VALUE)) - .add(BigDecimal.ONE), this); - } - } - - /** - * Creates a {@link BigFloat} value with this context. - * - * @param value the source long value - * - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - */ - public BigFloat valueOf(long value) { - return new BigFloat(new BigDecimal(value, mathContext), this); - } - - /** - * parse unsigned value with this logic
value & 18446744073709551615
- * @param value an int value - * @param unsigned if true value will parse as unsigned integer - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - */ - public BigFloat valueOf(long value, boolean unsigned) { - if (!unsigned) { - return new BigFloat(new BigDecimal(value, mathContext), this); - } else { - if (value > -1) - return valueOf(value, false); - return new BigFloat(new BigDecimal(Long.MAX_VALUE) - .add(new BigDecimal(value & Long.MAX_VALUE)) - .add(BigDecimal.ONE), this); - } - } - - /** - * Creates a {@link BigFloat} value with this context. - * - * @param value the source double value - * - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - */ - public BigFloat valueOf(double value) { - if (Double.isInfinite(value)) - return value == Double.POSITIVE_INFINITY ? POSITIVE_INFINITY : NEGATIVE_INFINITY; - else if (Double.isNaN(value)) - return NaN; - return new BigFloat(new BigDecimal(String.valueOf(value), mathContext), this); - } - - /** - * Creates a {@link BigFloat} value with this context. - * - * @param value the source String value - * - * @return the {@link BigFloat} value with this context (rounded to the precision of this context) - * - * @throws NumberFormatException if the value is not a valid number. - */ - public BigFloat valueOf(String value) { - return new BigFloat(new BigDecimal(value, mathContext), this); - } - - /** - * Returns the constant pi with this context. - * - * @return pi with this context (rounded to the precision of this context) - * - * @see BigDecimalMath#pi(MathContext) - */ - public BigFloat pi() { - return valueOf(BigDecimalMath.pi(mathContext)); - } - - /** - * Returns the constant e with this context. - * - * @return e with this context (rounded to the precision of this context) - * - * @see BigDecimalMath#e(MathContext) - */ - public BigFloat e() { - return valueOf(BigDecimalMath.e(mathContext)); - } - - /** - * Returns the factorial of n with this context. - * - * @param n the value to calculate - * - * @return the factorial of n with this context (rounded to the precision of this context) - * - * @see BigDecimalMath#factorial(int) - */ - public BigFloat factorial(int n) { - return valueOf(BigDecimalMath.factorial(n)); - } - - @Override - public int hashCode() { - return mathContext.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Context other = (Context) obj; - return mathContext.equals(other.mathContext); - } - - @Override - public String toString() { - return mathContext.toString(); - } - } - /** - * Returns the {@link BigFloat} that is - this. - * - * @param x the value to negate - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#negate(MathContext) - */ - public static BigFloat negate(BigFloat x) { - if (x.isSpecial()) - if (x.isInfinity()) - return x == POSITIVE_INFINITY ? NEGATIVE_INFINITY : POSITIVE_INFINITY; - else - return NaN; - return x.context.valueOf(x.value.negate()); - } - - /** - * Returns the {@link BigFloat} that is the abs(this) (absolute value). - * - * @param x the value to make absolute - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimal#abs(MathContext) - */ - public static BigFloat abs(BigFloat x) { - if (x.isSpecial()) - return x.isInfinity() ? POSITIVE_INFINITY : NaN; - return x.context.valueOf(x.value.abs()); - } - - /** - * Returns the the maximum of two {@link BigFloat} values. - * - * @param value1 the first {@link BigFloat} value to compare - * @param value2 the second {@link BigFloat} value to compare - * - * @return the maximum {@link BigFloat} value - */ - public static BigFloat max(BigFloat value1, BigFloat value2) { - return value1.compareTo(value2) >= 0 ? value1 : value2; - } - - /** - * Returns the the maximum of n {@link BigFloat} values. - * - * @param value1 the first {@link BigFloat} value to compare - * @param values the other {@link BigFloat}s value to compare - * - * @return the maximum {@link BigFloat} value - */ - public static BigFloat max(BigFloat value1, BigFloat... values) { - BigFloat result = value1; - - for (BigFloat other : values) { - result = max(result, other); - } - - return result; - } - - /** - * Returns the the minimum of two {@link BigFloat} values. - * - * @param value1 the first {@link BigFloat} value to compare - * @param value2 the second {@link BigFloat} value to compare - * - * @return the minimum {@link BigFloat} value - */ - public static BigFloat min(BigFloat value1, BigFloat value2) { - return value1.compareTo(value2) < 0 ? value1 : value2; - } - - /** - * Returns the the minimum of n {@link BigFloat} values. - * - * @param value1 the first {@link BigFloat} value to compare - * @param values the other {@link BigFloat}s value to compare - * - * @return the minimum {@link BigFloat} value - */ - public static BigFloat min(BigFloat value1, BigFloat... values) { - BigFloat result = value1; - - for (BigFloat other : values) { - result = min(result, other); - } - - return result; - } - - private static BigFloat logSpecial(BigFloat val){ - if (val.isNaN() || val.isNegative()) - return NaN; - if (val == POSITIVE_INFINITY) - return POSITIVE_INFINITY; - if (val.isZero()) - return NEGATIVE_INFINITY; - return null; - } - - /** - * Returns the {@link BigFloat} that is log(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#log(BigDecimal, MathContext) - */ - public static BigFloat log(BigFloat x) { - BigFloat temp = logSpecial(x); - return temp != null ? temp : x.context.valueOf(BigDecimalMath.log(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is log2(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#log2(BigDecimal, MathContext) - */ - public static BigFloat log2(BigFloat x) { - BigFloat temp = logSpecial(x); - return temp != null ? temp : x.context.valueOf(BigDecimalMath.log2(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is log10(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#log10(BigDecimal, MathContext) - */ - public static BigFloat log10(BigFloat x) { - BigFloat temp = logSpecial(x); - return temp != null ? temp : x.context.valueOf(BigDecimalMath.log10(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is exp(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#exp(BigDecimal, MathContext) - */ - public static BigFloat exp(BigFloat x) { - if(x.isSpecial()) - return x != NEGATIVE_INFINITY ? x : x.context.ZERO; - return x.context.valueOf(BigDecimalMath.exp(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is sqrt(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#sqrt(BigDecimal, MathContext) - */ - public static BigFloat sqrt(BigFloat x) { - if (x.isNaN() || x.isNegative()) - return NaN; - if (x.isZero() || x.isInfinity()) - return x; - return x.context.valueOf(BigDecimalMath.sqrt(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is pow(x, y). - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param x the {@link BigFloat} value to take to the power - * @param y the {@link BigFloat} value to serve as exponent - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public static BigFloat pow(BigFloat x, BigFloat y) { - Context c = max(x.context, y.context); - return c.valueOf(BigDecimalMath.pow(x.value, y.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is root(x, y). - * - *

If the two values do not have the same {@link Context}, the result will contain the {@link Context} with the larger precision.

- * - * @param x the {@link BigFloat} value to calculate the n'th root - * @param y the {@link BigFloat} defining the root - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public static BigFloat root(BigFloat x, BigFloat y) { - Context c = max(x.context, y.context); - return c.valueOf(BigDecimalMath.root(x.value, y.value, c.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is sin(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#sin(BigDecimal, MathContext) - */ - public static BigFloat sin(BigFloat x) { - if(x.isSpecial()) - return NaN; - if(x.isZero()) - return x; - return x.context.valueOf(BigDecimalMath.sin(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is cos(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#cos(BigDecimal, MathContext) - */ - public static BigFloat cos(BigFloat x) { - if(x.isSpecial()) - return NaN; - return x.context.valueOf(BigDecimalMath.cos(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is tan(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#tan(BigDecimal, MathContext) - */ - public static BigFloat tan(BigFloat x) { - if(x.isSpecial()) - return NaN; - if(x.isZero()) - return x; - return x.context.valueOf(BigDecimalMath.tan(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is cot(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#cot(BigDecimal, MathContext) - */ - public static BigFloat cot(BigFloat x) { - if(x.isSpecial()) - return x; - if(x.isZero()) - return POSITIVE_INFINITY; - return x.context.valueOf(BigDecimalMath.cot(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is asin(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#asin(BigDecimal, MathContext) - */ - public static BigFloat asin(BigFloat x) { - if (x.isZero()) - return x; - return x.isNaN() || (!isRangeAbs1(x)) ? NaN : - x.context.valueOf(BigDecimalMath.asin(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is acos(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#acos(BigDecimal, MathContext) - */ - public static BigFloat acos(BigFloat x) { - return x.isNaN() || (!isRangeAbs1(x)) ? NaN : - x.context.valueOf(BigDecimalMath.acos(x.value, x.context.mathContext)); - } - - /** - * @param x a bigfloat - * @return if abs(x) <= 1 - */ - private static boolean isRangeAbs1(BigFloat x) { - return isBetween(x.context.NEGATIVE_ONE, x.context.ONE, x); - } - - /** - * Returns the {@link BigFloat} that is atan(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#atan(BigDecimal, MathContext) - */ - public static BigFloat atan(BigFloat x) { - return x.isSpecial() || x.isZero() ? x : x.context.valueOf(BigDecimalMath.atan(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is acot(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#acot(BigDecimal, MathContext) - */ - public static BigFloat acot(BigFloat x) { - return x.isSpecial() ? x : x.context.valueOf(BigDecimalMath.acot(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is sinh(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#sinh(BigDecimal, MathContext) - */ - public static BigFloat sinh(BigFloat x) { - if (x.isSpecial() || x.isZero()) - return x; - return x.context.valueOf(BigDecimalMath.sinh(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is cosh(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#cosh(BigDecimal, MathContext) - */ - public static BigFloat cosh(BigFloat x) { - if (x.isNaN()) - return NaN; - if (x.isInfinity()) - return POSITIVE_INFINITY; - if (x.isZero()) - return x.context.ONE; - return x.context.valueOf(BigDecimalMath.cosh(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is tanh(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#tanh(BigDecimal, MathContext) - */ - public static BigFloat tanh(BigFloat x) { - if (x.isNaN() || x.isZero()) - return x; - if (x.isInfinity()) - return x == POSITIVE_INFINITY ? x.context.ONE : x.context.NEGATIVE_ONE; - return x.context.valueOf(BigDecimalMath.tanh(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is coth(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#coth(BigDecimal, MathContext) - */ - public static BigFloat coth(BigFloat x) { - if(x.isSpecial()) - return x; - return x.context.valueOf(BigDecimalMath.coth(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is asinh(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#asinh(BigDecimal, MathContext) - */ - public static BigFloat asinh(BigFloat x) { - if(x.isSpecial()) - return x; - return x.context.valueOf(BigDecimalMath.asinh(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is acosh(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#acosh(BigDecimal, MathContext) - */ - public static BigFloat acosh(BigFloat x) { - return x.context.valueOf(BigDecimalMath.acosh(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is atanh(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#atanh(BigDecimal, MathContext) - */ - public static BigFloat atanh(BigFloat x) { - if(x.isSpecial()) - return x; - return x.context.valueOf(BigDecimalMath.atanh(x.value, x.context.mathContext)); - } - - /** - * Returns the {@link BigFloat} that is acoth(x). - * - * @param x the value - * - * @return the resulting {@link BigFloat} - * - * @see BigDecimalMath#acoth(BigDecimal, MathContext) - */ - public static BigFloat acoth(BigFloat x) { - if(x.isSpecial()) - return x; - return x.context.valueOf(BigDecimalMath.acoth(x.value, x.context.mathContext)); - } - - public static boolean isBetween(BigFloat min, BigFloat max, BigFloat value) { - return value.compareTo(min) >= 0 && value.compareTo(max) <= 0; - } - - private static Context max(Context left, Context right) { - return left.mathContext.getPrecision() > right.mathContext.getPrecision() ? left : right; - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/BigRational.java b/src/main/java/ch/obermuhlner/math/big/BigRational.java deleted file mode 100644 index 2d7389c7de..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/BigRational.java +++ /dev/null @@ -1,1103 +0,0 @@ -package ch.obermuhlner.math.big; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.MathContext; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.IntStream; - -/** - * A rational number represented as a quotient of two values. - * - *

Basic calculations with rational numbers (+ - * /) have no loss of precision. - * This allows to use {@link BigRational} as a replacement for {@link BigDecimal} if absolute accuracy is desired.

- * - *

Wikipedia: Rational number

- * - *

The values are internally stored as {@link BigDecimal} (for performance optimizations) but represented - * as {@link BigInteger} (for mathematical correctness) - * when accessed with {@link #getNumeratorBigInteger()} and {@link #getDenominatorBigInteger()}.

- * - *

The following basic calculations have no loss of precision:

- *
    - *
  • {@link #add(BigRational)}
  • - *
  • {@link #subtract(BigRational)}
  • - *
  • {@link #multiply(BigRational)}
  • - *
  • {@link #divide(BigRational)}
  • - *
  • {@link #pow(int)}
  • - *
- * - *

The following calculations are special cases of the ones listed above and have no loss of precision:

- *
    - *
  • {@link #negate()}
  • - *
  • {@link #reciprocal()}
  • - *
  • {@link #increment()}
  • - *
  • {@link #decrement()}
  • - *
- * - *

Any {@link BigRational} value can be converted into an arbitrary {@link #withPrecision(int) precision} (number of significant digits) - * or {@link #withScale(int) scale} (number of digits after the decimal point).

- */ -public class BigRational implements Comparable { - - /** - * The value 0 as {@link BigRational}. - */ - public static final BigRational ZERO = new BigRational(0); - /** - * The value 1 as {@link BigRational}. - */ - public static final BigRational ONE = new BigRational(1); - /** - * The value 2 as {@link BigRational}. - */ - public static final BigRational TWO = new BigRational(2); - /** - * The value 10 as {@link BigRational}. - */ - public static final BigRational TEN = new BigRational(10); - - private final BigDecimal numerator; - - private final BigDecimal denominator; - - private BigRational(int value) { - this(BigDecimal.valueOf(value), BigDecimal.ONE); - } - - private BigRational(BigDecimal num, BigDecimal denom) { - BigDecimal n = num; - BigDecimal d = denom; - - if (d.signum() == 0) { - throw new ArithmeticException("Divide by zero"); - } - - if (d.signum() < 0) { - n = n.negate(); - d = d.negate(); - } - - numerator = n; - denominator = d; - } - - /** - * Returns the numerator of this rational number as BigInteger. - * - * @return the numerator as BigInteger - */ - public BigInteger getNumeratorBigInteger() { - return numerator.toBigInteger(); - } - - /** - * Returns the numerator of this rational number as BigDecimal. - * - * @return the numerator as BigDecimal - */ - public BigDecimal getNumerator() { - return numerator; - } - - /** - * Returns the denominator of this rational number as BigInteger. - * - *

Guaranteed to not be 0.

- *

Guaranteed to be positive.

- * - * @return the denominator as BigInteger - */ - public BigInteger getDenominatorBigInteger() { - return denominator.toBigInteger(); - } - - /** - * Returns the denominator of this rational number as BigDecimal. - * - *

Guaranteed to not be 0.

- *

Guaranteed to be positive.

- * - * @return the denominator as BigDecimal - */ - public BigDecimal getDenominator() { - return denominator; - } - - /** - * Reduces this rational number to the smallest numerator/denominator with the same value. - * - * @return the reduced rational number - */ - public BigRational reduce() { - BigInteger n = numerator.toBigInteger(); - BigInteger d = denominator.toBigInteger(); - - BigInteger gcd = n.gcd(d); - n = n.divide(gcd); - d = d.divide(gcd); - - return valueOf(n, d); - } - - /** - * Returns the integer part of this rational number. - * - *

Examples:

- *
    - *
  • BigRational.valueOf(3.5).integerPart() returns BigRational.valueOf(3)
  • - *
- * - * @return the integer part of this rational number - */ - public BigRational integerPart() { - return of(numerator.subtract(numerator.remainder(denominator)), denominator); - } - - /** - * Returns the fraction part of this rational number. - * - *

Examples:

- *
    - *
  • BigRational.valueOf(3.5).integerPart() returns BigRational.valueOf(0.5)
  • - *
- * - * @return the fraction part of this rational number - */ - public BigRational fractionPart() { - return of(numerator.remainder(denominator), denominator); - } - - /** - * Negates this rational number (inverting the sign). - * - *

The result has no loss of precision.

- * - *

Examples:

- *
    - *
  • BigRational.valueOf(3.5).negate() returns BigRational.valueOf(-3.5)
  • - *
- * - * @return the negated rational number - */ - public BigRational negate() { - if (isZero()) { - return this; - } - - return of(numerator.negate(), denominator); - } - - /** - * Calculates the reciprocal of this rational number (1/x). - * - *

The result has no loss of precision.

- * - *

Examples:

- *
    - *
  • BigRational.valueOf(0.5).reciprocal() returns BigRational.valueOf(2)
  • - *
  • BigRational.valueOf(-2).reciprocal() returns BigRational.valueOf(-0.5)
  • - *
- * - * @return the reciprocal rational number - * @throws ArithmeticException if this number is 0 (division by zero) - */ - public BigRational reciprocal() { - return of(denominator, numerator); - } - - /** - * Returns the absolute value of this rational number. - * - *

The result has no loss of precision.

- * - *

Examples:

- *
    - *
  • BigRational.valueOf(-2).abs() returns BigRational.valueOf(2)
  • - *
  • BigRational.valueOf(2).abs() returns BigRational.valueOf(2)
  • - *
- * - * @return the absolute rational number (positive, or 0 if this rational is 0) - */ - public BigRational abs() { - return isPositive() ? this : negate(); - } - - /** - * Returns the signum function of this rational number. - * - * @return -1, 0 or 1 as the value of this rational number is negative, zero or positive. - */ - public int signum() { - return numerator.signum(); - } - - /** - * Calculates the increment of this rational number (+ 1). - * - *

This is functionally identical to - * this.add(BigRational.ONE) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @return the incremented rational number - */ - public BigRational increment() { - return of(numerator.add(denominator), denominator); - } - - /** - * Calculates the decrement of this rational number (- 1). - * - *

This is functionally identical to - * this.subtract(BigRational.ONE) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @return the decremented rational number - */ - public BigRational decrement() { - return of(numerator.subtract(denominator), denominator); - } - - /** - * Calculates the addition (+) of this rational number and the specified argument. - * - *

The result has no loss of precision.

- * - * @param value the rational number to add - * @return the resulting rational number - */ - public BigRational add(BigRational value) { - if (denominator.equals(value.denominator)) { - return of(numerator.add(value.numerator), denominator); - } - - BigDecimal n = numerator.multiply(value.denominator).add(value.numerator.multiply(denominator)); - BigDecimal d = denominator.multiply(value.denominator); - return of(n, d); - } - - private BigRational add(BigDecimal value) { - return of(numerator.add(value.multiply(denominator)), denominator); - } - - /** - * Calculates the addition (+) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.add(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the {@link BigInteger} to add - * @return the resulting rational number - */ - public BigRational add(BigInteger value) { - if (value.equals(BigInteger.ZERO)) { - return this; - } - return add(new BigDecimal(value)); - } - - /** - * Calculates the addition (+) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.add(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the int value to add - * @return the resulting rational number - */ - public BigRational add(int value) { - if (value == 0) { - return this; - } - return add(BigInteger.valueOf(value)); - } - - /** - * Calculates the subtraction (-) of this rational number and the specified argument. - * - *

The result has no loss of precision.

- * - * @param value the rational number to subtract - * @return the resulting rational number - */ - public BigRational subtract(BigRational value) { - if (denominator.equals(value.denominator)) { - return of(numerator.subtract(value.numerator), denominator); - } - - BigDecimal n = numerator.multiply(value.denominator).subtract(value.numerator.multiply(denominator)); - BigDecimal d = denominator.multiply(value.denominator); - return of(n, d); - } - - private BigRational subtract(BigDecimal value) { - return of(numerator.subtract(value.multiply(denominator)), denominator); - } - - /** - * Calculates the subtraction (-) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.subtract(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the {@link BigInteger} to subtract - * @return the resulting rational number - */ - public BigRational subtract(BigInteger value) { - if (value.equals(BigInteger.ZERO)) { - return this; - } - return subtract(new BigDecimal(value)); - } - - /** - * Calculates the subtraction (-) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.subtract(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the int value to subtract - * @return the resulting rational number - */ - public BigRational subtract(int value) { - if (value == 0) { - return this; - } - return subtract(BigInteger.valueOf(value)); - } - - /** - * Calculates the multiplication (*) of this rational number and the specified argument. - * - *

The result has no loss of precision.

- * - * @param value the rational number to multiply - * @return the resulting rational number - */ - public BigRational multiply(BigRational value) { - if (isZero() || value.isZero()) { - return ZERO; - } - if (equals(ONE)) { - return value; - } - if (value.equals(ONE)) { - return this; - } - - BigDecimal n = numerator.multiply(value.numerator); - BigDecimal d = denominator.multiply(value.denominator); - return of(n, d); - } - - // private, because we want to hide that we use BigDecimal internally - private BigRational multiply(BigDecimal value) { - BigDecimal n = numerator.multiply(value); - BigDecimal d = denominator; - return of(n, d); - } - - /** - * Calculates the multiplication (*) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.multiply(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the {@link BigInteger} to multiply - * @return the resulting rational number - */ - public BigRational multiply(BigInteger value) { - if (isZero() || value.signum() == 0) { - return ZERO; - } - if (equals(ONE)) { - return valueOf(value); - } - if (value.equals(BigInteger.ONE)) { - return this; - } - - return multiply(new BigDecimal(value)); - } - - /** - * Calculates the multiplication (*) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.multiply(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the int value to multiply - * @return the resulting rational number - */ - public BigRational multiply(int value) { - return multiply(BigInteger.valueOf(value)); - } - - /** - * Calculates the division (/) of this rational number and the specified argument. - * - *

The result has no loss of precision.

- * - * @param value the rational number to divide (0 is not allowed) - * @return the resulting rational number - * @throws ArithmeticException if the argument is 0 (division by zero) - */ - public BigRational divide(BigRational value) { - if (value.equals(ONE)) { - return this; - } - - BigDecimal n = numerator.multiply(value.denominator); - BigDecimal d = denominator.multiply(value.numerator); - return of(n, d); - } - - private BigRational divide(BigDecimal value) { - BigDecimal n = numerator; - BigDecimal d = denominator.multiply(value); - return of(n, d); - } - - /** - * Calculates the division (/) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.divide(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the {@link BigInteger} to divide (0 is not allowed) - * @return the resulting rational number - * @throws ArithmeticException if the argument is 0 (division by zero) - */ - public BigRational divide(BigInteger value) { - if (value.equals(BigInteger.ONE)) { - return this; - } - - return divide(new BigDecimal(value)); - } - - /** - * Calculates the division (/) of this rational number and the specified argument. - * - *

This is functionally identical to - * this.divide(BigRational.valueOf(value)) - * but slightly faster.

- * - *

The result has no loss of precision.

- * - * @param value the int value to divide (0 is not allowed) - * @return the resulting rational number - * @throws ArithmeticException if the argument is 0 (division by zero) - */ - public BigRational divide(int value) { - return divide(BigInteger.valueOf(value)); - } - - /** - * Returns whether this rational number is zero. - * - * @return true if this rational number is zero (0), false if it is not zero - */ - public boolean isZero() { - return numerator.signum() == 0; - } - - private boolean isPositive() { - return numerator.signum() > 0; - } - - /** - * Returns whether this rational number is an integer number without fraction part. - * - * @return true if this rational number is an integer number, false if it has a fraction part - */ - public boolean isInteger() { - return isIntegerInternal() || reduce().isIntegerInternal(); - } - - /** - * Returns whether this rational number is an integer number without fraction part. - * - *

Will return false if this number is not reduced to the integer representation yet (e.g. 4/4 or 4/2)

- * - * @return true if this rational number is an integer number, false if it has a fraction part - * @see #isInteger() - */ - private boolean isIntegerInternal() { - return denominator.compareTo(BigDecimal.ONE) == 0; - } - - /** - * Calculates this rational number to the power (xy) of the specified argument. - * - *

The result has no loss of precision.

- * - * @param exponent exponent to which this rational number is to be raised - * @return the resulting rational number - */ - public BigRational pow(int exponent) { - if (exponent == 0) { - return ONE; - } - if (exponent == 1) { - return this; - } - - final BigInteger n; - final BigInteger d; - if (exponent > 0) { - n = numerator.toBigInteger().pow(exponent); - d = denominator.toBigInteger().pow(exponent); - } - else { - n = denominator.toBigInteger().pow(-exponent); - d = numerator.toBigInteger().pow(-exponent); - } - return valueOf(n, d); - } - - /** - * Finds the minimum (smaller) of two rational numbers. - * - * @param value the rational number to compare with - * @return the minimum rational number, either this or the argument value - */ - private BigRational min(BigRational value) { - return compareTo(value) <= 0 ? this : value; - } - - /** - * Finds the maximum (larger) of two rational numbers. - * - * @param value the rational number to compare with - * @return the minimum rational number, either this or the argument value - */ - private BigRational max(BigRational value) { - return compareTo(value) >= 0 ? this : value; - } - - /** - * Returns a rational number with approximatively this value and the specified precision. - * - * @param precision the precision (number of significant digits) of the calculated result, or 0 for unlimited precision - * @return the calculated rational number with the specified precision - */ - public BigRational withPrecision(int precision) { - return valueOf(toBigDecimal(new MathContext(precision))); - } - - /** - * Returns a rational number with approximatively this value and the specified scale. - * - * @param scale the scale (number of digits after the decimal point) of the calculated result - * @return the calculated rational number with the specified scale - */ - public BigRational withScale(int scale) { - return valueOf(toBigDecimal().setScale(scale, RoundingMode.HALF_UP)); - } - - private static int countDigits(BigInteger number) { - double factor = Math.log(2) / Math.log(10); - int digitCount = (int) (factor * number.bitLength() + 1); - if (BigInteger.TEN.pow(digitCount - 1).compareTo(number) > 0) { - return digitCount - 1; - } - return digitCount; - } - - // TODO what is precision of a rational? - private int precision() { - return countDigits(numerator.toBigInteger()) + countDigits(denominator.toBigInteger()); - } - - /** - * Returns this rational number as a double value. - * - * @return the double value - */ - public double toDouble() { - // TODO best accuracy or maybe bigDecimalValue().doubleValue() is better? - return numerator.doubleValue() / denominator.doubleValue(); - } - - /** - * Returns this rational number as a float value. - * - * @return the float value - */ - public float toFloat() { - return numerator.floatValue() / denominator.floatValue(); - } - - /** - * Returns this rational number as a {@link BigDecimal}. - * - * @return the {@link BigDecimal} value - */ - public BigDecimal toBigDecimal() { - int precision = Math.max(precision(), MathContext.DECIMAL128.getPrecision()); - return toBigDecimal(new MathContext(precision)); - } - - /** - * Returns this rational number as a {@link BigDecimal} with the precision specified by the {@link MathContext}. - * - * @param mc the {@link MathContext} specifying the precision of the calculated result - * @return the {@link BigDecimal} - */ - public BigDecimal toBigDecimal(MathContext mc) { - return numerator.divide(denominator, mc); - } - - @Override - public int compareTo(BigRational other) { - if (this == other) { - return 0; - } - return numerator.multiply(other.denominator).compareTo(denominator.multiply(other.numerator)); - } - - @Override - public int hashCode() { - if (isZero()) { - return 0; - } - return numerator.hashCode() + denominator.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - - if (!(obj instanceof BigRational)) { - return false; - } - - BigRational other = (BigRational) obj; - if (!numerator.equals(other.numerator)) { - return false; - } - return denominator.equals(other.denominator); - } - - @Override - public String toString() { - if (isZero()) { - return "0"; - } - if (isIntegerInternal()) { - return numerator.toString(); - } - return toBigDecimal().toString(); - } - - /** - * Returns a plain string representation of this rational number without any exponent. - * - * @return the plain string representation - * @see BigDecimal#toPlainString() - */ - public String toPlainString() { - if (isZero()) { - return "0"; - } - if (isIntegerInternal()) { - return numerator.toPlainString(); - } - return toBigDecimal().toPlainString(); - } - - /** - * Returns the string representation of this rational number in the form "numerator/denominator". - * - *

The resulting string is a valid input of the {@link #valueOf(String)} method.

- * - *

Examples:

- *
    - *
  • BigRational.valueOf(0.5).toRationalString() returns "1/2"
  • - *
  • BigRational.valueOf(2).toRationalString() returns "2"
  • - *
  • BigRational.valueOf(4, 4).toRationalString() returns "4/4" (not reduced)
  • - *
- * - * @return the rational number string representation in the form "numerator/denominator", or "0" if the rational number is 0. - * @see #valueOf(String) - * @see #valueOf(int, int) - */ - public String toRationalString() { - if (isZero()) { - return "0"; - } - if (isIntegerInternal()) { - return numerator.toString(); - } - return numerator + "/" + denominator; - } - - /** - * Returns the string representation of this rational number as integer and fraction parts in the form "integerPart fractionNominator/fractionDenominator". - * - *

The integer part is omitted if it is 0 (when this absolute rational number is smaller than 1).

- *

The fraction part is omitted it it is 0 (when this rational number is an integer).

- *

If this rational number is 0, then "0" is returned.

- * - *

Example: BigRational.valueOf(3.5).toIntegerRationalString() returns "3 1/2".

- * - * @return the integer and fraction rational string representation - * @see #valueOf(int, int, int) - */ - public String toIntegerRationalString() { - BigDecimal fractionNumerator = numerator.remainder(denominator); - BigDecimal integerNumerator = numerator.subtract(fractionNumerator); - BigDecimal integerPart = integerNumerator.divide(denominator); - - StringBuilder result = new StringBuilder(); - if (integerPart.signum() != 0) { - result.append(integerPart); - } - if (fractionNumerator.signum() != 0) { - if (result.length() > 0) { - result.append(' '); - } - result.append(fractionNumerator.abs()); - result.append('/'); - result.append(denominator); - } - if (result.length() == 0) { - result.append('0'); - } - - return result.toString(); - } - - /** - * Creates a rational number of the specified int value. - * - * @param value the int value - * @return the rational number - */ - public static BigRational valueOf(int value) { - if (value == 0) { - return ZERO; - } - if (value == 1) { - return ONE; - } - return new BigRational(value); - } - - /** - * Creates a rational number of the specified numerator/denominator int values. - * - * @param numerator the numerator int value - * @param denominator the denominator int value (0 not allowed) - * @return the rational number - * @throws ArithmeticException if the denominator is 0 (division by zero) - */ - public static BigRational valueOf(int numerator, int denominator) { - return of(BigDecimal.valueOf(numerator), BigDecimal.valueOf(denominator)); - } - - /** - * Creates a rational number of the specified integer and fraction parts. - * - *

Useful to create numbers like 3 1/2 (= three and a half = 3.5) by calling - * BigRational.valueOf(3, 1, 2).

- *

To create a negative rational only the integer part argument is allowed to be negative: - * to create -3 1/2 (= minus three and a half = -3.5) call BigRational.valueOf(-3, 1, 2).

- * - * @param integer the integer part int value - * @param fractionNumerator the fraction part numerator int value (negative not allowed) - * @param fractionDenominator the fraction part denominator int value (0 or negative not allowed) - * @return the rational number - * @throws ArithmeticException if the fraction part denominator is 0 (division by zero), - * or if the fraction part numerator or denominator is negative - */ - public static BigRational valueOf(int integer, int fractionNumerator, int fractionDenominator) { - if (fractionNumerator < 0 || fractionDenominator < 0) { - throw new ArithmeticException("Negative value"); - } - - BigRational integerPart = valueOf(integer); - BigRational fractionPart = valueOf(fractionNumerator, fractionDenominator); - return integerPart.isPositive() ? integerPart.add(fractionPart) : integerPart.subtract(fractionPart); - } - - /** - * Creates a rational number of the specified numerator/denominator BigInteger values. - * - * @param numerator the numerator {@link BigInteger} value - * @param denominator the denominator {@link BigInteger} value (0 not allowed) - * @return the rational number - * @throws ArithmeticException if the denominator is 0 (division by zero) - */ - public static BigRational valueOf(BigInteger numerator, BigInteger denominator) { - return of(new BigDecimal(numerator), new BigDecimal(denominator)); - } - - /** - * Creates a rational number of the specified {@link BigInteger} value. - * - * @param value the {@link BigInteger} value - * @return the rational number - */ - public static BigRational valueOf(BigInteger value) { - if (value.compareTo(BigInteger.ZERO) == 0) { - return ZERO; - } - if (value.compareTo(BigInteger.ONE) == 0) { - return ONE; - } - return valueOf(value, BigInteger.ONE); - } - - /** - * Creates a rational number of the specified double value. - * - * @param value the double value - * @return the rational number - * @throws NumberFormatException if the double value is Infinite or NaN. - */ - public static BigRational valueOf(double value) { - if (value == 0.0) { - return ZERO; - } - if (value == 1.0) { - return ONE; - } - if (Double.isInfinite(value)) { - throw new NumberFormatException("Infinite"); - } - if (Double.isNaN(value)) { - throw new NumberFormatException("NaN"); - } - return valueOf(new BigDecimal(String.valueOf(value))); - } - - /** - * Creates a rational number of the specified {@link BigDecimal} value. - * - * @param value the double value - * @return the rational number - */ - public static BigRational valueOf(BigDecimal value) { - if (value.compareTo(BigDecimal.ZERO) == 0) { - return ZERO; - } - if (value.compareTo(BigDecimal.ONE) == 0) { - return ONE; - } - - int scale = value.scale(); - if (scale == 0) { - return new BigRational(value, BigDecimal.ONE); - } else if (scale < 0) { - BigDecimal n = new BigDecimal(value.unscaledValue()).multiply(BigDecimal.ONE.movePointLeft(value.scale())); - return new BigRational(n, BigDecimal.ONE); - } - else { - BigDecimal n = new BigDecimal(value.unscaledValue()); - BigDecimal d = BigDecimal.ONE.movePointRight(value.scale()); - return new BigRational(n, d); - } - } - - /** - * Creates a rational number of the specified string representation. - * - *

The accepted string representations are:

- *
    - *
  • Output of {@link BigRational#toString()} : "integerPart.fractionPart"
  • - *
  • Output of {@link BigRational#toRationalString()} : "numerator/denominator"
  • - *
  • Output of toString() of {@link BigDecimal}, {@link BigInteger}, {@link Integer}, ...
  • - *
  • Output of toString() of {@link Double}, {@link Float} - except "Infinity", "-Infinity" and "NaN"
  • - *
- * - * @param string the string representation to convert - * @return the rational number - * @throws ArithmeticException if the denominator is 0 (division by zero) - */ - public static BigRational valueOf(String string) { - String[] strings = string.split("/"); - BigRational result = valueOfSimple(strings[0]); - for (int i = 1; i < strings.length; i++) { - result = result.divide(valueOfSimple(strings[i])); - } - return result; - } - - private static BigRational valueOfSimple(String string) { - return valueOf(new BigDecimal(string)); - } - - public static BigRational valueOf(boolean positive, String integerPart, String fractionPart, String fractionRepeatPart, String exponentPart) { - BigRational result = ZERO; - - if (fractionRepeatPart != null && fractionRepeatPart.length() > 0) { - BigInteger lotsOfNines = BigInteger.TEN.pow(fractionRepeatPart.length()).subtract(BigInteger.ONE); - result = valueOf(new BigInteger(fractionRepeatPart), lotsOfNines); - } - - if (fractionPart != null && fractionPart.length() > 0) { - result = result.add(valueOf(new BigInteger(fractionPart))); - result = result.divide(BigInteger.TEN.pow(fractionPart.length())); - } - - if (integerPart != null && integerPart.length() > 0) { - result = result.add(new BigInteger(integerPart)); - } - - if (exponentPart != null && exponentPart.length() > 0) { - int exponent = Integer.parseInt(exponentPart); - BigInteger powerOfTen = BigInteger.TEN.pow(Math.abs(exponent)); - result = exponent >= 0 ? result.multiply(powerOfTen) : result.divide(powerOfTen); - } - - if (!positive) { - result = result.negate(); - } - - return result; - } - - /** - * Creates a rational number of the specified numerator/denominator BigDecimal values. - * - * @param numerator the numerator {@link BigDecimal} value - * @param denominator the denominator {@link BigDecimal} value (0 not allowed) - * @return the rational number - * @throws ArithmeticException if the denominator is 0 (division by zero) - */ - public static BigRational valueOf(BigDecimal numerator, BigDecimal denominator) { - return valueOf(numerator).divide(valueOf(denominator)); - } - - private static BigRational of(BigDecimal numerator, BigDecimal denominator) { - if (numerator.signum() == 0 && denominator.signum() != 0) { - return ZERO; - } - if (numerator.compareTo(BigDecimal.ONE) == 0 && denominator.compareTo(BigDecimal.ONE) == 0) { - return ONE; - } - return new BigRational(numerator, denominator); - } - - /** - * Returns the smallest of the specified rational numbers. - * - * @param values the rational numbers to compare - * @return the smallest rational number, 0 if no numbers are specified - */ - public static BigRational min(BigRational... values) { - if (values.length == 0) { - return BigRational.ZERO; - } - BigRational result = values[0]; - for (int i = 1; i < values.length; i++) { - result = result.min(values[i]); - } - return result; - } - - /** - * Returns the largest of the specified rational numbers. - * - * @param values the rational numbers to compare - * @return the largest rational number, 0 if no numbers are specified - * @see #max(BigRational) - */ - public static BigRational max(BigRational... values) { - if (values.length == 0) { - return BigRational.ZERO; - } - BigRational result = values[0]; - for (int i = 1; i < values.length; i++) { - result = result.max(values[i]); - } - return result; - } - - private static List bernoulliCache = new ArrayList<>(); - - /** - * Calculates the Bernoulli number for the specified index. - * - *

This function calculates the first Bernoulli numbers and therefore bernoulli(1) returns -0.5

- *

Note that bernoulli(x) for all odd x > 1 returns 0

- *

See: Wikipedia: Bernoulli number

- * - * @param n the index of the Bernoulli number to be calculated (starting at 0) - * @return the Bernoulli number for the specified index - * @throws ArithmeticException if x is lesser than 0 - */ - public static BigRational bernoulli(int n) { - if (n < 0) { - throw new ArithmeticException("Illegal bernoulli(n) for n < 0: n = " + n); - } - if (n == 1) { - return valueOf(-1, 2); - } else if (n % 2 == 1) { - return ZERO; - } - - synchronized (bernoulliCache) { - int index = n / 2; - - if (bernoulliCache.size() <= index) { - for (int i = bernoulliCache.size(); i <= index; i++) { - BigRational b = calculateBernoulli(i * 2); - bernoulliCache.add(b); - } - } - - return bernoulliCache.get(index); - } - } - - private static BigRational calculateBernoulli(int n) { - return IntStream.rangeClosed(0, n).parallel().mapToObj(k -> { - BigRational jSum = ZERO ; - BigRational bin = ONE ; - for(int j=0 ; j <= k ; j++) { - BigRational jPowN = valueOf(j).pow(n); - if (j % 2 == 0) { - jSum = jSum.add(bin.multiply(jPowN)) ; - } else { - jSum = jSum.subtract(bin.multiply(jPowN)) ; - } - - bin = bin.multiply(valueOf(k-j).divide(valueOf(j+1))); - } - return jSum.divide(valueOf(k+1)); - }).reduce(ZERO, BigRational::add); - } - -} diff --git a/src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java b/src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java deleted file mode 100644 index d6dca31ecf..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/DefaultBigDecimalMath.java +++ /dev/null @@ -1,736 +0,0 @@ -package ch.obermuhlner.math.big; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; -import java.util.*; - -/** - * A wrapper around {@link BigDecimalMath} that passes a current {@link MathContext} to the - * functions that need a {@link MathContext} argument. - * - *

The initial default {@link MathContext} is equivalent to {@link MathContext#DECIMAL128} - * but this can be overridden by setting the following system properties:

- *
    - *
  • ch.obermuhlner.math.big.default.precision to a positive integer precision (default=34)
  • - *
  • ch.obermuhlner.math.big.default.rounding to a {@link RoundingMode} name (default=HALF_UP)
  • - *
- * - *

It is also possible to programmatically set the default {@link MathContext} using {@link #setDefaultMathContext(MathContext)}. - * It is recommended to set the desired precision in the {@link MathContext} very early in the startup of the application and to not change it afterwards.

- * - *

Important: Avoid the pitfall of setting the precision temporarily using {@link #setDefaultMathContext(MathContext)} for a calculation. - * This can lead to race conditions and calculations with the wrong precision - * if other threads in your application do the same thing.

- * - *

To set a temporary {@link MathContext} you have to choice to use either: - *

    - *
  • DefaultBigDecimalMath.createLocalMathContext() in a try-with-resources statement
  • - *
  • DefaultBigDecimalMath.withLocalMathContext() with a lambda function
  • - *
- * - * Example code using DefaultBigDecimalMath.createLocalMathContext(): - *
-System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
-try (DefaultBigDecimalMath.LocalMathContext context = DefaultBigDecimalMath.createLocalMathContext(5)) {
-    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
-    try (DefaultBigDecimalMath.LocalMathContext context2 = DefaultBigDecimalMath.createLocalMathContext(10)) {
-        System.out.println("Pi[10]: " + DefaultBigDecimalMath.pi());
-    }
-    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
-}
-System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
- 
- * - * Example code using DefaultBigDecimalMath.withLocalMathContext(): - *
-System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
-DefaultBigDecimalMath.withPrecision(5, () -> {
-    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
-    DefaultBigDecimalMath.withPrecision(10, () -> {
-        System.out.println("Pi[10]: " + DefaultBigDecimalMath.pi());
-    });
-    System.out.println("Pi[5]: " + DefaultBigDecimalMath.pi());
-});
-System.out.println("Pi[default]: " + DefaultBigDecimalMath.pi());
-
- * - * Both snippets with give the following ouput: - *
-Pi[default]: 3.141592653589793238462643383279503
-Pi[5]: 3.1416
-Pi[10]: 3.141592654
-Pi[5]: 3.1416
-Pi[default]: 3.141592653589793238462643383279503
-
- *

The temporary {@link MathContext} are stored in {@link ThreadLocal} variables - * and will therefore not conflict with each other when used in multi-threaded use case.

- * - *

Important: Due to the {@link ThreadLocal} variables the local {@link MathContext} will - * not be available in other threads. - * This includes streams using parallel(), thread pools and manually started threads. - * If you need temporary {@link MathContext} for calculations then you must - * set the local {@link MathContext} inside every separate thread.

- * - *
-try (DefaultBigDecimalMath.LocalMathContext context = DefaultBigDecimalMath.createLocalMathContext(5)) {
-    BigDecimalStream.range(0.0, 1.0, 0.01, DefaultBigDecimalMath.currentMathContext())
-        .map(b -> DefaultBigDecimalMath.cos(b))
-        .map(b -> "sequential " + Thread.currentThread().getName() + " [5]: " + b)
-        .forEach(System.out::println);
-
-    BigDecimalStream.range(0.0, 1.0, 0.01, DefaultBigDecimalMath.currentMathContext())
-        .parallel()
-        .map(b -> {
-            try (DefaultBigDecimalMath.LocalMathContext context2 = DefaultBigDecimalMath.createLocalMathContext(5)) {
-                return DefaultBigDecimalMath.cos(b);
-            }
-        })
-        .map(b -> "parallel " + Thread.currentThread().getName() + " [5]: " + b)
-        .forEach(System.out::println);
-}
-
- */ -public class DefaultBigDecimalMath { - - private static MathContext defaultMathContext = createDefaultMathContext(); - private static ThreadLocal> mathContextStack = new ThreadLocal<>(); - - private static MathContext createDefaultMathContext () { - int precision = getIntSystemProperty("ch.obermuhlner.math.big.default.precision", MathContext.DECIMAL128.getPrecision()); - RoundingMode rounding = getRoundingModeSystemProperty("ch.obermuhlner.math.big.default.rounding", MathContext.DECIMAL128.getRoundingMode()); - - return new MathContext(precision, rounding); - } - - private static void pushMathContext(MathContext mathContext) { - Deque mathContexts = mathContextStack.get(); - if (mathContexts == null) { - mathContexts = new ArrayDeque<>(); - mathContextStack.set(mathContexts); - }; - mathContexts.addLast(mathContext); - } - - private static MathContext popMathContext() { - Deque mathContexts = mathContextStack.get(); - MathContext poppedMathContext = mathContexts.removeLast(); - if (mathContexts.isEmpty()) { - mathContextStack.remove(); - } - return poppedMathContext; - } - - private static int getIntSystemProperty(String propertyKey, int defaultValue) { - String propertyValue = System.getProperty(propertyKey, Integer.toString(defaultValue)); - try { - return Integer.parseInt(propertyValue); - } catch(NumberFormatException ex) { - return propertyException(propertyKey,propertyValue,defaultValue); - } - } - - private static RoundingMode getRoundingModeSystemProperty(String propertyKey, RoundingMode defaultValue) { - String propertyValue = System.getProperty(propertyKey, defaultValue.name()); - try { - return RoundingMode.valueOf(propertyValue); - } catch(IllegalArgumentException ex) { - return propertyException(propertyKey,propertyValue,defaultValue); - } - } - - private static T propertyException(String propertyKey,String propertyValue,T defaultValue){ - System.err.println("Property '" + propertyKey + "' is not valid: " + propertyValue + " (using " + defaultValue + " instead)"); - return defaultValue; - } - - /** - * Sets the default {@link MathContext} used if no other {@link MathContext} is defined using {@link #withLocalMathContext(MathContext, Runnable)}. - * - * @param defaultMathContext the default {@link MathContext} - * @see #currentMathContext() - * @see #withLocalMathContext(int, Runnable) - * @see #withLocalMathContext(int, RoundingMode, Runnable) - * @see #withLocalMathContext(MathContext, Runnable) - */ - public static void setDefaultMathContext(MathContext defaultMathContext) { - Objects.requireNonNull(defaultMathContext); - DefaultBigDecimalMath.defaultMathContext = defaultMathContext; - } - - /** - * Returns the default {@link MathContext} used for all mathematical functions in this class. - * - * @return the default {@link MathContext} - */ - public static MathContext getDefaultMathContext() { - return defaultMathContext; - } - - /** - * Executes the given {@link Runnable} using the specified precision. - * - * @param precision the precision to use for calculations in the runnable - * @param runnable the {@link Runnable} to execute - */ - public static void withLocalMathContext(int precision, Runnable runnable) { - withLocalMathContext(new MathContext(precision), runnable); - } - - /** - * Executes the given {@link Runnable} using the specified precision and {@link RoundingMode}. - * - * @param precision the precision to use for calculations in the runnable - * @param roundingMode the {@link RoundingMode} to use for calculations in the runnable - * @param runnable the {@link Runnable} to execute - */ - public static void withLocalMathContext(int precision, RoundingMode roundingMode, Runnable runnable) { - withLocalMathContext(new MathContext(precision, roundingMode), runnable); - } - - /** - * Executes the given {@link Runnable} using the specified {@link MathContext}. - * - * @param mathContext the {@link MathContext} to use for calculations in the runnable - * @param runnable the {@link Runnable} to execute - */ - public static void withLocalMathContext(MathContext mathContext, Runnable runnable) { - try (LocalMathContext context = createLocalMathContext(mathContext)) { - runnable.run(); - } - } - - /** - * Executes the given {@link Runnable} using the specified precision. - * - * @param precision the precision to use for calculations - * @return the created {@link LocalMathContext} to be used in a try-with-resources statement - */ - public static LocalMathContext createLocalMathContext(int precision) { - return createLocalMathContext(new MathContext(precision)); - } - - /** - * Executes the given {@link Runnable} using the specified precision and {@link RoundingMode}. - * - * @param precision the precision to use for calculations - * @param roundingMode the {@link RoundingMode} to use for calculations in the runnable - * @return the created {@link LocalMathContext} to be used in a try-with-resources statement - */ - public static LocalMathContext createLocalMathContext(int precision, RoundingMode roundingMode) { - return createLocalMathContext(new MathContext(precision, roundingMode)); - } - - /** - * Executes the given {@link Runnable} using the specified {@link MathContext}. - * - * @param mathContext the {@link MathContext} to use for calculations - * @return the created {@link LocalMathContext} to be used in a try-with-resources statement - */ - public static LocalMathContext createLocalMathContext(MathContext mathContext) { - return new LocalMathContext(mathContext); - } - - /** - * Returns the current {@link MathContext} used for all mathematical functions in this class. - * - *

The current {@link MathContext} is the last {@link MathContext} specified - * using {@link #withLocalMathContext(MathContext, Runnable)} - * or the default {@link MathContext} if none was specified.

- * - * @return the current {@link MathContext} - * @see #currentMathContext() - * @see #withLocalMathContext(int, Runnable) - * @see #withLocalMathContext(int, RoundingMode, Runnable) - * @see #withLocalMathContext(MathContext, Runnable) - */ - public static MathContext currentMathContext() { - Deque mathContexts = mathContextStack.get(); - if (mathContexts == null || mathContexts.isEmpty()) { - return defaultMathContext; - } - - return mathContexts.getLast(); - } - - /** - * Rounds the specified {@link BigDecimal} to the precision of the current {@link MathContext}. - * - * @param value the {@link BigDecimal} to round - * @return the rounded {@link BigDecimal} value - * @see #currentMathContext() - * @see BigDecimalMath#round(BigDecimal, MathContext) - */ - public static BigDecimal round(BigDecimal value) { - return BigDecimalMath.round(value, defaultMathContext); - } - - /** - * Rounds the specified {@link BigDecimal} to the precision of the current {@link MathContext} including trailing zeroes. - * - * @param value the {@link BigDecimal} to round - * @return the rounded {@link BigDecimal} value including trailing zeroes - * @see #currentMathContext() - * @see BigDecimalMath#roundWithTrailingZeroes(BigDecimal, MathContext) - */ - public static BigDecimal roundWithTrailingZeroes(BigDecimal value) { - return BigDecimalMath.roundWithTrailingZeroes(value, currentMathContext()); - } - - /** - * Returns the {@link BigDecimal} that is x + y using the current {@link MathContext}. - * - * @param x the x value - * @param y the y value to add - * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimal#add(BigDecimal, MathContext) - */ - public static BigDecimal add(BigDecimal x, BigDecimal y) { - return x.add(y, currentMathContext()); - } - - /** - * Returns the {@link BigDecimal} that is x - y using the current {@link MathContext}. - * - * @param x the x value - * @param y the y value to subtract - * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimal#subtract(BigDecimal, MathContext) - */ - public static BigDecimal subtract(BigDecimal x, BigDecimal y) { - return x.subtract(y, currentMathContext()); - } - - /** - * Returns the {@link BigDecimal} that is x * y using the current {@link MathContext}. - * - * @param x the x value - * @param y the y value to multiply - * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimal#multiply(BigDecimal, MathContext) - */ - public static BigDecimal multiply(BigDecimal x, BigDecimal y) { - return x.multiply(y, currentMathContext()); - } - - /** - * Returns the {@link BigDecimal} that is x / y using the current {@link MathContext}. - * - * @param x the x value - * @param y the y value to divide - * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimal#divide(BigDecimal, MathContext) - */ - public static BigDecimal divide(BigDecimal x, BigDecimal y) { - return x.divide(y, currentMathContext()); - } - - /** - * Returns the {@link BigDecimal} that is x % y using the current {@link MathContext}. - * - * @param x the x value - * @param y the y value to divide - * @return the resulting {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimal#remainder(BigDecimal, MathContext) - */ - public static BigDecimal remainder(BigDecimal x, BigDecimal y) { - return x.remainder(y, currentMathContext()); - } - - /** - * Calculates the reciprocal of the specified {@link BigDecimal} using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} - * @return the reciprocal {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#reciprocal(BigDecimal, MathContext) - */ - public static BigDecimal reciprocal(BigDecimal x) { - return BigDecimalMath.reciprocal(x, currentMathContext()); - } - - /** - * Calculates the factorial of the specified {@link BigDecimal} using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} - * @return the factorial {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#factorial(BigDecimal, MathContext) - */ - public static BigDecimal factorial(BigDecimal x) { - return BigDecimalMath.factorial(x, currentMathContext()); - } - - /** - * Calculates the gamma function of the specified {@link BigDecimal} using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} - * @return the gamma {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#gamma(BigDecimal, MathContext) - */ - public static BigDecimal gamma(BigDecimal x) { - return BigDecimalMath.gamma(x, currentMathContext()); - } - - /** - * Calculates the Bernoulli number for the specified index using the current {@link MathContext}. - * - * @param n the index of the Bernoulli number to be calculated (starting at 0) - * @return the Bernoulli number for the specified index with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#bernoulli(int, MathContext) - */ - public static BigDecimal bernoulli(int n) { - return BigDecimalMath.bernoulli(n, currentMathContext()); - } - - /** - * Calculates {@link BigDecimal} x to the power of {@link BigDecimal} y (xy) using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} value to take to the power - * @param y the {@link BigDecimal} value to serve as exponent - * @return the calculated x to the power of y with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#pow(BigDecimal, BigDecimal, MathContext) - */ - public static BigDecimal pow(BigDecimal x, BigDecimal y) { - return BigDecimalMath.pow(x, y, currentMathContext()); - } - - /** - * Calculates {@link BigDecimal} x to the power of long y (xy) using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} value to take to the power - * @param y the long value to serve as exponent - * @return the calculated x to the power of y with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#pow(BigDecimal, long, MathContext) - */ - public static BigDecimal pow(BigDecimal x, long y) { - return BigDecimalMath.pow(x, y, currentMathContext()); - } - - /** - * Calculates the square root of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} value to calculate the square root - * @return the calculated square root of x with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#sqrt(BigDecimal, MathContext) - */ - public static BigDecimal sqrt(BigDecimal x) { - return BigDecimalMath.sqrt(x, currentMathContext()); - } - - /** - * Calculates the n'th root of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} value to calculate the n'th root - * @param n the {@link BigDecimal} defining the root - * - * @return the calculated n'th root of x with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#root(BigDecimal, BigDecimal, MathContext) - */ - public static BigDecimal root(BigDecimal x, BigDecimal n) { - return BigDecimalMath.root(x, n, currentMathContext()); - } - - /** - * Calculates the natural logarithm of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the natural logarithm for - * @return the calculated natural logarithm {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#log(BigDecimal, MathContext) - */ - public static BigDecimal log(BigDecimal x) { - return BigDecimalMath.log(x, currentMathContext()); - } - - /** - * Calculates the logarithm of {@link BigDecimal} x to the base 2 using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the logarithm base 2 for - * @return the calculated natural logarithm {@link BigDecimal} to the base 2 with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#log2(BigDecimal, MathContext) - */ - public static BigDecimal log2(BigDecimal x) { - return BigDecimalMath.log2(x, currentMathContext()); - } - - /** - * Calculates the logarithm of {@link BigDecimal} x to the base 10 using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the logarithm base 10 for - * @return the calculated natural logarithm {@link BigDecimal} to the base 10 with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#log10(BigDecimal, MathContext) - */ - public static BigDecimal log10(BigDecimal x) { - return BigDecimalMath.log10(x, currentMathContext()); - } - - /** - * Returns the number pi using the current {@link MathContext}. - * - * @return the number pi with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#pi(MathContext) - */ - public static BigDecimal pi() { - return BigDecimalMath.pi(currentMathContext()); - } - - /** - * Returns the number e using the current {@link MathContext}. - * - * @return the number e with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#e(MathContext) - */ - public static BigDecimal e() { - return BigDecimalMath.e(currentMathContext()); - } - - /** - * Calculates the natural exponent of {@link BigDecimal} x (ex) using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the exponent for - * @return the calculated exponent {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#exp(BigDecimal, MathContext) - */ - public static BigDecimal exp(BigDecimal x) { - return BigDecimalMath.exp(x, currentMathContext()); - } - - /** - * Calculates the sine (sinus) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the sine for - * @return the calculated sine {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#sin(BigDecimal, MathContext) - */ - public static BigDecimal sin(BigDecimal x) { - return BigDecimalMath.sin(x, currentMathContext()); - } - - /** - * Calculates the arc sine (inverted sine) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc sine for - * @return the calculated arc sine {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#asin(BigDecimal, MathContext) - */ - public static BigDecimal asin(BigDecimal x) { - return BigDecimalMath.asin(x, currentMathContext()); - } - - /** - * Calculates the cosine (cosinus) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the cosine for - * @return the calculated cosine {@link BigDecimal} with the precision specified in the current {@link MathContext} - */ - public static BigDecimal cos(BigDecimal x) { - return BigDecimalMath.cos(x, currentMathContext()); - } - - /** - * Calculates the arc cosine (inverted cosine) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc cosine for - * @return the calculated arc sine {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#acos(BigDecimal, MathContext) - */ - public static BigDecimal acos(BigDecimal x) { - return BigDecimalMath.acos(x, currentMathContext()); - } - - /** - * Calculates the tangens of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the tangens for - * @return the calculated tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#tan(BigDecimal, MathContext) - */ - public static BigDecimal tan(BigDecimal x) { - return BigDecimalMath.tan(x, currentMathContext()); - } - - /** - * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc tangens for - * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#atan(BigDecimal, MathContext) - */ - public static BigDecimal atan(BigDecimal x) { - return BigDecimalMath.atan(x, currentMathContext()); - } - - /** - * Calculates the arc tangens (inverted tangens) of {@link BigDecimal} y / x in the range -pi to pi using the current {@link MathContext}. - * - * @param y the {@link BigDecimal} - * @param x the {@link BigDecimal} - * @return the calculated arc tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see #atan2(BigDecimal, BigDecimal) - */ - public static BigDecimal atan2(BigDecimal y, BigDecimal x) { - return BigDecimalMath.atan2(y, x, currentMathContext()); - } - - /** - * Calculates the cotangens of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the cotangens for - * @return the calculated cotanges {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#cot(BigDecimal, MathContext) - */ - public static BigDecimal cot(BigDecimal x) { - return BigDecimalMath.cot(x, currentMathContext()); - } - - /** - * Calculates the inverse cotangens (arc cotangens) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc cotangens for - * @return the calculated arc cotangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#acot(BigDecimal, MathContext) - */ - public static BigDecimal acot(BigDecimal x) { - return BigDecimalMath.acot(x, currentMathContext()); - } - - /** - * Calculates the hyperbolic sine of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the hyperbolic sine for - * @return the calculated hyperbolic sine {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#sinh(BigDecimal, MathContext) - */ - public static BigDecimal sinh(BigDecimal x) { - return BigDecimalMath.sinh(x, currentMathContext()); - } - - /** - * Calculates the hyperbolic cosine of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the hyperbolic cosine for - * @return the calculated hyperbolic cosine {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#cosh(BigDecimal, MathContext) - */ - public static BigDecimal cosh(BigDecimal x) { - return BigDecimalMath.cosh(x, currentMathContext()); - } - - /** - * Calculates the hyperbolic tangens of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the hyperbolic tangens for - * @return the calculated hyperbolic tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#tanh(BigDecimal, MathContext) - */ - public static BigDecimal tanh(BigDecimal x) { - return BigDecimalMath.tanh(x, currentMathContext()); - } - - /** - * Calculates the hyperbolic cotangens of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the hyperbolic cotangens for - * @return the calculated hyperbolic cotangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#coth(BigDecimal, MathContext) - */ - public static BigDecimal coth(BigDecimal x) { - return BigDecimalMath.coth(x, currentMathContext()); - } - - /** - * Calculates the arc hyperbolic sine (inverse hyperbolic sine) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic sine for - * @return the calculated arc hyperbolic sine {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#asinh(BigDecimal, MathContext) - */ - public static BigDecimal asinh(BigDecimal x) { - return BigDecimalMath.asinh(x, currentMathContext()); - } - - /** - * Calculates the arc hyperbolic cosine (inverse hyperbolic cosine) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic cosine for - * @return the calculated arc hyperbolic cosine {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#acosh(BigDecimal, MathContext) - */ - public static BigDecimal acosh(BigDecimal x) { - return BigDecimalMath.acosh(x, currentMathContext()); - } - - /** - * Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for - * @return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#atanh(BigDecimal, MathContext) - */ - public static BigDecimal atanh(BigDecimal x) { - return BigDecimalMath.atanh(x, currentMathContext()); - } - - /** - * Calculates the arc hyperbolic cotangens (inverse hyperbolic cotangens) of {@link BigDecimal} x using the current {@link MathContext}. - * - * @param x the {@link BigDecimal} to calculate the arc hyperbolic cotangens for - * @return the calculated arc hyperbolic cotangens {@link BigDecimal} with the precision specified in the current {@link MathContext} - * @see #currentMathContext() - * @see BigDecimalMath#acoth(BigDecimal, MathContext) - */ - public static BigDecimal acoth(BigDecimal x) { - return BigDecimalMath.acoth(x, currentMathContext()); - } - - /** - * The local context used to push and pop a {@link MathContext} on the stack. - * - *

The recommended way to use this class is to use the try-with-resources.

- */ - public static class LocalMathContext implements AutoCloseable { - public final MathContext mathContext; - - LocalMathContext(MathContext mathContext) { - this.mathContext = mathContext; - pushMathContext(mathContext); - } - - @Override - public void close() { - popMathContext(); - } - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java deleted file mode 100644 index f8bcd4837b..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/AsinCalculator.java +++ /dev/null @@ -1,46 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -import ch.obermuhlner.math.big.BigRational; - -/** - * Calculates arc sinus using the Maclaurin series. - * - *

See Wikipedia: Taylorreihe

- * - *

No argument checking or optimizations are done. - * This implementation is not intended to be called directly.

- */ -public class AsinCalculator extends SeriesCalculator { - - public static final AsinCalculator INSTANCE = new AsinCalculator(); - - private int n = 0; - private BigRational factorial2n = BigRational.ONE; - private BigRational factorialN = BigRational.ONE; - private BigRational fourPowerN = BigRational.ONE; - - private AsinCalculator() { - } - - @Override - protected BigRational getCurrentFactor() { - BigRational factor = factorial2n.divide(fourPowerN.multiply(factorialN).multiply(factorialN).multiply(2 * n + 1)); - return factor; - } - - @Override - protected void calculateNextFactor() { - n++; - factorial2n = factorial2n.multiply(2 * n - 1).multiply(2 * n); - factorialN = factorialN.multiply(n); - fourPowerN = fourPowerN.multiply(4); - } - - @Override - protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { - return new PowerTwoNPlusOneIterator(x, mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java deleted file mode 100644 index a2f844a094..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/AtanhCalculator.java +++ /dev/null @@ -1,40 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import ch.obermuhlner.math.big.BigRational; - -import java.math.BigDecimal; -import java.math.MathContext; - -/** - * Calculates sinus hyperbolicus using the Taylor series. - * - *

See Wikipedia: Taylor series

- * - *

No argument checking or optimizations are done. - * This implementation is not intended to be called directly.

- */ -public class AtanhCalculator extends SeriesCalculator { - - public static final AtanhCalculator INSTANCE = new AtanhCalculator(); - - private int n = 0; - - private AtanhCalculator() { - super(true); - } - - @Override - protected BigRational getCurrentFactor() { - return BigRational.valueOf(1, 2 * n + 1); - } - - @Override - protected void calculateNextFactor() { - n++; - } - - @Override - protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { - return new PowerTwoNPlusOneIterator(x, mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java deleted file mode 100644 index bf9edbd691..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/CosCalculator.java +++ /dev/null @@ -1,48 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -import ch.obermuhlner.math.big.BigRational; - -/** - * Calculates cosinus using the Maclaurin series. - * - *

See Wikipedia: Taylorreihe

- * - *

No argument checking or optimizations are done. - * This implementation is not intended to be called directly.

- */ -public class CosCalculator extends SeriesCalculator { - - public static final CosCalculator INSTANCE = new CosCalculator(); - - private int n = 0; - private boolean negative = false; - private BigRational factorial2n = BigRational.ONE; - - private CosCalculator() { - super(true); - } - - @Override - protected BigRational getCurrentFactor() { - BigRational factor = factorial2n.reciprocal(); - if (negative) { - factor = factor.negate(); - } - return factor; - } - - @Override - protected void calculateNextFactor() { - n++; - factorial2n = factorial2n.multiply(2 * n - 1).multiply(2 * n); - negative = !negative; - } - - @Override - protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { - return new PowerTwoNIterator(x, mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java deleted file mode 100644 index f22631e8ae..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/CoshCalculator.java +++ /dev/null @@ -1,43 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -import ch.obermuhlner.math.big.BigRational; - -/** - * Calculates cosinus hyperbolicus using the Taylor series. - * - *

See Wikipedia: Taylor series

- * - *

No argument checking or optimizations are done. - * This implementation is not intended to be called directly.

- */ -public class CoshCalculator extends SeriesCalculator { - - public static final CoshCalculator INSTANCE = new CoshCalculator(); - - private int n = 0; - - private BigRational factorial2n = BigRational.ONE; - - private CoshCalculator() { - super(true); - } - - @Override - protected BigRational getCurrentFactor() { - return factorial2n.reciprocal(); - } - - @Override - protected void calculateNextFactor() { - n++; - factorial2n = factorial2n.multiply(2 * n - 1).multiply(2 * n); - } - - @Override - protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { - return new PowerTwoNIterator(x, mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java deleted file mode 100644 index 16c6e6ac21..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/ExpCalculator.java +++ /dev/null @@ -1,42 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -import ch.obermuhlner.math.big.BigRational; - -/** - * Calculates exp using the Maclaurin series. - * - *

See Wikipedia: Taylorreihe

- * - *

No argument checking or optimizations are done. - * This implementation is not intended to be called directly.

- */ -public class ExpCalculator extends SeriesCalculator { - - public static final ExpCalculator INSTANCE = new ExpCalculator(); - - private int n = 0; - private BigRational oneOverFactorialOfN = BigRational.ONE; - - private ExpCalculator() { - // prevent instances - } - - @Override - protected BigRational getCurrentFactor() { - return oneOverFactorialOfN; - } - - @Override - protected void calculateNextFactor() { - n++; - oneOverFactorialOfN = oneOverFactorialOfN.divide(n); - } - - @Override - protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { - return new PowerNIterator(x, mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java deleted file mode 100644 index def0f5f7ef..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/PowerIterator.java +++ /dev/null @@ -1,28 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; - -/** - * Iterator over the powers of a value x. - * - *

This API allows to efficiently calculate the various powers of x in a taylor series by storing intermediate results.

- *

For example xn can be calculated using one multiplication by storing the previously calculated xn-1 and x.

- * - *

{@link #getCurrentPower()} will be called first to retrieve the initial value.

- * - * For later iterations {@link #calculateNextPower()} will be called before {@link #getCurrentPower()}. - */ -public interface PowerIterator { - - /** - * Returns the current power. - * - * @return the current power. - */ - BigDecimal getCurrentPower(); - - /** - * Calculates the next power. - */ - void calculateNextPower(); -} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java deleted file mode 100644 index d6ef34e01e..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/PowerNIterator.java +++ /dev/null @@ -1,33 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -/** - * {@link PowerIterator} to calculate xn. - */ -public class PowerNIterator implements PowerIterator { - - private final BigDecimal x; - - private final MathContext mathContext; - - private BigDecimal powerOfX; - - public PowerNIterator(BigDecimal x, MathContext mathContext) { - this.x = x; - this.mathContext = mathContext; - - powerOfX = BigDecimal.ONE; - } - - @Override - public BigDecimal getCurrentPower() { - return powerOfX; - } - - @Override - public void calculateNextPower() { - powerOfX = powerOfX.multiply(x, mathContext); - } -} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java deleted file mode 100644 index 839d617e16..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNIterator.java +++ /dev/null @@ -1,33 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -/** - * {@link PowerIterator} to calculate x2*n. - */ -public class PowerTwoNIterator implements PowerIterator { - - private final MathContext mathContext; - - private final BigDecimal xPowerTwo; - - private BigDecimal powerOfX; - - public PowerTwoNIterator(BigDecimal x, MathContext mathContext) { - this.mathContext = mathContext; - - xPowerTwo = x.multiply(x, mathContext); - powerOfX = BigDecimal.ONE; - } - - @Override - public BigDecimal getCurrentPower() { - return powerOfX; - } - - @Override - public void calculateNextPower() { - powerOfX = powerOfX.multiply(xPowerTwo, mathContext); - } -} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java deleted file mode 100644 index 15ad0168c0..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNMinusOneIterator.java +++ /dev/null @@ -1,35 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import ch.obermuhlner.math.big.BigDecimalMath; - -import java.math.BigDecimal; -import java.math.MathContext; - -/** - * {@link PowerIterator} to calculate x2*n-1. - */ -public class PowerTwoNMinusOneIterator implements PowerIterator { - - private final MathContext mathContext; - - private final BigDecimal xPowerTwo; - - private BigDecimal powerOfX; - - public PowerTwoNMinusOneIterator(BigDecimal x, MathContext mathContext) { - this.mathContext = mathContext; - - xPowerTwo = x.multiply(x, mathContext); - powerOfX = BigDecimalMath.reciprocal(x, mathContext); - } - - @Override - public BigDecimal getCurrentPower() { - return powerOfX; - } - - @Override - public void calculateNextPower() { - powerOfX = powerOfX.multiply(xPowerTwo, mathContext); - } -} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java b/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java deleted file mode 100644 index 57afa97634..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/PowerTwoNPlusOneIterator.java +++ /dev/null @@ -1,33 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -/** - * {@link PowerIterator} to calculate x2*n+1. - */ -public class PowerTwoNPlusOneIterator implements PowerIterator { - - private final MathContext mathContext; - - private final BigDecimal xPowerTwo; - - private BigDecimal powerOfX; - - public PowerTwoNPlusOneIterator(BigDecimal x, MathContext mathContext) { - this.mathContext = mathContext; - - xPowerTwo = x.multiply(x, mathContext); - powerOfX = x; - } - - @Override - public BigDecimal getCurrentPower() { - return powerOfX; - } - - @Override - public void calculateNextPower() { - powerOfX = powerOfX.multiply(xPowerTwo, mathContext); - } -} \ No newline at end of file diff --git a/src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java deleted file mode 100644 index 117c2737d2..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/SeriesCalculator.java +++ /dev/null @@ -1,127 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import ch.obermuhlner.math.big.BigRational; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.util.ArrayList; -import java.util.List; - -import static java.util.Objects.requireNonNull; - -/** - * Utility class to calculate taylor series efficiently until the maximum error (as defined by the precision in the {@link MathContext} is reached. - * - *

Stores the factors of the taylor series terms so that future calculations will be faster.

- */ -public abstract class SeriesCalculator { - - private final boolean calculateInPairs; - - private final List factors = new ArrayList<>(); - - /** - * Constructs a {@link SeriesCalculator} that calculates single terms. - */ - protected SeriesCalculator() { - this(false); - } - - /** - * Constructs a {@link SeriesCalculator} with control over whether the sum terms are calculated in pairs. - * - *

Calculation of pairs is useful for taylor series where the terms alternate the sign. - * In these cases it is more efficient to calculate two terms at once check then whether the acceptable error has been reached.

- * - * @param calculateInPairs true to calculate the terms in pairs, false to calculate single terms - */ - protected SeriesCalculator(boolean calculateInPairs) { - this.calculateInPairs = calculateInPairs; - } - - /** - * Calculates the series for the specified value x and the precision defined in the {@link MathContext}. - * - * @param x the value x - * @param mathContext the {@link MathContext} - * @return the calculated result - */ - public BigDecimal calculate(BigDecimal x, MathContext mathContext) { - BigDecimal acceptableError = BigDecimal.ONE.movePointLeft(mathContext.getPrecision() + 1); - - PowerIterator powerIterator = createPowerIterator(x, mathContext); - - BigDecimal sum = BigDecimal.ZERO; - BigDecimal step; - int i = 0; - do { - BigRational factor; - BigDecimal xToThePower; - - factor = getFactor(i); - xToThePower = powerIterator.getCurrentPower(); - powerIterator.calculateNextPower(); - step = factor.getNumerator().multiply(xToThePower).divide(factor.getDenominator(), mathContext); - i++; - - if (calculateInPairs) { - factor = getFactor(i); - xToThePower = powerIterator.getCurrentPower(); - powerIterator.calculateNextPower(); - BigDecimal step2 = factor.getNumerator().multiply(xToThePower).divide(factor.getDenominator(), mathContext); - step = step.add(step2); - i++; - } - - sum = sum.add(step); - //System.out.println(sum + " " + step); - } while (step.abs().compareTo(acceptableError) > 0); - - return sum.round(mathContext); - } - - /** - * Creates the {@link PowerIterator} used for this series. - * - * @param x the value x - * @param mathContext the {@link MathContext} - * @return the {@link PowerIterator} - */ - protected abstract PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext); - - /** - * Returns the factor of the term with specified index. - * - * All mutable state of this class (and all its subclasses) must be modified in this method. - * This method is synchronized to allow thread-safe usage of this class. - * - * @param index the index (starting with 0) - * @return the factor of the specified term - */ - protected synchronized BigRational getFactor(int index) { - while (factors.size() <= index) { - BigRational factor = getCurrentFactor(); - addFactor(factor); - calculateNextFactor(); - } - return factors.get(index); - } - - private void addFactor(BigRational factor){ - factors.add(requireNonNull(factor, "Factor cannot be null")); - } - - /** - * Returns the factor of the highest term already calculated. - *

When called for the first time will return the factor of the first term (index 0).

- *

After this call the method {@link #calculateNextFactor()} will be called to prepare for the next term.

- * - * @return the factor of the highest term - */ - protected abstract BigRational getCurrentFactor(); - - /** - * Calculates the factor of the next term. - */ - protected abstract void calculateNextFactor(); -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java deleted file mode 100644 index 471074fd6b..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/SinCalculator.java +++ /dev/null @@ -1,49 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -import ch.obermuhlner.math.big.BigRational; - -/** - * Calculates sinus using the Maclaurin series. - * - *

See Wikipedia: Taylorreihe

- * - *

No argument checking or optimizations are done. - * This implementation is not intended to be called directly.

- */ -public class SinCalculator extends SeriesCalculator { - - public static final SinCalculator INSTANCE = new SinCalculator(); - - private int n = 0; - private boolean negative = false; - private BigRational factorial2nPlus1 = BigRational.ONE; - - private SinCalculator() { - super(true); - } - - @Override - protected BigRational getCurrentFactor() { - BigRational factor = factorial2nPlus1.reciprocal(); - if (negative) { - factor = factor.negate(); - } - return factor; - } - - @Override - protected void calculateNextFactor() { - n++; - factorial2nPlus1 = factorial2nPlus1.multiply(2 * n); - factorial2nPlus1 = factorial2nPlus1.multiply(2 * n + 1); - negative = !negative; - } - - @Override - protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { - return new PowerTwoNPlusOneIterator(x, mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java b/src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java deleted file mode 100644 index 9601735755..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/internal/SinhCalculator.java +++ /dev/null @@ -1,44 +0,0 @@ -package ch.obermuhlner.math.big.internal; - -import java.math.BigDecimal; -import java.math.MathContext; - -import ch.obermuhlner.math.big.BigRational; - -/** - * Calculates sinus hyperbolicus using the Taylor series. - * - *

See Wikipedia: Taylor series

- * - *

No argument checking or optimizations are done. - * This implementation is not intended to be called directly.

- */ -public class SinhCalculator extends SeriesCalculator { - - public static final SinhCalculator INSTANCE = new SinhCalculator(); - - private int n = 0; - - private BigRational factorial2nPlus1 = BigRational.ONE; - - private SinhCalculator() { - super(true); - } - - @Override - protected BigRational getCurrentFactor() { - return factorial2nPlus1.reciprocal(); - } - - @Override - protected void calculateNextFactor() { - n++; - factorial2nPlus1 = factorial2nPlus1.multiply(2 * n); - factorial2nPlus1 = factorial2nPlus1.multiply(2 * n + 1); - } - - @Override - protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { - return new PowerTwoNPlusOneIterator(x, mathContext); - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java b/src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java deleted file mode 100644 index 05a45fd846..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/stream/BigDecimalStream.java +++ /dev/null @@ -1,219 +0,0 @@ -package ch.obermuhlner.math.big.stream; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.util.Comparator; -import java.util.Spliterator; -import java.util.Spliterators.AbstractSpliterator; -import java.util.function.Consumer; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - -import ch.obermuhlner.math.big.BigDecimalMath; - -/** - * Provides constructor methods for streams of {@link BigDecimal} elements. - */ -public class BigDecimalStream { - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. - * - *

An equivalent sequence of increasing values can be produced - * sequentially using a {@code for} loop as follows: - *

for (BigDecimal i = startInclusive; i.compareTo(endExclusive) < 0; i = i.add(step, mathContext)) {
-    // ...
-}
- * - * @param startInclusive the (inclusive) initial value - * @param endExclusive the exclusive upper bound - * @param step the step between elements - * @param mathContext the {@link MathContext} used for all mathematical operations - * @return a sequential {@code Stream} - */ - public static Stream range(BigDecimal startInclusive, BigDecimal endExclusive, BigDecimal step, MathContext mathContext) { - if (step.signum() == 0) { - throw new IllegalArgumentException("invalid step: 0"); - } - if (endExclusive.subtract(startInclusive).signum() != step.signum()) { - return Stream.empty(); - } - return StreamSupport.stream(new BigDecimalSpliterator(startInclusive, endExclusive, false, step, mathContext), false); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. - * - *

The {@code long} arguments are converted using {@link BigDecimal#valueOf(long)}.

- * - * @param startInclusive the (inclusive) initial value - * @param endExclusive the exclusive upper bound - * @param step the step between elements - * @param mathContext the {@link MathContext} used for all mathematical operations - * @return a sequential {@code Stream} - * @see #range(BigDecimal, BigDecimal, BigDecimal, MathContext) - */ - public static Stream range(long startInclusive, long endExclusive, long step, MathContext mathContext) { - return range(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endExclusive), BigDecimal.valueOf(step), mathContext); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. - * - *

The {@code double} arguments are converted using {@link BigDecimal#valueOf(double)}.

- * - * @param startInclusive the (inclusive) initial value - * @param endExclusive the exclusive upper bound - * @param step the step between elements - * @param mathContext the {@link MathContext} used for all mathematical operations - * @return a sequential {@code Stream} - * @see #range(BigDecimal, BigDecimal, BigDecimal, MathContext) - */ - public static Stream range(double startInclusive, double endExclusive, double step, MathContext mathContext) { - return range(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endExclusive), BigDecimal.valueOf(step), mathContext); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. - * - *

An equivalent sequence of increasing values can be produced - * sequentially using a {@code for} loop as follows: - *

for (BigDecimal i = startInclusive; i.compareTo(endInclusive) <= 0; i = i.add(step, mathContext)) {
-    // ...
-}
- * - * @param startInclusive the (inclusive) initial value - * @param endInclusive the inclusive upper bound - * @param step the step between elements - * @param mathContext the {@link MathContext} used for all mathematical operations - * @return a sequential {@code Stream} - * @see #range(BigDecimal, BigDecimal, BigDecimal, MathContext) - */ - public static Stream rangeClosed(BigDecimal startInclusive, BigDecimal endInclusive, BigDecimal step, MathContext mathContext) { - if (step.signum() == 0) { - throw new IllegalArgumentException("invalid step: 0"); - } - if (endInclusive.subtract(startInclusive).signum() == -step.signum()) { - return Stream.empty(); - } - return StreamSupport.stream(new BigDecimalSpliterator(startInclusive, endInclusive, true, step, mathContext), false); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. - * - *

The {@code long} arguments are converted using {@link BigDecimal#valueOf(long)}.

- * - * @param startInclusive the (inclusive) initial value - * @param endInclusive the inclusive upper bound - * @param step the step between elements - * @param mathContext the {@link MathContext} used for all mathematical operations - * @return a sequential {@code Stream} - * @see #rangeClosed(BigDecimal, BigDecimal, BigDecimal, MathContext) - */ - public static Stream rangeClosed(long startInclusive, long endInclusive, long step, MathContext mathContext) { - return rangeClosed(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endInclusive), BigDecimal.valueOf(step), mathContext); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. - * - *

The {@code double} arguments are converted using {@link BigDecimal#valueOf(double)}.

- * - * @param startInclusive the (inclusive) initial value - * @param endInclusive the inclusive upper bound - * @param step the step between elements - * @param mathContext the {@link MathContext} used for all mathematical operations - * @return a sequential {@code Stream} - * @see #rangeClosed(BigDecimal, BigDecimal, BigDecimal, MathContext) - */ - public static Stream rangeClosed(double startInclusive, double endInclusive, double step, MathContext mathContext) { - return rangeClosed(BigDecimal.valueOf(startInclusive), BigDecimal.valueOf(endInclusive), BigDecimal.valueOf(step), mathContext); - } - - private static class BigDecimalSpliterator extends AbstractSpliterator { - - private BigDecimal value; - private BigDecimal step; - private long count; - private MathContext mathContext; - - public BigDecimalSpliterator(BigDecimal startInclusive, BigDecimal step, long count, MathContext mathContext) { - super(count, - Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED | Spliterator.SORTED); - - this.value = startInclusive; - this.step = step; - this.count = count; - this.mathContext = mathContext; - } - - public BigDecimalSpliterator(BigDecimal startInclusive, BigDecimal end, boolean inclusive, BigDecimal step, MathContext mathContext) { - this(startInclusive, step, estimatedCount(startInclusive, end, inclusive, step, mathContext), mathContext); - } - - private static long estimatedCount(BigDecimal startInclusive, BigDecimal end, boolean inclusive, BigDecimal step, MathContext mathContext) { - BigDecimal count = end.subtract(startInclusive).divide(step, mathContext); - long result = count.longValue(); - if (BigDecimalMath.fractionalPart(count).signum() != 0) { - result++; - } else { - if (inclusive) { - result++; - } - } - return result; - } - - @Override - public Comparator getComparator() { - if (step.signum() < 0) { - return Comparator.reverseOrder(); - } - return null; - } - - @Override - public boolean tryAdvance(Consumer action) { - if (count == 0) { - return false; - } - - action.accept(value); - value = value.add(step, mathContext); - count--; - return true; - } - - @Override - public void forEachRemaining(Consumer action) { - while (count > 0) { - action.accept(value); - value = value.add(step, mathContext); - count--; - } - } - - @Override - public Spliterator trySplit() { - long firstHalfCount = count / 2; - - if (firstHalfCount == 0) { - return null; - } - - long secondHalfCount = count - firstHalfCount; - - count = firstHalfCount; - BigDecimal startSecondHalf = value.add(step.multiply(new BigDecimal(firstHalfCount), mathContext), mathContext); - - return new BigDecimalSpliterator(startSecondHalf, step, secondHalfCount, mathContext); - } - } -} diff --git a/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java b/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java deleted file mode 100644 index 1c982302a6..0000000000 --- a/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java +++ /dev/null @@ -1,214 +0,0 @@ -package ch.obermuhlner.math.big.stream; - -import java.util.Comparator; -import java.util.Spliterator; -import java.util.Spliterators.AbstractSpliterator; -import java.util.function.Consumer; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - -import ch.obermuhlner.math.big.BigFloat; -import ch.obermuhlner.math.big.BigFloat.Context; - -/** - * Provides constructor methods for streams of {@link BigFloat} elements. - */ -public class BigFloatStream { - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. - * - *

An equivalent sequence of increasing values can be produced - * sequentially using a {@code for} loop as follows: - *

for (BigFloat i = startInclusive; i.isLessThan(endExclusive); i = i.add(step)) {
-    // ...
-}
- * - * @param startInclusive the (inclusive) initial value - * @param endExclusive the exclusive upper bound - * @param step the step between elements - * @return a sequential {@code Stream} - */ - public static Stream range(BigFloat startInclusive, BigFloat endExclusive, BigFloat step) { - if (step.isZero()) { - throw new IllegalArgumentException("invalid step: 0"); - } - if (endExclusive.subtract(startInclusive).signum() != step.signum()) { - return Stream.empty(); - } - return StreamSupport.stream(new BigFloatSpliterator(startInclusive, endExclusive, false, step), false); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. - * - *

{@link Context#valueOf(long)} is used to convert the {@code long} values.

- * - * @param startInclusive the (inclusive) initial value - * @param endExclusive the exclusive upper bound - * @param step the step between elements - * @param context the {@link Context} used to convert the {@code long} values - * @return a sequential {@code Stream} - * @see #range(BigFloat, BigFloat, BigFloat) - */ - public static Stream range(long startInclusive, long endExclusive, long step, Context context) { - return range(context.valueOf(startInclusive), context.valueOf(endExclusive), context.valueOf(step)); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}. - * - *

{@link Context#valueOf(double)} is used to convert the {@code double} values.

- * - * @param startInclusive the (inclusive) initial value - * @param endExclusive the exclusive upper bound - * @param step the step between elements - * @param context the {@link Context} used to convert the {@code double} values - * @return a sequential {@code Stream} - * @see #range(BigFloat, BigFloat, BigFloat) - */ - public static Stream range(double startInclusive, double endExclusive, double step, Context context) { - return range(context.valueOf(startInclusive), context.valueOf(endExclusive), context.valueOf(step)); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. - * - *

An equivalent sequence of increasing values can be produced - * sequentially using a {@code for} loop as follows: - *

for (BigFloat i = startInclusive; i.isLessThanOrEqual(endInclusive); i = i.add(step)) {
-    //...
-}
-
- * - * @param startInclusive the (inclusive) initial value - * @param endInclusive the inclusive upper bound - * @param step the step between elements - * @return a sequential {@code Stream} - */ - public static Stream rangeClosed(BigFloat startInclusive, BigFloat endInclusive, BigFloat step) { - if (step.isZero()) { - throw new IllegalArgumentException("invalid step: 0"); - } - if (endInclusive.subtract(startInclusive).signum() == -step.signum()) { - return Stream.empty(); - } - return StreamSupport.stream(new BigFloatSpliterator(startInclusive, endInclusive, true, step), false); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. - * - *

{@link Context#valueOf(long)} is used to convert the {@code long} values.

- * - * @param startInclusive the (inclusive) initial value - * @param endInclusive the inclusive upper bound - * @param step the step between elements - * @param context the {@link Context} used to convert the {@code long} values - * @return a sequential {@code Stream} - * @see #rangeClosed(BigFloat, BigFloat, BigFloat) - */ - public static Stream rangeClosed(long startInclusive, long endInclusive, long step, Context context) { - return rangeClosed(context.valueOf(startInclusive), context.valueOf(endInclusive), context.valueOf(step)); - } - - /** - * Returns a sequential ordered {@code Stream} from {@code startInclusive} - * (inclusive) to {@code endInclusive} (inclusive) by an incremental {@code step}. - * - *

{@link Context#valueOf(double)} is used to convert the {@code double} values.

- * - * @param startInclusive the (inclusive) initial value - * @param endInclusive the inclusive upper bound - * @param step the step between elements - * @param context the {@link Context} used to convert the {@code double} values - * @return a sequential {@code Stream} - * @see #rangeClosed(BigFloat, BigFloat, BigFloat) - */ - public static Stream rangeClosed(double startInclusive, double endInclusive, double step, Context context) { - return rangeClosed(context.valueOf(startInclusive), context.valueOf(endInclusive), context.valueOf(step)); - } - - private static class BigFloatSpliterator extends AbstractSpliterator { - - private BigFloat value; - private BigFloat step; - private long count; - - public BigFloatSpliterator(BigFloat startInclusive, BigFloat step, long count) { - super(count, - Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED | Spliterator.SORTED); - - this.value = startInclusive; - this.step = step; - this.count = count; - } - - public BigFloatSpliterator(BigFloat startInclusive, BigFloat end, boolean inclusive, BigFloat step) { - this(startInclusive, step, estimatedCount(startInclusive, end, inclusive, step)); - } - - private static long estimatedCount(BigFloat startInclusive, BigFloat end, boolean inclusive, BigFloat step) { - BigFloat count = end.subtract(startInclusive).divide(step); - long result = count.toLong(); - if (count.getFractionalPart().signum() != 0) { - result++; - } else { - if (inclusive) { - result++; - } - } - return result; - } - - @Override - public Comparator getComparator() { - if (step.signum() < 0) { - return Comparator.reverseOrder(); - } - return null; - } - - @Override - public boolean tryAdvance(Consumer action) { - if (count == 0) { - return false; - } - - action.accept(value); - value = value.add(step); - count--; - return true; - } - - @Override - public void forEachRemaining(Consumer action) { - while (count > 0) { - action.accept(value); - value = value.add(step); - count--; - } - } - - @Override - public Spliterator trySplit() { - long firstHalfCount = count / 2; - - if (firstHalfCount == 0) { - return null; - } - - long secondHalfCount = count - firstHalfCount; - - count = firstHalfCount; - BigFloat startSecondHalf = value.add(step.multiply(firstHalfCount)); - - return new BigFloatSpliterator(startSecondHalf, step, secondHalfCount); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java new file mode 100644 index 0000000000..4ca63d14fe --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java @@ -0,0 +1,41 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +public class cElementalDecayResult { + private final cElementalInstanceStackMap output; + private double massAffected; + private double massDiff; + + public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) { + this.output = output; + this.massAffected = massAffected; + this.massDiff = massDiff; + } + + public cElementalInstanceStackMap getOutput() { + return output; + } + + /** + * How much was lost in the process (decayed or removed) + * @return + */ + public double getMassAffected() { + return massAffected; + } + + /** + * Difference of mass of actually decayed elements + * @return + */ + public double getMassDiff() { + return massDiff; + } + + public void setMassAffected(double massAffected) { + this.massAffected = massAffected; + } + + public void setMassDiff(double massDiff) { + this.massDiff = massDiff; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index ad22f5123b..9ecbf5374e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -414,20 +414,23 @@ public final class cElementalInstanceStackMap implements Comparable 0) { newEnergyLevel -= 1; @@ -195,19 +194,19 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { long decayCnt=(long) min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); double amountPer= div(amount,decayCnt); amount= sub(amount,amountPer*(--decayCnt)); - //todo decay mechanics should handle splitting! - cElementalInstanceStackMap output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); + + cElementalDecayResult output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(output==null){ amount=amountTemp; return null; } - if(amountPer>0){ - amount=amountPer; - for(int i=0;i 0 && !definition.usesSpecialEnergeticDecayHandling()) { setLifeTimeMultiplier(getLifeTimeMultiplier()); return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); @@ -236,27 +235,8 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } //Use to get direct decay output providing correct decay array - private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { - if(lifeTime<1){ - throw new ArithmeticException("Value would be too big..."); - } - double decayInverseRatio=Math.pow(2D,1D/* 1 second *//lifeTime); - double newAmount,decayedAmount; - if(decayInverseRatio>0.99999999D){ - //todo cache this... - BigFloat dir=BigFloat.context(50).valueOf(2).pow(1D/* 1 second *//lifeTime); - BigFloat na=BigFloat.context(50).valueOf(amount).divide(dir); - newAmount=na.toDouble(); - if(newAmount>=amount) { - decayedAmount=BigFloat.context(50).valueOf(amount).subtract(na).toDouble(); - newAmount=amount-ulp(amount); - }else { - decayedAmount=amount-newAmount; - } - }else{ - newAmount= div(amount,decayInverseRatio); - decayedAmount=amount-newAmount; - } + private cElementalDecayResult exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + double newAmount= div(amount,Math.pow(2D,1D/* 1 second *//lifeTime)); //if(definition.getSymbol().startsWith("U ")) { // System.out.println("newAmount = " + newAmount); @@ -276,61 +256,62 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { //split to non decaying and decaying part double amount=this.amount; - this.amount= decayedAmount; - cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); + this.amount-=newAmount; + cElementalDecayResult products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); this.amount=newAmount; if(products!=null){ - products.putUnify(clone()); + products.getOutput().putUnify(clone()); } this.amount=amount; return products; } //Use to get direct decay output providing correct decay array - private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + private cElementalDecayResult decayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { if (decays == null) { return null;//Can not decay so it wont } + boolean makesEnergy=definition.decayMakesEnergy(energy); + double mass=getMass(); if (decays.length == 0) { - if(definition.decayMakesEnergy(this.energy)) { - return null; - } - return new cElementalInstanceStackMap();//provide non null 0 length array for annihilation + return makesEnergy ? null : new cElementalDecayResult(new cElementalInstanceStackMap(), mass, 0); + //provide non null 0 length array for annihilation } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end - if(decays[0]==deadEnd && definition.decayMakesEnergy(this.energy)) { - return null;//no extra photons + if(decays[0]==deadEnd) { + return makesEnergy ? null : new cElementalDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount), mass, 0); } - cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); + cElementalInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); if(newProductsAge<0){ - if(products.size()==1) { - if(products.size()==1 && products.get(0).definition.equals(definition)) { - products.get(0).setEnergy(energy); - products.get(0).age=age; + if(output.size()==1) { + if(output.size()==1 && output.get(0).definition.equals(definition)) { + output.get(0).setEnergy(energy); + output.get(0).age=age; } }else { - for (cElementalInstanceStack stack : products.values()) { + for (cElementalInstanceStack stack : output.values()) { if (stack.definition.equals(definition)) { stack.age = age; } } } }else{ - if(products.size()==1 && products.get(0).definition.equals(definition)) { - products.get(0).setEnergy(energy); + if(output.size()==1 && output.get(0).definition.equals(definition)) { + output.get(0).setEnergy(energy); } } - if(this.energy <= 0 && products.getMass() > getMass()){ + if(energy <= 0 && output.getMass() > mass){ return null;//no energy usage to decay } - return products; + return new cElementalDecayResult(new cElementalInstanceStackMap(), mass, makesEnergy ? output.getMass()-mass:0); } else { - cElementalInstanceStackMap output = new cElementalInstanceStackMap(); + cElementalDecayResult totalOutput = new cElementalDecayResult(new cElementalInstanceStackMap(),getMass(),0); + cElementalInstanceStackMap output=totalOutput.getOutput(),results; int differentDecays = decays.length; double[] probabilities=new double[differentDecays]; for (int i = 0; i < probabilities.length; i++) { probabilities[i]=decays[i].probability; } - double[] qttyOfDecay = distribute(this.amount, probabilities); + double[] qttyOfDecay = distribute(amount, probabilities); //long amountRemaining = this.amount, amount = this.amount; //float remainingProbability = 1D; // @@ -376,23 +357,22 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { // } //} - if(definition.decayMakesEnergy(this.energy)){ - for (int i = 0; i < differentDecays; i++) { - if (qttyOfDecay[i] > 0) { - if(decays[i]==deadEnd){ - cElementalInstanceStack clone=this.clone(); - clone.amount=qttyOfDecay[i]; - output.putUnify(clone); - }else { - output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i])); - } + if(definition.decayMakesEnergy(energy)){ + for (int i = differentDecays - 1; i >= 0; i--) { + if(decays[i]==deadEnd){ + cElementalInstanceStack clone=clone(); + clone.amount=qttyOfDecay[i]; + output.putUnify(clone); + }else { + results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + totalOutput.setMassDiff(add(totalOutput.getMassDiff(),results.getMass()-mass)); } } }else{ - for (int i = 0; i < differentDecays; i++) { - if (qttyOfDecay[i] > 0) { - output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i])); - } + for (int i = differentDecays - 1; i >= 0; i--) { + results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); } } @@ -413,10 +393,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { output.get(0).age=age; } } - if(this.energy <= 0 && output.getMass() > getMass()){ + if(energy <= 0 && output.getMass() > getMass()){ return null;//no energy usage to decay } - return output; + return totalOutput; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index e0398a8fcb..9cfcaf9d55 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecayResult; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; @@ -43,6 +44,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.DoubleCount.add; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -374,13 +376,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB KEEPUP_COST = -heliumPlasmaValue; } - protected double fuse(GT_MetaTileEntity_EM_collider partner) { + protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU if (partner.stack != null && stack != null) {//todo add single event mode as an option boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); cElementalInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); + double preMass = add(stack2.getMass(),stack.getMass()); //System.out.println("preMass = " + preMass); cElementalInstanceStackMap map = new cElementalInstanceStackMap(); @@ -407,7 +409,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 0; } - protected double collide(GT_MetaTileEntity_EM_collider partner) { + protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! if (partner.stack != null && stack != null) {//todo add single event mode as an option boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); @@ -482,13 +484,14 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB if (stack == null) { return null; } - cElementalInstanceStackMap newInstances = stack.decay(1, stack.age += 1, 0); + cElementalDecayResult newInstances = stack.decay(1, stack.age += 1, 0); if (newInstances == null) { stack.nextColor(); + return null; } else { - stack = newInstances.remove(newInstances.getLast().definition); + stack = newInstances.getOutput().remove(newInstances.getOutput().getLast().definition); + return newInstances.getOutput(); } - return newInstances; } @Override @@ -552,14 +555,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB mMaxProgresstime = 20; mEUt = KEEPUP_COST; eAmpereFlow = 2; - return true; } else { started = true; mMaxProgresstime = 20; mEUt = STARTUP_COST; eAmpereFlow = 10; - return true; } + return true; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 37e121dd26..fe96ca45ba 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -145,15 +145,13 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase //System.out.println(stack.definition.getSymbol()+" "+stack.amount); } - double preMass = outputEM[0].getMass(); - outputEM[0].tickContent(1, 0, 1); - double energyDose = ((preMass - outputEM[0].getMass()) * URANIUM_MASS_TO_EU_PARTIAL); eAmpereFlow = (long) ampereFlow.get(); if (eAmpereFlow <= 0) { mEUt = 0; return false; } - mEUt = (int) (energyDose / eAmpereFlow); + double energyDose = -outputEM[0].tickContent(1, 0, 1) * URANIUM_MASS_TO_EU_PARTIAL; + mEUt = (int) ( energyDose / eAmpereFlow); return outputEM[0].hasStacks(); } -- cgit From 2343de3da2fd37e70caa3d73a8b6ce0686700535 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Jul 2020 11:32:26 +0200 Subject: Safeguard collide --- .../metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 9cfcaf9d55..329b3cbc14 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -403,17 +403,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB partner.stack = stack = null; //System.out.println("check = " + check); //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return check ? preMass - map.getMass() : - Math.min(preMass - map.getMass(), 0); + return check ? preMass - map.getMass() : Math.min(preMass - map.getMass(), 0); } return 0; } protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! if (partner.stack != null && stack != null) {//todo add single event mode as an option - boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && - partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); - cElementalInstanceStack stack2 = partner.stack; double preMass = stack2.getMass() + stack.getMass(); //System.out.println("preMass = " + preMass); @@ -427,17 +423,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } - for (cElementalInstanceStack newStack : map.values()) { - check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); - } //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); outputEM = new cElementalInstanceStackMap[]{map}; partner.stack = stack = null; //System.out.println("check = " + check); //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return check ? preMass - map.getMass() : - Math.min(preMass - map.getMass(), 0); + return Math.min(preMass - map.getMass(), 0); } return 0; } -- cgit From 614b1538f85731f7598dc9f527739f3203f29af7 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Jul 2020 12:00:45 +0200 Subject: Cleanup DEBUG scanning of EM --- .../elementalMatter/core/cElementalInstanceStackMap.java | 11 +++++------ .../elementalMatter/core/stacks/cElementalInstanceStack.java | 3 ++- .../hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index 9ecbf5374e..96fd686ef8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -330,15 +330,14 @@ public final class cElementalInstanceStackMap implements Comparable 0) { if (content == null || content.size() == 0) { return new String[]{translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, translateToLocalFormatted("tt.keyphrase.No_Stacks", clientLocale)}; -- cgit From 8ee168be62e5d5a10d0efd281293a2623d260633 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Jul 2020 12:10:15 +0200 Subject: Reduce decay counts --- .../elementalMatter/core/stacks/cElementalInstanceStack.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index 9d38e283db..547c0b7b9d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -17,14 +17,14 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.DoubleCount.*; -import static java.lang.Math.min; -import static java.lang.Math.ulp; +import static java.lang.Math.*; /** * Created by danie_000 on 22.10.2016. */ public final class cElementalInstanceStack implements iHasElementalDefinition { - public static int MIN_MULTIPLE_DECAY_CALLS=16,MAX_MULTIPLE_DECAY_CALLS=64,DECAY_CALL_PER=144;//todo + public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16; + public static double DECAY_CALL_PER=AVOGADRO_CONSTANT;//todo public final iElementalDefinition definition; //energy - if positive then particle should try to decay @@ -192,7 +192,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } if(definition.usesMultipleDecayCalls(energy)){ double amountTemp=amount; - long decayCnt=(long) min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); + long decayCnt=(long) min(MAX_MULTIPLE_DECAY_CALLS,max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS)); double amountPer= div(amount,decayCnt); amount= sub(amount,amountPer*(--decayCnt)); @@ -418,7 +418,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { maxEnergy=instance.energy; } lifeTimeMul = min(lifeTimeMul, instance.lifeTimeMult); - age = Math.max(age, instance.age); + age = max(age, instance.age); } } -- cgit From ed1a7521080d545318fccd27b5c4351489db9690 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 19 Jul 2020 12:05:45 +0100 Subject: Refactor TecTechConfig.java --- .../java/com/github/technus/tectech/TecTech.java | 2 +- .../technus/tectech/loader/TecTechConfig.java | 156 ++++++++++++--------- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 18 +-- .../single/GT_MetaTileEntity_TeslaCoil.java | 2 +- 4 files changed, 100 insertions(+), 78 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 47a3b576b1..809a7e877d 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -78,7 +78,7 @@ public class TecTech { LOGGER.error(Reference.MODID + " could not load its config file. Things are going to be weird!"); } - if (configTecTech.modAdminErrorLogs) { + if (configTecTech.MOD_ADMIN_ERROR_LOGS) { LOGGER.setDebugOutput(DEBUG_MODE); LOGGER.debug("moduleAdminErrorLogs is enabled"); moduleAdminErrorLogs = new IngameErrorLog(); diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index cc6afd3f00..66e549ddb1 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -9,65 +9,70 @@ public class TecTechConfig extends ConfigManager { super(pConfigBaseDirectory, pModCollectionDirectory, pModID); } - public boolean modAdminErrorLogs; - //final static to allow compiler to remove the debug code when this is false public static boolean DEBUG_MODE = false; + public boolean DISABLE_MATERIAL_LOADING_FFS; + public boolean BOOM_ENABLE; + public boolean DISABLE_BLOCK_HARDNESS_NERF; public boolean EASY_SCAN; public boolean NERF_FUSION; public boolean ENABLE_TURRET_EXPLOSIONS; - public boolean DISABLE_MATERIAL_LOADING_FFS; - public boolean DISABLE_BLOCK_HARDNESS_NERF; public float TURRET_DAMAGE_FACTOR; public float TURRET_EXPLOSION_FACTOR; - public int TESLA_MULTI_TOWER_RANGE; - public int TESLA_MULTI_TRANSCEIVER_RANGE; - public int TESLA_MULTI_COVER_RANGE; - public int TESLA_MULTI_PLASMA_RANGE_MULTI_T1; - public int TESLA_MULTI_PLASMA_RANGE_MULTI_T2; - public int TESLA_MULTI_HELIUM_PLASMA_PER_SECOND; - public int TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND; - public int TESLA_MULTI_RADON_PLASMA_PER_SECOND; + + public boolean MOD_ADMIN_ERROR_LOGS; + + public boolean TESLA_MULTI_GAS_OUTPUT; + public float TESLA_MULTI_LOSS_FACTOR_OVERDRIVE; public int TESLA_MULTI_LOSS_PER_BLOCK_T0; public int TESLA_MULTI_LOSS_PER_BLOCK_T1; public int TESLA_MULTI_LOSS_PER_BLOCK_T2; - public float TESLA_MULTI_OVERDRIVE_LOSS_FACTOR; - public boolean TESLA_MULTI_GAS_OUTPUT; - public int TESLA_SINGLE_RANGE; + public int TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM; + public int TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN; + public int TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON; + public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1; + public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2; + public int TESLA_MULTI_RANGE_COVER; + public int TESLA_MULTI_RANGE_TOWER; + public int TESLA_MULTI_RANGE_TRANSCEIVER; + public float TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE; public int TESLA_SINGLE_LOSS_PER_BLOCK; - public float TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR; + public int TESLA_SINGLE_RANGE; /** * This loading phases do not correspond to mod loading phases! */ @Override protected void PreInit() { - modAdminErrorLogs = false; - EASY_SCAN = false; + DISABLE_MATERIAL_LOADING_FFS = false; + BOOM_ENABLE = true; - NERF_FUSION = false; DISABLE_BLOCK_HARDNESS_NERF = false; + EASY_SCAN = false; + NERF_FUSION = false; ENABLE_TURRET_EXPLOSIONS = true; - DISABLE_MATERIAL_LOADING_FFS = false; TURRET_DAMAGE_FACTOR = 10; TURRET_EXPLOSION_FACTOR = 1; - TESLA_MULTI_TOWER_RANGE= 32; - TESLA_MULTI_TRANSCEIVER_RANGE= 16; - TESLA_MULTI_COVER_RANGE= 16; - TESLA_MULTI_PLASMA_RANGE_MULTI_T1= 2; - TESLA_MULTI_PLASMA_RANGE_MULTI_T2= 4; - TESLA_MULTI_HELIUM_PLASMA_PER_SECOND = 100; - TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND = 50; - TESLA_MULTI_RADON_PLASMA_PER_SECOND = 50; + + MOD_ADMIN_ERROR_LOGS = false; + + TESLA_MULTI_GAS_OUTPUT = false; + TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = 0.25F; TESLA_MULTI_LOSS_PER_BLOCK_T0 = 1; TESLA_MULTI_LOSS_PER_BLOCK_T1 = 1; TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1; - TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = 0.25F; - TESLA_MULTI_GAS_OUTPUT = false; - TESLA_SINGLE_RANGE = 20; + TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = 100; + TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = 50; + TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = 50; + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = 2; + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = 4; + TESLA_MULTI_RANGE_COVER = 16; + TESLA_MULTI_RANGE_TOWER = 32; + TESLA_MULTI_RANGE_TRANSCEIVER = 16; + TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = 0.25F; TESLA_SINGLE_LOSS_PER_BLOCK = 1; - TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = 0.25F; + TESLA_SINGLE_RANGE = 20; } /** @@ -75,43 +80,61 @@ public class TecTechConfig extends ConfigManager { */ @Override protected void Init() { - modAdminErrorLogs = _mainConfig.getBoolean("AdminErrorLog", "Modules", modAdminErrorLogs, - "If set to true, every op/admin will receive all errors occurred during the startup phase as in game message on join"); - DEBUG_MODE = _mainConfig.getBoolean("DebugMode", "Debug", DEBUG_MODE, + DEBUG_MODE = _mainConfig.getBoolean("DebugMode", "debug", DEBUG_MODE, "Enables logging and other purely debug features"); - EASY_SCAN = _mainConfig.getBoolean("EasyScan", "Features", EASY_SCAN, - "Enables tricorder to scan EM i/o hatches directly, too CHEEKY"); - BOOM_ENABLE = _mainConfig.getBoolean("BoomEnable", "Features", BOOM_ENABLE, + DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "debug", + DISABLE_MATERIAL_LOADING_FFS, "Set to true to disable gregtech material processing"); + + BOOM_ENABLE = _mainConfig.getBoolean("BoomEnable", "features", BOOM_ENABLE, "Set to false to disable explosions on everything bad that you can do"); - NERF_FUSION = _mainConfig.getBoolean("NerfFusion", "Features", NERF_FUSION, + DISABLE_BLOCK_HARDNESS_NERF = _mainConfig.getBoolean("DisableBlockHardnessNerf", "features", + DISABLE_BLOCK_HARDNESS_NERF, "Set to true to disable the block hardness nerf"); + EASY_SCAN = _mainConfig.getBoolean("EasyScan", "features", EASY_SCAN, + "Enables tricorder to scan EM i/o hatches directly, too CHEEKY"); + NERF_FUSION = _mainConfig.getBoolean("NerfFusion", "features", NERF_FUSION, "Set to true to enable removal of plasmas heavier than Fe and other weird ones"); - ENABLE_TURRET_EXPLOSIONS = _mainConfig.getBoolean("TurretBoomEnable", "Features", ENABLE_TURRET_EXPLOSIONS, - "Set to false to disable explosions caused by EM turrets"); - TURRET_DAMAGE_FACTOR = _mainConfig.getFloat("TurretDamageFactor", "Features", TURRET_DAMAGE_FACTOR, 0, Short.MAX_VALUE, - "Damage is multiplied by this number"); - TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "Features", TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE, - "Explosion strength is multiplied by this number"); - DISABLE_BLOCK_HARDNESS_NERF = _mainConfig.getBoolean("DisableBlockHardnessNerf", "Features", DISABLE_BLOCK_HARDNESS_NERF, - "Set to true to disable the block hardness nerf"); - DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS, - "Set to true to disable gregtech material processing"); - - TESLA_MULTI_TOWER_RANGE = _mainConfig.getInt("TeslaMultiTowerRange", "Balance Tweaks", TESLA_MULTI_TOWER_RANGE, 0, Integer.MAX_VALUE, "Tesla Tower to Tower max range"); - TESLA_MULTI_TRANSCEIVER_RANGE = _mainConfig.getInt("TeslaMultiTransceiverRange", "Balance Tweaks", TESLA_MULTI_TRANSCEIVER_RANGE, 0, Integer.MAX_VALUE, "Tesla Tower to Transceiver max range"); - TESLA_MULTI_COVER_RANGE = _mainConfig.getInt("TeslaMultiCoverRange", "Balance Tweaks", TESLA_MULTI_COVER_RANGE, 0, Integer.MAX_VALUE, "Tesla Tower to Tesla Coil Rich Edition Cover max range"); - TESLA_MULTI_PLASMA_RANGE_MULTI_T1 = _mainConfig.getInt("TeslaMultiPlasmaRangeMultiT1", "Balance Tweaks", TESLA_MULTI_PLASMA_RANGE_MULTI_T1, 0, Integer.MAX_VALUE, "Tesla Tower T1 Plasmas Range Multiplier"); - TESLA_MULTI_PLASMA_RANGE_MULTI_T2 = _mainConfig.getInt("TeslaMultiPlasmaRangeMultiT2", "Balance Tweaks", TESLA_MULTI_PLASMA_RANGE_MULTI_T2, 0, Integer.MAX_VALUE, "Tesla Tower T2 Plasmas Range Multiplier"); - TESLA_MULTI_HELIUM_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiHeliumPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_HELIUM_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower helium plasma consumed each second the tesla tower is active"); - TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiNitrogenPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower nitrogen plasma consumed each second the tesla tower is active"); - TESLA_MULTI_RADON_PLASMA_PER_SECOND = _mainConfig.getInt("TeslaMultiRadonPlasmaPerSecond", "Balance Tweaks", TESLA_MULTI_RADON_PLASMA_PER_SECOND, 0, Integer.MAX_VALUE, "Tesla Tower radon plasma consumed each second the tesla tower is active"); - TESLA_MULTI_LOSS_PER_BLOCK_T0 = _mainConfig.getInt("TeslaMultiLossPerBlockT0", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T0, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using no plasmas"); - TESLA_MULTI_LOSS_PER_BLOCK_T1 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T1, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using helium or nitrogen plasma"); - TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "Balance Tweaks", TESLA_MULTI_LOSS_PER_BLOCK_T2, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using radon plasma"); - TESLA_MULTI_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaMultiOverdriveLossFactor", "Balance Tweaks", TESLA_MULTI_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Tower power loss per amp as a factor of the tier voltage"); - TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean("TeslaMultiMoltenOutput", "Balance Tweaks", TESLA_MULTI_GAS_OUTPUT, "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio"); - TESLA_SINGLE_RANGE = _mainConfig.getInt("TeslaSingleRange", "Balance Tweaks", TESLA_SINGLE_RANGE, 0, Integer.MAX_VALUE, "Tesla Transceiver to max range"); - TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt("TeslaSingleLossPerBlock", "Balance Tweaks", TESLA_SINGLE_LOSS_PER_BLOCK, 0, Integer.MAX_VALUE, "Tesla Transceiver power transmission loss per block per amp"); - TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR = _mainConfig.getFloat("TeslaSingleOverdriveLossFactor", "Balance Tweaks", TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR, 0, 1, "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage"); + ENABLE_TURRET_EXPLOSIONS = _mainConfig.getBoolean("TurretBoomEnable", "features", + ENABLE_TURRET_EXPLOSIONS, "Set to false to disable explosions caused by EM turrets"); + TURRET_DAMAGE_FACTOR = _mainConfig.getFloat("TurretDamageFactor", "features", TURRET_DAMAGE_FACTOR, + 0, Short.MAX_VALUE, "Damage is multiplied by this number"); + TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "features", + TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE, "Explosion strength is multiplied by this number"); + + MOD_ADMIN_ERROR_LOGS = _mainConfig.getBoolean("AdminErrorLog", "modules", MOD_ADMIN_ERROR_LOGS, + "If set to true, every op/admin will receive all errors occurred during the startup phase as in game message on join"); + + TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean("TeslaMultiGasOutput", "tesla_tweaks", + TESLA_MULTI_GAS_OUTPUT, "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio"); + TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat("TeslaMultiLossFactorOverdrive", "tesla_tweaks", + TESLA_MULTI_LOSS_FACTOR_OVERDRIVE, 0, 1, "Additional Tesla Tower power loss per amp as a factor of the tier voltage"); + TESLA_MULTI_LOSS_PER_BLOCK_T0 = _mainConfig.getInt("TeslaMultiLossPerBlockT0", "tesla_tweaks", + TESLA_MULTI_LOSS_PER_BLOCK_T0, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using no plasmas"); + TESLA_MULTI_LOSS_PER_BLOCK_T1 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "tesla_tweaks", + TESLA_MULTI_LOSS_PER_BLOCK_T1, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using helium or nitrogen plasma"); + TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt("TeslaMultiLossPerBlockT2", "tesla_tweaks", + TESLA_MULTI_LOSS_PER_BLOCK_T2, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using radon plasma"); + TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT1Helium", + "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM, 0, Integer.MAX_VALUE, "Tesla Tower helium plasma consumed each second the tesla tower is active"); + TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT1Nitrogen", + "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN, 0, Integer.MAX_VALUE, "Tesla Tower nitrogen plasma consumed each second the tesla tower is active"); + TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT2Radon", + "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON, 0, Integer.MAX_VALUE, "Tesla Tower radon plasma consumed each second the tesla tower is active"); + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = _mainConfig.getInt("TeslaMultiRangeCoefficientPlasmaT1", + "tesla_tweaks", TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1, 0, Integer.MAX_VALUE, "Tesla Tower T1 Plasmas Range Multiplier"); + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = _mainConfig.getInt("TeslaMultiRangeCoefficientPlasmaT2", + "tesla_tweaks", TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2, 0, Integer.MAX_VALUE, "Tesla Tower T2 Plasmas Range Multiplier"); + TESLA_MULTI_RANGE_COVER = _mainConfig.getInt("TeslaMultiRangeCover", "tesla_tweaks", + TESLA_MULTI_RANGE_COVER, 0, Integer.MAX_VALUE, "Tesla Tower to Tesla Coil Rich Edition Cover max range"); + TESLA_MULTI_RANGE_TOWER = _mainConfig.getInt("TeslaMultiRangeTower", "tesla_tweaks", + TESLA_MULTI_RANGE_TOWER, 0, Integer.MAX_VALUE, "Tesla Tower to Tower max range"); + TESLA_MULTI_RANGE_TRANSCEIVER = _mainConfig.getInt("TeslaMultiRangeTransceiver", "tesla_tweaks", + TESLA_MULTI_RANGE_TRANSCEIVER, 0, Integer.MAX_VALUE, "Tesla Tower to Transceiver max range"); + TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat("TeslaSingleLossFactorOverdrive", "tesla_tweaks", + TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE, 0, 1, "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage"); + TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt("TeslaSingleLossPerBlock", "tesla_tweaks", + TESLA_SINGLE_LOSS_PER_BLOCK, 0, Integer.MAX_VALUE, "Tesla Transceiver power transmission loss per block per amp"); + TESLA_SINGLE_RANGE = _mainConfig.getInt("TeslaSingleRange", "tesla_tweaks", + TESLA_SINGLE_RANGE, 0, Integer.MAX_VALUE, "Tesla Transceiver to max range"); } /** @@ -119,6 +142,5 @@ public class TecTechConfig extends ConfigManager { */ @Override protected void PostInit() { - } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 8ab6be3a50..e63a92d107 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -53,18 +53,18 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables - private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_TOWER_RANGE;//Default is 32 - private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_TRANSCEIVER_RANGE;//Default is 16 - private static final int transferRadiusCoverUltimateFromConfig = TecTech.configTecTech.TESLA_MULTI_COVER_RANGE;//Default is 16 - private static final int plasmaRangeMultiT1 = TecTech.configTecTech.TESLA_MULTI_PLASMA_RANGE_MULTI_T1;//Default is 2 - private static final int plasmaRangeMultiT2 = TecTech.configTecTech.TESLA_MULTI_PLASMA_RANGE_MULTI_T2;//Default is 4 - private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_HELIUM_PLASMA_PER_SECOND;//Default is 100 - private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_NITROGEN_PLASMA_PER_SECOND;//Default is 50 - private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_RADON_PLASMA_PER_SECOND;//Default is 50 + private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32 + private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TRANSCEIVER;//Default is 16 + private static final int transferRadiusCoverUltimateFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_COVER;//Default is 16 + private static final int plasmaRangeMultiT1 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1;//Default is 2 + private static final int plasmaRangeMultiT2 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2;//Default is 4 + private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM;//Default is 100 + private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN;//Default is 50 + private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON;//Default is 50 //Default is {1, 1, 1} private static final int[] plasmaTierLoss = new int[]{TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T0, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T1, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T2}; - private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F; + private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F; private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false //Face icons 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 fcf85e26c3..8d3696d9ad 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 @@ -38,7 +38,7 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer { private final static int transferRadiusMax = TecTech.configTecTech.TESLA_SINGLE_RANGE;//Default is 20 private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 - private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS_FACTOR;//Default is 0.25F + private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F private Map teslaNodeMap = new HashMap<>();//Tesla Map to map them tesla bois! private final static HashSet sparkList = new HashSet<>(); -- cgit From 5cc23f76bbb12b13f5456793796aa8f5a8db08b2 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 19 Jul 2020 18:50:01 +0200 Subject: Adjust some logic IDK --- .../elementalMatter/core/cElementalDecay.java | 6 +- .../core/cElementalInstanceStackMap.java | 7 +++ .../core/stacks/cElementalInstanceStack.java | 28 ++++++--- .../core/templates/cElementalPrimitive.java | 6 +- .../core/transformations/bTransformationInfo.java | 4 +- .../definitions/complex/dAtomDefinition.java | 13 ++--- .../definitions/complex/dHadronDefinition.java | 22 +++---- .../definitions/complex/iaeaNuclide.java | 12 +++- .../definitions/primitive/eBosonDefinition.java | 12 ++-- .../definitions/primitive/eLeptonDefinition.java | 36 ++++++------ .../definitions/primitive/eNeutrinoDefinition.java | 10 ++-- .../definitions/primitive/eQuarkDefinition.java | 67 +++++++++++----------- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 2 - .../multi/GT_MetaTileEntity_EM_decay.java | 8 +-- .../github/technus/tectech/util/DoubleCount.java | 9 ++- 15 files changed, 139 insertions(+), 103 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java index e00bf2d264..e67f773a86 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java @@ -20,7 +20,7 @@ public final class cElementalDecay { public final double probability; public cElementalDecay(iElementalDefinition... outSafe) { - this(2D, outSafe); + this(1D, outSafe); } public cElementalDecay(double probability, iElementalDefinition... outSafe) { @@ -33,7 +33,7 @@ public final class cElementalDecay { } public cElementalDecay(cElementalDefinitionStack... outSafe) { - this(2D, outSafe); + this(1D, outSafe); } public cElementalDecay(double probability, cElementalDefinitionStack... out) { @@ -42,7 +42,7 @@ public final class cElementalDecay { } public cElementalDecay(cElementalDefinitionStackMap tree) { - this(2D, tree); + this(1D, tree); } public cElementalDecay(double probability, cElementalDefinitionStackMap tree) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index 96fd686ef8..e1fdc6a553 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -99,6 +99,11 @@ public final class cElementalInstanceStackMap implements Comparable> getEntrySet() { + return map.entrySet(); + } + + //Removers public void clear() { map.clear(); @@ -336,6 +341,7 @@ public final class cElementalInstanceStackMap implements Comparable fluidQuantization=new HashMap<>(32); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index b990adef15..965c46cef6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -2,8 +2,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex 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.XSTR; import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; @@ -19,19 +17,21 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.Loader; import gregtech.api.enums.Materials; import net.minecraft.nbt.NBTTagCompound; import java.util.*; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.OrePrefixes.dust; /** @@ -178,7 +178,7 @@ public final class dAtomDefinition extends cElementalDefinition { } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - rawLifeTime = Math.min(rawLifeTimeTemp, iElementalDefinition.STABLE_RAW_LIFE_TIME); + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); }else { rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : iaea.halfTime; } @@ -193,7 +193,7 @@ public final class dAtomDefinition extends cElementalDefinition { } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - rawLifeTime = Math.min(rawLifeTimeTemp, iElementalDefinition.STABLE_RAW_LIFE_TIME); + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); iaeaDefinitionExistsAndHasEnergyLevels =false; } @@ -208,7 +208,6 @@ public final class dAtomDefinition extends cElementalDefinition { decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); } //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - hash=super.hashCode(); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 6b9e56bbf1..c5efaf1403 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -154,7 +154,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi name.append(' ').append(sym); }else { for (cElementalDefinitionStack quark : quarkStacks.values()) { - name.append(' ').append(quark.definition.getSymbol()).append(quark.amount); + name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount); } } return name.toString(); @@ -278,7 +278,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public cElementalDecay[] getDecayArray() { cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); - if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { + if (amount == 2 && quarkStacks.length == 2 && + quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && + quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } else if (amount != 3) { return new cElementalDecay[]{new cElementalDecay(0.95D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks @@ -293,24 +295,22 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //remove last eQuarkDefinition lastQuark = newBaryon.remove(2); + cElementalDefinitionStack[] decay; if (Math.abs(lastQuark.getType()) > 1) { - cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[1].outputStacks.values(); - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; + decay = lastQuark.getDecayArray()[1].outputStacks.values(); } else { - cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[0].outputStacks.values(); - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; + decay = lastQuark.getDecayArray()[2].outputStacks.values(); } + newBaryon.add((eQuarkDefinition) decay[0].definition); + Particles[0] = decay[1].definition; + Particles[1] = decay[2].definition; eQuarkDefinition[] contentOfBaryon = newBaryon.toArray(new eQuarkDefinition[3]); try { return new cElementalDecay[]{ - new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), new cElementalDecay(0.001D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), + new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), eBosonDefinition.deadEnd}; } catch (tElementalException e) { if (DEBUG_MODE) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java index 410e53810e..8b09bfd2e0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java @@ -52,7 +52,7 @@ public final class iaeaNuclide { while((line=reader.readLine())!=null) { String[] split= splitButDifferent(line,","); if(split.length!=47) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuvlidesTable database " + line); + throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclidesTable database " + line); } get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); } @@ -140,6 +140,14 @@ public final class iaeaNuclide { energeticStatesArray = empty; } else { energeticStatesArray = energeticStates.values().toArray(new energeticState[0]); + double life=halfTime; + for (energeticState energeticState : energeticStatesArray) { + if(Double.isNaN(energeticState.Thalf)){ + energeticState.Thalf=life; + }else { + life=energeticState.Thalf; + } + } } } @@ -162,7 +170,7 @@ public final class iaeaNuclide { public static final class energeticState{ public final double energy; - public final double Thalf; + public double Thalf; public final iaeaDecay[] decaymodes; private energeticState(iaeaNuclide nuclide,double Thalf,iaeaDecay[] decaymodes){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java index f1f740f665..9a82cdd6c0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java @@ -4,6 +4,10 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -21,11 +25,11 @@ public final class eBosonDefinition extends cElementalPrimitive { } public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, cElementalDecay.noDecay); - boson_H__.init(null, 1.56e-22D, 0, 0, + boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); + boson_H__.init(null, 1.56e-22D, 2, 2, + new cElementalDecay(0.01D, quark_b, quark_b_), + new cElementalDecay(0.02D, lepton_t, lepton_t_), new cElementalDecay(0.96D, new cElementalDefinitionStack(boson_Y__, 4)), - new cElementalDecay(0.02D, eLeptonDefinition.lepton_t, eLeptonDefinition.lepton_t_), - new cElementalDecay(0.01D, eQuarkDefinition.quark_b, eQuarkDefinition.quark_b_), deadEnd); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java index dd57d6875e..1e3b7189a8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java @@ -4,6 +4,10 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -29,28 +33,28 @@ public final class eLeptonDefinition extends cElementalPrimitive { public static void run() { lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, - eBosonDefinition.deadEnd,//makes photons and don't care - new cElementalDecay(lepton_e, eBosonDefinition.boson_Y__)); + deadEnd, + new cElementalDecay(lepton_e,boson_Y__)); lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, - new cElementalDecay(0.9D, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), + deadEnd);//makes photons and don't care lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, - new cElementalDecay(0.8D, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_Y__), - new cElementalDecay(0.1D, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(0.05F, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_H__), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), + new cElementalDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), + new cElementalDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), + deadEnd);//makes photons and don't care lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, - eBosonDefinition.deadEnd,//makes photons and don't care - new cElementalDecay(lepton_e_, eBosonDefinition.boson_Y__)); + deadEnd, + new cElementalDecay(lepton_e,boson_Y__)); lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, - new cElementalDecay(0.9F, lepton_e_, eNeutrinoDefinition.lepton_Ve, eNeutrinoDefinition.lepton_Vm_), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), + deadEnd);//makes photons and don't care lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, - new cElementalDecay(0.8F, lepton_m_, eNeutrinoDefinition.lepton_Vm, eNeutrinoDefinition.lepton_Vt_, eBosonDefinition.boson_Y__), - new cElementalDecay(0.1F, lepton_e_, eNeutrinoDefinition.lepton_Ve, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(0.05F, lepton_m_, eNeutrinoDefinition.lepton_Vm, eNeutrinoDefinition.lepton_Vt_, eBosonDefinition.boson_H__), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), + new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), + new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), + deadEnd);//makes photons and don't care } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java index ba084af9a2..c55e7f6364 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java @@ -4,6 +4,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -30,19 +32,19 @@ public final class eNeutrinoDefinition extends cElementalPrimitive { cElementalDecay.noProduct); lepton_Vm.init(lepton_Vm_, 1D, 1, 0, new cElementalDecay(0.825D, nothing), - eBosonDefinition.deadEndHalf); + deadEndHalf); lepton_Vt.init(lepton_Vt_, 1, 1, 0, new cElementalDecay(0.75F, nothing), - eBosonDefinition.deadEnd); + deadEnd); lepton_Ve_.init(lepton_Ve, 1, -1, -1, cElementalDecay.noProduct); lepton_Vm_.init(lepton_Vm, 1, 1, 0, new cElementalDecay(0.825F, nothing), - eBosonDefinition.deadEndHalf); + deadEndHalf); lepton_Vt_.init(lepton_Vt, 1, 1, 0, new cElementalDecay(0.75F, nothing), - eBosonDefinition.deadEnd); + deadEnd); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java index 027b604dc5..9e5b2e66bb 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java @@ -3,6 +3,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -27,67 +30,67 @@ public final class eQuarkDefinition extends cElementalPrimitive { public static void run() { quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9D, quark_d, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), new cElementalDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), + new cElementalDecay(0.9D, quark_d, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_c.init(quark_c_, 0.5e-13D, 1, -1, - new cElementalDecay(0.9D, quark_s, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.05071504D, quark_d, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), new cElementalDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), + new cElementalDecay(0.9D, quark_s, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26D, 2, -1, - new cElementalDecay(0.9D, quark_b, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.00163216D, quark_s, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(7.51689e-5D, quark_d, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), + quark_t.init(quark_t_, 2.5e-26D, 0, -1, + new cElementalDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), + new cElementalDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), + new cElementalDecay(0.9D, quark_b, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9D, quark_u, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), new cElementalDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(0.9D, quark_u, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_s.init(quark_s_, 0.6e-9D, 1, -1, - new cElementalDecay(0.9D, quark_c, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.050778116D, quark_u, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), new cElementalDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), + new cElementalDecay(0.9D, quark_c, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13D, 2, -1, - new cElementalDecay(0.9D, quark_t, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.00169744D, quark_c, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(1.23201e-5D, quark_u, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), + quark_b.init(quark_b_, 0.7e-13D, 0, -1, + new cElementalDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), + new cElementalDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), + new cElementalDecay(0.9D, quark_t, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9D, quark_d_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), new cElementalDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_c_.init(quark_c, 0.5e-13D, 1, -1, - new cElementalDecay(0.9F, quark_s_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.05071504F, quark_d_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), + new cElementalDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 2, -1, - new cElementalDecay(0.9F, quark_b_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.00163216F, quark_s_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(7.51689e-5F, quark_d_, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), + quark_t_.init(quark_t, 2.5e-26F, 0, -1, + new cElementalDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), + new cElementalDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), + new cElementalDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9F, quark_u_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), new cElementalDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), + new cElementalDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_s_.init(quark_s, 0.6e-9F, 1, -1, - new cElementalDecay(0.9F, quark_c_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.050778116F, quark_u_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), new cElementalDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), + new cElementalDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 2, -1, - new cElementalDecay(0.9F, quark_t_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.00169744F, quark_c_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(1.23201e-5F, quark_u_, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), + quark_b_.init(quark_b, 0.7e-13F, 0, -1, + new cElementalDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), + new cElementalDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), + new cElementalDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 5b09e05fe5..c8606f68f0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -111,10 +111,8 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta if (aBaseMetaTileEntity.isServerSide()) { byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { - content.cleanUp(); purgeOverflow(); content.tickContentByOneSecond(1, postEnergize);//Hatches don't life time mult things - content.cleanUp(); purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index fe96ca45ba..d534b41fec 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -132,17 +132,15 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase outputEM[0] = input; outputEM[1] = new cElementalInstanceStackMap(); - for (cElementalInstanceStack stack : outputEM[0].values()) { - if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) - && getBaseMetaTileEntity().decreaseStoredEnergyUnits( - (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { + if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && + getBaseMetaTileEntity().decreaseStoredEnergyUnits( + (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { stack.setEnergy(1); } else if (!stack.definition.decayMakesEnergy(stack.getEnergy())) { outputEM[0].remove(stack.definition); outputEM[1].putReplace(stack); } - //System.out.println(stack.definition.getSymbol()+" "+stack.amount); } eAmpereFlow = (long) ampereFlow.get(); diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java index e7ef18be08..0c5865d56e 100644 --- a/src/main/java/com/github/technus/tectech/util/DoubleCount.java +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -6,7 +6,7 @@ import static java.lang.Math.max; import static java.lang.Math.ulp; public class DoubleCount { - public static double[] distribute(double count,double... probabilities){ + public static double[] distribute(double count,double... probabilities) throws ArithmeticException{ if(probabilities==null){ return null; }else if(count==0){ @@ -20,12 +20,15 @@ public class DoubleCount { double remaining=count,previous=probabilities[size],probability,out,sum=0; for (int i = size - 1; i >= 0; i--) { probability=probabilities[i]; - remaining-=out=count*probability; - sum+=output[i]=out-ulp(out); + remaining-=out=count*(probability-ulp(probability)); + sum+=output[i]=out; if(previous=1){ + break; + } } if(remaining*count<0){ throw new ArithmeticException("Malformed probability sum: "+ Arrays.toString(probabilities)); -- cgit From 2026ac448d504c02287f12c2685d4c92bd612870 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Sat, 25 Jul 2020 20:37:55 +0200 Subject: fix(TecTech)Really Ultimated Batterie fix the recipe Really Ultimated Batterie change Neutronium wires(which not exists) to Superconductor Wires UHV --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b669165176..ab4c6003cf 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1213,7 +1213,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Wafer_UHPIC.get(64), ItemList.Circuit_Wafer_SoC2.get(32), ItemList.Circuit_Parts_DiodeASMD.get(64), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Neutronium, 64), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(3760), Materials.Naquadria.getMolten(9216), -- cgit From 8e81f24ce5f168e7f4269c8c006d0b85f2472550 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Sun, 26 Jul 2020 07:51:35 +0200 Subject: feat(Extra Utilities, TecTech)Deep Dark Portal (#36) Add new raw DD Portal Block recipe to Tec Tech TT Station update GT dependencies GTNewHorizons/GT-New-Horizons-Modpack#6260 --- build.properties | 4 ++-- .../dreamcraft/DreamCraftRecipeLoader.java | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/build.properties b/build.properties index 0f85658bd6..be76171615 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=620 -gregtech.version=5.09.33.50 +gregtech.jenkinsbuild=648 +gregtech.version=5.09.33.52 cofhcore.version=[1.7.10]3.1.4-329-dev yamcore.version=0.5.79 baubles.version=1.0.1.10 diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index ab4c6003cf..8047efe5a3 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1181,6 +1181,26 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Concrete.getMolten(73728L) }, getItemContainer("StargateFramePart").get(1L), 72000, 2000000); + //Deep Dark Portal + TT_recipeAdder.addResearchableAssemblylineRecipe(GT_ModHandler.getModItem("dreamcraft", "item.HeavyDutyPlateTier8", 1, 0), + 16777216, 2048, 2000000, 64, new Object[]{ + GT_ModHandler.getModItem("ExtraUtilities", "cobblestone_compressed", 1, 7), + GT_ModHandler.getModItem("IC2", "blockMachine2", 1, 0), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 4L), + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + GT_ModHandler.getModItem("dreamcraft", "item.PicoWafer", 32, 0), + ItemList.Robot_Arm_UEV.get(4), + ItemList.Emitter_UEV.get(4), + ItemList.Sensor_UEV.get(4), + }, new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("oganesson"), 50000), + Materials.Infinity.getMolten(9216L), + Materials.Cheese.getMolten(232000L), + }, ItemList.Block_BedrockiumCompressed.get(1), 10000, 5000000); + //Batteries TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ -- cgit From 18ec8a9bc25aed92dda52334c4fff5b39f1dc010 Mon Sep 17 00:00:00 2001 From: basdxz Date: Tue, 4 Aug 2020 22:32:50 +0100 Subject: Repackage Tesla code into interfaces and util class Currently bugged, Tesla Towers always drain power from Energy Injectors --- .../tectech/mechanics/spark/ThaumSpark.java | 29 +- .../tectech/mechanics/tesla/ITeslaConnectable.java | 127 ++++++++ .../mechanics/tesla/ITeslaConnectableSimple.java | 22 ++ .../tectech/thing/cover/GT_Cover_TM_TeslaCoil.java | 65 +++- .../cover/GT_Cover_TM_TeslaCoil_Ultimate.java | 10 + .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 357 +++++++-------------- .../single/GT_MetaTileEntity_TeslaCoil.java | 171 +++++----- 7 files changed, 450 insertions(+), 331 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java index 604624828c..e31e63f250 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java @@ -1,5 +1,7 @@ package com.github.technus.tectech.mechanics.spark; +import com.github.technus.tectech.util.Vec3Impl; + import java.io.Serializable; import java.util.Objects; @@ -9,22 +11,10 @@ public class ThaumSpark implements Serializable { public int x, y, z, wID; public byte xR, yR, zR; - public ThaumSpark(){ - this.x = 0; - this.z = 0; - this.y = 0; - - this.xR = 0; - this.yR = 0; - this.zR = 0; - - this.wID = 0; - } - public ThaumSpark(int x, int y, int z, byte xR, byte yR, byte zR, int wID) { this.x = x; - this.z = z; this.y = y; + this.z = z; this.xR = xR; this.yR = yR; @@ -33,6 +23,19 @@ public class ThaumSpark implements Serializable { this.wID = wID; } + public ThaumSpark(Vec3Impl origin, Vec3Impl target, int wID) { + this.x = origin.get0(); + this.y = origin.get1(); + this.z = origin.get2(); + + Vec3Impl offset = target.sub(origin); + this.xR = (byte) offset.get0(); + this.yR = (byte) offset.get1(); + this.zR = (byte) offset.get2(); + + this.wID = wID; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java new file mode 100644 index 0000000000..07ecc4bc31 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -0,0 +1,127 @@ +package com.github.technus.tectech.mechanics.tesla; + +import com.github.technus.tectech.mechanics.spark.ThaumSpark; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import static com.github.technus.tectech.util.Util.entriesSortedByValues; +import static java.lang.Math.sqrt; + +public interface ITeslaConnectable extends ITeslaConnectableSimple { + //Map with all Teslas in the same dimension and the distance to them //TODO Range + Map teslaNodeMap = new HashMap<>(); + //ThaumCraft lighting coordinate pairs, so we can send them in bursts and save on lag + HashSet sparkList = new HashSet<>(); + + //-128 to -1 disables capability + //0 means any source or target + //1 to 127 must match on source and target or source/target must be 0 + byte getTeslaTransmissionCapability(); + + //Transmission Range is typically 16+ in blocks + int getTeslaTransmissionRange(); + boolean isOverdriveEnabled(); + + int getTeslaEnergyLossPerBlock(); + float getTeslaOverdriveLossCoefficient(); + + long getTeslaOutputVoltage(); + long getTeslaOutputCurrent(); + + boolean teslaDrainEnergy(long teslaVoltageDrained); + + class TeslaUtil { + public static final HashSet teslaNodeSet = new HashSet<>();//Targets for power transmission + + public static void generateTeslaNodeMap(ITeslaConnectable origin) { + origin.teslaNodeMap.clear(); + for (ITeslaConnectableSimple target : teslaNodeSet) { + //Sanity checks + if (target == null) { + //The Tesla Covers do not remove themselves from the list and this is the code that does + teslaNodeSet.remove(null); + continue; + } else if (origin.equals(target) || !origin.getTeslaDimension().equals(target.getTeslaDimension())) { + //Skip if looking at myself and skip if not in the same dimension + //TODO, INTERDIM? + continue; + } else if (origin.getTeslaTransmissionCapability() != 0 && origin.getTeslaReceptionCapability() != 0 && + origin.getTeslaTransmissionCapability() != origin.getTeslaReceptionCapability()) { + //Skip if incompatible + continue; + } + + //Range calc + int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition())); + if (distance > origin.getTeslaTransmissionRange() * target.getTeslaReceptionCoefficient()) { + //Skip if the range is too vast + continue; + } + origin.teslaNodeMap.put(target, distance); + } + } + + public static void cleanTeslaNodeMap(ITeslaConnectable origin) { + //TODO Do we still need this? + for (ITeslaConnectableSimple target : origin.teslaNodeMap.keySet()) { + if (target == null) { + origin.teslaNodeMap.remove(null); + } + } + } + + public static long powerTeslaNodeMap(ITeslaConnectable origin) { + //Teslas can only send OR receive + if (origin.isTeslaReadyToReceive()) { + return 0L;//TODO Negative values to indicate charging? + } + long remainingAmperes = origin.getTeslaOutputCurrent(); + while (remainingAmperes > 0) { + long startingAmperes = remainingAmperes; + for (Map.Entry Rx : entriesSortedByValues(teslaNodeMap)) { + if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * 2 : origin.getTeslaOutputVoltage())) { + //Return and end the tick if we're out of energy to send + return origin.getTeslaOutputCurrent() - remainingAmperes; + } + + ITeslaConnectableSimple target = Rx.getKey(); + int distance = Rx.getValue(); + + //Calculate the voltage output + long outputVoltageInjectable; + long outputVoltageConsumption; + + if (origin.isOverdriveEnabled()) { + outputVoltageInjectable = origin.getTeslaOutputVoltage(); + outputVoltageConsumption = origin.getTeslaOutputVoltage() + (distance * origin.getTeslaEnergyLossPerBlock()) + + (long) Math.round(origin.getTeslaOutputVoltage() * origin.getTeslaOverdriveLossCoefficient()); + } else { + outputVoltageInjectable = origin.getTeslaOutputVoltage() - (distance * origin.getTeslaEnergyLossPerBlock()); + outputVoltageConsumption = origin.getTeslaOutputVoltage(); + } + + //Skip the target if the cost is too high + if (origin.getTeslaStoredEnergy() < outputVoltageConsumption) { + continue; + } + + if (target.teslaInjectEnergy(outputVoltageInjectable)) { + origin.teslaDrainEnergy(outputVoltageConsumption); + sparkList.add(new ThaumSpark(origin.getTeslaPosition(), target.getTeslaPosition(), origin.getTeslaDimension())); + remainingAmperes--; + } + if (remainingAmperes == 0) { + return origin.getTeslaOutputCurrent(); + } + } + //End the tick after one iteration with no transmissions + if (remainingAmperes == startingAmperes) { + return origin.getTeslaOutputCurrent() - remainingAmperes; + } + } + return origin.getTeslaOutputCurrent() - remainingAmperes; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java new file mode 100644 index 0000000000..3b56b6968c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java @@ -0,0 +1,22 @@ +package com.github.technus.tectech.mechanics.tesla; + +import com.github.technus.tectech.util.Vec3Impl; + +public interface ITeslaConnectableSimple { + //-128 to -1 disables capability + //0 means any source or target + //1 to 127 must match on source and target or source/target must be 0 + byte getTeslaReceptionCapability(); + + //Reception Coefficient is a range extension, typical is 1 + float getTeslaReceptionCoefficient(); + + boolean isTeslaReadyToReceive(); + + long getTeslaStoredEnergy(); + + boolean teslaInjectEnergy(long teslaVoltageInjected); + + Vec3Impl getTeslaPosition(); + Integer getTeslaDimension(); +} diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java index 6442ba51b6..2efe2f3cbc 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java @@ -1,40 +1,95 @@ package com.github.technus.tectech.thing.cover; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; +import com.github.technus.tectech.util.Vec3Impl; import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil.teslaNodeSet; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; import static ic2.api.info.Info.DMG_ELECTRIC; -public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior { +public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior implements ITeslaConnectableSimple { + private IGregTechTileEntity IGT; + public GT_Cover_TM_TeslaCoil() { } + @Override public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { - if (aTileEntity.getEUCapacity() > 0) { - teslaNodeSet.add(aTileEntity.getIGregTechTileEntityOffset(0, 0, 0)); + //Only do stuff if we're on top and have power + if (aSide == 1 || aTileEntity.getEUCapacity() > 0) { + //Pull IGT onto the outside, should only execute first tick + if (IGT == null) { + IGT = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + } + //Makes sure we're on the list + teslaNodeSet.add(this); } + return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); } + @Override public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return "Do not attempt to use screwdriver!"; + return "Do not attempt to use screwdriver!";//TODO Translation support } + @Override public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } + @Override public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + //Shock a non-hazmat player if they dare stuff a screwdriver into one of these if (aTileEntity.getStoredEU() > 0 && !GT_Utility.isWearingFullElectroHazmat(aPlayer)) { aPlayer.attackEntityFrom(DMG_ELECTRIC, 20); } return aCoverVariable; } + @Override public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + //It updates once every 200 ticks, so once every 10 seconds return 200; } + + @Override + public byte getTeslaReceptionCapability() { + return 2; + } + + @Override + public float getTeslaReceptionCoefficient() { + return 1; + } + + @Override + public boolean isTeslaReadyToReceive() { + return true; + } + + @Override + public long getTeslaStoredEnergy() { + return IGT.getStoredEU(); + } + + @Override + public Vec3Impl getTeslaPosition() { + return new Vec3Impl(IGT); + } + + @Override + public Integer getTeslaDimension() { + return IGT.getWorld().provider.dimensionId; + } + + @Override + public boolean teslaInjectEnergy(long teslaVoltageInjected) { + //Same as in the microwave transmitters, this does not account for amp limits + return IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java index 2b5db1f5c9..028ac3a4d6 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java @@ -7,23 +7,33 @@ public class GT_Cover_TM_TeslaCoil_Ultimate extends GT_Cover_TM_TeslaCoil { public GT_Cover_TM_TeslaCoil_Ultimate() { } + @Override public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } + @Override public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } + @Override public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } + @Override public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } + @Override public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } + + @Override + public byte getTeslaReceptionCapability() { + return 1; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index e63a92d107..729b73044e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -7,8 +7,7 @@ import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.spark.ThaumSpark; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; -import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; @@ -18,7 +17,6 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TeslaCoil; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; @@ -37,21 +35,18 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; import static com.github.technus.tectech.mechanics.structure.Structure.adders; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.entriesSortedByValues; import static gregtech.api.enums.GT_Values.E; import static java.lang.Math.*; import static net.minecraft.util.StatCollector.translateToLocal; -public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { +public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { //region variables private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32 private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TRANSCEIVER;//Default is 16 @@ -76,9 +71,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs, so the tesla takes a second to 'cool' any plasma it would output as a gas - public static final HashSet teslaNodeSet = new HashSet<>(); //Targets for power transmission - private final HashSet sparkList = new HashSet<>(); //Thaumcraft lighting coordinate pairs, so we can send them in bursts and save on lag - private Map teslaNodeMap = new HashMap<>(); //Targets for power transmission private final ArrayList eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps private int sortTime = 0; //Scan timer used for tesla search intervals @@ -88,6 +80,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private int vTier = -1; //Tesla voltage tier limited by capacitors private long outputCurrentMax = 0; //Tesla current output limited by capacitors + //outputVoltage and current after settings + private long outputVoltage; + private long outputCurrent; + //Prevents unnecessary offset calculation, saving on lag private byte oldRotation = -1; private byte oldOrientation = -1; @@ -185,7 +181,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value > transferRadiusTransceiverFromConfig) return STATUS_HIGH; if (value < transferRadiusTransceiverFromConfig) return STATUS_LOW; return STATUS_OK; - }; private static final IStatusFunction TRANSFER_RADIUS_COVER_ULTIMATE_STATUS = (base, p) -> { + }; + private static final IStatusFunction TRANSFER_RADIUS_COVER_ULTIMATE_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -262,24 +259,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock super(aName); } - private int getPerBlockLoss(){ - return plasmaTierLoss[plasmaTier]; - } - - private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) { - long outputVoltageInjectable; - long outputVoltageConsumption; - - if (overDriveToggle) { - outputVoltageInjectable = outputVoltage; - outputVoltageConsumption = outputVoltage + (distance * getPerBlockLoss()) + (long) Math.round(overDriveLoss * outputVoltage); - } else { - outputVoltageInjectable = outputVoltage - (distance * getPerBlockLoss()); - outputVoltageConsumption = outputVoltage; - } - return new long[]{outputVoltageInjectable, outputVoltageConsumption}; - } - private float getRangeMulti(int mTier, int vTier) { //By Default: //Helium and Nitrogen Plasmas will double the range @@ -303,16 +282,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return 1F * plasmaBoost; } - private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { - byte xR = (byte) (node.getXCoord() - posTop.get0()); - byte yR = (byte) (node.getYCoord() - posTop.get1()); - byte zR = (byte) (node.getZCoord() - posTop.get2()); - - int wID = mte.getWorld().provider.dimensionId; - - sparkList.add(new ThaumSpark(posTop.get0(), posTop.get1(), posTop.get2(), xR, yR, zR, wID)); - } - private void checkPlasmaBoost() { //If there's fluid in the queue, try to output it //That way it takes at least a second to 'process' the plasma @@ -367,7 +336,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock Vec3Impl xyzOffsets; xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); - if (mTier == 9){mTier = 6;}//Hacky remap because the ZPM coils were added later + if (mTier == 9) { + mTier = 6; + }//Hacky remap because the ZPM coils were added later if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { @@ -480,11 +451,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { super.onRemoval(); - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - if (aBaseMetaTileEntity.isClientSide()) { + if (this.getBaseMetaTileEntity().isClientSide()) { return; } - teslaNodeSet.remove(aBaseMetaTileEntity); + teslaNodeSet.remove(this); for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(false); @@ -558,7 +528,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); energyCapacity = aNBT.getLong("eEnergyCapacity"); - teslaNodeSet.add(this.getBaseMetaTileEntity()); + teslaNodeSet.add(this); } @Override @@ -578,113 +548,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { super.onFirstTick_EM(aBaseMetaTileEntity); if (!aBaseMetaTileEntity.isClientSide()) { - teslaNodeSet.add(aBaseMetaTileEntity); - } - } - - - public static Map generateTeslaNodeMap(IGregTechTileEntity orgin){ - Map generatedNodeMap = new HashMap<>(); - IMetaTileEntity originInside = orgin.getMetaTileEntity(); - int originX; - int originY; - int originZ; - if (originInside instanceof GT_MetaTileEntity_TM_teslaCoil) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) originInside; - originX = teslaTower.posTop.get0(); - originY = teslaTower.posTop.get1(); - originZ = teslaTower.posTop.get2(); - } else { - originX = orgin.getXCoord(); - originY = orgin.getYCoord(); - originZ = orgin.getZCoord(); - } - - for (IGregTechTileEntity node : teslaNodeSet) { - if (node == null) { - //Technically, the Tesla Covers do not remove themselves from the list and this is the code that does - teslaNodeSet.remove(null); - continue; - } else if (node == orgin || orgin.getWorld().provider.dimensionId != node.getWorld().provider.dimensionId) { - //Skip if looking at myself and skip if not in the same dimension - //TODO, INTERDIM? - continue; - } - - //Makes the target coordinates the center of the sphere of the tower if it has one - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - int targetX; - int targetY; - int targetZ; - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - targetX = teslaTower.posTop.get0(); - targetY = teslaTower.posTop.get1(); - targetZ = teslaTower.posTop.get2(); - } else { - targetX = node.getXCoord(); - targetY = node.getYCoord(); - targetZ = node.getZCoord(); - } - - //Find the xyz offsets and calculate the distance between us and the target - int xPosOffset = targetX - originX; - int yPosOffset = targetY - originY; - int zPosOffset = targetZ - originZ; - int distance = (int) ceil(sqrt(pow(xPosOffset, 2) + pow(yPosOffset, 2) + pow(zPosOffset, 2))); - //Thought we need abs here, we don't. An Integer to the power of two is going to be either 0 or positive. - //We also can just put stuff here without further checks, as we always check the next section - generatedNodeMap.put(node, distance); - } - return generatedNodeMap; - } - - public static void cleanTeslaNodeMap(Map nodeMap, IGregTechTileEntity orgin) { - IMetaTileEntity orginInside = orgin.getMetaTileEntity(); - //Assumes that if the orgin is not a Tesla Tower, it mus be a single block. - boolean isMulti = orginInside instanceof GT_MetaTileEntity_TM_teslaCoil; - - for (Map.Entry Rx : nodeMap.entrySet()) { - //All the checks need to pass or the target gets removed from the transmission list - IGregTechTileEntity node = Rx.getKey(); - //Null check - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - //We need this in a try catch, just as a precaution that a chunk had unloaded or a machine was removed - try { - //Is it an Active Tesla Tower with at least some energy capacity? - //Singles and Multis can send power here, so we don't check - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (teslaTower.maxEUStore() > 0) { - continue; - } - //Is it a Tesla Transceiver with at least one battery? - //Only multis can send power to singles - } else if (isMulti && nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { - GT_MetaTileEntity_TeslaCoil teslaTransceiver = (GT_MetaTileEntity_TeslaCoil) nodeInside; - if (teslaTransceiver.mBatteryCount > 0) { - continue; - } - //Is it a tile entity with a Tesla Coil Cover? - //Only single can send power to non-Rich edition covers - //Since Rich edition inherits from regular, we need the final check - } else if (!isMulti && node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil && - node.getEUCapacity() > 0 && !(node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate)) { - continue; - //Is it a tile entity with a Tesla Coil Cover Rich edition? - //Only multis can send power to Rich edition covers - } else if (isMulti && node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate && node.getEUCapacity() > 0) { - continue; - } - } catch (Exception ignored) { - } - } - nodeMap.remove(Rx.getKey()); + teslaNodeSet.add(this); } } - @Override public boolean onRunningTick(ItemStack aStack) { IGregTechTileEntity mte = getBaseMetaTileEntity(); @@ -706,13 +573,12 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (sortTime == sortTimeMinSetting.get()) { sortTime = 0; sortTimeDisplay.updateStatus(); - teslaNodeMap = generateTeslaNodeMap(mte); + generateTeslaNodeMap(this); } sortTime++; sortTimeDisplay.set(sortTime); //Power Limit Settings - long outputVoltage; if (outputVoltageSetting.get() > 0) { outputVoltage = min(outputVoltageMax, (long) outputVoltageSetting.get()); } else { @@ -720,95 +586,34 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } outputVoltageDisplay.set(outputVoltage); - long outputCurrent; if (outputCurrentSetting.get() > 0) { outputCurrent = min(outputCurrentMax, (long) outputCurrentSetting.get()); } else { outputCurrent = outputCurrentMax; } - outputCurrentDisplay.set(0); - - //Stuff to do if ePowerPass - if (ePowerPass) { - //Range calculation and display - int transferRadiusTower = (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier)); - transferRadiusTowerDisplay.set(transferRadiusTower); - int transferRadiusTransceiver = (int) (transferRadiusTransceiverSetting.get() * getRangeMulti(mTier, vTier)); - transferRadiusTransceiverDisplay.set(transferRadiusTransceiver); - int transferRadiusCoverUltimate = (int) (transferRadiusCoverUltimateSetting.get() * getRangeMulti(mTier, vTier)); - transferRadiusCoverUltimateDisplay.set(transferRadiusCoverUltimate); - - //Clean the teslaNodeMap - cleanTeslaNodeMap(teslaNodeMap, mte); - - //Power transfer - long sparks = outputCurrent; - while (sparks > 0) { - boolean overdriveToggle = overDriveSetting.get() > 0; - boolean idle = true; - for (Map.Entry Rx : entriesSortedByValues(teslaNodeMap)) { - if (getEUVar() >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) { - IGregTechTileEntity node = Rx.getKey(); - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - - long[] outputVoltageNow = getOutputVoltage(outputVoltage, Rx.getValue(), overdriveToggle); - long outputVoltageInjectable = outputVoltageNow[0]; - long outputVoltageConsumption = outputVoltageNow[1]; - - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) { - GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (!nodeTesla.ePowerPass) { - if (nodeTesla.getEUVar() + outputVoltageInjectable <= (nodeTesla.maxEUStore() / 2)) { - setEUVar(getEUVar() - outputVoltageConsumption); - node.increaseStoredEnergyUnits(outputVoltageConsumption, true); - thaumLightning(mte, node); - sparks--; - idle = false; - } - } - } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil && Rx.getValue() <= transferRadiusTransceiver) { - GT_MetaTileEntity_TeslaCoil nodeTesla = (GT_MetaTileEntity_TeslaCoil) nodeInside; - if (!nodeTesla.powerPassToggle) { - if (node.injectEnergyUnits((byte) 6, outputVoltageInjectable, 1L) > 0L) { - setEUVar(getEUVar() - outputVoltageConsumption); - thaumLightning(mte, node); - sparks--; - idle = false; - } - } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate) && Rx.getValue() <= transferRadiusCoverUltimate) { - if (node.injectEnergyUnits((byte) 1, outputVoltageInjectable, 1L) > 0L) { - setEUVar(getEUVar() - outputVoltageConsumption); - thaumLightning(mte, node); - sparks--; - idle = false; - } - } - if (sparks == 0) { - break; - } - } else { - idle = true; - break; - } - } - if (idle) { - break; - } - } - outputCurrentDisplay.set(outputCurrent - sparks); - if (sortTime % 60 == 0 && !sparkList.isEmpty()) { - NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), - mte.getWorld().provider.dimensionId, - posTop.get0(), - posTop.get1(), - posTop.get2(), - 256); - } - sparkList.clear(); - } else { - outputCurrentDisplay.set(0); + + //Range calculation and display + int transferRadiusTower = getTeslaTransmissionRange(); + transferRadiusTowerDisplay.set(transferRadiusTower); + transferRadiusTransceiverDisplay.set(transferRadiusTower * 2); + transferRadiusCoverUltimateDisplay.set(transferRadiusTower); + + //Clean the teslaNodeMap + cleanTeslaNodeMap(this); + + //Power transfer + outputCurrentDisplay.set(powerTeslaNodeMap(this)); + + if (!sparkList.isEmpty()) { + NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), + mte.getWorld().provider.dimensionId, + posTop.get0(), + posTop.get1(), + posTop.get2(), + 256); } + sparkList.clear(); + return true; } @@ -882,4 +687,88 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public String[] getStructureDescription(ItemStack stackSize) { return description; } + + @Override + public byte getTeslaReceptionCapability() { + return 0; + } + + @Override + public float getTeslaReceptionCoefficient() { + return 0; + } + + @Override + public byte getTeslaTransmissionCapability() { + return 1; + } + + @Override + public int getTeslaTransmissionRange() { + return (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier)); + } + + @Override + public boolean isOverdriveEnabled() { + return overDriveSetting.get() > 0; + } + + @Override + public int getTeslaEnergyLossPerBlock() { + return plasmaTierLoss[plasmaTier]; + } + + @Override + public float getTeslaOverdriveLossCoefficient() { + return overDriveLoss; + } + + @Override + public long getTeslaOutputVoltage() { + return outputVoltage; + } + + @Override + public long getTeslaOutputCurrent() { + return outputCurrent; + } + + @Override + public boolean teslaDrainEnergy(long teslaVoltageDrained) { + if (getEUVar() < teslaVoltageDrained) { + return false; + } + + setEUVar(getEUVar() - teslaVoltageDrained); + return true; + } + + @Override + public boolean isTeslaReadyToReceive() { + return !this.ePowerPass; + } + + @Override + public long getTeslaStoredEnergy() { + return getEUVar(); + } + + @Override + public Vec3Impl getTeslaPosition() { + return posTop; + } + + @Override + public Integer getTeslaDimension() { + return this.getBaseMetaTileEntity().getWorld().provider.dimensionId; + } + + @Override + public boolean teslaInjectEnergy(long teslaVoltageInjected) { + if (this.getEUVar() + teslaVoltageInjected <= (this.maxEUStore() / 2)) { + this.getBaseMetaTileEntity().increaseStoredEnergyUnits(teslaVoltageInjected, true); + return true; + } + return false; + } } 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 8d3696d9ad..388a253b27 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 @@ -1,14 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.single; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; 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.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.spark.ThaumSpark; -import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; -import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.Vec3Impl; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -23,25 +23,19 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.reflect.FieldUtils; import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil.*; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.entriesSortedByValues; import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; import static java.lang.Math.round; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; -public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer { +public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer implements ITeslaConnectable { private final static int transferRadiusMax = TecTech.configTecTech.TESLA_SINGLE_RANGE;//Default is 20 private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F - private Map teslaNodeMap = new HashMap<>();//Tesla Map to map them tesla bois! - private final static HashSet sparkList = new HashSet<>(); private byte sparkCount = 0; private final static int transferRadiusMin = 4;//Minimum user configurable @@ -229,23 +223,22 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { super.onFirstTick(aBaseMetaTileEntity); if (!aBaseMetaTileEntity.isClientSide()) { - teslaNodeSet.add(aBaseMetaTileEntity); + teslaNodeSet.add(this); } } @Override public void onRemoval() { super.onRemoval(); - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - if (!aBaseMetaTileEntity.isClientSide()) { - teslaNodeSet.remove(aBaseMetaTileEntity); + if (!this.getBaseMetaTileEntity().isClientSide()) { + teslaNodeSet.remove(this); } } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - teslaNodeSet.add(this.getBaseMetaTileEntity()); + teslaNodeSet.add(this); } @Override @@ -270,72 +263,13 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB //Create the teslaNodeMap if (sortTime == sortTimeMax) { sortTime = 0; - teslaNodeMap = generateTeslaNodeMap(aBaseMetaTileEntity); + generateTeslaNodeMap(this); } sortTime++; - //Stuff to do if ePowerPass - if (powerPassToggle) { - float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac)); - long outputCurrent = mBatteryCount; - //Radius for transceiver to tower transfers - int transferRadiusTower = (int) (transferRadius * rangeFrac); - //Radius for transceiver to cover transfers - int transferRadiusCover = (int) (transferRadiusTower / 1.25); - - //Clean the teslaNodeMap - cleanTeslaNodeMap(teslaNodeMap, aBaseMetaTileEntity); - - //Power transfer - while (outputCurrent > 0) { - boolean idle = true; - for (Map.Entry Rx : entriesSortedByValues(teslaNodeMap)) { - if (getEUVar() >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) { - IGregTechTileEntity node = Rx.getKey(); - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - - long[] outputVoltageNow = getOutputVoltage(outputVoltage, Rx.getValue(), overdriveToggle); - long outputVoltageInjectable = outputVoltageNow[0]; - long outputVoltageConsumption = outputVoltageNow[1]; - - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) { - GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (!nodeTesla.ePowerPass) { - if (nodeTesla.getEUVar() + outputVoltageInjectable <= (nodeTesla.maxEUStore() / 2)) { - setEUVar(getEUVar() - outputVoltageConsumption); - node.increaseStoredEnergyUnits(outputVoltageInjectable, true); - thaumLightning(aBaseMetaTileEntity, node); - outputCurrent--; - idle = false; - } - } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && !(node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate) && Rx.getValue() <= transferRadiusCover) { - if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil){ - GT_MetaTileEntity_TeslaCoil nodeTesla = (GT_MetaTileEntity_TeslaCoil) nodeInside; - if (nodeTesla.powerPassToggle){ - continue; - } - } - if (node.injectEnergyUnits((byte) 1, outputVoltageInjectable, 1L) > 0L) { - setEUVar(getEUVar() - outputVoltageConsumption); - thaumLightning(aBaseMetaTileEntity, node); - outputCurrent--; - idle = false; - } - } - if (outputCurrent == 0) { - break; - } - } else { - idle = true; - break; - } - } - if (idle) { - break; - } - } - } + //Send Power + powerTeslaNodeMap(this); + sparkCount++; if (sparkCount == 60 && !sparkList.isEmpty()) { sparkCount = 0; @@ -364,4 +298,83 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return true; } + @Override + public byte getTeslaReceptionCapability() { + return 1; + } + + @Override + public float getTeslaReceptionCoefficient() { + return 1; + } + + @Override + public byte getTeslaTransmissionCapability() { + return 2; + } + + @Override + public int getTeslaTransmissionRange() { + return transferRadius; + } + + @Override + public boolean isOverdriveEnabled() { + return overdriveToggle; + } + + @Override + public int getTeslaEnergyLossPerBlock() { + return perBlockLoss; + } + + @Override + public float getTeslaOverdriveLossCoefficient() { + return overDriveLoss; + } + + @Override + public long getTeslaOutputVoltage() { + return outputVoltage; + } + + @Override + public long getTeslaOutputCurrent() { + return mBatteryCount; + } + + @Override + public boolean teslaDrainEnergy(long teslaVoltageDrained) { + if (getEUVar() < teslaVoltageDrained) { + return false; + } + + setEUVar(getEUVar() - teslaVoltageDrained); + return true; + } + + @Override + public boolean isTeslaReadyToReceive() { + return !this.powerPassToggle; + } + + @Override + public long getTeslaStoredEnergy() { + return getEUVar(); + } + + @Override + public Vec3Impl getTeslaPosition() { + return new Vec3Impl(this.getBaseMetaTileEntity()); + } + + @Override + public Integer getTeslaDimension() { + return this.getBaseMetaTileEntity().getWorld().provider.dimensionId; + } + + @Override + public boolean teslaInjectEnergy(long teslaVoltageInjected) { + return this.getBaseMetaTileEntity().injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; + } } -- cgit From 23e8843b01ec3ff95123e6472656c61632c1c598 Mon Sep 17 00:00:00 2001 From: basdxz Date: Wed, 5 Aug 2020 00:14:42 +0100 Subject: Fix Tesla draining energy when disabled --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 729b73044e..93f6e50c5a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -619,12 +619,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public long maxEUStore() { - return energyCapacity * 2; + //Setting the power here so that the tower looses all it's charge once disabled + //This also stops it from exploding + return getBaseMetaTileEntity().isActive() ? energyCapacity * 2 : 0; } @Override public long getEUVar() { - return getBaseMetaTileEntity().isActive() ? super.getEUVar() : 0; + //Same reason as maxEUStore, set to 1 instead of zero so it doesn't drain constantly + return getBaseMetaTileEntity().isActive() ? super.getEUVar() : 1; } private boolean addCapacitorToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { -- cgit From 47ab2b7b988c95518b862059ef0c0d8b4c71c5d7 Mon Sep 17 00:00:00 2001 From: Lex <50260829+4gname@users.noreply.github.com> Date: Tue, 25 Aug 2020 01:02:12 +0700 Subject: add check only block without meta (#37) Meta 0 will be used to build and display the hologram. For example, you can make 16 kinds of glass blocks, and check only the block, without meta. --- .../technus/tectech/mechanics/structure/StructureUtility.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index a9b88af2f3..1b89b80036 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -391,6 +391,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); + if (meta == -1) return block == worldBlock; return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @@ -411,6 +412,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); + if (meta == -1) return block == worldBlock; return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @@ -432,6 +434,10 @@ public class StructureUtility { public static IStructureElement ofBlock(Block block, int meta) { return ofBlock(block, meta, block, meta); } + + public static IStructureElement ofBlock(Block block) { + return ofBlock(block, -1, block, 0); + } //endregion -- cgit From 4dcc2865086950ac8397206d47342d3613d14ae2 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 24 Aug 2020 20:16:11 +0200 Subject: Add block with any meta structure utility --- .../mechanics/structure/StructureUtility.java | 62 +++++++++++++++++++--- 1 file changed, 55 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 1b89b80036..a02e87308d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -23,6 +23,7 @@ import java.util.function.Function; import java.util.function.Supplier; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; +import static java.lang.Integer.MIN_VALUE; public class StructureUtility { private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz=|!@#$%&()[]{};:<>/?_,.*^'`"; @@ -197,7 +198,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world, x, y, z); + return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override @@ -289,7 +290,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world, x, y, z); + return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override @@ -309,7 +310,7 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, -1) == worldBlock.getDamageValue(world, x, y, z); + return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override @@ -391,7 +392,6 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - if (meta == -1) return block == worldBlock; return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @@ -412,7 +412,6 @@ public class StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - if (meta == -1) return block == worldBlock; return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @@ -431,12 +430,61 @@ public class StructureUtility { } } + public static IStructureElement ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { + if (block == null || defaultBlock == null) { + throw new IllegalArgumentException(); + } + if(block instanceof ICustomBlockSetting){ + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return block == world.getBlock(x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } else { + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return block == world.getBlock(x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } + } + public static IStructureElement ofBlock(Block block, int meta) { return ofBlock(block, meta, block, meta); } - public static IStructureElement ofBlock(Block block) { - return ofBlock(block, -1, block, 0); + public static IStructureElement ofBlockAnyMeta(Block block) { + return ofBlockAnyMeta(block, block, 0); + } + + public static IStructureElement ofBlockAnyMeta(Block block,int defaultMeta) { + return ofBlockAnyMeta(block, block, defaultMeta); } //endregion -- cgit From 4eb402956e5bc05c4954ae9812f2d60024677129 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 24 Aug 2020 20:23:33 +0200 Subject: Add some comments --- .../tectech/mechanics/structure/StructureUtility.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index a02e87308d..2f6998f028 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -25,6 +25,11 @@ import java.util.function.Supplier; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static java.lang.Integer.MIN_VALUE; +/** + * Fluent API for structure checking! + * + * (Just import static this class to have a nice fluent syntax while defining structure definitions) + */ public class StructureUtility { private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz=|!@#$%&()[]{};:<>/?_,.*^'`"; @SuppressWarnings("rawtypes") @@ -430,6 +435,9 @@ public class StructureUtility { } } + /** + * Same as above but ignores target meta id + */ public static IStructureElement ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { if (block == null || defaultBlock == null) { throw new IllegalArgumentException(); @@ -478,11 +486,17 @@ public class StructureUtility { public static IStructureElement ofBlock(Block block, int meta) { return ofBlock(block, meta, block, meta); } - + + /** + * Same as above but ignores target meta id + */ public static IStructureElement ofBlockAnyMeta(Block block) { return ofBlockAnyMeta(block, block, 0); } + /** + * Same as above but allows to set hint particle render + */ public static IStructureElement ofBlockAnyMeta(Block block,int defaultMeta) { return ofBlockAnyMeta(block, block, defaultMeta); } -- cgit From 5d43e5230fe6e184d3f71f11da333086ee78960e Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 10 Sep 2020 19:06:43 +0200 Subject: Cleanup structure iterator code --- .../mechanics/structure/IStructureDefinition.java | 134 ++------------------- .../structure/StructureIterationType.java | 8 ++ .../mechanics/structure/StructureUtility.java | 130 ++++++++++++++++++++ 3 files changed, 145 insertions(+), 127 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index c8488d5cea..de7a98f9bc 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -1,13 +1,11 @@ package com.github.technus.tectech.mechanics.structure; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.Arrays; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.structure.StructureIterationType.*; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.iterate; public interface IStructureDefinition { /** @@ -22,146 +20,28 @@ public interface IStructureDefinition { int basePositionA, int basePositionB, int basePositionC, boolean forceCheckAllBlocks){ return iterate(object, null, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,false,forceCheckAllBlocks); + basePositionA, basePositionB, basePositionC,forceCheckAllBlocks? CHECK_FULLY:CHECK); } default boolean hints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,true,null); + basePositionA, basePositionB, basePositionC,SPAWN_HINTS); } default boolean build(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,false,null); + basePositionA, basePositionB, basePositionC,BUILD_TEMPLATE); } default boolean buildOrHints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, - boolean hintsOnly){ + boolean hints){ return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,hintsOnly,null); - } - - static boolean iterate(T object, ItemStack trigger, IStructureElement[] elements, World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){ - if(world.isRemote ^ hintsOnly){ - return false; - } - - //change base position to base offset - basePositionA=-basePositionA; - basePositionB=-basePositionB; - basePositionC=-basePositionC; - - int[] abc = new int[]{basePositionA,basePositionB,basePositionC}; - int[] xyz = new int[3]; - - if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){ - if(checkBlocksIfNotNullForceCheckAllIfTrue){ - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - return false; - } - } else { - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - return false; - } - abc[0]+=1; - } - } - } else { - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - return false; - } - } else { - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - } - abc[0]+=1; - } - } - } - }else { - if(hintsOnly) { - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); - - abc[0]+=1; - } - } - } else { - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger); - } - abc[0]+=1; - } - } - } - } - return true; + basePositionA, basePositionB, basePositionC,hints?SPAWN_HINTS:BUILD_TEMPLATE); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java new file mode 100644 index 0000000000..618c07f970 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.mechanics.structure; + +public enum StructureIterationType { + SPAWN_HINTS, //only spawn hint particles + BUILD_TEMPLATE, //only builds template + CHECK, //checks the structure skipping all unloaded chunks (for machines that were validated already) + CHECK_FULLY, //checks the structure failing on unloaded chunks (for machines that are not valid currently) +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 2f6998f028..131822fa46 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -22,6 +22,8 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.structure.StructureIterationType.SPAWN_HINTS; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static java.lang.Integer.MIN_VALUE; @@ -1376,6 +1378,134 @@ public class StructureUtility { } } + public static boolean iterate(T object, + ItemStack trigger, + IStructureElement[] elements, + World world, + ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + StructureIterationType iterationType) { + if (world.isRemote ^ (iterationType == SPAWN_HINTS)) { + return false; + } + + //change base position to base offset + basePositionA = -basePositionA; + basePositionB = -basePositionB; + basePositionC = -basePositionC; + + int[] abc = new int[]{basePositionA, basePositionB, basePositionC}; + int[] xyz = new int[3]; + + switch (iterationType) { + case SPAWN_HINTS: { + for (IStructureElement element : elements) { + if (element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + } else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); + + abc[0] += 1; + } + } + break; + } + case BUILD_TEMPLATE: { + for (IStructureElement element : elements) { + if (element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + } else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger); + } + abc[0] += 1; + } + } + break; + } + case CHECK: { + for (IStructureElement element : elements) { + if (element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + } else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if (!element.check(object, world, xyz[0], xyz[1], xyz[2])) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] failed @ " + + Arrays.toString(xyz) + " " + Arrays.toString(abc)); + } + return false; + } + } else { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] !blockExists @ " + + Arrays.toString(xyz) + " " + Arrays.toString(abc)); + } + } + abc[0] += 1; + } + break; + } + } + case CHECK_FULLY: { + for (IStructureElement element : elements) { + if (element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + } else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if (!element.check(object, world, xyz[0], xyz[1], xyz[2])) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] failed @ " + + Arrays.toString(xyz) + " " + Arrays.toString(abc)); + } + return false; + } + } else { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] !blockExists @ " + + Arrays.toString(xyz) + " " + Arrays.toString(abc)); + } + return false; + } + abc[0] += 1; + } + } + break; + } + default: return false; + } + return true; + } + /** * Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape) * WARNING! Do not use on old api... -- cgit From 62953799f55937348fa49b8de9f3dad11963bd52 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 14 Sep 2020 18:52:27 +0200 Subject: Renamge Generic parameter --- .../mechanics/structure/IStructureDefinition.java | 12 +++--- .../mechanics/structure/IStructureElement.java | 8 ++-- .../structure/IStructureElementChain.java | 22 +++++----- .../structure/IStructureElementCheckOnly.java | 6 +-- .../structure/IStructureElementDeferred.java | 2 +- .../structure/IStructureElementNoPlacement.java | 4 +- .../mechanics/structure/IStructureNavigate.java | 8 ++-- .../mechanics/structure/StructureDefinition.java | 50 +++++++++++----------- .../mechanics/structure/adders/IBlockAdder.java | 4 +- .../mechanics/structure/adders/IHatchAdder.java | 6 +-- .../mechanics/structure/adders/ITileAdder.java | 4 +- .../java/com/github/technus/tectech/util/Util.java | 1 - 12 files changed, 63 insertions(+), 64 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index de7a98f9bc..ca9712df04 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -7,15 +7,15 @@ import net.minecraft.world.World; import static com.github.technus.tectech.mechanics.structure.StructureIterationType.*; import static com.github.technus.tectech.mechanics.structure.StructureUtility.iterate; -public interface IStructureDefinition { +public interface IStructureDefinition { /** * Used internally * @param name same name as for other methods here * @return the array of elements to process */ - IStructureElement[] getStructureFor(String name); + IStructureElement[] getStructureFor(String name); - default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing, + default boolean check(MultiBlock object, String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean forceCheckAllBlocks){ @@ -23,21 +23,21 @@ public interface IStructureDefinition { basePositionA, basePositionB, basePositionC,forceCheckAllBlocks? CHECK_FULLY:CHECK); } - default boolean hints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, + default boolean hints(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, basePositionA, basePositionB, basePositionC,SPAWN_HINTS); } - default boolean build(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, + default boolean build(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, basePositionA, basePositionB, basePositionC,BUILD_TEMPLATE); } - default boolean buildOrHints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, + default boolean buildOrHints(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean hints){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index f946e71f91..436c7ce203 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -6,12 +6,12 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -public interface IStructureElement { - boolean check(T t,World world,int x,int y,int z); +public interface IStructureElement { + boolean check(MultiBlock multiBlock, World world, int x, int y, int z); - boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger); + boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger); - boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger); + boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger); default int getStepA(){ return 1; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java index f9593ee1c5..4c7059dd81 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java @@ -6,13 +6,13 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -public interface IStructureElementChain extends IStructureElement { - IStructureElement[] fallbacks(); +public interface IStructureElementChain extends IStructureElement { + IStructureElement[] fallbacks(); @Override - default boolean check(T t, World world, int x, int y, int z){ - for (IStructureElement fallback : fallbacks()) { - if (fallback.check(t, world, x, y, z)) { + default boolean check(MultiBlock multiBlock, World world, int x, int y, int z){ + for (IStructureElement fallback : fallbacks()) { + if (fallback.check(multiBlock, world, x, y, z)) { return true; } } @@ -20,9 +20,9 @@ public interface IStructureElementChain extends IStructureElement { } @Override - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - for (IStructureElement fallback : fallbacks()) { - if (fallback.spawnHint(t, world, x, y, z, trigger)) { + default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.spawnHint(multiBlock, world, x, y, z, trigger)) { return true; } } @@ -30,9 +30,9 @@ public interface IStructureElementChain extends IStructureElement { } @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - for (IStructureElement fallback : fallbacks()) { - if (fallback.placeBlock(t, world, x, y, z, trigger)) { + default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.placeBlock(multiBlock, world, x, y, z, trigger)) { return true; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java index ec15aea53b..c6492a5ed6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java @@ -3,14 +3,14 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IStructureElementCheckOnly extends IStructureElement { +public interface IStructureElementCheckOnly extends IStructureElement { @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ + default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){ return false; } @Override - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){ + default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){ return false; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java index dbb74312a8..c0e39bb2ad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java @@ -3,5 +3,5 @@ package com.github.technus.tectech.mechanics.structure; /** * Use StructureUtility to instantiate */ -public interface IStructureElementDeferred extends IStructureElement { +public interface IStructureElementDeferred extends IStructureElement { } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java index 47e6060878..12cf2141ae 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java @@ -3,9 +3,9 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IStructureElementNoPlacement extends IStructureElement { +public interface IStructureElementNoPlacement extends IStructureElement { @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ + default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){ return false; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java index d3f4134cea..8c7c837a94 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -6,19 +6,19 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -interface IStructureNavigate extends IStructureElement { +interface IStructureNavigate extends IStructureElement { @Override - default boolean check(T t, World world, int x, int y, int z){ + default boolean check(MultiBlock multiBlock, World world, int x, int y, int z){ return true; } @Override - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { return true; } @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { return true; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index 9a1e94d98a..f42cbd35d1 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -7,31 +7,31 @@ import java.util.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; -public class StructureDefinition implements IStructureDefinition { - private final Map> elements; +public class StructureDefinition implements IStructureDefinition { + private final Map> elements; private final Map shapes; - private final Map[]> structures; + private final Map[]> structures; - public static Builder builder() { + public static Builder builder() { return new Builder<>(); } private StructureDefinition( - Map> elements, + Map> elements, Map shapes, - Map[]> structures) { + Map[]> structures) { this.elements =elements; this.shapes=shapes; this.structures = structures; } - public static class Builder { + public static class Builder { private static final char A='\uA000'; private static final char B='\uB000'; private static final char C='\uC000'; private char d ='\uD000'; private final Map navigates; - private final Map> elements; + private final Map> elements; private final Map shapes; private Builder() { @@ -40,7 +40,7 @@ public class StructureDefinition implements IStructureDefinition { shapes = new HashMap<>(); } - public Map> getElements() { + public Map> getElements() { return elements; } @@ -57,7 +57,7 @@ public class StructureDefinition implements IStructureDefinition { * @return */ @Deprecated - public Builder addShapeOldApi(String name, String[][] structurePiece) { + public Builder addShapeOldApi(String name, String[][] structurePiece) { StringBuilder builder = new StringBuilder(); if (structurePiece.length > 0) { for (String[] strings : structurePiece) { @@ -142,7 +142,7 @@ public class StructureDefinition implements IStructureDefinition { * @param structurePiece generated or written struct - DO NOT STORE IT ANYWHERE, or at least set them to null afterwards * @return this builder */ - public Builder addShape(String name, String[][] structurePiece) { + public Builder addShape(String name, String[][] structurePiece) { StringBuilder builder = new StringBuilder(); if (structurePiece.length > 0) { for (String[] strings : structurePiece) { @@ -199,13 +199,13 @@ public class StructureDefinition implements IStructureDefinition { return this; } - public Builder addElement(Character name, IStructureElement structurePiece) { + public Builder addElement(Character name, IStructureElement structurePiece) { elements.putIfAbsent(name, structurePiece); return this; } - public IStructureDefinition build() { - Map[]> structures = compileStructureMap(); + public IStructureDefinition build() { + Map[]> structures = compileStructureMap(); if(DEBUG_MODE){ return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), structures); }else { @@ -214,22 +214,22 @@ public class StructureDefinition implements IStructureDefinition { } @SuppressWarnings("unchecked") - private Map[]> compileElementSetMap() { + private Map[]> compileElementSetMap() { Set missing = new HashSet<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { - IStructureElement iStructureElement = elements.get((char) c); + IStructureElement iStructureElement = elements.get((char) c); if (iStructureElement == null) { missing.add(c); } })); if (missing.isEmpty()) { - Map[]> map = new HashMap<>(); + Map[]> map = new HashMap<>(); shapes.forEach((key, value) -> { Set chars=new HashSet<>(); for (char c : value.toCharArray()) { chars.add(c); } - IStructureElement[] compiled = new IStructureElement[chars.size()]; + IStructureElement[] compiled = new IStructureElement[chars.size()]; int i=0; for (Character aChar : chars) { compiled[i++]=elements.get(aChar); @@ -244,18 +244,18 @@ public class StructureDefinition implements IStructureDefinition { } @SuppressWarnings("unchecked") - private Map[]> compileStructureMap() { + private Map[]> compileStructureMap() { Set mising = new HashSet<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { - IStructureElement iStructureElement = elements.get((char) c); + IStructureElement iStructureElement = elements.get((char) c); if (iStructureElement == null) { mising.add(c); } })); if (mising.isEmpty()) { - Map[]> map = new HashMap<>(); + Map[]> map = new HashMap<>(); shapes.forEach((key, value) -> { - IStructureElement[] compiled = new IStructureElement[value.length()]; + IStructureElement[] compiled = new IStructureElement[value.length()]; for (int i = 0; i < value.length(); i++) { compiled[i] = elements.get(value.charAt(i)); } @@ -269,7 +269,7 @@ public class StructureDefinition implements IStructureDefinition { } } - public Map> getElements(){ + public Map> getElements(){ return elements; } @@ -277,12 +277,12 @@ public class StructureDefinition implements IStructureDefinition { return shapes; } - public Map[]> getStructures() { + public Map[]> getStructures() { return structures; } @Override - public IStructureElement[] getStructureFor(String name) { + public IStructureElement[] getStructureFor(String name) { return structures.get(name); } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java index 908c4c4aca..9d223ccd52 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java @@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure.adders; import net.minecraft.block.Block; -public interface IBlockAdder { +public interface IBlockAdder { /** * Callback on block added, needs to check if block is valid (and add it) * @param block block attempted to add * @param meta meta of block attempted to add * @return is structure still valid */ - boolean apply(T t,Block block, Integer meta); + boolean apply(MultiBlock multiBlock, Block block, Integer meta); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java index a47befc2e8..e7bb5fc459 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java @@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure.adders; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -public interface IHatchAdder { +public interface IHatchAdder { /** * Callback to add hatch, needs to check if hatch is valid (and add it) * @param iGregTechTileEntity hatch - * @param aShort requested texture index, or null if not... + * @param textureIndex requested texture index, or null if not... * @return managed to add hatch (structure still valid) */ - boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort); + boolean apply(MultiBlock multiBlock, IGregTechTileEntity iGregTechTileEntity, Short textureIndex); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java index cc3c7dbb7a..72d08751b5 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java @@ -2,11 +2,11 @@ package com.github.technus.tectech.mechanics.structure.adders; import net.minecraft.tileentity.TileEntity; -public interface ITileAdder { +public interface ITileAdder { /** * Callback to add hatch, needs to check if tile is valid (and add it) * @param tileEntity tile * @return managed to add hatch (structure still valid) */ - boolean apply(T t,TileEntity tileEntity); + boolean apply(MultiBlock multiBlock, TileEntity tileEntity); } diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java index 1843770e3a..8c693620b6 100644 --- a/src/main/java/com/github/technus/tectech/util/Util.java +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -40,7 +40,6 @@ public final class Util { private Util() { } - @SuppressWarnings("ComparatorMethodParameterNotUsed") public static > SortedSet> entriesSortedByValues(Map map) { SortedSet> sortedEntries = new TreeSet<>( (e1, e2) -> { -- cgit From f297d6c576675819a801c6f3fdeb4affc1315347 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 14 Sep 2020 20:19:54 +0200 Subject: Remove boxing --- .../mechanics/structure/StructureUtility.java | 532 ++++++++++----------- .../mechanics/structure/adders/IBlockAdder.java | 2 +- .../mechanics/structure/adders/IHatchAdder.java | 2 +- 3 files changed, 268 insertions(+), 268 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 131822fa46..14930952c5 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -39,18 +39,18 @@ public class StructureUtility { @SuppressWarnings("rawtypes") private static final IStructureElement AIR = new IStructureElement() { @Override - public boolean check(Object t, World world, int x, int y, int z) { + public boolean check(Object multiBlock, World world, int x, int y, int z) { return world.getBlock(x, y, z).getMaterial() == Material.air; } @Override - public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 13); return true; } @Override - public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, Blocks.air, 0, 2); return false; } @@ -58,18 +58,18 @@ public class StructureUtility { @SuppressWarnings("rawtypes") private static final IStructureElement NOT_AIR = new IStructureElement() { @Override - public boolean check(Object t, World world, int x, int y, int z) { + public boolean check(Object multiBlock, World world, int x, int y, int z) { return world.getBlock(x, y, z).getMaterial() != Material.air; } @Override - public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 14); return true; } @Override - public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, sHintCasingsTT, 14, 2); return true; } @@ -77,18 +77,18 @@ public class StructureUtility { @SuppressWarnings("rawtypes") private static final IStructureElement ERROR = new IStructureElement() { @Override - public boolean check(Object t, World world, int x, int y, int z) { + public boolean check(Object multiBlock, World world, int x, int y, int z) { return false; } @Override - public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 15); return true; } @Override - public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { return true; } }; @@ -98,12 +98,12 @@ public class StructureUtility { } @SuppressWarnings("unchecked") - public static IStructureElement isAir() { + public static IStructureElement isAir() { return AIR; } @SuppressWarnings("unchecked") - public static IStructureElement notAir() { + public static IStructureElement notAir() { return NOT_AIR; } @@ -112,11 +112,11 @@ public class StructureUtility { * Placement is always handled by this and does nothing. * Makes little to no use it in fallback chain. * - * @param + * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureElement error() { + public static IStructureElement error() { return ERROR; } @@ -126,19 +126,19 @@ public class StructureUtility { * Check always returns: true. * * @param dots - * @param + * @param * @return */ - public static IStructureElementNoPlacement ofHint(int dots) { + public static IStructureElementNoPlacement ofHint(int dots) { int meta = dots - 1; - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, meta); return false; } @@ -149,18 +149,18 @@ public class StructureUtility { * Check always returns: true. * * @param icons - * @param + * @param * @return */ - public static IStructureElementNoPlacement ofHintDeferred(Supplier icons) { - return new IStructureElementNoPlacement() { + public static IStructureElementNoPlacement ofHintDeferred(Supplier icons) { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, icons.get()); return false; } @@ -172,18 +172,18 @@ public class StructureUtility { * * @param icons * @param RGBa - * @param + * @param * @return */ - public static IStructureElementNoPlacement ofHintDeferred(Supplier icons, short[] RGBa) { - return new IStructureElementNoPlacement() { + public static IStructureElementNoPlacement ofHintDeferred(Supplier icons, short[] RGBa) { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(), RGBa); return false; } @@ -197,19 +197,19 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta) { if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @@ -219,7 +219,7 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta) { if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { throw new IllegalArgumentException(); } @@ -228,57 +228,57 @@ public class StructureUtility { throw new IllegalArgumentException(); } } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) { if (block == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta) { + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta) { return ofBlockHint(block, meta, block, meta); } - public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta) { if (iBlockAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @@ -288,46 +288,46 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElement ofBlocksFlat(Map blocsMap, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlocksFlat(Map blocsMap, Block defaultBlock, int defaultMeta) { if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { throw new IllegalArgumentException(); } if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -338,7 +338,7 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta) { if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { throw new IllegalArgumentException(); } @@ -348,41 +348,41 @@ public class StructureUtility { } } if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -390,46 +390,46 @@ public class StructureUtility { } } - public static IStructureElement ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { if (block == null || defaultBlock == null) { throw new IllegalArgumentException(); } if(block instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; } else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -440,44 +440,44 @@ public class StructureUtility { /** * Same as above but ignores target meta id */ - public static IStructureElement ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { if (block == null || defaultBlock == null) { throw new IllegalArgumentException(); } if(block instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { return block == world.getBlock(x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; } else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { return block == world.getBlock(x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -485,21 +485,21 @@ public class StructureUtility { } } - public static IStructureElement ofBlock(Block block, int meta) { + public static IStructureElement ofBlock(Block block, int meta) { return ofBlock(block, meta, block, meta); } /** * Same as above but ignores target meta id */ - public static IStructureElement ofBlockAnyMeta(Block block) { + public static IStructureElement ofBlockAnyMeta(Block block) { return ofBlockAnyMeta(block, block, 0); } /** * Same as above but allows to set hint particle render */ - public static IStructureElement ofBlockAnyMeta(Block block,int defaultMeta) { + public static IStructureElement ofBlockAnyMeta(Block block,int defaultMeta) { return ofBlockAnyMeta(block, block, defaultMeta); } @@ -507,46 +507,46 @@ public class StructureUtility { //region adders - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, int defaultMeta) { if (iBlockAdder == null || defaultBlock == null) { throw new IllegalArgumentException(); } if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -554,102 +554,102 @@ public class StructureUtility { } } - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, int dots) { + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, int dots) { return ofBlockAdder(iBlockAdder, sHintCasingsTT, dots - 1); } - public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta) { if (iTileAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t, tileEntity); + return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(multiBlock, tileEntity); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots) { + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots) { return ofHatchAdder(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1); } - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) { if (iHatchAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1, placeCasing, placeCasingMeta); } - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { if (iHatchAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } if(placeCasing instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); Block worldBlock = world.getBlock(x, y, z); return (tileEntity instanceof IGregTechTileEntity && - iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) placeCasing).setBlock(world, x, y, z, placeCasingMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); Block worldBlock = world.getBlock(x, y, z); return (tileEntity instanceof IGregTechTileEntity && - iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); return true; } @@ -661,48 +661,48 @@ public class StructureUtility { //region side effects - public static , T> IStructureElement onElementPass(Consumer onCheckPass, B element) { - return new IStructureElement() { + public static IStructureElement onElementPass(Consumer onCheckPass, IStructureElement element) { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { - boolean check = element.check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + boolean check = element.check(multiBlock, world, x, y, z); if (check) { - onCheckPass.accept(t); + onCheckPass.accept(multiBlock); } return check; } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static , T> IStructureElement onElementFail(Consumer onFail, B element) { - return new IStructureElement() { + public static IStructureElement onElementFail(Consumer onFail, IStructureElement element) { + return new IStructureElement() { @Override - public boolean check(T t, World world, int x, int y, int z) { - boolean check = element.check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + boolean check = element.check(multiBlock, world, x, y, z); if (!check) { - onFail.accept(t); + onFail.accept(multiBlock); } return check; } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(multiBlock, world, x, y, z, trigger); } }; } @@ -714,15 +714,15 @@ public class StructureUtility { * If none does it will finally return false. * * @param elementChain - * @param + * @param * @return */ @SafeVarargs - public static IStructureElementChain ofChain(IStructureElement... elementChain) { + public static IStructureElementChain ofChain(IStructureElement... elementChain) { if (elementChain == null || elementChain.length == 0) { throw new IllegalArgumentException(); } - for (IStructureElement iStructureElement : elementChain) { + for (IStructureElement iStructureElement : elementChain) { if (iStructureElement == null) { throw new IllegalArgumentException(); } @@ -735,317 +735,317 @@ public class StructureUtility { * If none does it will finally return false. * * @param elementChain - * @param + * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureElementChain ofChain(List> elementChain) { + public static IStructureElementChain ofChain(List> elementChain) { return ofChain(elementChain.toArray(new IStructureElement[0])); } //region defer - public static IStructureElementDeferred defer(Supplier> to) { + public static IStructureElementDeferred defer(Supplier> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return to.get().check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return to.get().check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.get().placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.get().placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.get().spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.get().spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function> to) { + public static IStructureElementDeferred defer(Function> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return to.apply(t).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return to.apply(multiBlock).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(multiBlock).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(multiBlock).spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractor, Map> map) { + public static IStructureElementDeferred defer(Function keyExtractor, Map> map) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.get(keyExtractor.apply(t)).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(multiBlock)).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(multiBlock)).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(multiBlock)).spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractor, Map> map, IStructureElement defaultElem) { + public static IStructureElementDeferred defer(Function keyExtractor, Map> map, IStructureElement defaultElem) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(t), defaultElem).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t), defaultElem).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t), defaultElem).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array) { + public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array) { if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return array[keyExtractor.apply(t)].check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return array[keyExtractor.apply(multiBlock)].check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t)].placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(multiBlock)].placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t)].spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(multiBlock)].spawnHint(multiBlock, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractor, List> array) { + public static IStructureElementDeferred defer(Function keyExtractor, List> array) { return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElementDeferred defer(BiFunction> to) { + public static IStructureElementDeferred defer(BiFunction> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return to.apply(t, null).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return to.apply(multiBlock, null).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(multiBlock, trigger).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(multiBlock, trigger).spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.get(keyExtractor.apply(t, null)).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(multiBlock, null)).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(multiBlock, trigger)).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(multiBlock, trigger)).spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(t, null), defaultElem).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(multiBlock, null), defaultElem).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array) { if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return array[keyExtractor.apply(t, null)].check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return array[keyExtractor.apply(multiBlock, null)].check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(multiBlock, trigger)].placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(multiBlock, trigger)].spawnHint(multiBlock, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array) { return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to) { + public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return toCheck.apply(t).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return toCheck.apply(multiBlock).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(multiBlock, trigger).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(multiBlock, trigger).spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return map.get(keyExtractorCheck.apply(multiBlock)).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(multiBlock, trigger)).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(multiBlock, trigger)).spawnHint(multiBlock, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractorCheck.apply(t), defaultElem).check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractorCheck.apply(multiBlock), defaultElem).check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, IStructureElement... array) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, IStructureElement... array) { if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(T t, World world, int x, int y, int z) { - return array[keyExtractorCheck.apply(t)].check(t, world, x, y, z); + public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + return array[keyExtractorCheck.apply(multiBlock)].check(multiBlock, world, x, y, z); } @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); + public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(multiBlock, trigger)].placeBlock(multiBlock, world, x, y, z, trigger); } @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); + public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(multiBlock, trigger)].spawnHint(multiBlock, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, List> array) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, List> array) { return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0])); } @@ -1057,10 +1057,10 @@ public class StructureUtility { * @param a * @param b * @param c - * @param + * @param * @return */ - public static IStructureNavigate step(int a, int b, int c) { + public static IStructureNavigate step(int a, int b, int c) { return step(new Vec3Impl(a, b, c)); } @@ -1068,11 +1068,11 @@ public class StructureUtility { * Used internally, to generate skips for structure definitions * * @param step - * @param + * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureNavigate step(Vec3Impl step) { + public static IStructureNavigate step(Vec3Impl step) { if (step == null || step.get0() < 0 || step.get1() < 0 || step.get2() < 0) { throw new IllegalArgumentException(); } @@ -1087,8 +1087,8 @@ public class StructureUtility { }); } - private static IStructureNavigate stepA(int a, int b, int c) { - return new IStructureNavigate() { + private static IStructureNavigate stepA(int a, int b, int c) { + return new IStructureNavigate() { @Override public int getStepA() { return a; @@ -1106,8 +1106,8 @@ public class StructureUtility { }; } - private static IStructureNavigate stepB(int a, int b, int c) { - return new IStructureNavigate() { + private static IStructureNavigate stepB(int a, int b, int c) { + return new IStructureNavigate() { @Override public int getStepA() { return a; @@ -1130,8 +1130,8 @@ public class StructureUtility { }; } - private static IStructureNavigate stepC(int a, int b, int c) { - return new IStructureNavigate() { + private static IStructureNavigate stepC(int a, int b, int c) { + return new IStructureNavigate() { @Override public int getStepA() { return a; @@ -1378,9 +1378,9 @@ public class StructureUtility { } } - public static boolean iterate(T object, + public static boolean iterate(MultiBlock object, ItemStack trigger, - IStructureElement[] elements, + IStructureElement[] elements, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, @@ -1400,7 +1400,7 @@ public class StructureUtility { switch (iterationType) { case SPAWN_HINTS: { - for (IStructureElement element : elements) { + for (IStructureElement element : elements) { if (element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); @@ -1419,7 +1419,7 @@ public class StructureUtility { break; } case BUILD_TEMPLATE: { - for (IStructureElement element : elements) { + for (IStructureElement element : elements) { if (element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); @@ -1439,7 +1439,7 @@ public class StructureUtility { break; } case CHECK: { - for (IStructureElement element : elements) { + for (IStructureElement element : elements) { if (element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); @@ -1470,7 +1470,7 @@ public class StructureUtility { } } case CHECK_FULLY: { - for (IStructureElement element : elements) { + for (IStructureElement element : elements) { if (element.isNavigating()) { abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java index 9d223ccd52..36ebfb3d21 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java @@ -10,5 +10,5 @@ public interface IBlockAdder { * @param meta meta of block attempted to add * @return is structure still valid */ - boolean apply(MultiBlock multiBlock, Block block, Integer meta); + boolean apply(MultiBlock multiBlock, Block block, int meta); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java index e7bb5fc459..0545a83d9e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java @@ -10,5 +10,5 @@ public interface IHatchAdder { * @param textureIndex requested texture index, or null if not... * @return managed to add hatch (structure still valid) */ - boolean apply(MultiBlock multiBlock, IGregTechTileEntity iGregTechTileEntity, Short textureIndex); + boolean apply(MultiBlock multiBlock, IGregTechTileEntity iGregTechTileEntity, int textureIndex); } -- cgit From 30097b9cf11fefa9a40eaa19b0fa6d397f42d34d Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 29 Sep 2020 20:45:58 +0200 Subject: removed unused import (#38) --- .../technus/tectech/mechanics/structure/StructureUtility.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 2f6998f028..521b0e7645 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -217,11 +217,11 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta) { if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { throw new IllegalArgumentException(); } - for (Set value : blocsMap.values()) { + for (Collection value : blocsMap.values()) { if (value.isEmpty()) { throw new IllegalArgumentException(); } @@ -336,11 +336,11 @@ public class StructureUtility { /** * Allows block duplicates (with different meta) */ - public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta) { if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { throw new IllegalArgumentException(); } - for (Set value : blocsMap.values()) { + for (Collection value : blocsMap.values()) { if (value.isEmpty()) { throw new IllegalArgumentException(); } -- cgit From 474c28ca31043f9b1861e149e79bb540b81f08f5 Mon Sep 17 00:00:00 2001 From: Motias <47714084+MotiasF33@users.noreply.github.com> Date: Fri, 2 Oct 2020 07:02:42 +0300 Subject: fix division by 144 #6649 and ^ required soldering for higher circuits (#39) * fix nanocircuit /144 fluid * divided by 144 molten soldering divided by 144, and it is required a little more than in previous tier recipes Co-authored-by: MotDT <47714084+MotDT@users.noreply.github.com> --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 8047efe5a3..caa307cb86 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1079,7 +1079,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(3744L), Materials.Naquadria.getMolten(4032L), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000) }, getItemContainer("NanoCircuit").get(1L), 8000, 8000000); @@ -1100,7 +1100,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Neutronium, 16), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(4032L), Materials.UUMatter.getFluid(8000L), Materials.Osmium.getMolten(1152L) }, getItemContainer("PikoCircuit").get(1L), 10000, 8000000); @@ -1119,7 +1119,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Bedrockium, 8), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(4608L), Materials.UUMatter.getFluid(24000L), Materials.Osmium.getMolten(2304L) }, getItemContainer("QuantumCircuit").get(1L), 20000, 32000000); -- cgit From 9b640643a01ad9835f1baf4ca37cd25c558dfb6f Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 7 Oct 2020 19:50:28 +0200 Subject: Add getters for translating relative coordinates to world --- .../alignment/enumerable/ExtendedFacing.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java index 2a93bcc540..5949b432df 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -128,6 +128,7 @@ public enum ExtendedFacing { private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(ExtendedFacing::getName2, (extendedFacing) -> extendedFacing)); private final ForgeDirection direction; + private final ForgeDirection a,b,c; private final Rotation rotation; private final Flip flip; @@ -206,6 +207,9 @@ public enum ExtendedFacing { default: throw new RuntimeException("More impossible..."); } + this.a=a; + this.b=b; + this.c=c; integerAxisSwap =new IntegerAxisSwap(a,b,c); } @@ -327,4 +331,28 @@ public enum ExtendedFacing { public IntegerAxisSwap getIntegerAxisSwap() { return integerAxisSwap; } + + public ForgeDirection getRelativeLeftInWorld() { + return a; + } + + public ForgeDirection getRelativeRightInWorld() { + return a.getOpposite(); + } + + public ForgeDirection getRelativeDownInWorld() { + return b; + } + + public ForgeDirection getRelativeUpInWorld() { + return b.getOpposite(); + } + + public ForgeDirection getRelativeBackInWorld() { + return c; + } + + public ForgeDirection getRelativeForwardInWorld() { + return c.getOpposite(); + } } -- cgit From 57d8442bdaab404c06bff3abebd4d962d6512b89 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 7 Oct 2020 20:11:34 +0200 Subject: Invalidate machine on rotation --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main') 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 9e508f9e7e..9af6d40df7 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 @@ -166,10 +166,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } @Override - public void setExtendedFacing(ExtendedFacing alignment) { - if(extendedFacing!=alignment){ - extendedFacing=alignment; + public void setExtendedFacing(ExtendedFacing newExtendedFacing) { + if(extendedFacing!=newExtendedFacing){ + extendedFacing=newExtendedFacing; IGregTechTileEntity base = getBaseMetaTileEntity(); + mMachine = false; if (getBaseMetaTileEntity().isServerSide()) { NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), base.getWorld().provider.dimensionId, -- cgit From f14ea1f84ab07a7fd32fa520ca4fc1e18a1333d5 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Mon, 26 Oct 2020 12:46:12 -0400 Subject: Change FG recipe for UHV and UEV (#40) * Add items for consistancy * Change to nano for consistency * number --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index caa307cb86..7ab4a8fab5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -928,6 +928,8 @@ public class DreamCraftRecipeLoader implements Runnable { 48000, 64, 200000, 8, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 6L), + ItemList.Gravistar.get(4L), + ItemList.Emitter_UHV.get(4L), new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), @@ -947,7 +949,9 @@ public class DreamCraftRecipeLoader implements Runnable { 96000, 128, 400000, 16, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Infinity, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 6L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 8L}, + ItemList.Gravistar.get(8L), + ItemList.Emitter_UEV.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 4}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), -- cgit From dac069de4ba59e14833d7c661f4c8ff5722abc84 Mon Sep 17 00:00:00 2001 From: basdxz Date: Wed, 4 Nov 2020 08:32:46 +0000 Subject: Fix disconnect on Tesla Lightning Now properly getting the world from player --- .../technus/tectech/mechanics/spark/RendererMessage.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java index f2fd17817d..58caed7951 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java @@ -5,6 +5,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; @@ -71,12 +72,14 @@ public class RendererMessage implements IMessage { private static void thaumLightning(int tX, int tY, int tZ, int tXN, int tYN, int tZN, int wID) { //This is enough to check for thaum, since it only ever matters for client side effects (Tested not to crash) if (Loader.isModLoaded("Thaumcraft")) { - World world = DimensionManager.getWorld(wID); - FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8); - bolt.defaultFractal(); - bolt.setType(2); - bolt.setWidth(0.125F); - bolt.finalizeBolt(); + World world = Minecraft.getMinecraft().theWorld; + if (world.provider.dimensionId == wID){ + FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8); + bolt.defaultFractal(); + bolt.setType(2); + bolt.setWidth(0.125F); + bolt.finalizeBolt(); + } } } } \ No newline at end of file -- cgit From 8bed7d36a5e0574015395b64e8f9d3d59d3cb9f8 Mon Sep 17 00:00:00 2001 From: basdxz Date: Wed, 4 Nov 2020 09:03:34 +0000 Subject: Fixes ConcurrentModificationException on Tesla Connected Cleaning Now just removes nulls if any --- .../technus/tectech/mechanics/tesla/ITeslaConnectable.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index 07ecc4bc31..e397c1dc5f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -4,14 +4,14 @@ import com.github.technus.tectech.mechanics.spark.ThaumSpark; import java.util.HashMap; import java.util.HashSet; -import java.util.Map; +import java.util.Objects; import static com.github.technus.tectech.util.Util.entriesSortedByValues; import static java.lang.Math.sqrt; public interface ITeslaConnectable extends ITeslaConnectableSimple { //Map with all Teslas in the same dimension and the distance to them //TODO Range - Map teslaNodeMap = new HashMap<>(); + HashMap teslaNodeMap = new HashMap<>(); //ThaumCraft lighting coordinate pairs, so we can send them in bursts and save on lag HashSet sparkList = new HashSet<>(); @@ -64,12 +64,8 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { } public static void cleanTeslaNodeMap(ITeslaConnectable origin) { - //TODO Do we still need this? - for (ITeslaConnectableSimple target : origin.teslaNodeMap.keySet()) { - if (target == null) { - origin.teslaNodeMap.remove(null); - } - } + //Wipes all null objects, in practice this is unloaded or improperly removed tesla objects + origin.teslaNodeMap.keySet().removeIf(Objects::isNull); } public static long powerTeslaNodeMap(ITeslaConnectable origin) { @@ -80,7 +76,7 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { long remainingAmperes = origin.getTeslaOutputCurrent(); while (remainingAmperes > 0) { long startingAmperes = remainingAmperes; - for (Map.Entry Rx : entriesSortedByValues(teslaNodeMap)) { + for (HashMap.Entry Rx : entriesSortedByValues(teslaNodeMap)) { if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * 2 : origin.getTeslaOutputVoltage())) { //Return and end the tick if we're out of energy to send return origin.getTeslaOutputCurrent() - remainingAmperes; -- cgit From 5de583bf34003095ff286aa132aa0e005020cab7 Mon Sep 17 00:00:00 2001 From: basdxz Date: Wed, 4 Nov 2020 09:06:13 +0000 Subject: Revert "Merge branch 'master' into BassAddons" This reverts commit 95993fb3d937b8dcfc9c945c18a754ce4ac11f88. --- .../dreamcraft/DreamCraftRecipeLoader.java | 12 +- .../mechanics/structure/IStructureDefinition.java | 146 ++++- .../mechanics/structure/IStructureElement.java | 8 +- .../structure/IStructureElementChain.java | 22 +- .../structure/IStructureElementCheckOnly.java | 6 +- .../structure/IStructureElementDeferred.java | 2 +- .../structure/IStructureElementNoPlacement.java | 4 +- .../mechanics/structure/IStructureNavigate.java | 8 +- .../mechanics/structure/StructureDefinition.java | 50 +- .../structure/StructureIterationType.java | 8 - .../mechanics/structure/StructureUtility.java | 646 ++++++++------------- .../mechanics/structure/adders/IBlockAdder.java | 4 +- .../mechanics/structure/adders/IHatchAdder.java | 6 +- .../mechanics/structure/adders/ITileAdder.java | 4 +- .../java/com/github/technus/tectech/util/Util.java | 1 + 15 files changed, 453 insertions(+), 474 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index d58a6e7686..df5c11e67b 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -933,8 +933,6 @@ public class DreamCraftRecipeLoader implements Runnable { 48000, 64, 200000, 8, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 6L), - ItemList.Gravistar.get(4L), - ItemList.Emitter_UHV.get(4L), new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), @@ -954,9 +952,7 @@ public class DreamCraftRecipeLoader implements Runnable { 96000, 128, 400000, 16, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Infinity, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 6L), - ItemList.Gravistar.get(8L), - ItemList.Emitter_UEV.get(4L), - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 4}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 8L}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), @@ -1088,7 +1084,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3744L), + Materials.SolderingAlloy.getMolten(3760L), Materials.Naquadria.getMolten(4032L), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000) }, getItemContainer("NanoCircuit").get(1L), 8000, 8000000); @@ -1109,7 +1105,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Neutronium, 16), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(4032L), + Materials.SolderingAlloy.getMolten(3760L), Materials.UUMatter.getFluid(8000L), Materials.Osmium.getMolten(1152L) }, getItemContainer("PikoCircuit").get(1L), 10000, 8000000); @@ -1128,7 +1124,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Bedrockium, 8), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(4608L), + Materials.SolderingAlloy.getMolten(3760L), Materials.UUMatter.getFluid(24000L), Materials.Osmium.getMolten(2304L) }, getItemContainer("QuantumCircuit").get(1L), 20000, 32000000); diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index ca9712df04..c8488d5cea 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -1,47 +1,167 @@ package com.github.technus.tectech.mechanics.structure; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import static com.github.technus.tectech.mechanics.structure.StructureIterationType.*; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.iterate; +import java.util.Arrays; -public interface IStructureDefinition { +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; + +public interface IStructureDefinition { /** * Used internally * @param name same name as for other methods here * @return the array of elements to process */ - IStructureElement[] getStructureFor(String name); + IStructureElement[] getStructureFor(String name); - default boolean check(MultiBlock object, String piece, World world, ExtendedFacing extendedFacing, + default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean forceCheckAllBlocks){ return iterate(object, null, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,forceCheckAllBlocks? CHECK_FULLY:CHECK); + basePositionA, basePositionB, basePositionC,false,forceCheckAllBlocks); } - default boolean hints(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing, + default boolean hints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,SPAWN_HINTS); + basePositionA, basePositionB, basePositionC,true,null); } - default boolean build(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing, + default boolean build(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC) { return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,BUILD_TEMPLATE); + basePositionA, basePositionB, basePositionC,false,null); } - default boolean buildOrHints(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing, + default boolean buildOrHints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, - boolean hints){ + boolean hintsOnly){ return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,hints?SPAWN_HINTS:BUILD_TEMPLATE); + basePositionA, basePositionB, basePositionC,hintsOnly,null); + } + + static boolean iterate(T object, ItemStack trigger, IStructureElement[] elements, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){ + if(world.isRemote ^ hintsOnly){ + return false; + } + + //change base position to base offset + basePositionA=-basePositionA; + basePositionB=-basePositionB; + basePositionC=-basePositionC; + + int[] abc = new int[]{basePositionA,basePositionB,basePositionC}; + int[] xyz = new int[3]; + + if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){ + if(checkBlocksIfNotNullForceCheckAllIfTrue){ + for (IStructureElement element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + return false; + } + } else { + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + return false; + } + abc[0]+=1; + } + } + } else { + for (IStructureElement element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + return false; + } + } else { + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + } + abc[0]+=1; + } + } + } + }else { + if(hintsOnly) { + for (IStructureElement element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); + + abc[0]+=1; + } + } + } else { + for (IStructureElement element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger); + } + abc[0]+=1; + } + } + } + } + return true; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index 436c7ce203..f946e71f91 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -6,12 +6,12 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -public interface IStructureElement { - boolean check(MultiBlock multiBlock, World world, int x, int y, int z); +public interface IStructureElement { + boolean check(T t,World world,int x,int y,int z); - boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger); + boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger); - boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger); + boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger); default int getStepA(){ return 1; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java index 4c7059dd81..f9593ee1c5 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java @@ -6,13 +6,13 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -public interface IStructureElementChain extends IStructureElement { - IStructureElement[] fallbacks(); +public interface IStructureElementChain extends IStructureElement { + IStructureElement[] fallbacks(); @Override - default boolean check(MultiBlock multiBlock, World world, int x, int y, int z){ - for (IStructureElement fallback : fallbacks()) { - if (fallback.check(multiBlock, world, x, y, z)) { + default boolean check(T t, World world, int x, int y, int z){ + for (IStructureElement fallback : fallbacks()) { + if (fallback.check(t, world, x, y, z)) { return true; } } @@ -20,9 +20,9 @@ public interface IStructureElementChain extends IStructureElement fallback : fallbacks()) { - if (fallback.spawnHint(multiBlock, world, x, y, z, trigger)) { + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.spawnHint(t, world, x, y, z, trigger)) { return true; } } @@ -30,9 +30,9 @@ public interface IStructureElementChain extends IStructureElement fallback : fallbacks()) { - if (fallback.placeBlock(multiBlock, world, x, y, z, trigger)) { + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement fallback : fallbacks()) { + if (fallback.placeBlock(t, world, x, y, z, trigger)) { return true; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java index c6492a5ed6..ec15aea53b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java @@ -3,14 +3,14 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IStructureElementCheckOnly extends IStructureElement { +public interface IStructureElementCheckOnly extends IStructureElement { @Override - default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){ + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ return false; } @Override - default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){ + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){ return false; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java index c0e39bb2ad..dbb74312a8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java @@ -3,5 +3,5 @@ package com.github.technus.tectech.mechanics.structure; /** * Use StructureUtility to instantiate */ -public interface IStructureElementDeferred extends IStructureElement { +public interface IStructureElementDeferred extends IStructureElement { } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java index 12cf2141ae..47e6060878 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java @@ -3,9 +3,9 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IStructureElementNoPlacement extends IStructureElement { +public interface IStructureElementNoPlacement extends IStructureElement { @Override - default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){ + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ return false; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java index 8c7c837a94..d3f4134cea 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -6,19 +6,19 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ -interface IStructureNavigate extends IStructureElement { +interface IStructureNavigate extends IStructureElement { @Override - default boolean check(MultiBlock multiBlock, World world, int x, int y, int z){ + default boolean check(T t, World world, int x, int y, int z){ return true; } @Override - default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { return true; } @Override - default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { return true; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index f42cbd35d1..9a1e94d98a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -7,31 +7,31 @@ import java.util.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; -public class StructureDefinition implements IStructureDefinition { - private final Map> elements; +public class StructureDefinition implements IStructureDefinition { + private final Map> elements; private final Map shapes; - private final Map[]> structures; + private final Map[]> structures; - public static Builder builder() { + public static Builder builder() { return new Builder<>(); } private StructureDefinition( - Map> elements, + Map> elements, Map shapes, - Map[]> structures) { + Map[]> structures) { this.elements =elements; this.shapes=shapes; this.structures = structures; } - public static class Builder { + public static class Builder { private static final char A='\uA000'; private static final char B='\uB000'; private static final char C='\uC000'; private char d ='\uD000'; private final Map navigates; - private final Map> elements; + private final Map> elements; private final Map shapes; private Builder() { @@ -40,7 +40,7 @@ public class StructureDefinition implements IStructureDefinition(); } - public Map> getElements() { + public Map> getElements() { return elements; } @@ -57,7 +57,7 @@ public class StructureDefinition implements IStructureDefinition addShapeOldApi(String name, String[][] structurePiece) { + public Builder addShapeOldApi(String name, String[][] structurePiece) { StringBuilder builder = new StringBuilder(); if (structurePiece.length > 0) { for (String[] strings : structurePiece) { @@ -142,7 +142,7 @@ public class StructureDefinition implements IStructureDefinition addShape(String name, String[][] structurePiece) { + public Builder addShape(String name, String[][] structurePiece) { StringBuilder builder = new StringBuilder(); if (structurePiece.length > 0) { for (String[] strings : structurePiece) { @@ -199,13 +199,13 @@ public class StructureDefinition implements IStructureDefinition addElement(Character name, IStructureElement structurePiece) { + public Builder addElement(Character name, IStructureElement structurePiece) { elements.putIfAbsent(name, structurePiece); return this; } - public IStructureDefinition build() { - Map[]> structures = compileStructureMap(); + public IStructureDefinition build() { + Map[]> structures = compileStructureMap(); if(DEBUG_MODE){ return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), structures); }else { @@ -214,22 +214,22 @@ public class StructureDefinition implements IStructureDefinition[]> compileElementSetMap() { + private Map[]> compileElementSetMap() { Set missing = new HashSet<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { - IStructureElement iStructureElement = elements.get((char) c); + IStructureElement iStructureElement = elements.get((char) c); if (iStructureElement == null) { missing.add(c); } })); if (missing.isEmpty()) { - Map[]> map = new HashMap<>(); + Map[]> map = new HashMap<>(); shapes.forEach((key, value) -> { Set chars=new HashSet<>(); for (char c : value.toCharArray()) { chars.add(c); } - IStructureElement[] compiled = new IStructureElement[chars.size()]; + IStructureElement[] compiled = new IStructureElement[chars.size()]; int i=0; for (Character aChar : chars) { compiled[i++]=elements.get(aChar); @@ -244,18 +244,18 @@ public class StructureDefinition implements IStructureDefinition[]> compileStructureMap() { + private Map[]> compileStructureMap() { Set mising = new HashSet<>(); shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { - IStructureElement iStructureElement = elements.get((char) c); + IStructureElement iStructureElement = elements.get((char) c); if (iStructureElement == null) { mising.add(c); } })); if (mising.isEmpty()) { - Map[]> map = new HashMap<>(); + Map[]> map = new HashMap<>(); shapes.forEach((key, value) -> { - IStructureElement[] compiled = new IStructureElement[value.length()]; + IStructureElement[] compiled = new IStructureElement[value.length()]; for (int i = 0; i < value.length(); i++) { compiled[i] = elements.get(value.charAt(i)); } @@ -269,7 +269,7 @@ public class StructureDefinition implements IStructureDefinition> getElements(){ + public Map> getElements(){ return elements; } @@ -277,12 +277,12 @@ public class StructureDefinition implements IStructureDefinition[]> getStructures() { + public Map[]> getStructures() { return structures; } @Override - public IStructureElement[] getStructureFor(String name) { + public IStructureElement[] getStructureFor(String name) { return structures.get(name); } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java deleted file mode 100644 index 618c07f970..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -public enum StructureIterationType { - SPAWN_HINTS, //only spawn hint particles - BUILD_TEMPLATE, //only builds template - CHECK, //checks the structure skipping all unloaded chunks (for machines that were validated already) - CHECK_FULLY, //checks the structure failing on unloaded chunks (for machines that are not valid currently) -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 87ab275d39..521b0e7645 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -22,8 +22,6 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.structure.StructureIterationType.SPAWN_HINTS; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static java.lang.Integer.MIN_VALUE; @@ -39,18 +37,18 @@ public class StructureUtility { @SuppressWarnings("rawtypes") private static final IStructureElement AIR = new IStructureElement() { @Override - public boolean check(Object multiBlock, World world, int x, int y, int z) { + public boolean check(Object t, World world, int x, int y, int z) { return world.getBlock(x, y, z).getMaterial() == Material.air; } @Override - public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 13); return true; } @Override - public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, Blocks.air, 0, 2); return false; } @@ -58,18 +56,18 @@ public class StructureUtility { @SuppressWarnings("rawtypes") private static final IStructureElement NOT_AIR = new IStructureElement() { @Override - public boolean check(Object multiBlock, World world, int x, int y, int z) { + public boolean check(Object t, World world, int x, int y, int z) { return world.getBlock(x, y, z).getMaterial() != Material.air; } @Override - public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 14); return true; } @Override - public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, sHintCasingsTT, 14, 2); return true; } @@ -77,18 +75,18 @@ public class StructureUtility { @SuppressWarnings("rawtypes") private static final IStructureElement ERROR = new IStructureElement() { @Override - public boolean check(Object multiBlock, World world, int x, int y, int z) { + public boolean check(Object t, World world, int x, int y, int z) { return false; } @Override - public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 15); return true; } @Override - public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { return true; } }; @@ -98,12 +96,12 @@ public class StructureUtility { } @SuppressWarnings("unchecked") - public static IStructureElement isAir() { + public static IStructureElement isAir() { return AIR; } @SuppressWarnings("unchecked") - public static IStructureElement notAir() { + public static IStructureElement notAir() { return NOT_AIR; } @@ -112,11 +110,11 @@ public class StructureUtility { * Placement is always handled by this and does nothing. * Makes little to no use it in fallback chain. * - * @param + * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureElement error() { + public static IStructureElement error() { return ERROR; } @@ -126,19 +124,19 @@ public class StructureUtility { * Check always returns: true. * * @param dots - * @param + * @param * @return */ - public static IStructureElementNoPlacement ofHint(int dots) { + public static IStructureElementNoPlacement ofHint(int dots) { int meta = dots - 1; - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, meta); return false; } @@ -149,18 +147,18 @@ public class StructureUtility { * Check always returns: true. * * @param icons - * @param + * @param * @return */ - public static IStructureElementNoPlacement ofHintDeferred(Supplier icons) { - return new IStructureElementNoPlacement() { + public static IStructureElementNoPlacement ofHintDeferred(Supplier icons) { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, icons.get()); return false; } @@ -172,18 +170,18 @@ public class StructureUtility { * * @param icons * @param RGBa - * @param + * @param * @return */ - public static IStructureElementNoPlacement ofHintDeferred(Supplier icons, short[] RGBa) { - return new IStructureElementNoPlacement() { + public static IStructureElementNoPlacement ofHintDeferred(Supplier icons, short[] RGBa) { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(), RGBa); return false; } @@ -197,19 +195,19 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta) { if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @@ -228,57 +226,57 @@ public class StructureUtility { throw new IllegalArgumentException(); } } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) { if (block == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta) { + public static IStructureElementNoPlacement ofBlockHint(Block block, int meta) { return ofBlockHint(block, meta, block, meta); } - public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta) { if (iBlockAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @@ -288,46 +286,46 @@ public class StructureUtility { /** * Does not allow Block duplicates (with different meta) */ - public static IStructureElement ofBlocksFlat(Map blocsMap, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlocksFlat(Map blocsMap, Block defaultBlock, int defaultMeta) { if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { throw new IllegalArgumentException(); } if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -348,41 +346,41 @@ public class StructureUtility { } } if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -390,46 +388,46 @@ public class StructureUtility { } } - public static IStructureElement ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { if (block == null || defaultBlock == null) { throw new IllegalArgumentException(); } if(block instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; } else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -440,44 +438,44 @@ public class StructureUtility { /** * Same as above but ignores target meta id */ - public static IStructureElement ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { if (block == null || defaultBlock == null) { throw new IllegalArgumentException(); } if(block instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { return block == world.getBlock(x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; } else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { return block == world.getBlock(x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -485,21 +483,21 @@ public class StructureUtility { } } - public static IStructureElement ofBlock(Block block, int meta) { + public static IStructureElement ofBlock(Block block, int meta) { return ofBlock(block, meta, block, meta); } /** * Same as above but ignores target meta id */ - public static IStructureElement ofBlockAnyMeta(Block block) { + public static IStructureElement ofBlockAnyMeta(Block block) { return ofBlockAnyMeta(block, block, 0); } /** * Same as above but allows to set hint particle render */ - public static IStructureElement ofBlockAnyMeta(Block block,int defaultMeta) { + public static IStructureElement ofBlockAnyMeta(Block block,int defaultMeta) { return ofBlockAnyMeta(block, block, defaultMeta); } @@ -507,46 +505,46 @@ public class StructureUtility { //region adders - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, int defaultMeta) { + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, int defaultMeta) { if (iBlockAdder == null || defaultBlock == null) { throw new IllegalArgumentException(); } if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); return true; } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); return true; } @@ -554,102 +552,102 @@ public class StructureUtility { } } - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, int dots) { + public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, int dots) { return ofBlockAdder(iBlockAdder, sHintCasingsTT, dots - 1); } - public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta) { if (iTileAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(multiBlock, tileEntity); + return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t, tileEntity); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots) { + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots) { return ofHatchAdder(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1); } - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) { + public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) { if (iHatchAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } - return new IStructureElementNoPlacement() { + return new IStructureElementNoPlacement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } }; } - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1, placeCasing, placeCasingMeta); } - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { + public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { if (iHatchAdder == null || hintBlock == null) { throw new IllegalArgumentException(); } if(placeCasing instanceof ICustomBlockSetting){ - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); Block worldBlock = world.getBlock(x, y, z); return (tileEntity instanceof IGregTechTileEntity && - iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { ((ICustomBlockSetting) placeCasing).setBlock(world, x, y, z, placeCasingMeta); return true; } }; }else { - return new IStructureElement() { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { + public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); Block worldBlock = world.getBlock(x, y, z); return (tileEntity instanceof IGregTechTileEntity && - iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); return true; } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); return true; } @@ -661,48 +659,48 @@ public class StructureUtility { //region side effects - public static IStructureElement onElementPass(Consumer onCheckPass, IStructureElement element) { - return new IStructureElement() { + public static , T> IStructureElement onElementPass(Consumer onCheckPass, B element) { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - boolean check = element.check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + boolean check = element.check(t, world, x, y, z); if (check) { - onCheckPass.accept(multiBlock); + onCheckPass.accept(t); } return check; } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return element.placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return element.spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElement onElementFail(Consumer onFail, IStructureElement element) { - return new IStructureElement() { + public static , T> IStructureElement onElementFail(Consumer onFail, B element) { + return new IStructureElement() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - boolean check = element.check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + boolean check = element.check(t, world, x, y, z); if (!check) { - onFail.accept(multiBlock); + onFail.accept(t); } return check; } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return element.placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return element.spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(t, world, x, y, z, trigger); } }; } @@ -714,15 +712,15 @@ public class StructureUtility { * If none does it will finally return false. * * @param elementChain - * @param + * @param * @return */ @SafeVarargs - public static IStructureElementChain ofChain(IStructureElement... elementChain) { + public static IStructureElementChain ofChain(IStructureElement... elementChain) { if (elementChain == null || elementChain.length == 0) { throw new IllegalArgumentException(); } - for (IStructureElement iStructureElement : elementChain) { + for (IStructureElement iStructureElement : elementChain) { if (iStructureElement == null) { throw new IllegalArgumentException(); } @@ -735,317 +733,317 @@ public class StructureUtility { * If none does it will finally return false. * * @param elementChain - * @param + * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureElementChain ofChain(List> elementChain) { + public static IStructureElementChain ofChain(List> elementChain) { return ofChain(elementChain.toArray(new IStructureElement[0])); } //region defer - public static IStructureElementDeferred defer(Supplier> to) { + public static IStructureElementDeferred defer(Supplier> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return to.get().check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return to.get().check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.get().placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.get().placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.get().spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.get().spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function> to) { + public static IStructureElementDeferred defer(Function> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return to.apply(multiBlock).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return to.apply(t).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(multiBlock).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(multiBlock).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractor, Map> map) { + public static IStructureElementDeferred defer(Function keyExtractor, Map> map) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return map.get(keyExtractor.apply(multiBlock)).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(t)).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(multiBlock)).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(multiBlock)).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractor, Map> map, IStructureElement defaultElem) { + public static IStructureElementDeferred defer(Function keyExtractor, Map> map, IStructureElement defaultElem) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(t), defaultElem).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t), defaultElem).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t), defaultElem).spawnHint(t, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array) { + public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array) { if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return array[keyExtractor.apply(multiBlock)].check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractor.apply(t)].check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(multiBlock)].placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t)].placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(multiBlock)].spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t)].spawnHint(t, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractor, List> array) { + public static IStructureElementDeferred defer(Function keyExtractor, List> array) { return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElementDeferred defer(BiFunction> to) { + public static IStructureElementDeferred defer(BiFunction> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return to.apply(multiBlock, null).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return to.apply(t, null).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(multiBlock, trigger).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(multiBlock, trigger).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return map.get(keyExtractor.apply(multiBlock, null)).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(t, null)).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(multiBlock, trigger)).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(multiBlock, trigger)).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(multiBlock, null), defaultElem).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(t, null), defaultElem).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array) { if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return array[keyExtractor.apply(multiBlock, null)].check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractor.apply(t, null)].check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(multiBlock, trigger)].placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(multiBlock, trigger)].spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array) { + public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array) { return defer(keyExtractor, array.toArray(new IStructureElement[0])); } - public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to) { + public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to) { if (to == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return toCheck.apply(multiBlock).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return toCheck.apply(t).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(multiBlock, trigger).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(multiBlock, trigger).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return map.get(keyExtractorCheck.apply(multiBlock)).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(multiBlock, trigger)).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(multiBlock, trigger)).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); } }; } - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { if (keyExtractor == null || map == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractorCheck.apply(multiBlock), defaultElem).check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractorCheck.apply(t), defaultElem).check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); } }; } @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, IStructureElement... array) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, IStructureElement... array) { if (keyExtractor == null || array == null) { throw new IllegalArgumentException(); } - return new IStructureElementDeferred() { + return new IStructureElementDeferred() { @Override - public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) { - return array[keyExtractorCheck.apply(multiBlock)].check(multiBlock, world, x, y, z); + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractorCheck.apply(t)].check(t, world, x, y, z); } @Override - public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(multiBlock, trigger)].placeBlock(multiBlock, world, x, y, z, trigger); + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); } @Override - public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(multiBlock, trigger)].spawnHint(multiBlock, world, x, y, z, trigger); + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); } }; } @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, List> array) { + public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, List> array) { return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0])); } @@ -1057,10 +1055,10 @@ public class StructureUtility { * @param a * @param b * @param c - * @param + * @param * @return */ - public static IStructureNavigate step(int a, int b, int c) { + public static IStructureNavigate step(int a, int b, int c) { return step(new Vec3Impl(a, b, c)); } @@ -1068,11 +1066,11 @@ public class StructureUtility { * Used internally, to generate skips for structure definitions * * @param step - * @param + * @param * @return */ @SuppressWarnings("unchecked") - public static IStructureNavigate step(Vec3Impl step) { + public static IStructureNavigate step(Vec3Impl step) { if (step == null || step.get0() < 0 || step.get1() < 0 || step.get2() < 0) { throw new IllegalArgumentException(); } @@ -1087,8 +1085,8 @@ public class StructureUtility { }); } - private static IStructureNavigate stepA(int a, int b, int c) { - return new IStructureNavigate() { + private static IStructureNavigate stepA(int a, int b, int c) { + return new IStructureNavigate() { @Override public int getStepA() { return a; @@ -1106,8 +1104,8 @@ public class StructureUtility { }; } - private static IStructureNavigate stepB(int a, int b, int c) { - return new IStructureNavigate() { + private static IStructureNavigate stepB(int a, int b, int c) { + return new IStructureNavigate() { @Override public int getStepA() { return a; @@ -1130,8 +1128,8 @@ public class StructureUtility { }; } - private static IStructureNavigate stepC(int a, int b, int c) { - return new IStructureNavigate() { + private static IStructureNavigate stepC(int a, int b, int c) { + return new IStructureNavigate() { @Override public int getStepA() { return a; @@ -1378,134 +1376,6 @@ public class StructureUtility { } } - public static boolean iterate(MultiBlock object, - ItemStack trigger, - IStructureElement[] elements, - World world, - ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - StructureIterationType iterationType) { - if (world.isRemote ^ (iterationType == SPAWN_HINTS)) { - return false; - } - - //change base position to base offset - basePositionA = -basePositionA; - basePositionB = -basePositionB; - basePositionC = -basePositionC; - - int[] abc = new int[]{basePositionA, basePositionB, basePositionC}; - int[] xyz = new int[3]; - - switch (iterationType) { - case SPAWN_HINTS: { - for (IStructureElement element : elements) { - if (element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - } else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); - - abc[0] += 1; - } - } - break; - } - case BUILD_TEMPLATE: { - for (IStructureElement element : elements) { - if (element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - } else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger); - } - abc[0] += 1; - } - } - break; - } - case CHECK: { - for (IStructureElement element : elements) { - if (element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - } else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if (!element.check(object, world, xyz[0], xyz[1], xyz[2])) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] failed @ " + - Arrays.toString(xyz) + " " + Arrays.toString(abc)); - } - return false; - } - } else { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] !blockExists @ " + - Arrays.toString(xyz) + " " + Arrays.toString(abc)); - } - } - abc[0] += 1; - } - break; - } - } - case CHECK_FULLY: { - for (IStructureElement element : elements) { - if (element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - } else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if (!element.check(object, world, xyz[0], xyz[1], xyz[2])) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] failed @ " + - Arrays.toString(xyz) + " " + Arrays.toString(abc)); - } - return false; - } - } else { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] !blockExists @ " + - Arrays.toString(xyz) + " " + Arrays.toString(abc)); - } - return false; - } - abc[0] += 1; - } - } - break; - } - default: return false; - } - return true; - } - /** * Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape) * WARNING! Do not use on old api... diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java index 36ebfb3d21..908c4c4aca 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java @@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure.adders; import net.minecraft.block.Block; -public interface IBlockAdder { +public interface IBlockAdder { /** * Callback on block added, needs to check if block is valid (and add it) * @param block block attempted to add * @param meta meta of block attempted to add * @return is structure still valid */ - boolean apply(MultiBlock multiBlock, Block block, int meta); + boolean apply(T t,Block block, Integer meta); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java index 0545a83d9e..a47befc2e8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java @@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure.adders; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -public interface IHatchAdder { +public interface IHatchAdder { /** * Callback to add hatch, needs to check if hatch is valid (and add it) * @param iGregTechTileEntity hatch - * @param textureIndex requested texture index, or null if not... + * @param aShort requested texture index, or null if not... * @return managed to add hatch (structure still valid) */ - boolean apply(MultiBlock multiBlock, IGregTechTileEntity iGregTechTileEntity, int textureIndex); + boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java index 72d08751b5..cc3c7dbb7a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java @@ -2,11 +2,11 @@ package com.github.technus.tectech.mechanics.structure.adders; import net.minecraft.tileentity.TileEntity; -public interface ITileAdder { +public interface ITileAdder { /** * Callback to add hatch, needs to check if tile is valid (and add it) * @param tileEntity tile * @return managed to add hatch (structure still valid) */ - boolean apply(MultiBlock multiBlock, TileEntity tileEntity); + boolean apply(T t,TileEntity tileEntity); } diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java index 8c693620b6..1843770e3a 100644 --- a/src/main/java/com/github/technus/tectech/util/Util.java +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -40,6 +40,7 @@ public final class Util { private Util() { } + @SuppressWarnings("ComparatorMethodParameterNotUsed") public static > SortedSet> entriesSortedByValues(Map map) { SortedSet> sortedEntries = new TreeSet<>( (e1, e2) -> { -- cgit From cc518e371ff8557877d3e3f33aac91c0881c6d7b Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 8 Nov 2020 08:51:17 +0000 Subject: Fixes tesla covers Looks like GT5 covers are behaviors and not discrete objects, go figure! This is a horrible fix, but it works. --- .../mechanics/tesla/TeslaCoverConnection.java | 50 ++++++++++++++++++++++ .../tectech/thing/cover/GT_Cover_TM_TeslaCoil.java | 46 ++------------------ .../cover/GT_Cover_TM_TeslaCoil_Ultimate.java | 3 +- 3 files changed, 55 insertions(+), 44 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java new file mode 100644 index 0000000000..99e0d75c1c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.mechanics.tesla; + +import com.github.technus.tectech.util.Vec3Impl; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public class TeslaCoverConnection implements ITeslaConnectableSimple { + private final IGregTechTileEntity IGT; + private final byte teslaReceptionCapability; + + public TeslaCoverConnection(IGregTechTileEntity IGT, byte teslaReceptionCapability) { + this.IGT = IGT; + this.teslaReceptionCapability = teslaReceptionCapability; + } + + @Override + public byte getTeslaReceptionCapability() { + return teslaReceptionCapability; + } + + @Override + public float getTeslaReceptionCoefficient() { + return 1; + } + + @Override + public boolean isTeslaReadyToReceive() { + return true; + } + + @Override + public long getTeslaStoredEnergy() { + return IGT.getStoredEU(); + } + + @Override + public Vec3Impl getTeslaPosition() { + return new Vec3Impl(IGT); + } + + @Override + public Integer getTeslaDimension() { + return IGT.getWorld().provider.dimensionId; + } + + @Override + public boolean teslaInjectEnergy(long teslaVoltageInjected) { + //Same as in the microwave transmitters, this does not account for amp limits + return IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java index 2efe2f3cbc..d3d9ead6d2 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.cover; import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; +import com.github.technus.tectech.mechanics.tesla.TeslaCoverConnection; import com.github.technus.tectech.util.Vec3Impl; import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; @@ -11,9 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; import static ic2.api.info.Info.DMG_ELECTRIC; -public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior implements ITeslaConnectableSimple { - private IGregTechTileEntity IGT; - +public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior { public GT_Cover_TM_TeslaCoil() { } @@ -21,14 +19,10 @@ public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior implements ITeslaCon public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { //Only do stuff if we're on top and have power if (aSide == 1 || aTileEntity.getEUCapacity() > 0) { - //Pull IGT onto the outside, should only execute first tick - if (IGT == null) { - IGT = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); - } //Makes sure we're on the list - teslaNodeSet.add(this); + teslaNodeSet.add(new TeslaCoverConnection(aTileEntity.getIGregTechTileEntityOffset(0, 0, 0), + getTeslaReceptionCapability())); } - return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); } @@ -57,39 +51,7 @@ public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior implements ITeslaCon return 200; } - @Override public byte getTeslaReceptionCapability() { return 2; } - - @Override - public float getTeslaReceptionCoefficient() { - return 1; - } - - @Override - public boolean isTeslaReadyToReceive() { - return true; - } - - @Override - public long getTeslaStoredEnergy() { - return IGT.getStoredEU(); - } - - @Override - public Vec3Impl getTeslaPosition() { - return new Vec3Impl(IGT); - } - - @Override - public Integer getTeslaDimension() { - return IGT.getWorld().provider.dimensionId; - } - - @Override - public boolean teslaInjectEnergy(long teslaVoltageInjected) { - //Same as in the microwave transmitters, this does not account for amp limits - return IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; - } } diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java index 028ac3a4d6..3417d7ae20 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java @@ -31,8 +31,7 @@ public class GT_Cover_TM_TeslaCoil_Ultimate extends GT_Cover_TM_TeslaCoil { public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } - - @Override + public byte getTeslaReceptionCapability() { return 1; } -- cgit From 70b7ebbfc1014ed3f1bd571c31d8b6a550a82abe Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 8 Nov 2020 09:06:04 +0000 Subject: Fixed Tesla hysteresis function --- .../com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index e397c1dc5f..291acf393d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -83,6 +83,10 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { } ITeslaConnectableSimple target = Rx.getKey(); + + //Continue if the target can't receive + if(!target.isTeslaReadyToReceive()) continue; + int distance = Rx.getValue(); //Calculate the voltage output -- cgit From 0cc795de170612d8fd93c86050d512cb3979f97d Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Mon, 9 Nov 2020 20:01:23 +0100 Subject: fix 16 length computer not forming (#43) fix that a computer of 16 blocks length will not form --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') 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 5d88fdfc50..6a6a707399 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 @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB totalLen++; offset--; } - if (totalLen > 16) { + if (totalLen > 17) { return false; } if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { @@ -375,4 +375,4 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB public String[] getStructureDescription(ItemStack stackSize) { return description; } -} \ No newline at end of file +} -- cgit From 8dd64d25caf626c538dcb628408a239ee724fc5e Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 15 Nov 2020 15:29:30 +0000 Subject: Tesla Speedup -Switched from sorted HashMap to ArrayListMultiMap -Fixed issue where interface lacked proper methods --- .../tectech/mechanics/tesla/ITeslaConnectable.java | 23 +++--- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 18 ++++ .../single/GT_MetaTileEntity_TeslaCoil.java | 96 +++++++++++++--------- 3 files changed, 87 insertions(+), 50 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index 291acf393d..d505ca8e09 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -1,19 +1,20 @@ package com.github.technus.tectech.mechanics.tesla; import com.github.technus.tectech.mechanics.spark.ThaumSpark; +import com.google.common.collect.Multimap; -import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Objects; -import static com.github.technus.tectech.util.Util.entriesSortedByValues; import static java.lang.Math.sqrt; public interface ITeslaConnectable extends ITeslaConnectableSimple { //Map with all Teslas in the same dimension and the distance to them //TODO Range - HashMap teslaNodeMap = new HashMap<>(); + Multimap getTeslaNodeMap(); + //ThaumCraft lighting coordinate pairs, so we can send them in bursts and save on lag - HashSet sparkList = new HashSet<>(); + HashSet getSparkList(); //-128 to -1 disables capability //0 means any source or target @@ -36,7 +37,7 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { public static final HashSet teslaNodeSet = new HashSet<>();//Targets for power transmission public static void generateTeslaNodeMap(ITeslaConnectable origin) { - origin.teslaNodeMap.clear(); + origin.getTeslaNodeMap().clear(); for (ITeslaConnectableSimple target : teslaNodeSet) { //Sanity checks if (target == null) { @@ -59,13 +60,13 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { //Skip if the range is too vast continue; } - origin.teslaNodeMap.put(target, distance); + origin.getTeslaNodeMap().put(distance, target); } } public static void cleanTeslaNodeMap(ITeslaConnectable origin) { //Wipes all null objects, in practice this is unloaded or improperly removed tesla objects - origin.teslaNodeMap.keySet().removeIf(Objects::isNull); + origin.getTeslaNodeMap().keySet().removeIf(Objects::isNull); } public static long powerTeslaNodeMap(ITeslaConnectable origin) { @@ -76,18 +77,18 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { long remainingAmperes = origin.getTeslaOutputCurrent(); while (remainingAmperes > 0) { long startingAmperes = remainingAmperes; - for (HashMap.Entry Rx : entriesSortedByValues(teslaNodeMap)) { + for (Map.Entry Rx : origin.getTeslaNodeMap().entries()) { if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * 2 : origin.getTeslaOutputVoltage())) { //Return and end the tick if we're out of energy to send return origin.getTeslaOutputCurrent() - remainingAmperes; } - ITeslaConnectableSimple target = Rx.getKey(); + ITeslaConnectableSimple target = Rx.getValue(); //Continue if the target can't receive if(!target.isTeslaReadyToReceive()) continue; - int distance = Rx.getValue(); + int distance = Rx.getKey(); //Calculate the voltage output long outputVoltageInjectable; @@ -109,7 +110,7 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { if (target.teslaInjectEnergy(outputVoltageInjectable)) { origin.teslaDrainEnergy(outputVoltageConsumption); - sparkList.add(new ThaumSpark(origin.getTeslaPosition(), target.getTeslaPosition(), origin.getTeslaDimension())); + origin.getSparkList().add(new ThaumSpark(origin.getTeslaPosition(), target.getTeslaPosition(), origin.getTeslaDimension())); remainingAmperes--; } if (remainingAmperes == 0) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 93f6e50c5a..5f6e0fffaa 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -8,6 +8,7 @@ import com.github.technus.tectech.mechanics.spark.ThaumSpark; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; @@ -19,6 +20,8 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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.Vec3Impl; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; @@ -35,6 +38,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import java.util.HashSet; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; @@ -47,6 +51,10 @@ import static java.lang.Math.*; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { + //Interface fields + Multimap teslaNodeMap = ArrayListMultimap.create(); + HashSet sparkList = new HashSet<>(); + //region variables private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32 private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TRANSCEIVER;//Default is 16 @@ -701,6 +709,16 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return 0; } + @Override + public Multimap getTeslaNodeMap() { + return teslaNodeMap; + } + + @Override + public HashSet getSparkList() { + return sparkList; + } + @Override public byte getTeslaTransmissionCapability() { return 1; 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 388a253b27..cc42929806 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; @@ -9,6 +10,8 @@ import com.github.technus.tectech.mechanics.spark.ThaumSpark; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.util.Vec3Impl; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -23,6 +26,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.reflect.FieldUtils; import java.util.Arrays; +import java.util.HashSet; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; import static com.github.technus.tectech.util.CommonValues.V; @@ -32,6 +36,10 @@ import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer implements ITeslaConnectable { + //Interface fields + Multimap teslaNodeMap = ArrayListMultimap.create(); + HashSet sparkList = new HashSet<>(); + private final static int transferRadiusMax = TecTech.configTecTech.TESLA_SINGLE_RANGE;//Default is 20 private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F @@ -179,45 +187,45 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return new GT_MetaTileEntity_TeslaCoil(mName, mTier, mDescription, mTextures, mInventory.length); } - private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { - int x = mte.getXCoord(); - int y = mte.getYCoord(); - int z = mte.getZCoord(); - - byte xR; - byte yR; - byte zR; - - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil) { - GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - xR = (byte) (nodeTesla.posTop.get0() - x); - yR = (byte) (nodeTesla.posTop.get1() - y); - zR = (byte) (nodeTesla.posTop.get2() - z); - } else { - xR = (byte) (node.getXCoord() - x); - yR = (byte) (node.getYCoord() - y); - zR = (byte) (node.getZCoord() - z); - } - - int wID = mte.getWorld().provider.dimensionId; - - sparkList.add(new ThaumSpark(x, y, z, xR, yR, zR, wID)); - } - - private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) { - long outputVoltageInjectable; - long outputVoltageConsumption; - - if (overDriveToggle) { - outputVoltageInjectable = outputVoltage; - outputVoltageConsumption = outputVoltage + (distance * perBlockLoss) + (long) Math.round(overDriveLoss * outputVoltage); - } else { - outputVoltageInjectable = outputVoltage - (distance * perBlockLoss); - outputVoltageConsumption = outputVoltage; - } - return new long[]{outputVoltageInjectable, outputVoltageConsumption}; - } +// private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { +// int x = mte.getXCoord(); +// int y = mte.getYCoord(); +// int z = mte.getZCoord(); +// +// byte xR; +// byte yR; +// byte zR; +// +// IMetaTileEntity nodeInside = node.getMetaTileEntity(); +// if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil) { +// GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; +// xR = (byte) (nodeTesla.posTop.get0() - x); +// yR = (byte) (nodeTesla.posTop.get1() - y); +// zR = (byte) (nodeTesla.posTop.get2() - z); +// } else { +// xR = (byte) (node.getXCoord() - x); +// yR = (byte) (node.getYCoord() - y); +// zR = (byte) (node.getZCoord() - z); +// } +// +// int wID = mte.getWorld().provider.dimensionId; +// +// sparkList.add(new ThaumSpark(x, y, z, xR, yR, zR, wID)); +// } +// +// private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) { +// long outputVoltageInjectable; +// long outputVoltageConsumption; +// +// if (overDriveToggle) { +// outputVoltageInjectable = outputVoltage; +// outputVoltageConsumption = outputVoltage + (distance * perBlockLoss) + (long) Math.round(overDriveLoss * outputVoltage); +// } else { +// outputVoltageInjectable = outputVoltage - (distance * perBlockLoss); +// outputVoltageConsumption = outputVoltage; +// } +// return new long[]{outputVoltageInjectable, outputVoltageConsumption}; +// } @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { @@ -308,6 +316,16 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return 1; } + @Override + public Multimap getTeslaNodeMap() { + return teslaNodeMap; + } + + @Override + public HashSet getSparkList() { + return sparkList; + } + @Override public byte getTeslaTransmissionCapability() { return 2; -- cgit From 548e3eb74288448704ec790b4be6bdd16d3f7549 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 15 Nov 2020 17:07:46 +0000 Subject: Further Optimisation -Tesla Maps are fully written to only one -Subsequent modifications are done to remove or add new Teslas -Lots more encapsulation --- .../tectech/mechanics/tesla/ITeslaConnectable.java | 76 ++++++++++++++-------- .../tectech/thing/cover/GT_Cover_TM_TeslaCoil.java | 4 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 9 +-- .../single/GT_MetaTileEntity_TeslaCoil.java | 8 +-- 4 files changed, 55 insertions(+), 42 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index d505ca8e09..07059c82b2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -34,39 +34,59 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { boolean teslaDrainEnergy(long teslaVoltageDrained); class TeslaUtil { - public static final HashSet teslaNodeSet = new HashSet<>();//Targets for power transmission + private static final HashSet teslaSimpleNodeSet = new HashSet<>();//Targets for power transmission + private static final HashSet teslaNodeSet = new HashSet<>();//Sources of power transmission - public static void generateTeslaNodeMap(ITeslaConnectable origin) { - origin.getTeslaNodeMap().clear(); - for (ITeslaConnectableSimple target : teslaNodeSet) { - //Sanity checks - if (target == null) { - //The Tesla Covers do not remove themselves from the list and this is the code that does - teslaNodeSet.remove(null); - continue; - } else if (origin.equals(target) || !origin.getTeslaDimension().equals(target.getTeslaDimension())) { - //Skip if looking at myself and skip if not in the same dimension - //TODO, INTERDIM? - continue; - } else if (origin.getTeslaTransmissionCapability() != 0 && origin.getTeslaReceptionCapability() != 0 && - origin.getTeslaTransmissionCapability() != origin.getTeslaReceptionCapability()) { - //Skip if incompatible - continue; - } + public static void teslaSimpleNodeSetAdd(ITeslaConnectableSimple target){ + teslaSimpleNodeSet.add(target); + teslaNodeSet.forEach(origin -> addTargetToTeslaOrigin(target, origin)); + } - //Range calc - int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition())); - if (distance > origin.getTeslaTransmissionRange() * target.getTeslaReceptionCoefficient()) { - //Skip if the range is too vast - continue; - } - origin.getTeslaNodeMap().put(distance, target); + public static void teslaSimpleNodeSetRemove(ITeslaConnectableSimple target){ + teslaSimpleNodeSet.remove(target); + if (target instanceof ITeslaConnectable)teslaNodeSet.remove(target); + teslaNodeSet.forEach(origin -> removeTargetFromTeslaOrigin(target, origin)); + } + + private static void addTargetToTeslaOrigin(ITeslaConnectableSimple target, ITeslaConnectable origin){ + if (origin.equals(target) || !origin.getTeslaDimension().equals(target.getTeslaDimension())) { + //Skip if looking at myself and skip if not in the same dimension + //TODO, INTERDIM? + return; + } else if (origin.getTeslaTransmissionCapability() != 0 && origin.getTeslaReceptionCapability() != 0 && + origin.getTeslaTransmissionCapability() != origin.getTeslaReceptionCapability()) { + //Skip if incompatible + return; + } + //Range calc + int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition())); + if (distance > origin.getTeslaTransmissionRange() * target.getTeslaReceptionCoefficient()) { + //Skip if the range is too vast + return; } + origin.getTeslaNodeMap().put(distance, target); } - public static void cleanTeslaNodeMap(ITeslaConnectable origin) { - //Wipes all null objects, in practice this is unloaded or improperly removed tesla objects - origin.getTeslaNodeMap().keySet().removeIf(Objects::isNull); + private static void removeTargetFromTeslaOrigin(ITeslaConnectableSimple target, ITeslaConnectable origin){ + //Range calc TODO Remove duplicate? + int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition())); + origin.getTeslaNodeMap().remove(distance, target); + } + + public static void generateTeslaNodeMap(ITeslaConnectable origin) { + if(!teslaNodeSet.contains(origin)) { + origin.getTeslaNodeMap().clear(); + for (ITeslaConnectableSimple target : teslaSimpleNodeSet) { + //Sanity checks + if (target == null) { + //The Tesla Covers do not remove themselves from the list and this is the code that does + teslaSimpleNodeSet.remove(null); + continue; + } + addTargetToTeslaOrigin(target, origin); + } + } + teslaNodeSet.add(origin); } public static long powerTeslaNodeMap(ITeslaConnectable origin) { diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java index d3d9ead6d2..a573ed740b 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java @@ -1,8 +1,6 @@ package com.github.technus.tectech.thing.cover; -import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; import com.github.technus.tectech.mechanics.tesla.TeslaCoverConnection; -import com.github.technus.tectech.util.Vec3Impl; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; @@ -20,7 +18,7 @@ public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior { //Only do stuff if we're on top and have power if (aSide == 1 || aTileEntity.getEUCapacity() > 0) { //Makes sure we're on the list - teslaNodeSet.add(new TeslaCoverConnection(aTileEntity.getIGregTechTileEntityOffset(0, 0, 0), + teslaSimpleNodeSetAdd(new TeslaCoverConnection(aTileEntity.getIGregTechTileEntityOffset(0, 0, 0), getTeslaReceptionCapability())); } return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 5f6e0fffaa..22f1d003e6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -462,7 +462,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (this.getBaseMetaTileEntity().isClientSide()) { return; } - teslaNodeSet.remove(this); + teslaSimpleNodeSetRemove(this); for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(false); @@ -536,7 +536,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); energyCapacity = aNBT.getLong("eEnergyCapacity"); - teslaNodeSet.add(this); + teslaSimpleNodeSetAdd(this); } @Override @@ -556,7 +556,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { super.onFirstTick_EM(aBaseMetaTileEntity); if (!aBaseMetaTileEntity.isClientSide()) { - teslaNodeSet.add(this); + teslaSimpleNodeSetAdd(this); } } @@ -606,9 +606,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock transferRadiusTransceiverDisplay.set(transferRadiusTower * 2); transferRadiusCoverUltimateDisplay.set(transferRadiusTower); - //Clean the teslaNodeMap - cleanTeslaNodeMap(this); - //Power transfer outputCurrentDisplay.set(powerTeslaNodeMap(this)); 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 cc42929806..c7ebb76e09 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,14 +7,12 @@ 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.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.util.Vec3Impl; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer; @@ -231,7 +229,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { super.onFirstTick(aBaseMetaTileEntity); if (!aBaseMetaTileEntity.isClientSide()) { - teslaNodeSet.add(this); + teslaSimpleNodeSetAdd(this); } } @@ -239,14 +237,14 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB public void onRemoval() { super.onRemoval(); if (!this.getBaseMetaTileEntity().isClientSide()) { - teslaNodeSet.remove(this); + teslaSimpleNodeSetRemove(this); } } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - teslaNodeSet.add(this); + teslaSimpleNodeSetAdd(this); } @Override -- cgit From ab706fea9e4192b611788981930a575f6d4205fe Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 15 Nov 2020 17:57:49 +0000 Subject: Thaum Lightning fixes -Less spammy lightning bolts -Still has duplicate code and stuff --- .../tectech/mechanics/tesla/ITeslaConnectable.java | 19 +++-- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 55 +++++++-------- .../single/GT_MetaTileEntity_TeslaCoil.java | 82 +++++----------------- 3 files changed, 49 insertions(+), 107 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index 07059c82b2..74aa4b8463 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -5,7 +5,6 @@ import com.google.common.collect.Multimap; import java.util.HashSet; import java.util.Map; -import java.util.Objects; import static java.lang.Math.sqrt; @@ -74,17 +73,15 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { } public static void generateTeslaNodeMap(ITeslaConnectable origin) { - if(!teslaNodeSet.contains(origin)) { - origin.getTeslaNodeMap().clear(); - for (ITeslaConnectableSimple target : teslaSimpleNodeSet) { - //Sanity checks - if (target == null) { - //The Tesla Covers do not remove themselves from the list and this is the code that does - teslaSimpleNodeSet.remove(null); - continue; - } - addTargetToTeslaOrigin(target, origin); + origin.getTeslaNodeMap().clear(); + for (ITeslaConnectableSimple target : teslaSimpleNodeSet) { + //Sanity checks + if (target == null) { + //The Tesla Covers do not remove themselves from the list and this is the code that does + teslaSimpleNodeSet.remove(null); + continue; } + addTargetToTeslaOrigin(target, origin); } teslaNodeSet.add(origin); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 22f1d003e6..d1d645acc2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -52,8 +52,9 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { //Interface fields - Multimap teslaNodeMap = ArrayListMultimap.create(); - HashSet sparkList = new HashSet<>(); + private final Multimap teslaNodeMap = ArrayListMultimap.create(); + private final HashSet sparkList = new HashSet<>(); + private int sparkCount = 10; //region variables private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32 @@ -81,8 +82,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private final ArrayList eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps - private int sortTime = 0; //Scan timer used for tesla search intervals - private long energyCapacity = 0; //Total energy storage limited by capacitors private long outputVoltageMax = 0; //Tesla voltage output limited by capacitors private int vTier = -1; //Tesla voltage tier limited by capacitors @@ -459,13 +458,12 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { super.onRemoval(); - if (this.getBaseMetaTileEntity().isClientSide()) { - return; - } - teslaSimpleNodeSetRemove(this); - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { - cap.getBaseMetaTileEntity().setActive(false); + if (!getBaseMetaTileEntity().isClientSide()) { + teslaSimpleNodeSetRemove(this); + for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { + cap.getBaseMetaTileEntity().setActive(false); + } } } } @@ -557,13 +555,12 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock super.onFirstTick_EM(aBaseMetaTileEntity); if (!aBaseMetaTileEntity.isClientSide()) { teslaSimpleNodeSetAdd(this); + generateTeslaNodeMap(this); } } @Override public boolean onRunningTick(ItemStack aStack) { - IGregTechTileEntity mte = getBaseMetaTileEntity(); - //Hysteresis based ePowerPass setting float energyFrac = (float) getEUVar() / energyCapacity; @@ -577,15 +574,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock ePowerPass = false; } - //Create the teslaNodeMap - if (sortTime == sortTimeMinSetting.get()) { - sortTime = 0; - sortTimeDisplay.updateStatus(); - generateTeslaNodeMap(this); - } - sortTime++; - sortTimeDisplay.set(sortTime); - //Power Limit Settings if (outputVoltageSetting.get() > 0) { outputVoltage = min(outputVoltageMax, (long) outputVoltageSetting.get()); @@ -609,16 +597,21 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //Power transfer outputCurrentDisplay.set(powerTeslaNodeMap(this)); - if (!sparkList.isEmpty()) { - NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), - mte.getWorld().provider.dimensionId, - posTop.get0(), - posTop.get1(), - posTop.get2(), - 256); + //Randomly send all the sparks out once every 3 to 5 seconds + sparkCount--; + if (sparkCount == 0){ + IGregTechTileEntity mte = getBaseMetaTileEntity(); + sparkCount = 60 + mte.getWorld().rand.nextInt(41); + if(!sparkList.isEmpty()){ + NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), + mte.getWorld().provider.dimensionId, + mte.getXCoord(), + mte.getYCoord(), + mte.getZCoord(), + 256); + sparkList.clear(); + } } - sparkList.clear(); - return true; } 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 c7ebb76e09..292d363ad9 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 @@ -35,15 +35,13 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer implements ITeslaConnectable { //Interface fields - Multimap teslaNodeMap = ArrayListMultimap.create(); - HashSet sparkList = new HashSet<>(); + private final Multimap teslaNodeMap = ArrayListMultimap.create(); + private final HashSet sparkList = new HashSet<>(); + private int sparkCount = 10; private final static int transferRadiusMax = TecTech.configTecTech.TESLA_SINGLE_RANGE;//Default is 20 private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1 private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F - - private byte sparkCount = 0; - private final static int transferRadiusMin = 4;//Minimum user configurable private int transferRadius = transferRadiusMax;//Default transferRadius setting @@ -61,9 +59,6 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB private String clientLocale = "en_US"; - private int sortTime = 0;//Sorting tick counter - private final static int sortTimeMax = 100;//Sorting tick counter limit, so we only sort once every 5 seconds - public GT_MetaTileEntity_TeslaCoil(int aID, String aName, String aNameRegional, int aTier, int aSlotCount) { super(aID, aName, aNameRegional, aTier, "", aSlotCount); Util.setTier(aTier, this); @@ -185,51 +180,12 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return new GT_MetaTileEntity_TeslaCoil(mName, mTier, mDescription, mTextures, mInventory.length); } -// private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { -// int x = mte.getXCoord(); -// int y = mte.getYCoord(); -// int z = mte.getZCoord(); -// -// byte xR; -// byte yR; -// byte zR; -// -// IMetaTileEntity nodeInside = node.getMetaTileEntity(); -// if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil) { -// GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; -// xR = (byte) (nodeTesla.posTop.get0() - x); -// yR = (byte) (nodeTesla.posTop.get1() - y); -// zR = (byte) (nodeTesla.posTop.get2() - z); -// } else { -// xR = (byte) (node.getXCoord() - x); -// yR = (byte) (node.getYCoord() - y); -// zR = (byte) (node.getZCoord() - z); -// } -// -// int wID = mte.getWorld().provider.dimensionId; -// -// sparkList.add(new ThaumSpark(x, y, z, xR, yR, zR, wID)); -// } -// -// private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) { -// long outputVoltageInjectable; -// long outputVoltageConsumption; -// -// if (overDriveToggle) { -// outputVoltageInjectable = outputVoltage; -// outputVoltageConsumption = outputVoltage + (distance * perBlockLoss) + (long) Math.round(overDriveLoss * outputVoltage); -// } else { -// outputVoltageInjectable = outputVoltage - (distance * perBlockLoss); -// outputVoltageConsumption = outputVoltage; -// } -// return new long[]{outputVoltageInjectable, outputVoltageConsumption}; -// } - @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { super.onFirstTick(aBaseMetaTileEntity); if (!aBaseMetaTileEntity.isClientSide()) { teslaSimpleNodeSetAdd(this); + generateTeslaNodeMap(this); } } @@ -266,27 +222,23 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB powerPassToggle = false; } - //Create the teslaNodeMap - if (sortTime == sortTimeMax) { - sortTime = 0; - generateTeslaNodeMap(this); - } - sortTime++; - //Send Power powerTeslaNodeMap(this); - sparkCount++; - if (sparkCount == 60 && !sparkList.isEmpty()) { - sparkCount = 0; - NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); + //Randomly send all the sparks out once every 3 to 5 seconds + sparkCount--; + if (sparkCount == 0){ + sparkCount = 60 + aBaseMetaTileEntity.getWorld().rand.nextInt(41); + if(!sparkList.isEmpty()){ + NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), + aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + 256); + sparkList.clear(); + } } - sparkList.clear(); } @Override -- cgit From 7fc2f07281062f043aa958fe66efed42c48150a7 Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 16 Nov 2020 02:05:51 +0000 Subject: Optimised Tesla Energy Injection -Small refactor in RendererMessage -Updated GT5u --- build.properties | 2 +- .../tectech/mechanics/spark/RendererMessage.java | 4 +- .../tectech/mechanics/tesla/ITeslaConnectable.java | 69 +++++++++++----------- 3 files changed, 38 insertions(+), 37 deletions(-) (limited to 'src/main') diff --git a/build.properties b/build.properties index 02c2b83517..0143910a75 100644 --- a/build.properties +++ b/build.properties @@ -6,7 +6,7 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=736 +gregtech.jenkinsbuild=745 gregtech.version=5.09.33.55 #cofhcore.version=[1.7.10]3.1.4-329-dev cofh_core_version=2388751 diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java index 58caed7951..4004a8d826 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java @@ -31,7 +31,7 @@ public class RendererMessage implements IMessage { ObjectInputStream ois = new ObjectInputStream(is); Object data = ois.readObject(); sparkList = (HashSet) data; - } catch (IOException | ClassNotFoundException ex) { + } catch (IOException | ClassNotFoundException ignored) { } } @@ -44,7 +44,7 @@ public class RendererMessage implements IMessage { oos.flush(); InputStream is = new ByteArrayInputStream(baos.toByteArray()); pBuffer.writeBytes(is, baos.toByteArray().length); - } catch (IOException ex) { + } catch (IOException ignore) { } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index 74aa4b8463..d5f215053f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -87,56 +87,57 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { } public static long powerTeslaNodeMap(ITeslaConnectable origin) { - //Teslas can only send OR receive - if (origin.isTeslaReadyToReceive()) { - return 0L;//TODO Negative values to indicate charging? - } long remainingAmperes = origin.getTeslaOutputCurrent(); - while (remainingAmperes > 0) { - long startingAmperes = remainingAmperes; - for (Map.Entry Rx : origin.getTeslaNodeMap().entries()) { - if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * 2 : origin.getTeslaOutputVoltage())) { - //Return and end the tick if we're out of energy to send - return origin.getTeslaOutputCurrent() - remainingAmperes; - } + boolean canSendPower = !origin.isTeslaReadyToReceive() && remainingAmperes > 0; + if (canSendPower) { + for (Map.Entry Rx : origin.getTeslaNodeMap().entries()) { + //Do we still have power left to send kind of check + if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * + 2 : origin.getTeslaOutputVoltage())) break; + //Explicit words for the important fields ITeslaConnectableSimple target = Rx.getValue(); - - //Continue if the target can't receive - if(!target.isTeslaReadyToReceive()) continue; - int distance = Rx.getKey(); + //Can our target receive energy? + if(!target.isTeslaReadyToReceive()) continue; //Calculate the voltage output long outputVoltageInjectable; long outputVoltageConsumption; - if (origin.isOverdriveEnabled()) { outputVoltageInjectable = origin.getTeslaOutputVoltage(); - outputVoltageConsumption = origin.getTeslaOutputVoltage() + (distance * origin.getTeslaEnergyLossPerBlock()) + - (long) Math.round(origin.getTeslaOutputVoltage() * origin.getTeslaOverdriveLossCoefficient()); + outputVoltageConsumption = origin.getTeslaOutputVoltage() + + (distance * origin.getTeslaEnergyLossPerBlock()) + + (long) Math.round(origin.getTeslaOutputVoltage() * + origin.getTeslaOverdriveLossCoefficient()); } else { - outputVoltageInjectable = origin.getTeslaOutputVoltage() - (distance * origin.getTeslaEnergyLossPerBlock()); + outputVoltageInjectable = origin.getTeslaOutputVoltage() - (distance * + origin.getTeslaEnergyLossPerBlock()); outputVoltageConsumption = origin.getTeslaOutputVoltage(); } - //Skip the target if the cost is too high - if (origin.getTeslaStoredEnergy() < outputVoltageConsumption) { - continue; + //Break out of the loop if the cost is too high + //Since the next target will have an even higher cost, just quit now. + if (origin.getTeslaStoredEnergy() < outputVoltageConsumption) break; + + //Now shove in as many packets as will fit~ + while(canSendPower){ + if (target.teslaInjectEnergy(outputVoltageInjectable)) { + origin.teslaDrainEnergy(outputVoltageConsumption); + origin.getSparkList().add(new ThaumSpark(origin.getTeslaPosition(), + target.getTeslaPosition(), origin.getTeslaDimension())); + remainingAmperes--; + //Update the can send power flag each time we send power + canSendPower = (origin.getTeslaStoredEnergy() < outputVoltageConsumption || + remainingAmperes == 0); + } else { + //Breaks out when I can't send anymore power + break; + } } - if (target.teslaInjectEnergy(outputVoltageInjectable)) { - origin.teslaDrainEnergy(outputVoltageConsumption); - origin.getSparkList().add(new ThaumSpark(origin.getTeslaPosition(), target.getTeslaPosition(), origin.getTeslaDimension())); - remainingAmperes--; - } - if (remainingAmperes == 0) { - return origin.getTeslaOutputCurrent(); - } - } - //End the tick after one iteration with no transmissions - if (remainingAmperes == startingAmperes) { - return origin.getTeslaOutputCurrent() - remainingAmperes; + //Break out if we can't send power anymore + if (canSendPower)break; } } return origin.getTeslaOutputCurrent() - remainingAmperes; -- cgit From 0304d1464f38ac75cf338ac470f1cc7228cd6d5c Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 25 Nov 2020 17:25:05 +0100 Subject: Implement anti-laser target hatches! https://www.livescience.com/anti-laser-wireless-charging.html --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- src/main/resources/assets/tectech/lang/en_US.lang | 2 +- src/main/resources/assets/tectech/lang/zh_CN.lang | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main') 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 9af6d40df7..8abb027d3f 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 @@ -1440,7 +1440,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput(); if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar >> 7, 1), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -1449,7 +1449,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput() * tHatch.Amperes; if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar >> 7, tHatch.Amperes), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index dc4af9970b..b81b865b22 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -538,7 +538,7 @@ gt.blockmachines.multimachine.em.transformer.name=Active Transformer gt.blockmachines.multimachine.em.transformer.hint=1 - Energy IO Hatches or High Power Casing gt.blockmachines.multimachine.em.transformer.desc.0=Power substation gt.blockmachines.multimachine.em.transformer.desc.1=All the transformation! -gt.blockmachines.multimachine.em.transformer.desc.2=Only 0.78125% power loss, HAYO! +gt.blockmachines.multimachine.em.transformer.desc.2=Only 0.004% power loss, HAYO! gt.blockmachines.multimachine.tm.microwave.name=Microwave Grinder gt.blockmachines.multimachine.tm.microwave.hint.0=1 - Classic Hatches or Clean Stainless Steel Casing diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 6aae89bb1b..cfa23fb88d 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -535,7 +535,7 @@ gt.blockmachines.multimachine.em.transformer.name=有源变压器 gt.blockmachines.multimachine.em.transformer.hint=1 - 能源仓、动力仓或超能机械方块 gt.blockmachines.multimachine.em.transformer.desc.0=变电站 gt.blockmachines.multimachine.em.transformer.desc.1=任意电压间的相互转换! -gt.blockmachines.multimachine.em.transformer.desc.2=只有0.78125%的能量损失, HAYO! +gt.blockmachines.multimachine.em.transformer.desc.2=只有0.004%的能量损失, HAYO! gt.blockmachines.multimachine.tm.microwave.name=微波发生仪 gt.blockmachines.multimachine.tm.microwave.hint.0=1 - 基础仓室或洁净不锈钢机械方块 -- cgit From 6c9ec7b46509a7142edb94c15f9beac5a6153d82 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 25 Nov 2020 17:25:05 +0100 Subject: Implement anti-laser target hatches! https://www.livescience.com/anti-laser-wireless-charging.html (cherry picked from commit 0304d1464f38ac75cf338ac470f1cc7228cd6d5c) --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- src/main/resources/assets/tectech/lang/en_US.lang | 2 +- src/main/resources/assets/tectech/lang/zh_CN.lang | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main') 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 9af6d40df7..8abb027d3f 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 @@ -1440,7 +1440,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput(); if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar >> 7, 1), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -1449,7 +1449,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput() * tHatch.Amperes; if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar >> 7, tHatch.Amperes), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index dc4af9970b..b81b865b22 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -538,7 +538,7 @@ gt.blockmachines.multimachine.em.transformer.name=Active Transformer gt.blockmachines.multimachine.em.transformer.hint=1 - Energy IO Hatches or High Power Casing gt.blockmachines.multimachine.em.transformer.desc.0=Power substation gt.blockmachines.multimachine.em.transformer.desc.1=All the transformation! -gt.blockmachines.multimachine.em.transformer.desc.2=Only 0.78125% power loss, HAYO! +gt.blockmachines.multimachine.em.transformer.desc.2=Only 0.004% power loss, HAYO! gt.blockmachines.multimachine.tm.microwave.name=Microwave Grinder gt.blockmachines.multimachine.tm.microwave.hint.0=1 - Classic Hatches or Clean Stainless Steel Casing diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 6aae89bb1b..cfa23fb88d 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -535,7 +535,7 @@ gt.blockmachines.multimachine.em.transformer.name=有源变压器 gt.blockmachines.multimachine.em.transformer.hint=1 - 能源仓、动力仓或超能机械方块 gt.blockmachines.multimachine.em.transformer.desc.0=变电站 gt.blockmachines.multimachine.em.transformer.desc.1=任意电压间的相互转换! -gt.blockmachines.multimachine.em.transformer.desc.2=只有0.78125%的能量损失, HAYO! +gt.blockmachines.multimachine.em.transformer.desc.2=只有0.004%的能量损失, HAYO! gt.blockmachines.multimachine.tm.microwave.name=微波发生仪 gt.blockmachines.multimachine.tm.microwave.hint.0=1 - 基础仓室或洁净不锈钢机械方块 -- cgit From 08e3d560737749ed9e8b9848c5f98303e2a9d190 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 29 Nov 2020 17:27:45 +0000 Subject: Changed lightning Now a constant once every half second --- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 2 +- .../single/GT_MetaTileEntity_TeslaCoil.java | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index d1d645acc2..a1912bff32 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -601,7 +601,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock sparkCount--; if (sparkCount == 0){ IGregTechTileEntity mte = getBaseMetaTileEntity(); - sparkCount = 60 + mte.getWorld().rand.nextInt(41); + sparkCount = 10; if(!sparkList.isEmpty()){ NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), mte.getWorld().provider.dimensionId, 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 292d363ad9..28668b7634 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 @@ -228,7 +228,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB //Randomly send all the sparks out once every 3 to 5 seconds sparkCount--; if (sparkCount == 0){ - sparkCount = 60 + aBaseMetaTileEntity.getWorld().rand.nextInt(41); + sparkCount = 10; if(!sparkList.isEmpty()){ NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), aBaseMetaTileEntity.getWorld().provider.dimensionId, @@ -243,16 +243,15 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - try { - EntityPlayerMP player = (EntityPlayerMP) aPlayer; - clientLocale = (String) FieldUtils.readField(player, "translator", true); - } catch (Exception e) { - clientLocale = "en_US"; + if (aBaseMetaTileEntity.isServerSide()) { + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } + aBaseMetaTileEntity.openGUI(aPlayer); } - aBaseMetaTileEntity.openGUI(aPlayer); return true; } -- cgit From bd9322e8352b50f5d816bb65d92bfaeea7bd072c Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 29 Nov 2020 17:28:00 +0000 Subject: More robust Tesla covers --- .../tectech/mechanics/tesla/TeslaCoverConnection.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java index 99e0d75c1c..385ad8d74e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java @@ -3,12 +3,17 @@ package com.github.technus.tectech.mechanics.tesla; import com.github.technus.tectech.util.Vec3Impl; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetAdd; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetRemove; + public class TeslaCoverConnection implements ITeslaConnectableSimple { private final IGregTechTileEntity IGT; + private final Vec3Impl pos; private final byte teslaReceptionCapability; public TeslaCoverConnection(IGregTechTileEntity IGT, byte teslaReceptionCapability) { this.IGT = IGT; + this.pos = new Vec3Impl(IGT); this.teslaReceptionCapability = teslaReceptionCapability; } @@ -34,7 +39,7 @@ public class TeslaCoverConnection implements ITeslaConnectableSimple { @Override public Vec3Impl getTeslaPosition() { - return new Vec3Impl(IGT); + return pos; } @Override @@ -45,6 +50,14 @@ public class TeslaCoverConnection implements ITeslaConnectableSimple { @Override public boolean teslaInjectEnergy(long teslaVoltageInjected) { //Same as in the microwave transmitters, this does not account for amp limits - return IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; + boolean output = false; + + if (!IGT.isDead()){ + output = IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; + } else { + teslaSimpleNodeSetRemove(this); + } + + return output; } } -- cgit From 27234f0fae5be18cd66a83d6be0664a2e0e08921 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 29 Nov 2020 17:50:30 +0000 Subject: Fix power sending logic --- .../com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index d5f215053f..3cb8d9e9a2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -129,7 +129,7 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { remainingAmperes--; //Update the can send power flag each time we send power canSendPower = (origin.getTeslaStoredEnergy() < outputVoltageConsumption || - remainingAmperes == 0); + remainingAmperes > 0); } else { //Breaks out when I can't send anymore power break; @@ -137,7 +137,7 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { } //Break out if we can't send power anymore - if (canSendPower)break; + if (!canSendPower)break; } } return origin.getTeslaOutputCurrent() - remainingAmperes; -- cgit From 36ffce4bc6e283c4d4ffb5913af610206278d2ac Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 29 Nov 2020 18:53:32 +0000 Subject: Fix MultiMap sorting --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java | 3 ++- .../thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index a1912bff32..580e6195ad 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -22,6 +22,7 @@ import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Vec3Impl; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import com.google.common.collect.MultimapBuilder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; @@ -52,7 +53,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { //Interface fields - private final Multimap teslaNodeMap = ArrayListMultimap.create(); + private final Multimap teslaNodeMap = MultimapBuilder.treeKeys().linkedListValues().build(); private final HashSet sparkList = new HashSet<>(); private int sparkCount = 10; 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 28668b7634..8c3fb9410b 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 @@ -11,6 +11,7 @@ import com.github.technus.tectech.util.Util; import com.github.technus.tectech.util.Vec3Impl; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import com.google.common.collect.MultimapBuilder; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -35,7 +36,7 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer implements ITeslaConnectable { //Interface fields - private final Multimap teslaNodeMap = ArrayListMultimap.create(); + private final Multimap teslaNodeMap = MultimapBuilder.treeKeys().linkedListValues().build(); private final HashSet sparkList = new HashSet<>(); private int sparkCount = 10; -- cgit From b21fbb19c3c1a5093ed3200e7caa637c2699e5e2 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sun, 29 Nov 2020 18:53:59 +0000 Subject: Fix Duplicate Tesla Connections with covers --- .../technus/tectech/mechanics/tesla/ITeslaConnectable.java | 8 +++++--- .../tectech/mechanics/tesla/TeslaCoverConnection.java | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java index 3cb8d9e9a2..de8d828cf4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -36,9 +36,11 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple { private static final HashSet teslaSimpleNodeSet = new HashSet<>();//Targets for power transmission private static final HashSet teslaNodeSet = new HashSet<>();//Sources of power transmission - public static void teslaSimpleNodeSetAdd(ITeslaConnectableSimple target){ - teslaSimpleNodeSet.add(target); - teslaNodeSet.forEach(origin -> addTargetToTeslaOrigin(target, origin)); + public static void teslaSimpleNodeSetAdd(ITeslaConnectableSimple target) { + if (!teslaSimpleNodeSet.contains(target)) { + teslaSimpleNodeSet.add(target); + teslaNodeSet.forEach(origin -> addTargetToTeslaOrigin(target, origin)); + } } public static void teslaSimpleNodeSetRemove(ITeslaConnectableSimple target){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java index 385ad8d74e..5c6fef6af8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.mechanics.tesla; import com.github.technus.tectech.util.Vec3Impl; +import com.google.common.base.Objects; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetAdd; @@ -60,4 +61,17 @@ public class TeslaCoverConnection implements ITeslaConnectableSimple { return output; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TeslaCoverConnection that = (TeslaCoverConnection) o; + return Objects.equal(IGT, that.IGT); + } + + @Override + public int hashCode() { + return Objects.hashCode(IGT); + } } -- cgit From 7d3da8d8e75cff72a764de2e667734e4009b2bb3 Mon Sep 17 00:00:00 2001 From: basdxz Date: Fri, 4 Dec 2020 16:43:07 +0000 Subject: Fixes Git mishap Fixes for Pull #44 --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index df5c11e67b..0cfd8242ce 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -933,6 +933,8 @@ public class DreamCraftRecipeLoader implements Runnable { 48000, 64, 200000, 8, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 6L), + ItemList.Gravistar.get(4L), + ItemList.Emitter_UHV.get(4L), new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), @@ -952,7 +954,9 @@ public class DreamCraftRecipeLoader implements Runnable { 96000, 128, 400000, 16, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Infinity, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 6L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 8L}, + ItemList.Gravistar.get(8L), + ItemList.Emitter_UEV.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 4}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), @@ -1084,7 +1088,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(3744L), Materials.Naquadria.getMolten(4032L), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000) }, getItemContainer("NanoCircuit").get(1L), 8000, 8000000); @@ -1105,7 +1109,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Neutronium, 16), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(3744L), Materials.UUMatter.getFluid(8000L), Materials.Osmium.getMolten(1152L) }, getItemContainer("PikoCircuit").get(1L), 10000, 8000000); @@ -1124,7 +1128,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Bedrockium, 8), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(3744L), Materials.UUMatter.getFluid(24000L), Materials.Osmium.getMolten(2304L) }, getItemContainer("QuantumCircuit").get(1L), 20000, 32000000); -- cgit From a48c1e34f81520cd775ebbbec24ebaa63ebb719a Mon Sep 17 00:00:00 2001 From: KiloJoel Date: Sat, 5 Dec 2020 15:14:17 +0000 Subject: reduced file saving frequency --- .../com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main') 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 a3fa341697..0beb5e0af8 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 @@ -243,7 +243,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { player.attackEntityFrom(MainLoader.subspace,Math.max(1,badness/8f)); } } else if (playerTag.getDouble(SPACE_CANCER) > 0 && !player.isDead) { - playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-6f)); + if (playerTag.getDouble(SPACE_CANCER) == 0 || player.ticksExisted % 10 != 0) + return; + playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-5f)); } } TecTech.playerPersistence.saveData(player); -- cgit From a88ee316e57062d80688e62afa7deb530b1b2d2b Mon Sep 17 00:00:00 2001 From: "[Kiwi233]" <[huaxia0611@qq.com]> Date: Sun, 13 Dec 2020 22:08:19 +0800 Subject: Update zh_CN.lang --- src/main/resources/assets/tectech/lang/zh_CN.lang | 273 +++++++++++----------- 1 file changed, 138 insertions(+), 135 deletions(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 2dfe46f615..c01c8f2757 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -42,7 +42,7 @@ item.em.constructable.desc.0=触发可构造界面 item.em.constructable.desc.1=显示多方块结构细节, item.em.constructable.desc.2=只可在多方块控制器上使用. item.em.constructable.desc.3=(在创造模式下潜行右键可直接构造) -item.em.constructable.desc.4=数量影响等级/模式/类型 +item.em.constructable.desc.4=堆叠数量影响等级/模式/类型 item.em.EuMeterGT.name=GT EU电表 item.em.EuMeterGT.desc.0=测量EU相关的基本内容 @@ -64,6 +64,8 @@ item.tm.teslaCoilCapacitor.1.name=MV特斯拉电容 item.tm.teslaCoilCapacitor.2.name=HV特斯拉电容 item.tm.teslaCoilCapacitor.3.name=EV特斯拉电容 item.tm.teslaCoilCapacitor.4.name=IV特斯拉电容 +item.tm.teslaCoilCapacitor.5.name=LuV特斯拉电容 +item.tm.teslaCoilCapacitor.6.name=ZPM特斯拉电容 item.tm.teslaCoilCapacitor.desc.0=存储量: item.tm.teslaCoilCapacitor.desc.1=EU;充能速度: item.tm.teslaCoilCapacitor.desc.2=把这个破碎的东西浸入某种辛辣的水中! @@ -210,69 +212,69 @@ gt.blockmachines.hatch.energymulti64.tier.13.name=64安UXV能源仓 gt.blockmachines.hatch.energymulti.desc.0=为多方块机器以高电流输入能源 gt.blockmachines.hatch.energymulti.desc.1=输入电流 -gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576/t 激光靶仓 -gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256/t 激光靶仓 -gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024/t 激光靶仓 -gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096/t 激光靶仓 -gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384/t 激光靶仓 -gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536/t 激光靶仓 -gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144/t 激光靶仓 -gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/t 激光靶仓 gt.blockmachines.hatch.energytunnel.tier.14.name=传奇激光靶仓 gt.blockmachines.hatch.energytunnel.desc.0=多方块机器的能量输入端 gt.blockmachines.hatch.energytunnel.desc.1=通量 @@ -307,69 +309,69 @@ gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安IV动力仓 gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 -gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144/t 激光源仓 -gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/t 激光源仓 gt.blockmachines.hatch.dynamotunnel.tier.14.name=传奇激光源仓 gt.blockmachines.hatch.dynamotunnel.desc.0=多方块机器的能量输出端 gt.blockmachines.hatch.dynamotunnel.desc.1=通量 @@ -402,12 +404,12 @@ gt.blockmachines.hatch.certain.tier.10.name=未定元解析器 X gt.blockmachines.hatch.certain.desc.0=你真的很确定吗? gt.blockmachines.hatch.certain.desc.1=盒子里的薛定谔方程 -gt.blockmachines.hatch.datain.tier.07.name=副光学连接端口 +gt.blockmachines.hatch.datain.tier.07.name=副光学接口 gt.blockmachines.hatch.datain.desc.0=多方块机器的数据输入 gt.blockmachines.hatch.datain.desc.1=高速光纤接口 gt.blockmachines.hatch.datain.desc.2=启用前必须涂色 -gt.blockmachines.hatch.dataout.tier.07.name=主光学连接端口 +gt.blockmachines.hatch.dataout.tier.07.name=主光学接口 gt.blockmachines.hatch.dataout.desc.0=多方块机器的数据输出 gt.blockmachines.hatch.dataout.desc.1=高速光纤接口 gt.blockmachines.hatch.dataout.desc.2=启用前必须涂色 @@ -518,6 +520,7 @@ gt.blockcasingsBA0.2.name=HV超导初级特斯拉绕组 gt.blockcasingsBA0.3.name=EV超导初级特斯拉绕组 gt.blockcasingsBA0.4.name=IV超导初级特斯拉绕组 gt.blockcasingsBA0.5.name=LuV超导初级特斯拉绕组 +gt.blockcasingsBA0.9.name=ZPM超导初级特斯拉绕组 gt.blockcasingsBA0.0.desc.0=最高电圧 gt.blockcasingsBA0.0.desc.1=有的人称这为神迹,另一些人把这叫做物理. gt.blockcasingsBA0.6.name=特斯拉基座机械方块 @@ -575,12 +578,12 @@ gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7=充能进度显示 gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8=扫描时间显示 gt.blockmachines.multimachine.em.switch.name=QoS网络交换机 -gt.blockmachines.multimachine.em.switch.hint=1 - 基础仓室、光学连接端口或电子计算机机械方块 +gt.blockmachines.multimachine.em.switch.hint=1 - 基础仓室、光学接口或电子计算机机械方块 gt.blockmachines.multimachine.em.switch.desc.0=用户控制的计算力路由 gt.blockmachines.multimachine.em.switch.desc.1=服务质量是必须的 gt.blockmachines.multimachine.em.computer.name=量子计算机 -gt.blockmachines.multimachine.em.computer.hint.0=1 - 基础仓室、光学连接端口或电子计算机机械方块 +gt.blockmachines.multimachine.em.computer.hint.0=1 - 基础仓室、光学接口或电子计算机机械方块 gt.blockmachines.multimachine.em.computer.hint.1=2 - 计算机箱或进阶电子计算机械方块 gt.blockmachines.multimachine.em.computer.desc=你需要它来处理上面的这串数字 gt.blockmachines.multimachine.em.computer.cfgi.0=超频比 @@ -639,7 +642,7 @@ gt.blockmachines.multimachine.em.scanner.desc.0=它是如何存在的? gt.blockmachines.multimachine.em.scanner.desc.1=我!不!知!道!(至少暂时是这样) gt.blockmachines.multimachine.em.research.name=研究站 -gt.blockmachines.multimachine.em.research.hint.0=1 - 基础仓室、光学连接端口或电子计算机械方块 +gt.blockmachines.multimachine.em.research.hint.0=1 - 基础仓室、光学接口或电子计算机械方块 gt.blockmachines.multimachine.em.research.hint.1=2 - 物品固定容器 gt.blockmachines.multimachine.em.research.desc.0=哲学家们甚至... gt.blockmachines.multimachine.em.research.desc.1=从来不曾梦见它! @@ -762,7 +765,7 @@ gt.blockmachines.machine.tt.tesla.desc.1=富人的闪电洪炉 gt.blockmachines.debug.tt.pollutor.name=Debug污染生成机 gt.blockmachines.debug.tt.pollutor.desc.0=该死的genny破产了! gt.blockmachines.debug.tt.pollutor.desc.1=无限的生产者/消费者 -gt.blockmachines.debug.tt.pollutor.desc.2=我只是想要一个... +gt.blockmachines.debug.tt.pollutor.desc.2=因为我需要一个? gt.blockmachines.debug.tt.data.name=Debug数据仓 gt.blockmachines.debug.tt.data.desc.0=量子数据输出 gt.blockmachines.debug.tt.data.desc.1=高速光纤接口 @@ -811,7 +814,7 @@ tt.keyword.Efficiency=效率 #Button that allows to pass power to other machines tt.keyword.PowerPass=导能 #Button that vents EM -tt.keyword.SafeVoid=安全罩 +tt.keyword.SafeVoid=安全销毁 tt.keyword.Parametrizer=参数仪 tt.keyword.Value=值 tt.keyword.Input=输入 @@ -823,7 +826,7 @@ tt.keyword.PacketHistory=封包记录 tt.keyphrase.LIFE_TIME=寿命 tt.keyphrase.CARRIES_COLOR=有色 -tt.keyphrase.提示方块:Details=提示细节 +tt.keyphrase.Hint_Details=提示细节 tt.keyphrase.At_current_energy_level=在当前能级 #Used when 0 Elemental Matter Stacks tt.keyphrase.No_Stacks=空 -- cgit From 6f9466f7251748b7308edea9d845655f3d9b4ac6 Mon Sep 17 00:00:00 2001 From: basdxz Date: Tue, 15 Dec 2020 13:50:35 +0000 Subject: Ender Covers Things missing: -UI -Texture -Recipe -Wiki --- .../technus/tectech/loader/NetworkDispatcher.java | 5 + .../technus/tectech/loader/thing/CoverLoader.java | 4 + .../technus/tectech/loader/thing/ThingsLoader.java | 1 + .../enderStorage/EnderFluidContainer.java | 100 ++++++ .../enderStorage/EnderLinkCoverMessage.java | 122 +++++++ .../mechanics/enderStorage/EnderLinkTag.java | 39 +++ .../mechanics/enderStorage/EnderLinkTank.java | 46 +++ .../enderStorage/EnderWorldSavedData.java | 129 ++++++++ .../technus/tectech/thing/CustomItemList.java | 2 +- .../thing/cover/GT_Cover_TM_EnderFluidLink.java | 356 +++++++++++++++++++++ .../technus/tectech/thing/item/EnderLinkCover.java | 82 +++++ .../blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png | Bin 0 -> 157 bytes .../tectech/textures/items/itemEnderLinkCover.png | Bin 0 -> 169 bytes 13 files changed, 885 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderFluidContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTag.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTank.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderWorldSavedData.java create mode 100644 src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java create mode 100644 src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png create mode 100644 src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java index 581c81d15f..1edd924587 100644 --- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java +++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; +import com.github.technus.tectech.mechanics.enderStorage.EnderLinkCoverMessage; import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; @@ -34,6 +35,10 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher registerMessage(RendererMessage.ClientHandler.class, RendererMessage.RendererData.class); + registerMessage(EnderLinkCoverMessage.ServerHandler.class, EnderLinkCoverMessage.EnderLinkCoverQuery.class); + registerMessage(EnderLinkCoverMessage.ServerUpdateHandler.class, EnderLinkCoverMessage.EnderLinkCoverUpdate.class); + registerMessage(EnderLinkCoverMessage.ClientHandler.class, EnderLinkCoverMessage.EnderLinkCoverData.class); + registerMessage(TextParametersMessage.ServerHandler.class, TextParametersMessage.ParametersTextQuery.class); registerMessage(TextParametersMessage.ServerUpdateHandler.class, TextParametersMessage.ParametersTextUpdate.class); registerMessage(TextParametersMessage.ClientHandler.class, TextParametersMessage.ParametersTextData.class); diff --git a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java index d7e9a21a67..84dd00f65c 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java @@ -1,8 +1,10 @@ package com.github.technus.tectech.loader.thing; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.cover.GT_Cover_TM_EnderFluidLink; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; +import com.github.technus.tectech.thing.item.EnderLinkCover; import com.github.technus.tectech.thing.item.TeslaCoilCover; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; @@ -16,9 +18,11 @@ public class CoverLoader implements Runnable { public void run() { final IIconContainer TESLA_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY"); final IIconContainer TESLA_OVERLAY_ULTIMATE = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY_ULTIMATE"); + final IIconContainer ENDERFLUIDLINK_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/ENDERFLUIDLINK_OVERLAY"); GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 0), new GT_RenderedTexture(TESLA_OVERLAY), new GT_Cover_TM_TeslaCoil()); GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 1), new GT_RenderedTexture(TESLA_OVERLAY_ULTIMATE), new GT_Cover_TM_TeslaCoil_Ultimate()); + GregTech_API.registerCover(new ItemStack(EnderLinkCover.INSTANCE, 1, 0), new GT_RenderedTexture(ENDERFLUIDLINK_OVERLAY), new GT_Cover_TM_EnderFluidLink()); TecTech.LOGGER.info("Cover functionality registered"); } } diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index 7b432dbcb4..c5d8a2bb89 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -60,6 +60,7 @@ public class ThingsLoader implements Runnable { TeslaStaff.run(); TeslaCoilCover.run(); TeslaCoilCapacitor.run(); + EnderLinkCover.run(); TecTech.LOGGER.info("Useful Items registered"); TeslaCoilComponent.run(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderFluidContainer.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderFluidContainer.java new file mode 100644 index 0000000000..1a5ad6a69c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderFluidContainer.java @@ -0,0 +1,100 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +import java.io.Serializable; + +public class EnderFluidContainer implements IFluidHandler, Serializable { + private static final int CAPACITY = 64000; + private int fluidID = -1; + private int fluidQuantity = 0; + + public EnderFluidContainer() { + } + + private FluidStack getFluidStack() { + FluidStack fluidStack = null; + if (fluidID >= 0) { + fluidStack = new FluidStack(fluidID, fluidQuantity); + } + return fluidStack; + } + + private void setFluidStack(FluidStack fluidStack) { + if (fluidStack != null && fluidStack.amount != 0) { + fluidID = fluidStack.getFluidID(); + fluidQuantity = fluidStack.amount; + } else { + fluidID = -1; + fluidQuantity = 0; + } + } + + + @Override + public int fill(ForgeDirection side, FluidStack fluidStackIn, boolean doFill) { + int filledFluid = 0; + FluidStack fluidStackStored = getFluidStack(); + if (fluidStackIn != null) { + if (fluidStackStored == null) { + fluidStackStored = fluidStackIn.copy(); + fluidStackStored.amount = 0; + } + if (fluidStackStored.amount < CAPACITY && fluidStackIn.isFluidEqual(fluidStackStored)) { + filledFluid = Math.min(CAPACITY - fluidStackStored.amount, fluidStackIn.amount); + if (doFill) { + fluidStackStored.amount += filledFluid; + setFluidStack(fluidStackStored); + } + } + } + return filledFluid; + } + + @Override + public FluidStack drain(ForgeDirection side, FluidStack fluidStack, boolean doDrain) { + FluidStack fluidStackOutput = null; + if (fluidStack != null && fluidStack.isFluidEqual(getFluidStack())) { + fluidStackOutput = drain(side, fluidStack.amount, doDrain); + } + return fluidStackOutput; + } + + @Override + public FluidStack drain(ForgeDirection side, int amount, boolean doDrain) { + FluidStack fluidStackOutput = null; + FluidStack fluidStackStored = getFluidStack(); + if (fluidStackStored != null && fluidStackStored.amount > 0) { + int drainedFluid = Math.min(fluidStackStored.amount, amount); + fluidStackOutput = fluidStackStored.copy(); + fluidStackOutput.amount = drainedFluid; + if (doDrain) { + fluidStackStored.amount -= drainedFluid; + if (fluidStackStored.amount == 0) { + fluidStackStored = null; + } + setFluidStack(fluidStackStored); + } + } + return fluidStackOutput; + } + + @Override + public boolean canFill(ForgeDirection forgeDirection, Fluid fluid) { + return true; + } + + @Override + public boolean canDrain(ForgeDirection forgeDirection, Fluid fluid) { + return true; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection forgeDirection) { + return new FluidTankInfo[]{new FluidTankInfo(getFluidStack(), CAPACITY)}; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java new file mode 100644 index 0000000000..de9b10c51d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java @@ -0,0 +1,122 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; +import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fluids.IFluidHandler; + +import java.io.*; +import java.util.Arrays; + +import static com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData.bindEnderLinkTag; +import static com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData.getEnderLinkTag; +import static com.github.technus.tectech.thing.cover.GT_Cover_TM_EnderFluidLink.setEnderLinkTag; + +public class EnderLinkCoverMessage implements IMessage { + EnderLinkTankWithTag messageData; + + public EnderLinkCoverMessage() { + } + + @Override + public void fromBytes(ByteBuf pBuffer) { + try { + //I'd love to know why I need to offset by one byte for this to work + byte[] boop = pBuffer.array(); + boop = Arrays.copyOfRange(boop, 1, boop.length); + InputStream is = new ByteArrayInputStream(boop); + ObjectInputStream ois = new ObjectInputStream(is); + Object data = ois.readObject(); + messageData = (EnderLinkTankWithTag) data; + } catch (Exception ignore) { + } + } + + @Override + public void toBytes(ByteBuf pBuffer) { + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(messageData); + oos.flush(); + InputStream is = new ByteArrayInputStream(baos.toByteArray()); + pBuffer.writeBytes(is, baos.toByteArray().length); + } catch (Exception ignore) { + } + } + + public static class EnderLinkCoverQuery extends EnderLinkCoverMessage { + public EnderLinkCoverQuery() { + } + + public EnderLinkCoverQuery(EnderLinkTag tag, IFluidHandler fluidHandler) { + messageData = new EnderLinkTankWithTag(tag, fluidHandler); + } + } + + public static class EnderLinkCoverUpdate extends EnderLinkCoverMessage { + public EnderLinkCoverUpdate() { + } + + public EnderLinkCoverUpdate(EnderLinkTag tag, IFluidHandler fluidHandler) { + messageData = new EnderLinkTankWithTag(tag, fluidHandler); + } + } + + public static class EnderLinkCoverData extends EnderLinkCoverMessage { + public EnderLinkCoverData() { + } + + public EnderLinkCoverData(EnderLinkTag tag, IFluidHandler fluidHandler) { + messageData = new EnderLinkTankWithTag(tag, fluidHandler); + } + } + + public static class ServerHandler extends AbstractServerMessageHandler { + @Override + public IMessage handleServerMessage(EntityPlayer pPlayer, EnderLinkCoverQuery pMessage, MessageContext pCtx) { + IMessage reply = null; + if (pMessage.messageData != null) { + reply = new EnderLinkCoverData(getEnderLinkTag(pMessage.messageData.getFluidHandler()), + pMessage.messageData.getFluidHandler()); + } + return reply; + } + } + + public static class ServerUpdateHandler extends AbstractServerMessageHandler { + @Override + public IMessage handleServerMessage(EntityPlayer pPlayer, EnderLinkCoverUpdate pMessage, MessageContext pCtx) { + if (pMessage.messageData != null) { + bindEnderLinkTag(pMessage.messageData.getFluidHandler(), pMessage.messageData.getTag()); + } + return null; + } + } + + public static class ClientHandler extends AbstractClientMessageHandler { + @Override + public IMessage handleClientMessage(EntityPlayer pPlayer, EnderLinkCoverData pMessage, MessageContext pCtx) { + if (pMessage.messageData != null) { + setEnderLinkTag(pMessage.messageData.getTag()); + } + return null; + } + } + + private static class EnderLinkTankWithTag extends EnderLinkTank { + private final EnderLinkTag tag; + + public EnderLinkTankWithTag(EnderLinkTag tag, IFluidHandler fluidHandler) { + super(fluidHandler); + this.tag = tag; + } + + public EnderLinkTag getTag() { + return tag; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTag.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTag.java new file mode 100644 index 0000000000..3d7b7a20b8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTag.java @@ -0,0 +1,39 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import com.google.common.base.Objects; + +import java.awt.*; +import java.io.Serializable; +import java.util.UUID; + +public class EnderLinkTag implements Serializable { + private final Color color; + private final UUID player; + + public EnderLinkTag(Color color, UUID player) { + this.color = color; + this.player = player; + } + + public int getColorInt() { + return color.getRGB(); + } + + public UUID getUUID() { + return player; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EnderLinkTag that = (EnderLinkTag) o; + return Objects.equal(color, that.color) && + Objects.equal(player, that.player); + } + + @Override + public int hashCode() { + return Objects.hashCode(color, player); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTank.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTank.java new file mode 100644 index 0000000000..a64a629161 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTank.java @@ -0,0 +1,46 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import com.google.common.base.Objects; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fluids.IFluidHandler; + +import java.io.Serializable; + +public class EnderLinkTank implements Serializable { + private final int X; + private final int Y; + private final int Z; + private final int D; + + public EnderLinkTank(IFluidHandler fluidHandler) { + TileEntity tile = (TileEntity)fluidHandler; + X = tile.xCoord; + Y = tile.yCoord; + Z = tile.zCoord; + D = tile.getWorldObj().provider.dimensionId; + } + + public IFluidHandler getFluidHandler() { + IFluidHandler fluidHandler = null; + TileEntity tile = DimensionManager.getWorld(D).getTileEntity(X, Y, Z); + if (tile instanceof IFluidHandler) fluidHandler = (IFluidHandler) tile; + return fluidHandler; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EnderLinkTank that = (EnderLinkTank) o; + return X == that.X && + Y == that.Y && + Z == that.Z && + D == that.D; + } + + @Override + public int hashCode() { + return Objects.hashCode(X, Y, Z, D); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderWorldSavedData.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderWorldSavedData.java new file mode 100644 index 0000000000..6afa3a494f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderWorldSavedData.java @@ -0,0 +1,129 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.WorldSavedData; +import net.minecraft.world.storage.MapStorage; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fluids.IFluidHandler; + +import java.awt.*; +import java.io.*; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.Reference.MODID; + +public class EnderWorldSavedData extends WorldSavedData { + private static EnderWorldSavedData INSTANCE; + + private static final String DATA_NAME = MODID + "_EnderWorldSavedData"; + private static final String ENDER_LIQUID_TAG_LINK = DATA_NAME + "_EnderLiquidTagLink"; + private static final String ENDER_LIQUID_TANK_LINK = DATA_NAME + "_EnderLiquidTankLink"; + private static final EnderLinkTag DEFAULT_LINK_TAG = new EnderLinkTag(Color.WHITE, null); + + private Map EnderLiquidTagLink = new HashMap<>(); + private Map EnderLiquidTankLink = new HashMap<>(); + + public EnderWorldSavedData() { + super(DATA_NAME); + } + + public EnderWorldSavedData(String s) { + super(s); + } + + @Override + public void readFromNBT(NBTTagCompound nbtTagCompound) { + try { + byte[] ba = nbtTagCompound.getByteArray(ENDER_LIQUID_TAG_LINK); + InputStream is = new ByteArrayInputStream(ba); + ObjectInputStream ois = new ObjectInputStream(is); + Object data = ois.readObject(); + EnderLiquidTagLink = (Map) data; + } catch (IOException | ClassNotFoundException ignored) { + System.out.println("ENDER_LIQUID_TAG_LINK LOAD FAILED"); + System.out.println(ignored); + } + + try { + byte[] ba = nbtTagCompound.getByteArray(ENDER_LIQUID_TANK_LINK); + InputStream is = new ByteArrayInputStream(ba); + ObjectInputStream ois = new ObjectInputStream(is); + Object data = ois.readObject(); + EnderLiquidTankLink = (Map) data; + } catch (IOException | ClassNotFoundException ignored) { + System.out.println("ENDER_LIQUID_TANK_LINK LOAD FAILED"); + System.out.println(ignored); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbtTagCompound) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(EnderLiquidTagLink); + oos.flush(); + byte[] data = bos.toByteArray(); + nbtTagCompound.setByteArray(ENDER_LIQUID_TAG_LINK, data); + } catch (IOException ignored) { + System.out.println("ENDER_LIQUID_TAG_LINK SAVE FAILED"); + System.out.println(ignored); + } + + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(EnderLiquidTankLink); + oos.flush(); + byte[] data = bos.toByteArray(); + nbtTagCompound.setByteArray(ENDER_LIQUID_TANK_LINK, data); + } catch (IOException ignored) { + System.out.println("ENDER_LIQUID_TANK_LINK SAVE FAILED"); + System.out.println(ignored); + } + } + + private static void loadInstance() { + if (INSTANCE == null) { + MapStorage storage = DimensionManager.getWorld(0).mapStorage; + INSTANCE = (EnderWorldSavedData) storage.loadData(EnderWorldSavedData.class, DATA_NAME); + if (INSTANCE == null) { + INSTANCE = new EnderWorldSavedData(); + storage.setData(DATA_NAME, INSTANCE); + } + } + INSTANCE.markDirty(); + } + + private static Map getEnderLiquidLink() { + loadInstance(); + return INSTANCE.EnderLiquidTagLink; + } + + private static Map getEnderLiquidTankLink() { + loadInstance(); + return INSTANCE.EnderLiquidTankLink; + } + + public static EnderFluidContainer getEnderFluidContainer(EnderLinkTag tag) { + if (!getEnderLiquidLink().containsKey(tag)) { + getEnderLiquidLink().put(tag, new EnderFluidContainer()); + } + return getEnderLiquidLink().get(tag); + } + + public static EnderLinkTag getEnderLinkTag(IFluidHandler handler) { + EnderLinkTank tank = new EnderLinkTank(handler); + if (!getEnderLiquidTankLink().containsKey(tank)) { + getEnderLiquidTankLink().put(tank, DEFAULT_LINK_TAG); + } + return getEnderLiquidTankLink().get(tank); + } + + public static void bindEnderLinkTag(IFluidHandler handler, EnderLinkTag tag) { + EnderLinkTank tank = new EnderLinkTank(handler); + getEnderLiquidTankLink().remove(tank); + getEnderLiquidTankLink().put(tank, tag); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index a86695ff4a..44c18fbe09 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -94,7 +94,7 @@ public enum CustomItemList implements IItemContainer { eM_avr_HV, eM_avr_EV, eM_avr_IV, eM_avr_LuV, eM_avr_ZPM, eM_avr_UV, eM_avr_UHV, eM_avr_UEV, eM_avr_UIV, eM_avr_UMV, - scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, + scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkCover, Machine_TeslaCoil_1by1_LV, Machine_TeslaCoil_1by1_MV, Machine_TeslaCoil_1by1_HV, Machine_TeslaCoil_1by1_EV, Machine_TeslaCoil_1by1_IV, Machine_TeslaCoil_2by2_LV, Machine_TeslaCoil_2by2_MV, Machine_TeslaCoil_2by2_HV, Machine_TeslaCoil_2by2_EV, Machine_TeslaCoil_2by2_IV, 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 new file mode 100644 index 0000000000..9404b3af9f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java @@ -0,0 +1,356 @@ +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 eu.usrv.yamcore.auxiliary.PlayerChatHelper; +import gregtech.api.enums.GT_Values; +import gregtech.api.gui.GT_GUICover; +import gregtech.api.gui.widgets.GT_GuiIcon; +import gregtech.api.gui.widgets.GT_GuiIconButton; +import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; +import gregtech.api.interfaces.IGuiScreen; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.net.GT_Packet_TileEntityCover; +import gregtech.api.util.GT_CoverBehavior; +import gregtech.api.util.GT_Utility; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + +import java.awt.*; + +import static com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData.*; + +public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { + private static final int L_PER_TICK = 8000; + private final static int IMPORT_EXPORT_MASK = 0b0001; + private final static int PUBLIC_PRIVATE_MASK = 0b0010; + private static EnderLinkTag tag = new EnderLinkTag(Color.WHITE, null); + + public GT_Cover_TM_EnderFluidLink() { + } + + public static void setEnderLinkTag(EnderLinkTag inputTag) { + if(inputTag != null) { + tag = inputTag; + //Hacky Way to update the gui + GUI_INSTANCE.resetColorField(); + } + } + + private void transferFluid(IFluidHandler source, byte sSide, IFluidHandler target, byte tSide, int amount) { + FluidStack fluidStack = source.drain(ForgeDirection.getOrientation(sSide), amount, false); + + if (fluidStack != null) { + int fluidTransferred = target.fill(ForgeDirection.getOrientation(tSide), fluidStack, true); + source.drain(ForgeDirection.getOrientation(sSide), fluidTransferred, true); + } + } + + private boolean testBit(int aCoverVariable, int bitMask) { + return (aCoverVariable & bitMask) != 0; + } + + private int toggleBit(int aCoverVariable, int bitMask) { + return (aCoverVariable ^ bitMask); + } + + @Override + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + if ((aTileEntity instanceof IFluidHandler)) { + IFluidHandler fluidHandlerSelf = (IFluidHandler) aTileEntity; + IFluidHandler fluidHandlerEnder = getEnderFluidContainer(getEnderLinkTag((IFluidHandler) aTileEntity)); + + if (testBit(aCoverVariable, IMPORT_EXPORT_MASK)) { + transferFluid(fluidHandlerEnder, (byte) 6, fluidHandlerSelf, aSide, L_PER_TICK); + } else { + transferFluid(fluidHandlerSelf, aSide, fluidHandlerEnder, (byte) 6, L_PER_TICK); + } + } + return aCoverVariable; + } + + @Override + public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return ""; + } + + @Override + public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return true; + } + + @Override + public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + int newCoverVariable = toggleBit(aCoverVariable, IMPORT_EXPORT_MASK); + + if (testBit(aCoverVariable, IMPORT_EXPORT_MASK)) { + PlayerChatHelper.SendInfo(aPlayer, "Ender Suction Engaged!");//TODO Translation support + } else { + PlayerChatHelper.SendInfo(aPlayer, "Ender Filling Engaged!"); + } + return newCoverVariable; + } + + @Override + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + //Runs each tick + return 1; + } + + //region GUI + @Override + public boolean hasCoverGUI() { + return true; + } + + @Override + public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) { + //Only open gui if we're placed on a fluid tank + Object gui = null; + if (aTileEntity instanceof IFluidHandler) { + gui = new TM_EnderFluidLinkCover(aSide, aCoverID, coverData, aTileEntity); + } + return gui; + } + + private static TM_EnderFluidLinkCover GUI_INSTANCE; + + private class TM_EnderFluidLinkCover extends GT_GUICover { + private final byte side; + private final int coverID; + private int coverVariable; + private GT_GuiIntegerHexTextBox colorField; + + private final static int START_X = 10; + private final static int START_Y = 25; + private final static int SPACE_X = 18; + private final static int SPACE_Y = 18; + + private final static int SIZE_X = 176; + private final static int SIZE_Y = 107; + + private final static int BOX_SIZE_X = 34; + private final static int BOX_SIZE_Y = 34; + + private final static int TEXT_FIELD_SIZE_X = 72; + private final static int TEXT_FIELD_SIZE_Y = 12; + private final static int TEXT_STRING_LENGTH = 9; + + private final static int FONT_COLOR = 0xFF555555; + private final static int BOX_BORDER_COLOR = 0xFF000000; + + private final static int COLOR_FIELD_ID = 0; + private final static int PUBLIC_BUTTON_ID = 1; + private final static int PRIVATE_BUTTON_ID = 2; + private final static int IMPORT_BUTTON_ID = 3; + private final static int EXPORT_BUTTON_ID = 4; + + private GT_GuiIconButton newButtonWithSpacing(int id, int x, int y, GT_GuiIcon icon) { + return new GT_GuiIconButton(this, id, START_X + SPACE_X * x, START_Y + SPACE_Y * y, icon); + } + + private GT_GuiIntegerHexTextBox newTextField(int id, int x, int y) { + GT_GuiIntegerHexTextBox field = new GT_GuiIntegerHexTextBox(this, id, START_X + SPACE_X * x, + START_Y + SPACE_Y * y, TEXT_FIELD_SIZE_X, TEXT_FIELD_SIZE_Y); + field.setMaxStringLength(TEXT_STRING_LENGTH); + return field; + } + + private int drawNewString(String text, int x, int y) { + int align = 4; + return fontRendererObj.drawString(text, START_X + SPACE_X * x, align + START_Y + SPACE_Y * y, FONT_COLOR); + } + + private void drawColorSquare(int x, int y) { + //Draw the border square + int borderX1 = START_X + SPACE_X * x; + int borderY1 = START_Y + SPACE_Y * y; + int borderX2 = borderX1 + BOX_SIZE_X; + int borderY2 = borderY1 + BOX_SIZE_Y; + drawRect(borderX1, borderY1, borderX2, borderY2, BOX_BORDER_COLOR); + + // + //int white = 0xFFFFFFFF; + //int black = 0xFF000000; + //int checkers_x = 5; + //int checkers_wide = 3; + //int checkers_y = 5; + //int checkers_tall = 3; + //int checkeredX = borderX1 + 1; + //int checkeredY = borderY1 + 1; + //for (int i = 0; i < checkers_x; i++) { + // int checkerX1 = checkeredX + (checkers_wide * i); + // int checkerX2 = checkerX1 + checkers_wide; + // for (int j = 0; j < checkers_y; j++) { + // int checkerY1 = checkeredY + (checkers_tall * j); + // int checkerY2 = checkerY1 + checkers_tall; + // //Sets the color to white-black-white black and snakes around + // int nowColor = (checkers_x * i) + j % 2 == 0 ? white : black; + // drawRect(checkerX1, checkerY1, checkerX2, checkerY2, nowColor); + // } + //} + + int insideX1 = borderX1 + 1; + int insideY1 = borderY1 + 1; + int insideX2 = borderX2 - 1; + int insideY2 = borderY2 - 1; + drawRect(insideX1, insideY1, insideX2, insideY2, tag.getColorInt()); + } + + public TM_EnderFluidLinkCover(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + super(aTileEntity, SIZE_X, SIZE_Y, GT_Utility.intToStack(aCoverID)); + side = aSide; + coverID = aCoverID; + coverVariable = aCoverVariable; + NetworkDispatcher.INSTANCE.sendToServer(new EnderLinkCoverMessage.EnderLinkCoverQuery(tag, (IFluidHandler) tile)); + //Color Value Field + colorField = newTextField(COLOR_FIELD_ID, 2, 1); + GUI_INSTANCE = this; + resetColorField(); + //Public/Private Buttons + newButtonWithSpacing(PUBLIC_BUTTON_ID, 0, 2, GT_GuiIcon.WHITELIST) + .setTooltipText("Public"); + newButtonWithSpacing(PRIVATE_BUTTON_ID, 1, 2, GT_GuiIcon.BLACKLIST) + .setTooltipText("Private"); + //Import/Export Buttons + newButtonWithSpacing(IMPORT_BUTTON_ID, 0, 3, GT_GuiIcon.IMPORT) + .setTooltipText(trans("007", "Import")); + newButtonWithSpacing(EXPORT_BUTTON_ID, 1, 3, GT_GuiIcon.EXPORT) + .setTooltipText(trans("007", "Export")); + } + + @Override + public void drawExtras(int mouseX, int mouseY, float parTicks) { + super.drawExtras(mouseX, mouseY, parTicks); + drawColorSquare(0, 0); + drawNewString("Color Value", 2, 0); + drawNewString("Public/Private", 2, 2); + drawNewString(trans("229", "Import/Export"), 2, 3); + } + + @Override + protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) { + updateButtons(); + } + + @Override + public void buttonClicked(GuiButton btn){ + if (getClickable(btn.id)){ + coverVariable = getNewCoverVariable(btn.id); + GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile)); + } + updateButtons(); + } + + private void updateButtons(){ + GuiButton b; + for (Object o : buttonList) { + b = (GuiButton) o; + b.enabled = getClickable(b.id); + } + } + + private int getNewCoverVariable(int id) { + //TODO make this work between 0 and 1 screwdriver state things + //switch (id) { + // case 0: + // return coverVariable & ~0x1; + // case 1: + // return coverVariable | 0x1; + // case 2: + // if (coverVariable > 5) + // return 0x6 | (coverVariable & ~0xE); + // return (coverVariable & ~0xE); + // case 3: + // if (coverVariable > 5) + // return 0x8 | (coverVariable & ~0xE); + // return 0x2 | (coverVariable & ~0xE); + // case 4: + // if (coverVariable > 5) + // return 0xA | (coverVariable & ~0xE); + // return (0x4 | (coverVariable & ~0xE)); + // case 5: + // if (coverVariable <= 5) + // return coverVariable + 6; + // break; + // case 6: + // if (coverVariable > 5) + // return coverVariable - 6; + //} + return coverVariable; + } + + private boolean getClickable(int id) { + //TODO Make this work for 1 to 2 buttons + //if (coverVariable < 0 | 11 < coverVariable) + // return false; + // + //switch (id) { + // case 0: case 1: + // return (0x1 & coverVariable) != id; + // case 2: + // return (coverVariable % 6) >= 2; + // case 3: + // return (coverVariable % 6) < 2 | 4 <= (coverVariable % 6); + // case 4: + // return (coverVariable % 6) < 4; + // case 5: + // return coverVariable < 6; + // case 6: + // return coverVariable >= 6; + //} + return false; + } + + @Override + public void applyTextBox(GT_GuiIntegerTextBox box) { + try { + String string = box.getText(); + int colorValue = (int) Long.parseLong(string.replaceFirst("#", ""), 16); + tag = new EnderLinkTag(new Color(colorValue, true), tag.getUUID()); + NetworkDispatcher.INSTANCE.sendToServer(new EnderLinkCoverMessage.EnderLinkCoverUpdate(tag, (IFluidHandler) tile)); + } catch (NumberFormatException ignored) { + } + resetColorField(); + } + + @Override + public void resetTextBox(GT_GuiIntegerTextBox box) { + //Solid White becomes: #FFFFFFFF + box.setText("#" + String.format("%08X", tag.getColorInt())); + } + + public void resetColorField() { + resetTextBox(colorField); + } + + private class GT_GuiIntegerHexTextBox extends GT_GuiIntegerTextBox { + public GT_GuiIntegerHexTextBox(IGuiScreen gui, int id, int x, int y, int width, int height) { + super(gui, id, x, y, width, height); + } + + @Override + public boolean validChar(char c, int key) { + boolean isValid; + if (getCursorPosition() == 0) { + isValid = c == '#'; + } else { + isValid = super.validChar(c, key) + || c == 'A' || c == 'B' || c == 'C' || c == 'D' || c == 'E' || c == 'F' + || c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e' || c == 'f'; + } + return isValid; + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java b/src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java new file mode 100644 index 0000000000..9e23d2f076 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java @@ -0,0 +1,82 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.util.CommonValues; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; + +import java.util.List; + +import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.thing.CustomItemList.enderLinkCover; +import static com.github.technus.tectech.thing.CustomItemList.teslaCover; +import static net.minecraft.util.StatCollector.translateToLocal; + + +public final class EnderLinkCover extends Item { + public static EnderLinkCover INSTANCE; + //private static IIcon ultItemIcon; + + private EnderLinkCover() { + setHasSubtypes(true); + setUnlocalizedName("tm.enderlinkcover"); + setTextureName(MODID + ":itemEnderLinkCover"); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.BASS_MARK); + //switch (aStack.getItemDamage()) { + // case 0: + // aList.add(translateToLocal("item.tm.teslaCover.desc.0"));//Tesla-Enables Machines! + // break; + // case 1: + // aList.add(translateToLocal("item.tm.teslaCover.desc.1"));//Tesla-Enables Machines! (BUT LOUDER!!) + // break; + // default: + // aList.add(translateToLocal("item.tm.teslaCover.desc.2"));//Yeet this broken item into some spicy water! + // break; + //} + //aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.3"));//Use on top of a machine to enable Tesla capabilities + //aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.4"));//Who the hell uses cables anyway? + } + + @Override + public String getUnlocalizedName(ItemStack aStack) { + return getUnlocalizedName() + "." + getDamage(aStack); + } + + public static void run() { + INSTANCE = new EnderLinkCover(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + enderLinkCover.set(INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + itemIcon = iconRegister.registerIcon(getIconString()); + //ultItemIcon = iconRegister.registerIcon(MODID + ":itemTeslaCoverUltimate"); + } + + @Override + public IIcon getIconFromDamage(int damage) { + //if (damage == 1) { + // return ultItemIcon; + //} + return itemIcon; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs par2CreativeTabs, List aList) { + aList.add(new ItemStack(aItem, 1, 0)); + //aList.add(new ItemStack(aItem, 1, 1)); + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png new file mode 100644 index 0000000000..49ba0d2db9 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png differ diff --git a/src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png b/src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png new file mode 100644 index 0000000000..e57d83adff Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png differ -- cgit From 9eb861018aedb4b6e70bc664587f1944bcc459bf Mon Sep 17 00:00:00 2001 From: basdxz Date: Wed, 16 Dec 2020 12:40:12 +0000 Subject: Ender Covers UI Completed the On-Click UI --- .../thing/cover/GT_Cover_TM_EnderFluidLink.java | 133 ++++++++++----------- 1 file changed, 66 insertions(+), 67 deletions(-) (limited to 'src/main') 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 9404b3af9f..03c612c190 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 @@ -11,6 +11,8 @@ import gregtech.api.gui.widgets.GT_GuiIconButton; import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; import gregtech.api.interfaces.IGuiScreen; import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.net.GT_Packet_TileEntityCover; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; @@ -22,6 +24,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; import java.awt.*; +import java.util.UUID; import static com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData.*; @@ -29,7 +32,7 @@ public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { private static final int L_PER_TICK = 8000; private final static int IMPORT_EXPORT_MASK = 0b0001; private final static int PUBLIC_PRIVATE_MASK = 0b0010; - private static EnderLinkTag tag = new EnderLinkTag(Color.WHITE, null); + private static EnderLinkTag tag = new EnderLinkTag(Color.WHITE, null);//Client-Sided public GT_Cover_TM_EnderFluidLink() { } @@ -179,27 +182,30 @@ public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { int borderY2 = borderY1 + BOX_SIZE_Y; drawRect(borderX1, borderY1, borderX2, borderY2, BOX_BORDER_COLOR); - // - //int white = 0xFFFFFFFF; - //int black = 0xFF000000; - //int checkers_x = 5; - //int checkers_wide = 3; - //int checkers_y = 5; - //int checkers_tall = 3; - //int checkeredX = borderX1 + 1; - //int checkeredY = borderY1 + 1; - //for (int i = 0; i < checkers_x; i++) { - // int checkerX1 = checkeredX + (checkers_wide * i); - // int checkerX2 = checkerX1 + checkers_wide; - // for (int j = 0; j < checkers_y; j++) { - // int checkerY1 = checkeredY + (checkers_tall * j); - // int checkerY2 = checkerY1 + checkers_tall; - // //Sets the color to white-black-white black and snakes around - // int nowColor = (checkers_x * i) + j % 2 == 0 ? white : black; - // drawRect(checkerX1, checkerY1, checkerX2, checkerY2, nowColor); - // } - //} + //Draw Checkerboard Pattern + int white = 0xFFFFFFFF; + int grey = 0xFFBFBFBF; + boolean whiteOrGrey = true; + int cGridXStart = borderX1 + 1; + int cGridYStart = borderY1 + 1; + int cGridXToDraw = 4; + int cGridYToDraw = 4; + int cSquareWidth = 8; + int cSquareHeight = 8; + for (int i = 0; i < cGridXToDraw; i++) { + for (int j = 0; j < cGridYToDraw; j++) { + int cBoxX1 = cGridXStart + (cSquareWidth * i); + int cBoxY1 = cGridYStart + (cSquareHeight * j); + int cBoxX2 = cBoxX1 + cSquareWidth; + int cBoxY2 = cBoxY1 + cSquareHeight; + int cBoxColor = whiteOrGrey ? white : grey; + drawRect(cBoxX1, cBoxY1, cBoxX2, cBoxY2, cBoxColor); + whiteOrGrey = !whiteOrGrey; + } + whiteOrGrey = !whiteOrGrey; + } + //Draw the actual color int insideX1 = borderX1 + 1; int insideY1 = borderY1 + 1; int insideX2 = borderX2 - 1; @@ -260,56 +266,49 @@ public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { } } + private void switchPrivatePublic(int coverVar) { + UUID ownerUUID = tag.getUUID(); + if (testBit(coverVar, PUBLIC_PRIVATE_MASK)){ + if (tile instanceof BaseMetaTileEntity){ + BaseMetaTileEntity mte = (BaseMetaTileEntity) tile; + ownerUUID = mte.getOwnerUuid(); + } + } else { + ownerUUID = null; + } + EnderLinkTag newTag = new EnderLinkTag(new Color(tag.getColorInt(), true), ownerUUID); + NetworkDispatcher.INSTANCE.sendToServer(new EnderLinkCoverMessage.EnderLinkCoverUpdate(newTag, (IFluidHandler) tile)); + } + private int getNewCoverVariable(int id) { - //TODO make this work between 0 and 1 screwdriver state things - //switch (id) { - // case 0: - // return coverVariable & ~0x1; - // case 1: - // return coverVariable | 0x1; - // case 2: - // if (coverVariable > 5) - // return 0x6 | (coverVariable & ~0xE); - // return (coverVariable & ~0xE); - // case 3: - // if (coverVariable > 5) - // return 0x8 | (coverVariable & ~0xE); - // return 0x2 | (coverVariable & ~0xE); - // case 4: - // if (coverVariable > 5) - // return 0xA | (coverVariable & ~0xE); - // return (0x4 | (coverVariable & ~0xE)); - // case 5: - // if (coverVariable <= 5) - // return coverVariable + 6; - // break; - // case 6: - // if (coverVariable > 5) - // return coverVariable - 6; - //} - return coverVariable; + int tempCoverVariable = coverVariable; + switch (id) { + case PUBLIC_BUTTON_ID: case PRIVATE_BUTTON_ID: + tempCoverVariable = toggleBit(tempCoverVariable, PUBLIC_PRIVATE_MASK); + switchPrivatePublic(tempCoverVariable); + break; + case IMPORT_BUTTON_ID: case EXPORT_BUTTON_ID: + tempCoverVariable = toggleBit(tempCoverVariable, IMPORT_EXPORT_MASK); + } + return tempCoverVariable; } private boolean getClickable(int id) { - //TODO Make this work for 1 to 2 buttons - //if (coverVariable < 0 | 11 < coverVariable) - // return false; - // - //switch (id) { - // case 0: case 1: - // return (0x1 & coverVariable) != id; - // case 2: - // return (coverVariable % 6) >= 2; - // case 3: - // return (coverVariable % 6) < 2 | 4 <= (coverVariable % 6); - // case 4: - // return (coverVariable % 6) < 4; - // case 5: - // return coverVariable < 6; - // case 6: - // return coverVariable >= 6; - //} - return false; + boolean canBeClicked = false; + switch (id) { + case PUBLIC_BUTTON_ID: + canBeClicked = testBit(coverVariable, PUBLIC_PRIVATE_MASK); + break; + case PRIVATE_BUTTON_ID: + canBeClicked = !testBit(coverVariable, PUBLIC_PRIVATE_MASK); + break; + case IMPORT_BUTTON_ID: + canBeClicked = testBit(coverVariable, IMPORT_EXPORT_MASK); + break; + case EXPORT_BUTTON_ID: + canBeClicked = !testBit(coverVariable, IMPORT_EXPORT_MASK); + } + return canBeClicked; } @Override -- cgit From 6fec93b8f4f32abc64a0b6643c41ace97f8eb9d1 Mon Sep 17 00:00:00 2001 From: basdxz Date: Sat, 19 Dec 2020 11:06:57 +0000 Subject: Added Ender Fluid Link Resources -Added Locale -Added Textures --- .../technus/tectech/loader/thing/CoverLoader.java | 4 +- .../technus/tectech/loader/thing/ThingsLoader.java | 2 +- .../enderStorage/EnderLinkCoverMessage.java | 12 ++- .../technus/tectech/thing/CustomItemList.java | 2 +- .../tectech/thing/item/EnderFluidLinkCover.java | 47 ++++++++++++ .../technus/tectech/thing/item/EnderLinkCover.java | 82 --------------------- .../blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png | Bin 157 -> 1986 bytes .../iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta | 5 ++ src/main/resources/assets/tectech/lang/en_US.lang | 5 ++ .../textures/items/itemEnderFluidLinkCover.png | Bin 0 -> 574 bytes .../tectech/textures/items/itemEnderLinkCover.png | Bin 169 -> 0 bytes 11 files changed, 72 insertions(+), 87 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/thing/item/EnderFluidLinkCover.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta create mode 100644 src/main/resources/assets/tectech/textures/items/itemEnderFluidLinkCover.png delete mode 100644 src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java index 84dd00f65c..1376049f5a 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java @@ -4,7 +4,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.cover.GT_Cover_TM_EnderFluidLink; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; -import com.github.technus.tectech.thing.item.EnderLinkCover; +import com.github.technus.tectech.thing.item.EnderFluidLinkCover; import com.github.technus.tectech.thing.item.TeslaCoilCover; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; @@ -22,7 +22,7 @@ public class CoverLoader implements Runnable { GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 0), new GT_RenderedTexture(TESLA_OVERLAY), new GT_Cover_TM_TeslaCoil()); GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 1), new GT_RenderedTexture(TESLA_OVERLAY_ULTIMATE), new GT_Cover_TM_TeslaCoil_Ultimate()); - GregTech_API.registerCover(new ItemStack(EnderLinkCover.INSTANCE, 1, 0), new GT_RenderedTexture(ENDERFLUIDLINK_OVERLAY), new GT_Cover_TM_EnderFluidLink()); + GregTech_API.registerCover(new ItemStack(EnderFluidLinkCover.INSTANCE, 1, 0), new GT_RenderedTexture(ENDERFLUIDLINK_OVERLAY), new GT_Cover_TM_EnderFluidLink()); TecTech.LOGGER.info("Cover functionality registered"); } } diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index c5d8a2bb89..6fa0ba2bb3 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -60,7 +60,7 @@ public class ThingsLoader implements Runnable { TeslaStaff.run(); TeslaCoilCover.run(); TeslaCoilCapacitor.run(); - EnderLinkCover.run(); + EnderFluidLinkCover.run(); TecTech.LOGGER.info("Useful Items registered"); TeslaCoilComponent.run(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java index de9b10c51d..081ce3b309 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java @@ -4,6 +4,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; +import gregtech.api.metatileentity.BaseMetaTileEntity; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fluids.IFluidHandler; @@ -91,7 +92,16 @@ public class EnderLinkCoverMessage implements IMessage { @Override public IMessage handleServerMessage(EntityPlayer pPlayer, EnderLinkCoverUpdate pMessage, MessageContext pCtx) { if (pMessage.messageData != null) { - bindEnderLinkTag(pMessage.messageData.getFluidHandler(), pMessage.messageData.getTag()); + EnderLinkTag tag = pMessage.messageData.getTag(); + IFluidHandler handler = pMessage.messageData.getFluidHandler(); + if (tag.getUUID() == null){ + bindEnderLinkTag(handler, tag); + } else if (handler instanceof BaseMetaTileEntity) { + BaseMetaTileEntity baseTile = (BaseMetaTileEntity) handler; + if (tag.getUUID() == baseTile.getOwnerUuid()){ + bindEnderLinkTag(handler, tag); + } + } } return null; } diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 44c18fbe09..9bd69c67ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -94,7 +94,7 @@ public enum CustomItemList implements IItemContainer { eM_avr_HV, eM_avr_EV, eM_avr_IV, eM_avr_LuV, eM_avr_ZPM, eM_avr_UV, eM_avr_UHV, eM_avr_UEV, eM_avr_UIV, eM_avr_UMV, - scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkCover, + scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkFluidCover, Machine_TeslaCoil_1by1_LV, Machine_TeslaCoil_1by1_MV, Machine_TeslaCoil_1by1_HV, Machine_TeslaCoil_1by1_EV, Machine_TeslaCoil_1by1_IV, Machine_TeslaCoil_2by2_LV, Machine_TeslaCoil_2by2_MV, Machine_TeslaCoil_2by2_HV, Machine_TeslaCoil_2by2_EV, Machine_TeslaCoil_2by2_IV, diff --git a/src/main/java/com/github/technus/tectech/thing/item/EnderFluidLinkCover.java b/src/main/java/com/github/technus/tectech/thing/item/EnderFluidLinkCover.java new file mode 100644 index 0000000000..57a882ec26 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/EnderFluidLinkCover.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.util.CommonValues; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.List; + +import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.thing.CustomItemList.enderLinkFluidCover; +import static net.minecraft.util.StatCollector.translateToLocal; + +public final class EnderFluidLinkCover extends Item { + public static EnderFluidLinkCover INSTANCE; + + private EnderFluidLinkCover() { + setHasSubtypes(true); + setUnlocalizedName("tm.enderfluidlinkcover"); + setTextureName(MODID + ":itemEnderFluidLinkCover"); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.BASS_MARK); + aList.add(translateToLocal("item.tm.enderfluidlinkcover.desc.0"));//Ender-Fluid-Enables Machines! + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.enderfluidlinkcover.desc.1"));//Use on any side of a fluid tank to link it to the Ender + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.enderfluidlinkcover.desc.2"));//Ender Tanks so are laggy -Bot from the Chads of NH + } + + public static void run() { + INSTANCE = new EnderFluidLinkCover(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + enderLinkFluidCover.set(INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + itemIcon = iconRegister.registerIcon(getIconString()); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java b/src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java deleted file mode 100644 index 9e23d2f076..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/EnderLinkCover.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import com.github.technus.tectech.util.CommonValues; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -import java.util.List; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.thing.CustomItemList.enderLinkCover; -import static com.github.technus.tectech.thing.CustomItemList.teslaCover; -import static net.minecraft.util.StatCollector.translateToLocal; - - -public final class EnderLinkCover extends Item { - public static EnderLinkCover INSTANCE; - //private static IIcon ultItemIcon; - - private EnderLinkCover() { - setHasSubtypes(true); - setUnlocalizedName("tm.enderlinkcover"); - setTextureName(MODID + ":itemEnderLinkCover"); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.BASS_MARK); - //switch (aStack.getItemDamage()) { - // case 0: - // aList.add(translateToLocal("item.tm.teslaCover.desc.0"));//Tesla-Enables Machines! - // break; - // case 1: - // aList.add(translateToLocal("item.tm.teslaCover.desc.1"));//Tesla-Enables Machines! (BUT LOUDER!!) - // break; - // default: - // aList.add(translateToLocal("item.tm.teslaCover.desc.2"));//Yeet this broken item into some spicy water! - // break; - //} - //aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.3"));//Use on top of a machine to enable Tesla capabilities - //aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.4"));//Who the hell uses cables anyway? - } - - @Override - public String getUnlocalizedName(ItemStack aStack) { - return getUnlocalizedName() + "." + getDamage(aStack); - } - - public static void run() { - INSTANCE = new EnderLinkCover(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - enderLinkCover.set(INSTANCE); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) { - itemIcon = iconRegister.registerIcon(getIconString()); - //ultItemIcon = iconRegister.registerIcon(MODID + ":itemTeslaCoverUltimate"); - } - - @Override - public IIcon getIconFromDamage(int damage) { - //if (damage == 1) { - // return ultItemIcon; - //} - return itemIcon; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - aList.add(new ItemStack(aItem, 1, 0)); - //aList.add(new ItemStack(aItem, 1, 1)); - } -} diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png index 49ba0d2db9..010bc0888d 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":8 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index b81b865b22..9f49d692b8 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -87,6 +87,11 @@ item.tm.teslaCover.desc.4=Who the hell uses cables anyway? item.tm.teslaStaff.name=Tesla Staff item.tm.teslaStaff.desc=Power of the gods, at the whim of a mortal! +item.tm.enderfluidlinkcover.name=Ender Fluid Link Cover +item.tm.enderfluidlinkcover.desc.0=Ender-Fluid-Enables Machines! +item.tm.enderfluidlinkcover.desc.1=Use on any side of a fluid tank to link it to the Ender +item.tm.enderfluidlinkcover.desc.2=Ender Tanks so are laggy -Bot from the Chads of NH + #Death Messages death.attack.microwaving=%1$s was dehydrated by radiation. death.attack.microwaving.player=%1$s was dehydrated by radiation while fighting %2$s. diff --git a/src/main/resources/assets/tectech/textures/items/itemEnderFluidLinkCover.png b/src/main/resources/assets/tectech/textures/items/itemEnderFluidLinkCover.png new file mode 100644 index 0000000000..201f7e4090 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemEnderFluidLinkCover.png differ diff --git a/src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png b/src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png deleted file mode 100644 index e57d83adff..0000000000 Binary files a/src/main/resources/assets/tectech/textures/items/itemEnderLinkCover.png and /dev/null differ -- cgit From f71194d635e5ebf7d82ab4d402be58e6de60638d Mon Sep 17 00:00:00 2001 From: basdxz Date: Sat, 19 Dec 2020 11:48:49 +0000 Subject: Ender Fluid Covers Recipe -GTNH Recipe --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 0cfd8242ce..2609a81860 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1686,7 +1686,13 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NickelZincFerrite, 2), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 8), }, Materials.SolderingAlloy.getMolten(72), CustomItemList.teslaCover.getWithDamage(1, 1), 320, 7680); - + //Ender Fluid Link Cover + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Enderium, 4), + ItemList.Sensor_LuV.get(1), + ItemList.Emitter_LuV.get(1), + ItemList.Electric_Pump_LuV.get(1), + }, Materials.Chrome.getMolten(288), CustomItemList.enderLinkFluidCover.getWithDamage(1, 0), 320, 30720); //endregion //region recycling -- cgit From a5a0df0e6eee81011eb5c359724d9001c7ca1d11 Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 21 Dec 2020 00:55:26 +0000 Subject: Fixes Tesla Server-Side -Added Client-Side annotation to the relevant methods -Updated GT5u --- build.properties | 4 ++-- .../com/github/technus/tectech/mechanics/spark/RendererMessage.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/build.properties b/build.properties index 578a6b6e77..b376d96a59 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=778 -gregtech.version=5.09.33.57 +gregtech.jenkinsbuild=813 +gregtech.version=5.09.34.01 #cofhcore.version=[1.7.10]3.1.4-329-dev cofh_core_version=2388751 yamcore.version=0.5.79 diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java index 4004a8d826..58356774cc 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java @@ -3,6 +3,8 @@ package com.github.technus.tectech.mechanics.spark; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; @@ -16,7 +18,7 @@ import java.util.Arrays; import java.util.HashSet; public class RendererMessage implements IMessage { - HashSet sparkList = new HashSet(); + HashSet sparkList; public RendererMessage() { } @@ -69,6 +71,7 @@ public class RendererMessage implements IMessage { } } + @SideOnly(Side.CLIENT) private static void thaumLightning(int tX, int tY, int tZ, int tXN, int tYN, int tZN, int wID) { //This is enough to check for thaum, since it only ever matters for client side effects (Tested not to crash) if (Loader.isModLoaded("Thaumcraft")) { -- cgit From 04d1f031214f3de3b7896ae39776a81535c17103 Mon Sep 17 00:00:00 2001 From: Technus Date: Fri, 1 Jan 2021 15:16:22 +0100 Subject: Add compatibility for upgrading GT controllers --- .../metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') 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 8abb027d3f..85111682ee 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 @@ -812,7 +812,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), Rotation.byIndex(aNBT.getByte("eRotation")), Flip.byIndex(aNBT.getByte("eFlip"))); - eParameters = aNBT.getBoolean("eParam"); + eParameters = !aNBT.hasKey("eParam") || aNBT.getBoolean("eParam"); ePowerPass = aNBT.getBoolean("ePass"); eSafeVoid = aNBT.getBoolean("eVoid"); eDismantleBoom = aNBT.getBoolean("eBoom"); -- cgit From 86eb4d90663b2c96325c6746b21993b816127786 Mon Sep 17 00:00:00 2001 From: basdxz Date: Tue, 5 Jan 2021 16:05:17 +0000 Subject: Undo gradle changes on this branch for a touch --- .../dreamcraft/DreamCraftRecipeLoader.java | 114 ++++++++++----------- .../tectech/thing/casing/GT_Block_CasingsBA0.java | 8 +- .../thing/cover/GT_Cover_TM_EnderFluidLink.java | 1 - .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 6 +- 4 files changed, 62 insertions(+), 67 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 2609a81860..4fb21a2387 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -43,7 +43,7 @@ public class DreamCraftRecipeLoader implements Runnable { try { ADD_ASSEMBLER_RECIPE.invoke(GT_Values.RA, items, fluid, output, time, eut, true); } catch (Exception e) { - throw new RuntimeException("Failed to add clean room assembler recipe! " +output.getDisplayName(),e); + throw new RuntimeException("Failed to add clean room assembler recipe! " + output.getDisplayName(), e); } } //endregion @@ -269,9 +269,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 4)}, Materials.Electrum.getMolten(288), CustomItemList.eM_energyMulti16_LuV.get(1), 200, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_ZPM_LuV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 6)}, Materials.Tungsten.getMolten(288), CustomItemList.eM_energyMulti64_LuV.get(1), 400, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 4)}, Materials.Electrum.getMolten(288), CustomItemList.eM_energyMulti16_LuV.get(1), 200, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_ZPM_LuV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 6)}, Materials.Tungsten.getMolten(288), CustomItemList.eM_energyMulti64_LuV.get(1), 400, 7680); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2)}, Materials.Silver.getMolten(576), CustomItemList.eM_energyMulti4_ZPM.get(1), 100, 30720); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), CustomItemList.eM_energyMulti4_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 4)}, Materials.Electrum.getMolten(576), CustomItemList.eM_energyMulti16_ZPM.get(1), 200, 30720); @@ -294,9 +294,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); //Buck Converter IV-UIV - if(Loader.isModLoaded("bartworks")) { + if (Loader.isModLoaded("bartworks")) { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(288), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.NiobiumTitanium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.NiobiumTitanium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(288), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Naquadah, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(288), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UEV_UHV").get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.ElectrumFlux, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(288), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); @@ -560,7 +560,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ getItemContainer("WetTransformer_ZPM_LuV").get(1), getItemContainer("HighEnergyFlowCircuit").get(1), - GT_OreDictUnificator.get(OrePrefixes.wireGt01, getOrDefault("SuperconductorLuV",Materials.Superconductor), 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, getOrDefault("SuperconductorLuV", Materials.Superconductor), 16), ItemList.valueOf("Circuit_Chip_UHPIC").get(2), }, Materials.TungstenSteel.getMolten(576), CustomItemList.Machine_Multi_Transformer.get(1), 400, 30720); @@ -608,48 +608,48 @@ public class DreamCraftRecipeLoader implements Runnable { //Matter Junction TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_Switch.get(1), 8000, 32, 500000, 4, new ItemStack[]{ - CustomItemList.Machine_Multi_Transformer.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), - ItemList.Robot_Arm_LuV.get(2), - ItemList.Electric_Piston_LuV.get(2), - ItemList.Circuit_Wetwaresupercomputer.get(2), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 4), - }, new FluidStack[]{ - Materials.UUMatter.getFluid(1000), - Materials.Naquadah.getMolten(1296), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), - Materials.Osmium.getMolten(1296), - }, CustomItemList.Machine_Multi_EMjunction.get(1), 12000, 100000); + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Robot_Arm_LuV.get(2), + ItemList.Electric_Piston_LuV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(2), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 4), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMjunction.get(1), 12000, 100000); //Matter Quantizer TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Input_UV.get(1), 12000, 32, 500000, 6, new ItemStack[]{ - CustomItemList.Machine_Multi_Transformer.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), - ItemList.Emitter_UV.get(2), - ItemList.Circuit_Wetwaresupercomputer.get(1), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 2), - }, new FluidStack[]{ - Materials.UUMatter.getFluid(1000), - Materials.Naquadah.getMolten(1296), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), - Materials.Osmium.getMolten(1296), - }, CustomItemList.Machine_Multi_MatterToEM.get(1), 12000, 100000); + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Emitter_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_MatterToEM.get(1), 12000, 100000); //Matter DeQuantizer TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Output_UV.get(1), 12000, 32, 500000, 6, new ItemStack[]{ - CustomItemList.Machine_Multi_Transformer.get(1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), - ItemList.Sensor_UV.get(2), - ItemList.Circuit_Wetwaresupercomputer.get(1), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 2), - }, new FluidStack[]{ - Materials.UUMatter.getFluid(1000), - Materials.Naquadah.getMolten(1296), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), - Materials.Osmium.getMolten(1296), - }, CustomItemList.Machine_Multi_EMToMatter.get(1), 12000, 100000); + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Sensor_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMToMatter.get(1), 12000, 100000); //Essentia Quantizer TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_MatterToEM.get(1), @@ -1193,22 +1193,22 @@ public class DreamCraftRecipeLoader implements Runnable { //Deep Dark Portal TT_recipeAdder.addResearchableAssemblylineRecipe(GT_ModHandler.getModItem("dreamcraft", "item.HeavyDutyPlateTier8", 1, 0), 16777216, 2048, 2000000, 64, new Object[]{ - GT_ModHandler.getModItem("ExtraUtilities", "cobblestone_compressed", 1, 7), - GT_ModHandler.getModItem("IC2", "blockMachine2", 1, 0), - GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 4L), - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - GT_ModHandler.getModItem("dreamcraft", "item.PicoWafer", 32, 0), - ItemList.Robot_Arm_UEV.get(4), - ItemList.Emitter_UEV.get(4), - ItemList.Sensor_UEV.get(4), - }, new FluidStack[]{ - new FluidStack(FluidRegistry.getFluid("oganesson"), 50000), - Materials.Infinity.getMolten(9216L), - Materials.Cheese.getMolten(232000L), - }, ItemList.Block_BedrockiumCompressed.get(1), 10000, 5000000); + GT_ModHandler.getModItem("ExtraUtilities", "cobblestone_compressed", 1, 7), + GT_ModHandler.getModItem("IC2", "blockMachine2", 1, 0), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 4L), + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + GT_ModHandler.getModItem("dreamcraft", "item.PicoWafer", 32, 0), + ItemList.Robot_Arm_UEV.get(4), + ItemList.Emitter_UEV.get(4), + ItemList.Sensor_UEV.get(4), + }, new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("oganesson"), 50000), + Materials.Infinity.getMolten(9216L), + Materials.Cheese.getMolten(232000L), + }, ItemList.Block_BedrockiumCompressed.get(1), 10000, 5000000); //Batteries diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java index 0d2f710ae9..d2c34941ef 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java @@ -18,14 +18,12 @@ import net.minecraft.world.IBlockAccess; import java.util.List; import static com.github.technus.tectech.TecTech.tectechTexturePage1; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; /** * Created by danie_000 on 03.10.2016. */ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { - public static final byte texturePage = tectechTexturePage1; - public static final short textureOffset = (texturePage << 7) + 16;//Start of PAGE 8 (which is the 9th page) (8*128)+16 - private static IIcon[] tM0 = new IIcon[2]; private static IIcon[] tM1 = new IIcon[2]; private static IIcon[] tM2 = new IIcon[2]; @@ -37,10 +35,12 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { private static IIcon[] tM8 = new IIcon[2]; private static IIcon[] tM9 = new IIcon[2]; + private static final byte START_INDEX = 16; + public GT_Block_CasingsBA0() { super(GT_Item_CasingsBA0.class, "gt.blockcasingsBA0", GT_Material_Casings.INSTANCE); for (byte b = 0; b < 16; b = (byte) (b + 1)) { - Textures.BlockIcons.casingTexturePages[texturePage][b + 16] = new GT_CopiedBlockTexture(this, 6, b); + Textures.BlockIcons.casingTexturePages[texturePage][b + START_INDEX] = new GT_CopiedBlockTexture(this, 6, b); /*IMPORTANT for block recoloring**/ } 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 03c612c190..c5243b8bc5 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 @@ -12,7 +12,6 @@ import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; import gregtech.api.interfaces.IGuiScreen; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.net.GT_Packet_TileEntityCover; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 580e6195ad..864b68e21f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -72,10 +72,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F; private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false - //Face icons - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - private int mTier = 0; //Determines max voltage (LV to ZPM) private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon (Does not match actual plasma tiers) @@ -443,9 +439,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER"); ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER_ACTIVE"); - super.registerIcons(aBlockIconRegister); } @Override -- cgit From 775f3f6ca467af78c0d5b1b530d1a3d8964124f2 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Thu, 7 Jan 2021 12:14:13 -0500 Subject: Add recipe for debug maint hatch (#47) * Add recipe for debug maint hatch * Change name/description of the debug maint hatch * Reduced components * Reduce tape amount * Revert joke description * Revert the comment too --- .../dreamcraft/DreamCraftRecipeLoader.java | 135 ++++++++++++--------- .../tectech/loader/thing/MachineLoader.java | 2 +- ...T_MetaTileEntity_Hatch_CreativeMaintenance.java | 2 +- src/main/resources/assets/tectech/lang/en_US.lang | 6 +- 4 files changed, 82 insertions(+), 63 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 4fb21a2387..00b31915c2 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1190,67 +1190,86 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Concrete.getMolten(73728L) }, getItemContainer("StargateFramePart").get(1L), 72000, 2000000); - //Deep Dark Portal - TT_recipeAdder.addResearchableAssemblylineRecipe(GT_ModHandler.getModItem("dreamcraft", "item.HeavyDutyPlateTier8", 1, 0), - 16777216, 2048, 2000000, 64, new Object[]{ - GT_ModHandler.getModItem("ExtraUtilities", "cobblestone_compressed", 1, 7), - GT_ModHandler.getModItem("IC2", "blockMachine2", 1, 0), - GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 4L), - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, - GT_ModHandler.getModItem("dreamcraft", "item.PicoWafer", 32, 0), - ItemList.Robot_Arm_UEV.get(4), - ItemList.Emitter_UEV.get(4), - ItemList.Sensor_UEV.get(4), - }, new FluidStack[]{ - new FluidStack(FluidRegistry.getFluid("oganesson"), 50000), - Materials.Infinity.getMolten(9216L), - Materials.Cheese.getMolten(232000L), - }, ItemList.Block_BedrockiumCompressed.get(1), 10000, 5000000); - - - //Batteries - TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tritanium, 64L), - new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, - new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, - new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, - new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, - ItemList.Energy_Cluster.get(8L), - ItemList.Field_Generator_UV.get(2), - ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Parts_DiodeASMD.get(32), - GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 32), - }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(2880), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) - }, ItemList.ZPM2.get(1), 3000, 400000); - - TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.ZPM2.get(1L), 24000, 64, 200000, 6, new Object[]{ - GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, - ItemList.ZPM2.get(8), - ItemList.Field_Generator_UHV.get(4), - ItemList.Circuit_Wafer_UHPIC.get(64), - ItemList.Circuit_Wafer_UHPIC.get(64), - ItemList.Circuit_Wafer_SoC2.get(32), - ItemList.Circuit_Parts_DiodeASMD.get(64), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), - }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760), - Materials.Naquadria.getMolten(9216), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) - }, ItemList.ZPM3.get(1), 4000, 1600000); } //endregion + + //Deep Dark Portal + TT_recipeAdder.addResearchableAssemblylineRecipe(GT_ModHandler.getModItem("dreamcraft", "item.HeavyDutyPlateTier8", 1, 0), + 16777216, 2048, 2000000, 64, new Object[]{ + GT_ModHandler.getModItem("ExtraUtilities", "cobblestone_compressed", 1, 7), + GT_ModHandler.getModItem("IC2", "blockMachine2", 1, 0), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 4L), + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + GT_ModHandler.getModItem("dreamcraft", "item.PicoWafer", 32, 0), + ItemList.Robot_Arm_UEV.get(4), + ItemList.Emitter_UEV.get(4), + ItemList.Sensor_UEV.get(4), + }, new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("oganesson"), 50000), + Materials.Infinity.getMolten(9216L), + Materials.Cheese.getMolten(232000L), + }, ItemList.Block_BedrockiumCompressed.get(1), 10000, 5000000); + + //Debug maintenance hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_AutoMaintenance.get(1L), + 2764800, 128, 500000, 6, new Object[]{ + ItemList.Hatch_AutoMaintenance.get(1L), + ItemList.Robot_Arm_UV.get(1L), + ItemList.Electric_Pump_UV.get(1L), + ItemList.Conveyor_Module_UV.get(1L), + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 4L}, + ItemList.Energy_LapotronicOrb2.get(1L), + ItemList.Duct_Tape.get(64L), + ItemList.Duct_Tape.get(64L), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Americium, 64L), + }, new FluidStack[]{ + Materials.Lubricant.getFluid(256000), + Materials.SolderingAlloy.getMolten(1296L), + }, CustomItemList.hatch_CreativeMaintenance.get(1), 6000, 500000); + + //Batteries + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tritanium, 64L), + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + ItemList.Energy_Cluster.get(8L), + ItemList.Field_Generator_UV.get(2), + ItemList.Circuit_Wafer_HPIC.get(64), + ItemList.Circuit_Wafer_HPIC.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(32), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 32), + }, new FluidStack[]{ + Materials.SolderingAlloy.getMolten(2880), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) + }, ItemList.ZPM2.get(1), 3000, 400000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.ZPM2.get(1L), 24000, 64, 200000, 6, new Object[]{ + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + ItemList.ZPM2.get(8), + ItemList.Field_Generator_UHV.get(4), + ItemList.Circuit_Wafer_UHPIC.get(64), + ItemList.Circuit_Wafer_UHPIC.get(64), + ItemList.Circuit_Wafer_SoC2.get(32), + ItemList.Circuit_Parts_DiodeASMD.get(64), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), + }, new FluidStack[]{ + Materials.SolderingAlloy.getMolten(3760), + Materials.Naquadria.getMolten(9216), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) + }, ItemList.ZPM3.get(1), 4000, 1600000); + + //region singleblocks //Tesla Transceiver LV 1A diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 8a46732e66..0bf8c57f24 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -664,7 +664,7 @@ public class MachineLoader implements Runnable { // =================================================================================================== Machine_DebugPollutor.set(new GT_MetaTileEntity_DebugPollutor(15495, "debug.tt.pollutor", "Debug Pollution Generator", 15).getStackForm(1)); hatch_CreativeData.set(new GT_MetaTileEntity_Hatch_CreativeData(15496, "debug.tt.data", "Debug Data Hatch", 15).getStackForm(1)); - hatch_CreativeMaintenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance Hatch", 15).getStackForm(1L)); + hatch_CreativeMaintenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Auto-Taping Maintenance Hatch", 15).getStackForm(1L)); Machine_DebugGenny.set(new GT_MetaTileEntity_DebugPowerGenerator(15498, "debug.tt.genny", "Debug Power Generator", 15).getStackForm(1L)); Machine_DebugWriter.set(new GT_MetaTileEntity_DebugStructureWriter(15499, "debug.tt.writer", "Debug Structure Writer", 15).getStackForm(1L)); UnusedStuff.set(new ItemStack(Blocks.air)); 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 4e719f8ec8..d56e622a8f 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 @@ -26,7 +26,7 @@ public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEnti public String[] getDescription() { return new String[]{ CommonValues.BASS_MARK, - translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.0"),//For maintaining Multiblocks + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.0"),//For automatically maintaining Multiblocks translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.1"),//Does fix everything but itself. EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.2")//Fixing is for plebs! }; diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 9f49d692b8..f7209aed6a 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -775,8 +775,8 @@ gt.blockmachines.debug.tt.data.name=Debug Data Hatch gt.blockmachines.debug.tt.data.desc.0=Quantum Data Output gt.blockmachines.debug.tt.data.desc.1=High speed fibre optics connector. gt.blockmachines.debug.tt.data.desc.2=Must be painted to work -gt.blockmachines.debug.tt.maintenance.name=Debug Maintenance Hatch -gt.blockmachines.debug.tt.maintenance.desc.0=For maintaining Multiblocks +gt.blockmachines.debug.tt.maintenance.name=Auto-Taping Maintenance Hatch +gt.blockmachines.debug.tt.maintenance.desc.0=For automatically maintaining Multiblocks gt.blockmachines.debug.tt.maintenance.desc.1=Does fix everything but itself. gt.blockmachines.debug.tt.maintenance.desc.2=Fixing is for plebs! gt.blockmachines.debug.tt.genny.name=Debug Power Generator @@ -869,4 +869,4 @@ tt.keyphrase.Side_capabilities=Side capabilities #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret -tile.turretBaseEM.name=Elemental Turret Base \ No newline at end of file +tile.turretBaseEM.name=Elemental Turret Base -- cgit From db2f5941735d34c2cbf375f395d98ee4140231c8 Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 8 Jan 2021 19:24:34 +0100 Subject: Apply power GT compat --- .gitignore | 1 + .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 100 ++++++++++----------- 2 files changed, 51 insertions(+), 50 deletions(-) (limited to 'src/main') diff --git a/.gitignore b/.gitignore index b2a40dca6e..3d66b81105 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ libs/Galacticraft-API-1.7-3.0.12.504.jar libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar libs/MicdoodleCore-1.7-3.0.12.504.jar libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar +eclipse/ 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 85111682ee..810b02617d 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 @@ -1104,6 +1104,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ @Override public boolean onRunningTick(ItemStack aStack) { + return onRunningTickCheck(aStack); + } + + public boolean onRunningTickCheck_EM(ItemStack aStack) { + if (eRequiredData > eAvailableData) { + if (energyFlowOnRunningTick_EM(aStack, false)) { + stopMachine(); + } + return false; + } + return energyFlowOnRunningTick_EM(aStack, true); + } + + public boolean onRunningTickCheck(ItemStack aStack) { if (eRequiredData > eAvailableData) { if (energyFlowOnRunningTick(aStack, false)) { stopMachine(); @@ -1564,7 +1578,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region ENERGY!!!! //new method - private boolean energyFlowOnRunningTick(ItemStack aStack, boolean allowProduction) { + public boolean energyFlowOnRunningTick_EM(ItemStack aStack, boolean allowProduction) { long euFlow = mEUt * eAmpereFlow;//quick scope sign if (allowProduction && euFlow > 0) { addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); @@ -1576,6 +1590,18 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } return true; } + public boolean energyFlowOnRunningTick(ItemStack aStack, boolean allowProduction) { + long euFlow = mEUt * eAmpereFlow;//quick scope sign + if (allowProduction && euFlow > 0) { + addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); + } else if (euFlow < 0) { + if (!drainEnergyInput_EM(getMaxInputEnergy(), (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { + stopMachine(); + return false; + } + } + return true; + } //public final boolean energyFlowWithoutEffieciencyComputation(int eu,long ampere) { // long temp = eu * ampere;//quick scope sign @@ -1612,39 +1638,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Deprecated @Override - public final boolean addEnergyOutput(long EU) { - if (EU <= 0L) { - return true; - } - for (GT_MetaTileEntity_Hatch tHatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - if (tHatch.maxEUOutput() < EU) { - explodeMultiblock(); - } - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) { - return true; - } - } - } - for (GT_MetaTileEntity_Hatch tHatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - if (tHatch.maxEUOutput() < EU) { - explodeMultiblock(); - } - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) { - return true; - } - } - } - return false; + public final boolean addEnergyOutput(long eu) { + return addEnergyOutput_EM(eu,1); } - /** - * @param EU - * @param Amperes - * @return if was able to put inside the hatches - */ - private boolean addEnergyOutput_EM(long EU, long Amperes) { + public boolean addEnergyOutput_EM(long EU, long Amperes) { if (EU < 0) { EU = -EU; } @@ -1693,24 +1691,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Deprecated @Override - public final boolean drainEnergyInput(long EU) { - if (EU <= 0L) { - return true; - } - for (GT_MetaTileEntity_Hatch tHatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch) && tHatch.maxEUInput() > EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) { - return true; - } - } - for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch) && tHatch.maxEUInput() > EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) { - return true; - } - } - return false; + public final boolean drainEnergyInput(long eu) { + return drainEnergyInput_EM(0,eu,1); } - private boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { + public boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { if(maxEUinputMin==0){ return false; } @@ -1725,7 +1710,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } long EUuse = EUtEffective * Amperes; if (EUuse > getEUVar() || //not enough power - EUtTierVoltage > maxEUinputMax || //TIER IS BASED ON BEST HATCH! not total EUtEffective input + (EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { TecTech.LOGGER.debug("L1 " + EUuse + ' ' + getEUVar() + ' ' + (EUuse > getEUVar())); @@ -1747,7 +1732,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mMaxProgresstime = time; return true; } - long tempEUt = EU < V[1] ? V[1] : EU; + long tempEUt = Math.max(EU, V[1]); long tempTier = maxEUinputMax >> 2; while (tempEUt < tempTier) { tempEUt <<= 2; @@ -1796,6 +1781,21 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return energy; } + public final long getMaxTheoreticalInputEnergy() { + long energy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + energy += tHatch.maxEUInput()*tHatch.maxAmperesIn(); + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + energy += tHatch.maxEUInput() * tHatch.maxAmperesIn(); + } + } + return energy; + } + //new Method public final int getMaxEnergyInputTier_EM() { return getTier(maxEUinputMax); -- cgit From 27356d36da7b92db4eca6c91637342e7ab28ea75 Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 8 Jan 2021 19:32:31 +0100 Subject: This oughta do it --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') 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 810b02617d..05f5109ac8 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 @@ -1595,7 +1595,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (allowProduction && euFlow > 0) { addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { - if (!drainEnergyInput_EM(getMaxInputEnergy(), (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { + if (!drainEnergyInput_EM(0, (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { stopMachine(); return false; } @@ -1710,7 +1710,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } long EUuse = EUtEffective * Amperes; if (EUuse > getEUVar() || //not enough power - (EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input + (EUtTierVoltage==0?EUuse>getMaxInputEnergy():EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { TecTech.LOGGER.debug("L1 " + EUuse + ' ' + getEUVar() + ' ' + (EUuse > getEUVar())); -- cgit From 03f04631e222c533381338197ea69ae0185e71ff Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 8 Jan 2021 20:26:42 +0100 Subject: Another logic change --- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 710 ++++++++++++--------- 1 file changed, 392 insertions(+), 318 deletions(-) (limited to 'src/main') 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 05f5109ac8..d805e5f913 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 @@ -1139,57 +1139,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } if (--mUpdate == 0 || --mStartUpCheck == 0 || cyclicUpdate() || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = -1; - } - } - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = -1; - } - } - - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = -1; - } - } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = -1; - } - } - - for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(false); - } - } - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(false); - } - } - - eUncertainHatches.clear(); - eEnergyMulti.clear(); - eInputHatches.clear(); - eOutputHatches.clear(); - eParamHatches.clear(); - eMufflerHatches.clear(); - eDynamoMulti.clear(); - eOutputData.clear(); - eInputData.clear(); + clearHatches_EM(); if (aBaseMetaTileEntity instanceof BaseTileEntity) { ((BaseTileEntity) aBaseMetaTileEntity).ignoreUnloadedChunks = mMachine; @@ -1214,122 +1164,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } if (mMachine) { - short id = 1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = id++; - } - } - id = 1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = id++; - } - } + setupHatches_EM(); - id = 1; - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = id++; - } - } - id = 1; - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = id++; - } - } + setupEnergyHatchesVariables_EM(); - if (!mEnergyHatches.isEmpty() || !eEnergyMulti.isEmpty() || !mDynamoHatches.isEmpty() || !eDynamoMulti.isEmpty()) { - maxEUinputMin = V[15]; - maxEUinputMax = V[0]; - maxEUoutputMin = V[15]; - maxEUoutputMax = V[0]; - for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUInput() < maxEUinputMin) { - maxEUinputMin = hatch.maxEUInput(); - } - if (hatch.maxEUInput() > maxEUinputMax) { - maxEUinputMax = hatch.maxEUInput(); - } - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUInput() < maxEUinputMin) { - maxEUinputMin = hatch.maxEUInput(); - } - if (hatch.maxEUInput() > maxEUinputMax) { - maxEUinputMax = hatch.maxEUInput(); - } - } - } - for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUOutput() < maxEUoutputMin) { - maxEUoutputMin = hatch.maxEUOutput(); - } - if (hatch.maxEUOutput() > maxEUoutputMax) { - maxEUoutputMax = hatch.maxEUOutput(); - } - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUOutput() < maxEUoutputMin) { - maxEUoutputMin = hatch.maxEUOutput(); - } - if (hatch.maxEUOutput() > maxEUoutputMax) { - maxEUoutputMax = hatch.maxEUOutput(); - } - } - } - eMaxAmpereFlow = 0; - eMaxAmpereGen = 0; - //counts only full amps - for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin; - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin * hatch.Amperes; - } - } - for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin; - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin * hatch.Amperes; - } - } - } else { - maxEUinputMin = 0; - maxEUinputMax = 0; - eMaxAmpereFlow = 0; - maxEUoutputMin = 0; - maxEUoutputMax = 0; - eMaxAmpereGen = 0; - } if (getEUVar() > maxEUStore()) { setEUVar(maxEUStore()); } - - for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(true); - } - } - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(true); - } - } } else { maxEUinputMin = 0; maxEUinputMax = 0; @@ -1345,78 +1186,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (MULTI_PURGE_1_AT == Tick || MULTI_PURGE_2_AT == Tick) { purgeAllOverflowEM_EM(); } else if (MULTI_CHECK_AT == Tick) { - for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - if (GT_MetaTileEntity_MultiBlockBase.disableMaintenance) { - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } else { - if (tHatch.mAuto && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) { - tHatch.autoMaintainance(); - } - if (tHatch.mWrench) { - mWrench = true; - } - if (tHatch.mScrewdriver) { - mScrewdriver = true; - } - if (tHatch.mSoftHammer) { - mSoftHammer = true; - } - if (tHatch.mHardHammer) { - mHardHammer = true; - } - if (tHatch.mSolderingTool) { - mSolderingTool = true; - } - if (tHatch.mCrowbar) { - mCrowbar = true; - } - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; - } - } - } + maintenance_EM(); } else if (MOVE_AT == Tick && eSafeVoid) { - for (GT_MetaTileEntity_Hatch_OverflowElemental voider : eMufflerHatches) { - if (voider.overflowMax < voider.getOverflowMatter()) { - continue; - } - double remaining = voider.overflowMax - voider.getOverflowMatter(); - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContainerHandler().values()) { - double qty = div(remaining,instance.definition.getMass()); - if (qty > 0) { - qty = min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { - voider.setOverflowMatter(voider.overflowMax); - } - in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - double qty = div(remaining,instance.definition.getMass()); - if (qty > 0) { - qty = min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { - voider.setOverflowMatter(voider.overflowMax); - } - out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - } + safeVoid_EM(); } if (getRepairStatus() >= minRepairStatus) {//S @@ -1424,53 +1196,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt hatchesStatusUpdate_EM(); } - //region power pass and controller charging - {//DO - long euVar; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (getEUVar() > getMinimumStoredEU()) { - break; - } - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput(); - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { - setEUVar(getEUVar() + euVar); - } - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (getEUVar() > getMinimumStoredEU()) { - break; - } - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput() * tHatch.Amperes; - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { - setEUVar(getEUVar() + euVar); - } - } - } - if (ePowerPass && getEUVar() > getMinimumStoredEU()) { - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput(); - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput() * tHatch.Amperes; - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } - } - } - } - } - //endregion + chargeController_EM(aBaseMetaTileEntity); + dischargeController_EM(aBaseMetaTileEntity); if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start if (onRunningTick(mInventory[1])) {//Compute EU @@ -1485,27 +1212,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt outputAfterRecipe_EM(); cleanOutputEM_EM(); - if (mOutputItems != null) { - for (ItemStack tStack : mOutputItems) { - if (tStack != null) { - addOutput(tStack); - } - } - } - mOutputItems = null; - - if (mOutputFluids != null) { - if (mOutputFluids.length == 1) { - for (FluidStack tStack : mOutputFluids) { - if (tStack != null) { - addOutput(tStack); - } - } - } else if (mOutputFluids.length > 1) { - addFluidOutputs(mOutputFluids); - } - } - mOutputFluids = null; + addClassicOutputs_EM(); updateSlots(); mProgresstime = 0; @@ -1554,6 +1261,387 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } + protected void addClassicOutputs_EM() { + if (mOutputItems != null) { + for (ItemStack tStack : mOutputItems) { + if (tStack != null) { + addOutput(tStack); + } + } + } + mOutputItems = null; + + if (mOutputFluids != null) { + if (mOutputFluids.length == 1) { + for (FluidStack tStack : mOutputFluids) { + if (tStack != null) { + addOutput(tStack); + } + } + } else if (mOutputFluids.length > 1) { + addFluidOutputs(mOutputFluids); + } + } + mOutputFluids = null; + } + + protected void safeVoid_EM() { + for (GT_MetaTileEntity_Hatch_OverflowElemental voider : eMufflerHatches) { + if (voider.overflowMax < voider.getOverflowMatter()) { + continue; + } + double remaining = voider.overflowMax - voider.getOverflowMatter(); + for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { + for (cElementalInstanceStack instance : in.getContainerHandler().values()) { + double qty = div(remaining,instance.definition.getMass()); + if (qty > 0) { + qty = min(qty, instance.amount); + if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { + voider.setOverflowMatter(voider.overflowMax); + } + in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + } + } + } + for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { + for (cElementalInstanceStack instance : out.getContainerHandler().values()) { + double qty = div(remaining,instance.definition.getMass()); + if (qty > 0) { + qty = min(qty, instance.amount); + if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { + voider.setOverflowMatter(voider.overflowMax); + } + out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + } + } + } + } + } + + protected void maintenance_EM() { + for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.disableMaintenance) { + mWrench = true; + mScrewdriver = true; + mSoftHammer = true; + mHardHammer = true; + mSolderingTool = true; + mCrowbar = true; + } else { + if (tHatch.mAuto && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) { + tHatch.autoMaintainance(); + } + if (tHatch.mWrench) { + mWrench = true; + } + if (tHatch.mScrewdriver) { + mScrewdriver = true; + } + if (tHatch.mSoftHammer) { + mSoftHammer = true; + } + if (tHatch.mHardHammer) { + mHardHammer = true; + } + if (tHatch.mSolderingTool) { + mSolderingTool = true; + } + if (tHatch.mCrowbar) { + mCrowbar = true; + } + + tHatch.mWrench = false; + tHatch.mScrewdriver = false; + tHatch.mSoftHammer = false; + tHatch.mHardHammer = false; + tHatch.mSolderingTool = false; + tHatch.mCrowbar = false; + } + } + } + } + + protected void clearHatches_EM() { + mInputHatches.clear(); + mInputBusses.clear(); + mOutputHatches.clear(); + mOutputBusses.clear(); + mDynamoHatches.clear(); + mEnergyHatches.clear(); + mMufflerHatches.clear(); + mMaintenanceHatches.clear(); + + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = -1; + } + } + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = -1; + } + } + + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = -1; + } + } + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = -1; + } + } + + for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(false); + } + } + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(false); + } + } + + eUncertainHatches.clear(); + eEnergyMulti.clear(); + eInputHatches.clear(); + eOutputHatches.clear(); + eParamHatches.clear(); + eMufflerHatches.clear(); + eDynamoMulti.clear(); + eOutputData.clear(); + eInputData.clear(); + } + + protected void setupHatches_EM() { + short id = 1; + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = id++; + } + } + id = 1; + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = id++; + } + } + + id = 1; + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = id++; + } + } + id = 1; + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = id++; + } + } + + for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(true); + } + } + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(true); + } + } + } + + protected void setupEnergyHatchesVariables_EM() { + if (!mEnergyHatches.isEmpty() || !eEnergyMulti.isEmpty() || !mDynamoHatches.isEmpty() || !eDynamoMulti.isEmpty()) { + maxEUinputMin = V[15]; + maxEUinputMax = V[0]; + maxEUoutputMin = V[15]; + maxEUoutputMax = V[0]; + for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUInput() < maxEUinputMin) { + maxEUinputMin = hatch.maxEUInput(); + } + if (hatch.maxEUInput() > maxEUinputMax) { + maxEUinputMax = hatch.maxEUInput(); + } + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUInput() < maxEUinputMin) { + maxEUinputMin = hatch.maxEUInput(); + } + if (hatch.maxEUInput() > maxEUinputMax) { + maxEUinputMax = hatch.maxEUInput(); + } + } + } + for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUOutput() < maxEUoutputMin) { + maxEUoutputMin = hatch.maxEUOutput(); + } + if (hatch.maxEUOutput() > maxEUoutputMax) { + maxEUoutputMax = hatch.maxEUOutput(); + } + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUOutput() < maxEUoutputMin) { + maxEUoutputMin = hatch.maxEUOutput(); + } + if (hatch.maxEUOutput() > maxEUoutputMax) { + maxEUoutputMax = hatch.maxEUOutput(); + } + } + } + eMaxAmpereFlow = 0; + eMaxAmpereGen = 0; + //counts only full amps + for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin; + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin * hatch.Amperes; + } + } + for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin; + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin * hatch.Amperes; + } + } + } else { + maxEUinputMin = 0; + maxEUinputMax = 0; + eMaxAmpereFlow = 0; + maxEUoutputMin = 0; + maxEUoutputMax = 0; + eMaxAmpereGen = 0; + } + } + + protected void dischargeController_EM(IGregTechTileEntity aBaseMetaTileEntity) { + powerPass(aBaseMetaTileEntity); + } + + protected final void powerPass(IGregTechTileEntity aBaseMetaTileEntity) { + long euVar; + if (ePowerPass && getEUVar() > getMinimumStoredEU()) { + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput()*tHatch.maxAmperesOut(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.maxAmperesOut(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + } + } + + protected final void powerPass_EM(IGregTechTileEntity aBaseMetaTileEntity) { + long euVar; + if (ePowerPass && getEUVar() > getMinimumStoredEU()) { + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.Amperes; + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + } + } + + protected void chargeController_EM(IGregTechTileEntity aBaseMetaTileEntity) { + powerInput(); + } + + protected final void powerInput() { + long euVar; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUInput() * tHatch.maxAmperesIn(); + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUInput() * tHatch.maxAmperesIn(); + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + } + + protected final void powerInput_EM() { + long euVar; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUInput(); + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUInput() * tHatch.Amperes; + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + } + //endregion //region EFFICIENCY AND FIXING LIMITS @@ -1590,6 +1678,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } return true; } + public boolean energyFlowOnRunningTick(ItemStack aStack, boolean allowProduction) { long euFlow = mEUt * eAmpereFlow;//quick scope sign if (allowProduction && euFlow > 0) { @@ -1710,7 +1799,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } long EUuse = EUtEffective * Amperes; if (EUuse > getEUVar() || //not enough power - (EUtTierVoltage==0?EUuse>getMaxInputEnergy():EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input + (EUtTierVoltage==0?EUuse> getMaxInputEnergy():EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { TecTech.LOGGER.debug("L1 " + EUuse + ' ' + getEUVar() + ' ' + (EUuse > getEUVar())); @@ -1767,21 +1856,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //new Method public final long getMaxInputEnergy() { - long energy = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - energy += tHatch.maxEUInput(); - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - energy += tHatch.maxEUInput() * tHatch.Amperes; - } - } - return energy; - } - - public final long getMaxTheoreticalInputEnergy() { long energy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { @@ -1790,7 +1864,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - energy += tHatch.maxEUInput() * tHatch.maxAmperesIn(); + energy += tHatch.maxEUInput()*tHatch.maxAmperesIn(); } } return energy; -- cgit From aff4087e2a20d69b11c8df254c3636f40889a860 Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 8 Jan 2021 20:56:11 +0100 Subject: Cleanup that too --- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/main') 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 d805e5f913..c9348d0245 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 @@ -1839,7 +1839,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt }//Use in EM check recipe return statement if you want overclocking @Override // same as gt sum of all hatches - public final long getMaxInputVoltage() { + public long getMaxInputVoltage() { + return getMaxInputVoltageSum(); + } + + // same as gt sum of all hatches + public final long getMaxInputVoltageSum() { long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { @@ -1870,6 +1875,21 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return energy; } + public final long getMaxInputEnergy_EM() { + long energy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + energy += tHatch.maxEUInput(); + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + energy += tHatch.maxEUInput()*tHatch.Amperes; + } + } + return energy; + } + //new Method public final int getMaxEnergyInputTier_EM() { return getTier(maxEUinputMax); -- cgit From 89e0a8304c2887ebdf1ca4ebc0dbef4b44bdaa21 Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 8 Jan 2021 21:27:34 +0100 Subject: Adjust a bit more --- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/main') 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 c9348d0245..e0bc2e3364 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 @@ -1785,22 +1785,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } public boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { + long EUuse = EUtEffective * Amperes; + if(EUuse==0){ + return true; + } if(maxEUinputMin==0){ return false; } - if (EUtTierVoltage < 0) { - EUtTierVoltage = -EUtTierVoltage; - } - if (EUtEffective < 0) { - EUtEffective = -EUtEffective; + if (EUuse < 0) { + EUuse = -EUuse; } - if (Amperes < 0) { - Amperes = -Amperes; - } - long EUuse = EUtEffective * Amperes; if (EUuse > getEUVar() || //not enough power - (EUtTierVoltage==0?EUuse> getMaxInputEnergy():EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input - (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A + (EUtTierVoltage==0? EUuse> getMaxInputEnergy(): + (EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input + (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { TecTech.LOGGER.debug("L1 " + EUuse + ' ' + getEUVar() + ' ' + (EUuse > getEUVar())); TecTech.LOGGER.debug("L2 " + EUtEffective + ' ' + maxEUinputMax + ' ' + (EUtEffective > maxEUinputMax)); -- cgit From a58073983dfc76d4b616e163dfe610979c849178 Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 8 Jan 2021 23:23:07 +0100 Subject: Another 'fix' --- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 90 +++++++++++++--------- 1 file changed, 54 insertions(+), 36 deletions(-) (limited to 'src/main') 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 e0bc2e3364..d059e0e801 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 @@ -1196,8 +1196,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt hatchesStatusUpdate_EM(); } - chargeController_EM(aBaseMetaTileEntity); dischargeController_EM(aBaseMetaTileEntity); + chargeController_EM(aBaseMetaTileEntity); if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start if (onRunningTick(mInventory[1])) {//Compute EU @@ -1535,28 +1535,28 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } protected void dischargeController_EM(IGregTechTileEntity aBaseMetaTileEntity) { - powerPass(aBaseMetaTileEntity); + if(ePowerPass && getEUVar() > getMinimumStoredEU()){ + powerPass(aBaseMetaTileEntity); + } } protected final void powerPass(IGregTechTileEntity aBaseMetaTileEntity) { long euVar; - if (ePowerPass && getEUVar() > getMinimumStoredEU()) { - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput()*tHatch.maxAmperesOut(); - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.maxAmperesOut(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } - for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput() * tHatch.maxAmperesOut(); - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.maxAmperesOut(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } } @@ -1564,23 +1564,21 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected final void powerPass_EM(IGregTechTileEntity aBaseMetaTileEntity) { long euVar; - if (ePowerPass && getEUVar() > getMinimumStoredEU()) { - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput(); - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } - for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput() * tHatch.Amperes; - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.Amperes; + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } } @@ -1597,7 +1595,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt break; } if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput() * tHatch.maxAmperesIn(); + euVar = Math.min(tHatch.maxEUInput() * tHatch.maxAmperesIn(),tHatch.getEUVar()); if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { setEUVar(getEUVar() + euVar); } @@ -1608,7 +1606,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt break; } if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput() * tHatch.maxAmperesIn(); + euVar = Math.min(tHatch.maxEUInput() * tHatch.maxAmperesIn(),tHatch.getEUVar()); if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { setEUVar(getEUVar() + euVar); } @@ -1684,7 +1682,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (allowProduction && euFlow > 0) { addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { - if (!drainEnergyInput_EM(0, (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { + if (!drainEnergyInput((long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { stopMachine(); return false; } @@ -1802,7 +1800,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (DEBUG_MODE) { TecTech.LOGGER.debug("L1 " + EUuse + ' ' + getEUVar() + ' ' + (EUuse > getEUVar())); TecTech.LOGGER.debug("L2 " + EUtEffective + ' ' + maxEUinputMax + ' ' + (EUtEffective > maxEUinputMax)); - TecTech.LOGGER.debug("L3 " + EUuse + ' ' + eMaxAmpereFlow); + TecTech.LOGGER.debug("L3 " + Amperes + ' ' + getMaxInputEnergy()); TecTech.LOGGER.debug("L4 " + ((EUuse - 1) / maxEUinputMin + 1) + ' ' + eMaxAmpereFlow + ' ' + ((EUuse - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)); } return false; @@ -1812,6 +1810,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return true; } + public boolean drainEnergyInput(long EUtEffective, long Amperes) { + long EUuse = EUtEffective * Amperes; + if(EUuse==0){ + return true; + } + if(maxEUinputMin==0){ + return false; + } + if (EUuse < 0) { + EUuse = -EUuse; + } + //not enough power + if (EUuse > getEUVar() || EUuse > getMaxInputEnergy()) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A + return false; + } + //sub eu + setEUVar(getEUVar() - EUuse); + return true; + } + //new method public final boolean overclockAndPutValuesIn_EM(long EU, int time) {//TODO revise if (EU == 0L) { -- cgit From 3546ec3bbabb88f4499d3833152e73ba6ad76df1 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 9 Jan 2021 08:22:01 +0100 Subject: Adjust lasers for compat --- .../hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java | 9 +++++++-- .../hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java index beacf26122..202dc344c2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java @@ -82,8 +82,13 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc } @Override - public long maxAmperesOut() { - return 0; + public boolean isEnetOutput() { + return false; + } + + @Override + public boolean isEnetInput() { + return false; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java index 2393f4f702..854678b79b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java @@ -79,8 +79,13 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc } @Override - public long maxAmperesIn() { - return 0; + public boolean isEnetOutput() { + return false; + } + + @Override + public boolean isEnetInput() { + return false; } @Override -- cgit From 262f82fb854237f43932ea6fc21ee081c733ea39 Mon Sep 17 00:00:00 2001 From: KiloJoel Date: Sat, 9 Jan 2021 08:26:20 +0000 Subject: Fixed lag reduction on file saving (#48) --- .../tectech/mechanics/anomaly/AnomalyHandler.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/main') 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 0beb5e0af8..dd388bc233 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 @@ -233,23 +233,32 @@ public class AnomalyHandler implements IChunkMetaDataHandler { ChunkCoordIntPair pair = new ChunkCoordIntPair(player.chunkCoordX, player.chunkCoordZ); NBTTagCompound compound = data.get(player.worldObj.provider.dimensionId).get(pair); NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); + boolean saveRequired = false; if(player.capabilities.isCreativeMode){ - playerTag.setDouble(SPACE_CANCER, 0); + if (playerTag.getDouble(SPACE_CANCER) != 0) { + playerTag.setDouble(SPACE_CANCER, 0); + saveRequired = true; + } }else { if (compound != null) { int badness = (int) Math.min(COUNT_DIV, compound.getDouble(INTENSITY) / PER_PARTICLE); if (badness > 0) { playerTag.setDouble(SPACE_CANCER, Math.min(2, playerTag.getDouble(SPACE_CANCER) + 9.765625E-4f * badness)); player.attackEntityFrom(MainLoader.subspace,Math.max(1,badness/8f)); + saveRequired = true; } } else if (playerTag.getDouble(SPACE_CANCER) > 0 && !player.isDead) { - if (playerTag.getDouble(SPACE_CANCER) == 0 || player.ticksExisted % 10 != 0) - return; - playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-5f)); + if (player.ticksExisted % 10 == 0) { + playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-5f)); + saveRequired = true; + } } } - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), (EntityPlayerMP) player); + + if (saveRequired) { + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), (EntityPlayerMP) player); + } } } -- cgit From e4fe2b8644761b5668bc1203727db6b487ee3f04 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 9 Jan 2021 15:22:03 +0100 Subject: Add defaults --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') 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 d059e0e801..63df215bc8 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 @@ -801,13 +801,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt eMaxAmpereGen = aNBT.getLong("eGenRating"); maxEUinputMin = aNBT.getLong("eMaxEUmin"); maxEUinputMax = aNBT.getLong("eMaxEUmax"); - eAmpereFlow = aNBT.getLong("eRating"); + eAmpereFlow = aNBT.hasKey("eRating")?aNBT.getLong("eRating"):1; eMaxAmpereFlow = aNBT.getLong("eMaxA"); eRequiredData = aNBT.getLong("eDataR"); eAvailableData = aNBT.getLong("eDataA"); eCertainMode = aNBT.getByte("eCertainM"); eCertainStatus = aNBT.getByte("eCertainS"); - minRepairStatus = aNBT.getByte("eMinRepair"); + minRepairStatus = aNBT.hasKey("eMinRepair")?aNBT.getByte("eMinRepair"):3; extendedFacing=ExtendedFacing.of( ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), Rotation.byIndex(aNBT.getByte("eRotation")), -- cgit From 8ce32b0ceff798b46f182864eaae1f74285526a7 Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 18 Jan 2021 12:03:28 +0000 Subject: 4 strikes a tower --- .../technus/tectech/mechanics/spark/RendererMessage.java | 16 +++++++++++++++- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 6 +++++- .../single/GT_MetaTileEntity_TeslaCoil.java | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java index 58356774cc..af97324ab0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java @@ -16,7 +16,9 @@ import thaumcraft.client.fx.bolt.FXLightningBolt; import java.io.*; import java.util.Arrays; import java.util.HashSet; +import java.util.Random; +//TODO Re-work how sparks are distributed public class RendererMessage implements IMessage { HashSet sparkList; @@ -63,8 +65,20 @@ public class RendererMessage implements IMessage { public static class ClientHandler extends AbstractClientMessageHandler { @Override public IMessage handleClientMessage(EntityPlayer pPlayer, RendererData pMessage, MessageContext pCtx) { + //disgusting + Random localRand = Minecraft.getMinecraft().theWorld.rand; + int[] zapsToUse = new int[4]; + for (int i = 0; i < 3; i++) { + zapsToUse[0] = localRand.nextInt(pMessage.sparkList.size()); + } + int i = 0; for (ThaumSpark sp : pMessage.sparkList) { - thaumLightning(sp.x, sp.y, sp.z, sp.xR, sp.yR, sp.zR, sp.wID); + for (int j : zapsToUse) { + if(i == j){ + thaumLightning(sp.x, sp.y, sp.z, sp.xR, sp.yR, sp.zR, sp.wID); + } + } + i++; } pMessage.sparkList.clear(); return null; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 864b68e21f..c2f475888f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -72,6 +72,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F; private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false + //Face icons + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private int mTier = 0; //Determines max voltage (LV to ZPM) private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon (Does not match actual plasma tiers) @@ -594,7 +598,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //Power transfer outputCurrentDisplay.set(powerTeslaNodeMap(this)); - //Randomly send all the sparks out once every 3 to 5 seconds + //TODO Encapsulate the spark sender sparkCount--; if (sparkCount == 0){ IGregTechTileEntity mte = getBaseMetaTileEntity(); 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 8c3fb9410b..274389b01a 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 @@ -226,7 +226,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB //Send Power powerTeslaNodeMap(this); - //Randomly send all the sparks out once every 3 to 5 seconds + //TODO Encapsulate the spark sender sparkCount--; if (sparkCount == 0){ sparkCount = 10; -- cgit From 84048d774b12fc7ae48d83e61fc55438cc657831 Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 18 Jan 2021 21:23:37 +0000 Subject: Missing Textures --- .../technus/tectech/loader/thing/CoverLoader.java | 4 ++ .../thing/cover/GT_Cover_TM_PowerPassUpgrade.java | 37 +++++++++++++++++ .../tectech/thing/item/PowerPassUpgradeCover.java | 47 ++++++++++++++++++++++ .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 3 ++ 4 files changed, 91 insertions(+) create mode 100644 src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java create mode 100644 src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java index 1376049f5a..880113073c 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java @@ -2,9 +2,11 @@ package com.github.technus.tectech.loader.thing; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.cover.GT_Cover_TM_EnderFluidLink; +import com.github.technus.tectech.thing.cover.GT_Cover_TM_PowerPassUpgrade; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; import com.github.technus.tectech.thing.item.EnderFluidLinkCover; +import com.github.technus.tectech.thing.item.PowerPassUpgradeCover; import com.github.technus.tectech.thing.item.TeslaCoilCover; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; @@ -19,10 +21,12 @@ public class CoverLoader implements Runnable { final IIconContainer TESLA_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY"); final IIconContainer TESLA_OVERLAY_ULTIMATE = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY_ULTIMATE"); final IIconContainer ENDERFLUIDLINK_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/ENDERFLUIDLINK_OVERLAY"); + final IIconContainer POWERPASSUPGRADE_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/POWERPASSUPGRADE_OVERLAY"); GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 0), new GT_RenderedTexture(TESLA_OVERLAY), new GT_Cover_TM_TeslaCoil()); GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 1), new GT_RenderedTexture(TESLA_OVERLAY_ULTIMATE), new GT_Cover_TM_TeslaCoil_Ultimate()); GregTech_API.registerCover(new ItemStack(EnderFluidLinkCover.INSTANCE, 1, 0), new GT_RenderedTexture(ENDERFLUIDLINK_OVERLAY), new GT_Cover_TM_EnderFluidLink()); + GregTech_API.registerCover(new ItemStack(PowerPassUpgradeCover.INSTANCE, 1, 0), new GT_RenderedTexture(POWERPASSUPGRADE_OVERLAY), new GT_Cover_TM_PowerPassUpgrade()); TecTech.LOGGER.info("Cover functionality registered"); } } diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java new file mode 100644 index 0000000000..ce40a33dff --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.thing.cover; + +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_CoverBehavior; + +public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior { + public GT_Cover_TM_PowerPassUpgrade() { + } + + @Override + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + IGregTechTileEntity TE = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (TE instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) TE; + multi.ePowerPassUpgraded = true; + } + return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); + } + + @Override + public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { + IGregTechTileEntity TE = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (TE instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) TE; + multi.ePowerPassUpgraded = false; + } + return true; + } + + @Override + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + //It updates once every 200 ticks, so once every 10 seconds + return 200; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java new file mode 100644 index 0000000000..7dcf8bb48a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.util.CommonValues; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.List; + +import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.thing.CustomItemList.enderLinkFluidCover; +import static net.minecraft.util.StatCollector.translateToLocal; + +public final class PowerPassUpgradeCover extends Item { + public static PowerPassUpgradeCover INSTANCE; + + private PowerPassUpgradeCover() { + setHasSubtypes(true); + setUnlocalizedName("tm.powerpassupgradecover"); + setTextureName(MODID + ":itemPowerPassUpgradeCover"); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.BASS_MARK); + aList.add(translateToLocal("item.tm.powerpassupgradecover.desc.0"));//Ender-Fluid-Enables Machines! + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.1"));//Use on any side of a fluid tank to link it to the Ender + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.2"));//Ender Tanks so are laggy -Bot from the Chads of NH + } + + public static void run() { + INSTANCE = new PowerPassUpgradeCover(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + enderLinkFluidCover.set(INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + itemIcon = iconRegister.registerIcon(getIconString()); + } +} 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 63df215bc8..7cc83caaba 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 @@ -121,6 +121,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //if u need to force some things to be fixed - u might need to override doRandomMaintenanceDamage protected byte minRepairStatus = 3; + //can power pass be enabled + public boolean ePowerPassUpgraded = false; + //functionality toggles - changed by buttons in gui also public boolean ePowerPass = false, eSafeVoid = false; -- cgit From 3b43f1902dcb0adde3663dea19017b07126b64a9 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 18 Jan 2021 22:38:51 +0100 Subject: Add texture for automaticer hatch --- .../github/technus/tectech/proxy/ClientProxy.java | 54 +++++++++++---------- ...T_MetaTileEntity_Hatch_CreativeMaintenance.java | 24 +++++++++ .../iconsets/OVERLAY_FULLAUTOMAINTENANCE.png | Bin 0 -> 868 bytes .../iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta | 5 ++ 4 files changed, 57 insertions(+), 26 deletions(-) create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 9e693b7664..6a2a81057e 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -29,6 +29,8 @@ import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.util.ForgeDirection; +import static com.github.technus.tectech.TecTech.RANDOM; + public class ClientProxy extends CommonProxy { @Override public void registerRenderInfo() { @@ -50,8 +52,8 @@ public class ClientProxy extends CommonProxy { public void hint_particle_tinted(World w,int x, int y, int z, IIcon[] icons,short[] RGBa) { Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons).withColorTint(RGBa)); - EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @@ -59,8 +61,8 @@ public class ClientProxy extends CommonProxy { public void hint_particle_tinted(World w,int x, int y, int z, Block block, int meta,short[] RGBa) { Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta).withColorTint(RGBa)); - EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @@ -68,8 +70,8 @@ public class ClientProxy extends CommonProxy { public void hint_particle(World w,int x, int y, int z, IIcon[] icons) { Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons)); - EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @@ -77,8 +79,8 @@ public class ClientProxy extends CommonProxy { public void hint_particle(World w,int x, int y, int z, Block block, int meta) { Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta)); - EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @@ -89,8 +91,8 @@ public class ClientProxy extends CommonProxy { float yPos = aDir.offsetY * 0.76F + aMuffler.getYCoord() + 0.25F; float zPos = aDir.offsetZ * 0.76F + aMuffler.getZCoord() + 0.25F; - EntityFX particle = new WeightlessParticleFX(aMuffler.getWorld(), xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + EntityFX particle = new WeightlessParticleFX(aMuffler.getWorld(), xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @@ -101,42 +103,42 @@ public class ClientProxy extends CommonProxy { float yPos = aDir.offsetY * 0.76F + aMuffler.getYCoord() + 0.25F; float zPos = aDir.offsetZ * 0.76F + aMuffler.getZCoord() + 0.25F; - float ySpd = aDir.offsetY * 0.1F + 0.2F + 0.1F * (float)TecTech.RANDOM.nextGaussian(); + float ySpd = aDir.offsetY * 0.1F + 0.2F + 0.1F * (float) RANDOM.nextGaussian(); float xSpd; float zSpd; if (aDir.offsetY == -1) { - float temp = TecTech.RANDOM.nextFloat() * 2 * (float) Math.PI; - xSpd = (float) Math.sin(temp) * 0.1F*(float)TecTech.RANDOM.nextGaussian(); - zSpd = (float) Math.cos(temp) * 0.1F*(float)TecTech.RANDOM.nextGaussian(); + float temp = RANDOM.nextFloat() * 2 * (float) Math.PI; + xSpd = (float) Math.sin(temp) * 0.1F*(float) RANDOM.nextGaussian(); + zSpd = (float) Math.cos(temp) * 0.1F*(float) RANDOM.nextGaussian(); } else { - xSpd = aDir.offsetX * (0.1F + 0.2F *(float)TecTech.RANDOM.nextGaussian()); - zSpd = aDir.offsetZ * (0.1F + 0.2F *(float)TecTech.RANDOM.nextGaussian()); + xSpd = aDir.offsetX * (0.1F + 0.2F *(float) RANDOM.nextGaussian()); + zSpd = aDir.offsetZ * (0.1F + 0.2F *(float) RANDOM.nextGaussian()); } - aMuffler.getWorld().spawnParticle("largesmoke", xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - aMuffler.getWorld().spawnParticle("largesmoke", xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - aMuffler.getWorld().spawnParticle("largesmoke", xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + aMuffler.getWorld().spawnParticle("largesmoke", xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + aMuffler.getWorld().spawnParticle("largesmoke", xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + aMuffler.getWorld().spawnParticle("largesmoke", xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); } @Override public void em_particle(World w,double x, double y, double z) {//CUTE! EntityFX particle = new WeightlessParticleFX(w, - x + TecTech.RANDOM.nextFloat() * 0.5F, - y + TecTech.RANDOM.nextFloat() * 0.5F, - z + TecTech.RANDOM.nextFloat() * 0.5F, + x + RANDOM.nextFloat() * 0.5F, + y + RANDOM.nextFloat() * 0.5F, + z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @Override public void pollutor_particle(World w,double x, double y, double z) { w.spawnParticle("largesmoke", - x + TecTech.RANDOM.nextFloat() * 0.5F, - y + TecTech.RANDOM.nextFloat() * 0.5F, - z + TecTech.RANDOM.nextFloat() * 0.5F, + x + RANDOM.nextFloat() * 0.5F, + y + RANDOM.nextFloat() * 0.5F, + z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); 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 d56e622a8f..42817f473e 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 @@ -2,10 +2,15 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Util; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -13,6 +18,8 @@ import net.minecraft.util.EnumChatFormatting; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEntity_Hatch_Maintenance { + private static Textures.BlockIcons.CustomIcon face; + public GT_MetaTileEntity_Hatch_CreativeMaintenance(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); Util.setTier(aTier,this); @@ -32,6 +39,23 @@ public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEnti }; } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + face = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_FULLAUTOMAINTENANCE"); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(face)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(face)}; + } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Hatch_CreativeMaintenance(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png new file mode 100644 index 0000000000..6b554f2031 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta new file mode 100644 index 0000000000..60af678259 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":4 + } +} \ No newline at end of file -- cgit From 50eed5564fda6e36e18a9658e055a7f37476b1fc Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 18 Jan 2021 21:48:59 +0000 Subject: Add Textures and locale for powerpass cover also make it actually load the item lol --- .../technus/tectech/loader/thing/ThingsLoader.java | 1 + .../blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png | Bin 0 -> 1166 bytes src/main/resources/assets/tectech/lang/en_US.lang | 5 +++++ .../tectech/textures/items/itemPowerPassUpgradeCover.png | Bin 0 -> 583 bytes 4 files changed, 6 insertions(+) create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png create mode 100644 src/main/resources/assets/tectech/textures/items/itemPowerPassUpgradeCover.png (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index 6fa0ba2bb3..4adeeec315 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -61,6 +61,7 @@ public class ThingsLoader implements Runnable { TeslaCoilCover.run(); TeslaCoilCapacitor.run(); EnderFluidLinkCover.run(); + PowerPassUpgradeCover.run(); TecTech.LOGGER.info("Useful Items registered"); TeslaCoilComponent.run(); diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png new file mode 100644 index 0000000000..a623e9f1d5 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png differ diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index f7209aed6a..89d2b517a2 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -92,6 +92,11 @@ item.tm.enderfluidlinkcover.desc.0=Ender-Fluid-Enables Machines! item.tm.enderfluidlinkcover.desc.1=Use on any side of a fluid tank to link it to the Ender item.tm.enderfluidlinkcover.desc.2=Ender Tanks so are laggy -Bot from the Chads of NH +item.tm.powerpassupgradecover.name=Power Pass Upgrade Cover +item.tm.powerpassupgradecover.desc.0=Add power pass functionality to TecTech Multiblocks +item.tm.powerpassupgradecover.desc.1=Active transformer in a can?? +item.tm.powerpassupgradecover.desc.2=Chain them up like Christmas lights! + #Death Messages death.attack.microwaving=%1$s was dehydrated by radiation. death.attack.microwaving.player=%1$s was dehydrated by radiation while fighting %2$s. diff --git a/src/main/resources/assets/tectech/textures/items/itemPowerPassUpgradeCover.png b/src/main/resources/assets/tectech/textures/items/itemPowerPassUpgradeCover.png new file mode 100644 index 0000000000..85f8a77b77 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/items/itemPowerPassUpgradeCover.png differ -- cgit From 54da6804038db3a00696ebe83fbc4f8d3c8ff50b Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 18 Jan 2021 22:01:33 +0000 Subject: Fix Free cheaty ass maint hatch texture yuck. --- .../com/github/technus/tectech/mechanics/spark/RendererMessage.java | 2 +- .../textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta | 5 +++++ .../textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java index af97324ab0..7fdce41ef9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java @@ -69,7 +69,7 @@ public class RendererMessage implements IMessage { Random localRand = Minecraft.getMinecraft().theWorld.rand; int[] zapsToUse = new int[4]; for (int i = 0; i < 3; i++) { - zapsToUse[0] = localRand.nextInt(pMessage.sparkList.size()); + zapsToUse[i] = localRand.nextInt(pMessage.sparkList.size()); } int i = 0; for (ThaumSpark sp : pMessage.sparkList) { diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta new file mode 100644 index 0000000000..24f863c95e --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":3 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta deleted file mode 100644 index 60af678259..0000000000 --- a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLMAINTENANCE.png.mcmeta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "animation":{ - "frametime":4 - } -} \ No newline at end of file -- cgit From 2a06e369f32173447139743992fb0317085dbb88 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 25 Jan 2021 20:21:20 +0100 Subject: Update GT_MetaTileEntity_MultiblockBase_EM.java --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main') 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 63df215bc8..aa485feeab 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 @@ -1206,7 +1206,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt stopMachine(); } - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && RECIPE_AT == Tick) {//progress increase and done + if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {//progress increase and done hatchesStatusUpdate_EM(); outputAfterRecipe_EM(); @@ -1218,6 +1218,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mProgresstime = 0; mMaxProgresstime = 0; mEfficiencyIncrease = 0; + if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { mEfficiency = Math.max(0, min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); @@ -2584,4 +2585,4 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return false; } //endregion -} \ No newline at end of file +} -- cgit From f1abb31f609b9f2ae89cea9169180fd85da77fa1 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 25 Jan 2021 20:24:18 +0100 Subject: PowerPassCover --- .../thing/cover/GT_Cover_TM_PowerPassUpgrade.java | 38 ++++++++++++++-------- .../multi/GT_MetaTileEntity_EM_dataBank.java | 4 +-- .../multi/GT_MetaTileEntity_EM_infuser.java | 4 +-- .../multi/GT_MetaTileEntity_EM_transformer.java | 4 +-- .../multi/GT_MetaTileEntity_TM_microwave.java | 4 +-- .../GT_MetaTileEntity_TM_proccessingStack.java | 4 +-- .../multi/base/GT_Container_MultiMachineEM.java | 17 +++++++--- .../multi/base/GT_GUIContainer_MultiMachineEM.java | 15 +++++---- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 13 +++++--- 9 files changed, 63 insertions(+), 40 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java index ce40a33dff..dbbd5be370 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java @@ -3,35 +3,47 @@ package com.github.technus.tectech.thing.cover; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_CoverBehavior; +import net.minecraft.item.ItemStack; public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior { public GT_Cover_TM_PowerPassUpgrade() { } + public boolean isCoverPlaceable(byte aSide, GT_ItemStack aStack, ICoverable aTileEntity) { + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + return !multi.ePowerPassCapable; + } + return false; + } + @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { - IGregTechTileEntity TE = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); - if (TE instanceof GT_MetaTileEntity_MultiblockBase_EM) { - GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) TE; - multi.ePowerPassUpgraded = true; + public void placeCover(byte aSide, ItemStack aCover, ICoverable aTileEntity) { + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + multi.ePowerPassCapable = true; + multi.ePowerPass = true; } - return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); + super.placeCover(aSide, aCover, aTileEntity); } @Override public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { - IGregTechTileEntity TE = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); - if (TE instanceof GT_MetaTileEntity_MultiblockBase_EM) { - GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) TE; - multi.ePowerPassUpgraded = false; + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + multi.ePowerPassCapable = false; + multi.ePowerPass = false; } return true; } - @Override + @Deprecated public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - //It updates once every 200 ticks, so once every 10 seconds - return 200; + return 0; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 77647a0e20..6d4f096e91 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -130,12 +130,12 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true);//todo texture } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 152d110c8d..a3bc9a2c17 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -167,12 +167,12 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true); } public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_whooum"); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index cdac772541..62de14f019 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -117,12 +117,12 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, false); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, false); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, false); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 543c09b72a..fa97bd9f8e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -198,12 +198,12 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, true);//todo texture } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 189eae8205..c6c9a654dd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -99,12 +99,12 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, true); } @Override 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 8086b70691..7cbd51228e 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 @@ -20,11 +20,12 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public long[] eParamsOutl = new long[20]; public byte eCertainMode = 5, eCertainStatus = 127; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; - public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + public boolean ePowerPassButton; + public final boolean eSafeVoidButton, allowedToWorkButton; - public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean enableSafeVoid, boolean enablePowerButton) { super(aInventoryPlayer, aTileEntity); - ePowerPassButton=enablePowerPass; + ePowerPassButton=false; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; } @@ -74,7 +75,11 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { case 0: if(ePowerPassButton) { TecTech.proxy.playSound(base,"fx_click"); - mte.ePowerPass ^= true; + if(mte.ePowerPassCapable){ + mte.ePowerPass ^= true; + }else { + mte.ePowerPass = false; + } if (!allowedToWorkButton) {//TRANSFORMER HACK if (mte.ePowerPass) { mte.getBaseMetaTileEntity().enableWorking(); @@ -118,6 +123,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; + ePowerPassButton = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPassCapable; eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eSafeVoid; allowedToWork = mTileEntity.isAllowedToWork(); @@ -127,7 +133,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { var1.sendProgressBarUpdate(this, i++, (eParamsInStatus[j].getOrdinalByte() | (eParamsOutStatus[j].getOrdinalByte() << 8))); } var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); - var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0)); + 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); @@ -151,6 +157,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPass = (par2 & 1) == 1; eSafeVoid = (par2 & 2) == 2; allowedToWork = (par2 & 4) == 4; + ePowerPassButton = (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)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 5f5ddf6e4a..c471698a1c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -20,14 +20,13 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { private String mName; private static byte counter = 0; - private final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + private final boolean eSafeVoidButton, allowedToWorkButton; private final GT_Container_MultiMachineEM mContainer; - public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enableSafeVoid, boolean enablePowerButton) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; - ePowerPassButton=enablePowerPass; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; ySize= 192; @@ -38,7 +37,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; - ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; + eSafeVoidButton=allowedToWorkButton=true; ySize= 192; xSize = 198; } @@ -108,10 +107,12 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); x+= 173; - if(!ePowerPassButton) { + if (mContainer.ePowerPassButton) { + if (mContainer.ePowerPass) {// + drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); + } + } else {//no function drawTexturedModalRect(x, y + 115, 231, 23, 18, 18); - } else if (mContainer.ePowerPass) { - drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); } if(!eSafeVoidButton) { 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 7cc83caaba..da5ca5500d 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 @@ -122,7 +122,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected byte minRepairStatus = 3; //can power pass be enabled - public boolean ePowerPassUpgraded = false; + public boolean ePowerPassCapable = false; //functionality toggles - changed by buttons in gui also public boolean ePowerPass = false, eSafeVoid = false; @@ -293,7 +293,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ @Override protected void addFluidOutputs(FluidStack[] mOutputFluids) { - int min = mOutputFluids.length > mOutputHatches.size() ? mOutputHatches.size() : mOutputFluids.length; + int min = Math.min(mOutputFluids.length, mOutputHatches.size()); for (int i = 0; i < min; ++i) { if (mOutputHatches.get(i) != null && mOutputFluids[i] != null && GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(mOutputHatches.get(i))) { mOutputHatches.get(i).fill(mOutputFluids[i], true); @@ -546,11 +546,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { hatch_elemental.id = -1; } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + for (GT_MetaTileEntity_Hatch_OutputData hatch_data : eOutputData) { hatch_data.id = -1; hatch_data.q = null; } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { + for (GT_MetaTileEntity_Hatch_InputData hatch_data : eInputData) { hatch_data.id = -1; } for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { @@ -724,10 +724,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt aNBT.setByte("eFlip", (byte)extendedFacing.getFlip().getIndex()); aNBT.setBoolean("eParam", eParameters); aNBT.setBoolean("ePass", ePowerPass); + aNBT.setBoolean("ePassCapable", ePowerPassCapable); aNBT.setBoolean("eVoid", eSafeVoid); aNBT.setBoolean("eBoom", eDismantleBoom); aNBT.setBoolean("eOK", mMachine); - //Ensures compatibility if (mOutputItems != null) { aNBT.setInteger("mOutputItemsLength", mOutputItems.length); @@ -817,6 +817,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Flip.byIndex(aNBT.getByte("eFlip"))); eParameters = !aNBT.hasKey("eParam") || aNBT.getBoolean("eParam"); ePowerPass = aNBT.getBoolean("ePass"); + if(aNBT.hasKey("ePassCapable")) { + ePowerPassCapable = aNBT.getBoolean("ePassCapable"); + } eSafeVoid = aNBT.getBoolean("eVoid"); eDismantleBoom = aNBT.getBoolean("eBoom"); mMachine = aNBT.getBoolean("eOK"); -- cgit From 47e2d590dac90e48fc9d55631a58bcfaf5b03f65 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 25 Jan 2021 21:00:03 +0100 Subject: Implemented power pass cover --- .../thing/cover/GT_Cover_TM_PowerPassUpgrade.java | 6 +++--- .../multi/base/GT_Container_MultiMachineEM.java | 19 +++++++++---------- .../multi/base/GT_GUIContainer_MultiMachineEM.java | 20 ++++++++------------ .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 10 ++++------ 4 files changed, 24 insertions(+), 31 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java index dbbd5be370..c9bb6da14f 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java @@ -15,7 +15,7 @@ public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior { IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; - return !multi.ePowerPassCapable; + return !multi.ePowerPassCover; } return false; } @@ -25,7 +25,7 @@ public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior { IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; - multi.ePowerPassCapable = true; + multi.ePowerPassCover = true; multi.ePowerPass = true; } super.placeCover(aSide, aCover, aTileEntity); @@ -36,7 +36,7 @@ public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior { IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; - multi.ePowerPassCapable = false; + multi.ePowerPassCover = false; multi.ePowerPass = false; } return true; 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 7cbd51228e..c2d1012910 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 @@ -20,19 +20,18 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public long[] eParamsOutl = new long[20]; public byte eCertainMode = 5, eCertainStatus = 127; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; - public boolean ePowerPassButton; - public final boolean eSafeVoidButton, allowedToWorkButton; + public final boolean eSafeVoidButton, allowedToWorkButton,ePowerPassButton; + public boolean ePowerPassCover; - public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean enableSafeVoid, boolean enablePowerButton) { + public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity,boolean enablePowerPassButton, boolean enableSafeVoid, boolean enablePowerButton) { super(aInventoryPlayer, aTileEntity); - ePowerPassButton=false; + ePowerPassButton=enablePowerPassButton; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; } public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; + this(aInventoryPlayer,aTileEntity,true,true,true); } public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { @@ -73,9 +72,9 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { IGregTechTileEntity base = mte.getBaseMetaTileEntity(); switch (aSlotIndex) { case 0: - if(ePowerPassButton) { + if(ePowerPassButton || mte.ePowerPassCover) { TecTech.proxy.playSound(base,"fx_click"); - if(mte.ePowerPassCapable){ + if(mte.ePowerPassCover){ mte.ePowerPass ^= true; }else { mte.ePowerPass = false; @@ -123,7 +122,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; - ePowerPassButton = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPassCapable; + ePowerPassCover = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPassCover; eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eSafeVoid; allowedToWork = mTileEntity.isAllowedToWork(); @@ -157,7 +156,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPass = (par2 & 1) == 1; eSafeVoid = (par2 & 2) == 2; allowedToWork = (par2 & 4) == 4; - ePowerPassButton = (par2 & 8) == 8; + 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)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index c471698a1c..7794d54621 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -18,15 +18,16 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; */ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { - private String mName; + private final String mName; private static byte counter = 0; - private final boolean eSafeVoidButton, allowedToWorkButton; + private final boolean eSafeVoidButton, allowedToWorkButton,ePowerPassButton; private final GT_Container_MultiMachineEM mContainer; - public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enableSafeVoid, boolean enablePowerButton) { + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile,boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; + ePowerPassButton=enablePowerPass; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; ySize= 192; @@ -34,12 +35,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - mContainer=(GT_Container_MultiMachineEM)super.mContainer; - mName = aName; - eSafeVoidButton=allowedToWorkButton=true; - ySize= 192; - xSize = 198; + this(aInventoryPlayer,aTileEntity,aName,aTextureFile,true,true,true); } @Override @@ -107,12 +103,12 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); x+= 173; - if (mContainer.ePowerPassButton) { + if (!ePowerPassButton && !mContainer.ePowerPassCover) {//no function + drawTexturedModalRect(x, y + 115, 231, 23, 18, 18); + } else { if (mContainer.ePowerPass) {// drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); } - } else {//no function - drawTexturedModalRect(x, y + 115, 231, 23, 18, 18); } if(!eSafeVoidButton) { 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 465ac9ff71..9ba6235c83 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 @@ -121,8 +121,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //if u need to force some things to be fixed - u might need to override doRandomMaintenanceDamage protected byte minRepairStatus = 3; - //can power pass be enabled - public boolean ePowerPassCapable = false; + //is power pass cover present + public boolean ePowerPassCover = false; //functionality toggles - changed by buttons in gui also public boolean ePowerPass = false, eSafeVoid = false; @@ -724,7 +724,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt aNBT.setByte("eFlip", (byte)extendedFacing.getFlip().getIndex()); aNBT.setBoolean("eParam", eParameters); aNBT.setBoolean("ePass", ePowerPass); - aNBT.setBoolean("ePassCapable", ePowerPassCapable); + aNBT.setBoolean("ePowerPassCover", ePowerPassCover); aNBT.setBoolean("eVoid", eSafeVoid); aNBT.setBoolean("eBoom", eDismantleBoom); aNBT.setBoolean("eOK", mMachine); @@ -817,9 +817,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Flip.byIndex(aNBT.getByte("eFlip"))); eParameters = !aNBT.hasKey("eParam") || aNBT.getBoolean("eParam"); ePowerPass = aNBT.getBoolean("ePass"); - if(aNBT.hasKey("ePassCapable")) { - ePowerPassCapable = aNBT.getBoolean("ePassCapable"); - } + ePowerPassCover = aNBT.getBoolean("ePowerPassCover"); eSafeVoid = aNBT.getBoolean("eVoid"); eDismantleBoom = aNBT.getBoolean("eBoom"); mMachine = aNBT.getBoolean("eOK"); -- cgit From 34b58d35f3c70a7ebc3bce4a81a6055147fd21ab Mon Sep 17 00:00:00 2001 From: impbk2002 Date: Thu, 28 Jan 2021 02:11:21 +0900 Subject: Update GT_MetaTileEntity_Hatch_Rack.java (#50) OpenComputers unlocalized name fixed --- .../hatch/GT_MetaTileEntity_Hatch_Rack.java | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/main') 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 d9d5f90593..53fea9ef7c 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 @@ -342,28 +342,28 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { } if (Loader.isModLoaded("OpenComputers")) { - new RackComponent("OpenComputers:item.23", 0, 1, 0f, 100, true);//Transistor - new RackComponent("OpenComputers:item.24", 7, 12, -.05f, 1500, true);//chip t1 - new RackComponent("OpenComputers:item.25", 18, 20, -.1f, 3000, true);//chip t2 - new RackComponent("OpenComputers:item.26", 25, 22, -.15f, 4500, true);//chip t3 - new RackComponent("OpenComputers:item.27", 10, 15, -.05f, 3000, true);//alu - new RackComponent("OpenComputers:item.28", 25, 18, -.05f, 1500, true);//cu - - new RackComponent("OpenComputers:item.70", 42, 30, -.05f, 1500, true);//bus t1 - new RackComponent("OpenComputers:item.71", 70, 50, -.1f, 3000, true);//bus t2 - new RackComponent("OpenComputers:item.72", 105, 72, -.15f, 4500, true);//bus t3 - - new RackComponent("OpenComputers:item.29", 106, 73, -.1f, 1500, true);//cpu t1 - new RackComponent("OpenComputers:item.42", 226, 153, -.15f, 3000, true);//cpu t2 - new RackComponent("OpenComputers:item.43", 374, 241, -.2f, 4500, true);//cpu t3 - - new RackComponent("OpenComputers:item.8", 20, 27, -.1f, 1500, true);//gpu t1 - new RackComponent("OpenComputers:item.9", 62, 67, -.2f, 3000, true);//gpu t2 - new RackComponent("OpenComputers:item.10", 130, 111, -.3f, 4500, true);//gpu t3 - - new RackComponent("OpenComputers:item.101", 350, 234, -.1f, 1500, true);//apu t1 - new RackComponent("OpenComputers:item.102", 606, 398, -.2f, 4500, true);//apu t2 - new RackComponent("OpenComputers:item.103", 1590, 1006, -.3f, 9000, true);//apu tC + new RackComponent("OpenComputers:item.oc.Transistor", 0, 1, 0f, 100, true);//Transistor + new RackComponent("OpenComputers:item.oc.Microchip0", 7, 12, -.05f, 1500, true);//chip t1 + new RackComponent("OpenComputers:item.oc.Microchip1", 18, 20, -.1f, 3000, true);//chip t2 + new RackComponent("OpenComputers:item.oc.Microchip2", 25, 22, -.15f, 4500, true);//chip t3 + new RackComponent("OpenComputers:item.oc.ALU", 10, 15, -.05f, 3000, true);//alu + new RackComponent("OpenComputers:item.oc.ControlUnit", 25, 18, -.05f, 1500, true);//cu + + new RackComponent("OpenComputers:item.oc.ComponentBus0", 42, 30, -.05f, 1500, true);//bus t1 + new RackComponent("OpenComputers:item.oc.ComponentBus1", 70, 50, -.1f, 3000, true);//bus t2 + new RackComponent("OpenComputers:item.oc.ComponentBus2", 105, 72, -.15f, 4500, true);//bus t3 + + new RackComponent("OpenComputers:item.oc.CPU0", 106, 73, -.1f, 1500, true);//cpu t1 + new RackComponent("OpenComputers:item.oc.CPU1", 226, 153, -.15f, 3000, true);//cpu t2 + new RackComponent("OpenComputers:item.oc.CPU2", 374, 241, -.2f, 4500, true);//cpu t3 + + new RackComponent("OpenComputers:item.oc.GraphicsCard0", 20, 27, -.1f, 1500, true);//gpu t1 + new RackComponent("OpenComputers:item.oc.GraphicsCard1", 62, 67, -.2f, 3000, true);//gpu t2 + new RackComponent("OpenComputers:item.oc.GraphicsCard2", 130, 111, -.3f, 4500, true);//gpu t3 + + new RackComponent("OpenComputers:item.oc.APU0", 350, 234, -.1f, 1500, true);//apu t2 + new RackComponent("OpenComputers:item.oc.APU1", 606, 398, -.2f, 4500, true);//apu t3 + new RackComponent("OpenComputers:item.oc.APU2", 1590, 1006, -.3f, 9000, true);//apu tC } } -- cgit From 957d2b9e6dd33158e7bc60ef06c6ece250640db0 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 27 Jan 2021 19:46:22 +0100 Subject: Supply missing parameters --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java | 4 ++-- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java | 4 ++-- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java | 4 ++-- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java | 4 ++-- .../metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 6d4f096e91..582be290ac 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -130,12 +130,12 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true);//todo texture } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index a3bc9a2c17..82fd2df5ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -167,12 +167,12 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true); } public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_whooum"); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 62de14f019..3e288ccafa 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -117,12 +117,12 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, false); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, false); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, false); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index fa97bd9f8e..674ffe8c3e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -198,12 +198,12 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true);//todo texture } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index c6c9a654dd..38e14b9a6f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -99,12 +99,12 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true); } @Override -- cgit From a64e2174c8d5bbbbb40ea5af2b0c8b104700e944 Mon Sep 17 00:00:00 2001 From: Tec Date: Wed, 3 Mar 2021 21:33:14 +0100 Subject: Add fallback logic --- .../github/technus/tectech/util/DoubleCount.java | 63 ++++++++++++++-------- 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java index 0c5865d56e..b37c0987ae 100644 --- a/src/main/java/com/github/technus/tectech/util/DoubleCount.java +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -2,45 +2,62 @@ package com.github.technus.tectech.util; import java.util.Arrays; +import static java.lang.Math.*; import static java.lang.Math.max; import static java.lang.Math.ulp; public class DoubleCount { - public static double[] distribute(double count,double... probabilities) throws ArithmeticException{ - if(probabilities==null){ + public static double[] distribute(double count,double... probabilities) throws ArithmeticException { + if (probabilities == null) { return null; - }else if(count==0){ + } else if (count == 0) { return new double[probabilities.length]; - }else { - switch (probabilities.length){ + } else { + switch (probabilities.length) { default: { - int size=probabilities.length; - double[] output=new double[size]; + int size = probabilities.length; + double[] output = new double[size]; size--; - double remaining=count,previous=probabilities[size],probability,out,sum=0; + double remaining = count, previous = probabilities[size], probability, out, sum = 0; for (int i = size - 1; i >= 0; i--) { - probability=probabilities[i]; - remaining-=out=count*(probability-ulp(probability)); - sum+=output[i]=out; - if(previous=1){ + previous = probability; + if (probability >= 1) { break; } } - if(remaining*count<0){ - throw new ArithmeticException("Malformed probability sum: "+ Arrays.toString(probabilities)); - } - sum+=output[size]=remaining-ulp(remaining)*size; - if(sum>count){ - throw new ArithmeticException("Too much outputted: "+ Arrays.toString(output)+" "+sum+" / "+count); + if (remaining * count < 0) { + finishIt(size, output, remaining); + } else { + sum += output[size] = remaining - ulp(remaining) * size; + if (sum > count) { + remaining = sum - count; + finishIt(size, output, remaining); + } } return output; } - case 1: return new double[]{count}; - case 0: return probabilities;//empty array at hand... + case 1: + return new double[]{count}; + case 0: + return probabilities;//empty array at hand... + } + } + } + + private static void finishIt(int size, double[] output, double remaining) { + for (int i = size - 1; i >= 0; i--) { + if (abs(output[i]) >= abs(remaining)) { + output[i] -= remaining; + break; + } else { + remaining+=output[i]; + output[i]=0; } } } -- cgit From 9546dda5e4734824c6b9ce0245ebf9d603f27e5e Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Sat, 13 Mar 2021 22:43:17 +0100 Subject: fix-nullpointer-exeption (#51) fix null pointer exeption when dequantezizing items --- .../definitions/complex/dAtomDefinition.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index 965c46cef6..00c64e5ccd 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -1319,17 +1319,26 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { - return TRANSFORMATION_INFO.fluidDequantization.get(this); + HashMap temp = TRANSFORMATION_INFO.fluidDequantization; + if (temp == null) + return null; + return temp.get(this); } @Override public aItemDequantizationInfo someAmountIntoItemsStack() { - return TRANSFORMATION_INFO.itemDequantization.get(this); + HashMap temp = TRANSFORMATION_INFO.itemDequantization; + if (temp == null) + return null; + return temp.get(this); } @Override public aOredictDequantizationInfo someAmountIntoOredictStack() { - return TRANSFORMATION_INFO.oredictDequantization.get(this); + HashMap temp = TRANSFORMATION_INFO.oredictDequantization; + if (temp == null) + return null; + return temp.get(this); } private static final class Nomenclature { -- cgit From fb605813d17efe8e99818a0687d244d297bfb103 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 14 Mar 2021 04:12:29 +0100 Subject: Re-fix by RCA instead of workarounds --- .../core/transformations/bTransformationInfo.java | 28 +++++++++------------- .../definitions/complex/dAtomDefinition.java | 15 +++--------- 2 files changed, 14 insertions(+), 29 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java index c9ac204554..55ee24e2f6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java @@ -9,7 +9,9 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; +import java.util.Collections; import java.util.HashMap; +import java.util.Map; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; @@ -21,26 +23,18 @@ public class bTransformationInfo { public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000)/6.02214076e23D; public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; - public static final HashMap fluidQuantization=new HashMap<>(32); - public static final HashMap itemQuantization=new HashMap<>(32); - public static final HashMap oredictQuantization=new HashMap<>(32); + public static final Map fluidQuantization=new HashMap<>(32); + public static final Map itemQuantization=new HashMap<>(32); + public static final Map oredictQuantization=new HashMap<>(32); - public HashMap fluidDequantization; - - public HashMap itemDequantization; - - public HashMap oredictDequantization; + public Map fluidDequantization; + public Map itemDequantization; + public Map oredictDequantization; public bTransformationInfo(int fluidCap,int itemCap, int oreCap){ - if(fluidCap>0) { - fluidDequantization = new HashMap<>(fluidCap); - } - if(itemCap>0) { - itemDequantization = new HashMap<>(itemCap); - } - if(oreCap>0) { - oredictDequantization = new HashMap<>(oreCap); - } + fluidDequantization = fluidCap > 0 ? new HashMap<>(fluidCap) : Collections.emptyMap(); + itemDequantization = itemCap > 0 ? new HashMap<>(itemCap) : Collections.emptyMap(); + oredictDequantization = oreCap > 0 ? new HashMap<>(oreCap) : Collections.emptyMap(); } public void addFluid(iHasElementalDefinition em, FluidStack fluidStack){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index 00c64e5ccd..965c46cef6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -1319,26 +1319,17 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { - HashMap temp = TRANSFORMATION_INFO.fluidDequantization; - if (temp == null) - return null; - return temp.get(this); + return TRANSFORMATION_INFO.fluidDequantization.get(this); } @Override public aItemDequantizationInfo someAmountIntoItemsStack() { - HashMap temp = TRANSFORMATION_INFO.itemDequantization; - if (temp == null) - return null; - return temp.get(this); + return TRANSFORMATION_INFO.itemDequantization.get(this); } @Override public aOredictDequantizationInfo someAmountIntoOredictStack() { - HashMap temp = TRANSFORMATION_INFO.oredictDequantization; - if (temp == null) - return null; - return temp.get(this); + return TRANSFORMATION_INFO.oredictDequantization.get(this); } private static final class Nomenclature { -- cgit From 023479dafb85262398df2db407e015371c0c0a86 Mon Sep 17 00:00:00 2001 From: basdxz Date: Mon, 15 Mar 2021 05:30:53 +0000 Subject: Add's support for AO -Refactors TT_RenderedExtendedFacingTexture.java to match GT_RenderedTexture.java -Includes LightingHelper.java for compatibility with non-NH GT5/u the simple way. --- .../render/TT_RenderedExtendedFacingTexture.java | 34 +- .../technus/tectech/util/LightingHelper.java | 726 +++++++++++++++++++++ 2 files changed, 748 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/util/LightingHelper.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java index 44fa12ebb8..44bfa4445d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; import com.github.technus.tectech.mechanics.alignment.IAlignmentProvider; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.util.LightingHelper; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IIconContainer; @@ -45,40 +46,46 @@ public class TT_RenderedExtendedFacingTexture implements ITexture,IColorModulati @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingXPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.EAST.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + lighting.setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } + aRenderer.field_152631_f = false; } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingXNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.WEST.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + lighting.setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.UP.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); + lighting.setupColor(ForgeDirection.UP.ordinal(), 0xffffff); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { @@ -89,27 +96,30 @@ public class TT_RenderedExtendedFacingTexture implements ITexture,IColorModulati @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingZPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + lighting.setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingZNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.NORTH.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + lighting.setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } + aRenderer.field_152631_f = false; } - /** * Renders the given texture to the bottom face of the block. Args: block, x, y, z, texture */ diff --git a/src/main/java/com/github/technus/tectech/util/LightingHelper.java b/src/main/java/com/github/technus/tectech/util/LightingHelper.java new file mode 100644 index 0000000000..9a1c1b1abd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/LightingHelper.java @@ -0,0 +1,726 @@ +/* + * LightingHelper - Derived and adapted from @Mineshopper / carpentersblocks + * Copyright (c) 2013-2021. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.github.technus.tectech.util; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; + +//This is duplicated in newer GT5u on the GTNH Branch inside the gregtech.api.util package +//But I include it here as the easiest way to implement backwards compat with non-NH stuff +//Yes, it could be done in a cleaner way. If you would like to, you're welcome to make your own PR and @basdxz +@SuppressWarnings("unused") +@SideOnly(Side.CLIENT) +public class LightingHelper { + public static final int NORMAL_BRIGHTNESS = 0xff00ff; + public static final int MAX_BRIGHTNESS = 0xf000f0; + protected static final float[] LIGHTNESS = {0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F}; + private final RenderBlocks renderBlocks; + /** + * Brightness for side. + */ + private int brightness; + /** + * Ambient occlusion values for all four corners of side. + */ + private float aoTopLeft, aoBottomLeft, aoBottomRight, aoTopRight; + private boolean hasLightnessOverride; + private float lightnessOverride; + private boolean hasBrightnessOverride; + private int brightnessOverride; + private boolean hasColorOverride; + private int colorOverride = 0xffffff; + + /** + * Class constructor specifying the {@link RenderBlocks}. + * + * @param renderBlocks the {@link RenderBlocks} + */ + public LightingHelper(RenderBlocks renderBlocks) { + this.renderBlocks = renderBlocks; + } + + /** + * Gets average brightness from two brightness values. + * + * @param brightnessA the first brightness value + * @param brightnessB the second brightness value + * @return the mixed brightness + */ + public static int getAverageBrightness(int brightnessA, int brightnessB) { + int sectionA1 = brightnessA >> 16 & 0xff; + int sectionA2 = brightnessA & 255; + + int sectionB1 = brightnessB >> 16 & 0xff; + int sectionB2 = brightnessB & 255; + + int difference1 = (int) ((sectionA1 + sectionB1) / 2.0F); + int difference2 = (int) ((sectionA2 + sectionB2) / 2.0F); + + return difference1 << 16 | difference2; + } + + /** + * Gets rgb color from RGBA array. + * + * @param color the integer color + * @return a float array with rgb values + */ + public static float[] getRGB(short[] color) { + float red = color[0] / 255.0F; + float green = color[1] / 255.0F; + float blue = color[2] / 255.0F; + + return new float[]{red, green, blue}; + } + + /** + * Clears brightness override. + */ + public void clearBrightnessOverride() { + hasBrightnessOverride = false; + } + + /** + * Clears color override. + */ + public void clearColorOverride() { + hasColorOverride = false; + } + + /** + * Clears lightness override. + */ + public void clearLightnessOverride() { + hasLightnessOverride = false; + } + + /** + * @return the Ambient Occlusion for Bottom-Left corner + */ + public float getAoBottomLeft() { + return aoBottomLeft; + } + + /** + * @return the Ambient Occlusion for Bottom-Right corner + */ + public float getAoBottomRight() { + return aoBottomRight; + } + + /** + * @return the Ambient Occlusion for Top-Left corner + */ + public float getAoTopLeft() { + return aoTopLeft; + } + + /** + * @return the Ambient Occlusion for Top-Right corner + */ + public float getAoTopRight() { + return aoTopRight; + } + + /** + * Sets brightness override. + * + * @param brightness the brightness override + * @return the {@link LightingHelper} + */ + public LightingHelper setBrightnessOverride(int brightness) { + hasBrightnessOverride = true; + brightnessOverride = brightness; + return this; + } + + public LightingHelper setColorOverride(short[] color) { + return setColorOverride(getColor(color)); + } + + /** + * Sets color override. + * + * @param color the color override + * @return the {@link LightingHelper} + */ + public LightingHelper setColorOverride(int color) { + hasColorOverride = true; + colorOverride = color; + return this; + } + + /** + * Gets int color from RGBA array. + * + * @param rgba the short RGBA color array + * @return int color + */ + public static int getColor(short[] rgba) { + return (rgba[2] & 0xff) | (rgba[1] & 0xff) << 8 | (rgba[0] & 0xff) << 16; + } + + /** + * Sets lightness override. + * + * @param lightness the lightness override + * @return the {@link LightingHelper} + */ + public LightingHelper setLightnessOverride(float lightness) { + hasLightnessOverride = true; + lightnessOverride = lightness; + return this; + } + + /** + * Sets up the color using lightness, brightness, and the primary color + * value (usually the dye color) for the side. + * + * @param side the side + * @param rgba the primary short[] RGBA color array + */ + public void setupColor(int side, short[] rgba) { + setupColor(side, getColor(rgba)); + } + + /** + * Sets up the color using lightness, brightness, and the primary color + * value (usually the dye color) for the side. + * + * @param side the side + * @param hexColor the primary color + */ + public void setupColor(int side, int hexColor) { + Tessellator tessellator = Tessellator.instance; + float lightness = hasLightnessOverride ? lightnessOverride : LIGHTNESS[side]; + float[] rgb = getRGB(hexColor); + + if (hasColorOverride && !renderBlocks.hasOverrideBlockTexture()) { + rgb = getRGB(colorOverride); + } + + applyAnaglyph(rgb); + + if (renderBlocks.enableAO) { + tessellator.setBrightness(hasBrightnessOverride ? brightnessOverride : brightness); + + if (renderBlocks.hasOverrideBlockTexture()) { + + renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0]; + renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1]; + renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2]; + + } else { + + renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0] * lightness; + renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1] * lightness; + renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2] * lightness; + + renderBlocks.colorRedTopLeft *= aoTopLeft; + renderBlocks.colorGreenTopLeft *= aoTopLeft; + renderBlocks.colorBlueTopLeft *= aoTopLeft; + renderBlocks.colorRedBottomLeft *= aoBottomLeft; + renderBlocks.colorGreenBottomLeft *= aoBottomLeft; + renderBlocks.colorBlueBottomLeft *= aoBottomLeft; + renderBlocks.colorRedBottomRight *= aoBottomRight; + renderBlocks.colorGreenBottomRight *= aoBottomRight; + renderBlocks.colorBlueBottomRight *= aoBottomRight; + renderBlocks.colorRedTopRight *= aoTopRight; + renderBlocks.colorGreenTopRight *= aoTopRight; + renderBlocks.colorBlueTopRight *= aoTopRight; + } + + } else { + + tessellator.setColorOpaque_F(rgb[0] * lightness, rgb[1] * lightness, rgb[2] * lightness); + + } + } + + /** + * Gets rgb color from integer. + * + * @param color the integer color + * @return a float array with rgb values + */ + public static float[] getRGB(int color) { + float red = (color >> 16 & 0xff) / 255.0F; + float green = (color >> 8 & 0xff) / 255.0F; + float blue = (color & 0xff) / 255.0F; + + return new float[]{red, green, blue}; + } + + /** + * Will apply anaglyph color multipliers to RGB float array. + *

+ * If {@link EntityRenderer#anaglyphEnable} is false, + * will do nothing. + * + * @param rgb array containing red, green and blue float values + */ + public void applyAnaglyph(float[] rgb) { + if (EntityRenderer.anaglyphEnable) { + rgb[0] = (rgb[0] * 30.0F + rgb[1] * 59.0F + rgb[2] * 11.0F) / 100.0F; + rgb[1] = (rgb[0] * 30.0F + rgb[1] * 70.0F) / 100.0F; + rgb[2] = (rgb[0] * 30.0F + rgb[2] * 70.0F) / 100.0F; + } + } + + /** + * Gets mixed ambient occlusion value from two inputs, with a + * ratio applied to the final result. + * + * @param ao1 the first ambient occlusion value + * @param ao2 the second ambient occlusion value + * @param ratio the ratio for mixing + * @return the mixed red, green, blue float values + */ + public static float getMixedAo(float ao1, float ao2, double ratio) { + float diff = (float) (Math.abs(ao1 - ao2) * (1.0F - ratio)); + + return ao1 > ao2 ? ao1 - diff : ao1 + diff; + } + + /** + * Sets up lighting for the West face and returns the {@link LightingHelper}. + *

+ * This is a consolidated method that sets side shading + * with respect to the following attributes: + *

+ *

    + *
  • {@link RenderBlocks#enableAO}
  • + *
  • {@link RenderBlocks#partialRenderBounds}
  • + *
+ * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingXNeg(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int xOffset = renderBlocks.renderMinX > 0.0F ? x : x - 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z); + brightness = mixedBrightness; + + float ratio = (float) (1.0F - renderBlocks.renderMinX); + float aoLightValue = renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z); + renderBlocks.aoBrightnessXZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z - 1); + renderBlocks.aoBrightnessXZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z + 1); + renderBlocks.aoBrightnessXYNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z - 1); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z + 1); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z - 1); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z + 1); + renderBlocks.aoLightValueScratchXYNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNPN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), ratio); + + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessXYNP, mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXZNN, mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXZNP, mixedBrightness); + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessXYZNPP, mixedBrightness); + + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + aoLightValue + renderBlocks.aoLightValueScratchXYZNPN + renderBlocks.aoLightValueScratchXYNP) / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXZNN + aoLightValue) / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNP + aoLightValue + renderBlocks.aoLightValueScratchXZNP) / 4.0F; + float aoMixedXYZNPP = (aoLightValue + renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchXYZNPP) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); + aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); + aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMinZ + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); + aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMaxY * renderBlocks.renderMaxZ, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMaxY * renderBlocks.renderMinZ, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMinY * renderBlocks.renderMinZ, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMinY * renderBlocks.renderMaxZ, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); + + } + + return this; + } + + /** + * Sets up lighting for the East face and returns the {@link LightingHelper}. + *

+ * This is a consolidated method that sets side shading + * with respect to the following attributes: + *

+ *

    + *
  • {@link RenderBlocks#enableAO}
  • + *
  • {@link RenderBlocks#partialRenderBounds}
  • + *
+ * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingXPos(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int xOffset = renderBlocks.renderMaxX < 1.0F ? x : x + 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z); + brightness = mixedBrightness; + + float aoLightValue = renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z); + renderBlocks.aoBrightnessXZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z - 1); + renderBlocks.aoBrightnessXZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z + 1); + renderBlocks.aoBrightnessXYPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z - 1); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z + 1); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z - 1); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z + 1); + renderBlocks.aoLightValueScratchXYPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + + int brightnessMixedXYZPPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZPP, renderBlocks.aoBrightnessXYPP, renderBlocks.aoBrightnessXYZPPP, mixedBrightness); + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXZPP, mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZPNN, renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXZPN, mixedBrightness); + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZPN, renderBlocks.aoBrightnessXYZPPN, renderBlocks.aoBrightnessXYPP, mixedBrightness); + + float aoMixedXYZPPP = (aoLightValue + renderBlocks.aoLightValueScratchXZPP + renderBlocks.aoLightValueScratchXYPP + renderBlocks.aoLightValueScratchXYZPPP) / 4.0F; + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXYZPNP + aoLightValue + renderBlocks.aoLightValueScratchXZPP) / 4.0F; + float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchXYZPNN + renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXZPN + aoLightValue) / 4.0F; + float aoMixedXYZPPN = (renderBlocks.aoLightValueScratchXZPN + aoLightValue + renderBlocks.aoLightValueScratchXYZPPN + renderBlocks.aoLightValueScratchXYPP) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ); + aoBottomLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinZ); + aoBottomRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ); + aoTopRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMinY * renderBlocks.renderMaxZ); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMinY * renderBlocks.renderMinZ); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMaxY * renderBlocks.renderMinZ); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMaxY * renderBlocks.renderMaxZ); + + } + + return this; + } + + /** + * Sets up lighting for the bottom face and returns the {@link LightingHelper}. + *

+ * This is a consolidated method that sets side shading + * with respect to the following attributes: + *

+ *

    + *
  • {@link RenderBlocks#enableAO}
  • + *
  • {@link RenderBlocks#partialRenderBounds}
  • + *
+ * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingYNeg(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int yOffset = renderBlocks.renderMinY > 0.0F ? y : y - 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z); + brightness = mixedBrightness; + + float ratio = (float) (1.0F - renderBlocks.renderMinY); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z); + renderBlocks.aoBrightnessYZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z - 1); + renderBlocks.aoBrightnessYZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z + 1); + renderBlocks.aoBrightnessXYPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z + 1); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z + 1); + renderBlocks.aoLightValueScratchXYNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), ratio); + + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNP, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXYPN, mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNN, renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXYZPNN, mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessYZNN, mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessYZNP, mixedBrightness); + + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + aoLightValue + renderBlocks.aoLightValueScratchXYZPNP + renderBlocks.aoLightValueScratchXYPN) / 4.0F; + float aoMixedXYZPNN = (aoLightValue + renderBlocks.aoLightValueScratchYZNN + renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXYZPNN) / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNN + aoLightValue + renderBlocks.aoLightValueScratchYZNN) / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + aoBottomRight = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + + } + + return this; + } + + /** + * Sets up lighting for the top face and returns the {@link LightingHelper}. + *

+ * This is a consolidated method that sets side shading + * with respect to the following attributes: + *

+ *

    + *
  • {@link RenderBlocks#enableAO}
  • + *
  • {@link RenderBlocks#partialRenderBounds}
  • + *
+ * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingYPos(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int yOffset = renderBlocks.renderMaxY < 1.0F ? y : y + 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z); + brightness = mixedBrightness; + + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z); + renderBlocks.aoBrightnessXYPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z); + renderBlocks.aoBrightnessYZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z - 1); + renderBlocks.aoBrightnessYZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z + 1); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z + 1); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z + 1); + renderBlocks.aoLightValueScratchXYNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchYZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchYZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZNPN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + + int brightnessMixedXYZPPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPP, renderBlocks.aoBrightnessXYZPPP, renderBlocks.aoBrightnessXYPP, mixedBrightness); + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPN, renderBlocks.aoBrightnessXYPP, renderBlocks.aoBrightnessXYZPPN, mixedBrightness); + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessYZPN, mixedBrightness); + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNPP, renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessYZPP, mixedBrightness); + + float aoMixedXYZPPP = (renderBlocks.aoLightValueScratchYZPP + aoLightValue + renderBlocks.aoLightValueScratchXYZPPP + renderBlocks.aoLightValueScratchXYPP) / 4.0F; + float aoMixedXYZPPN = (aoLightValue + renderBlocks.aoLightValueScratchYZPN + renderBlocks.aoLightValueScratchXYPP + renderBlocks.aoLightValueScratchXYZPPN) / 4.0F; + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchXYZNPN + aoLightValue + renderBlocks.aoLightValueScratchYZPN) / 4.0F; + float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXYZNPP + renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchYZPP + aoLightValue) / 4.0F; + + aoTopLeft /*SE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + aoBottomLeft /*NE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + aoBottomRight /*NW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + aoTopRight /*SW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + } + + return this; + } + + /** + * Sets up lighting for the North face and returns the {@link LightingHelper}. + *

+ * This is a consolidated method that sets side shading + * with respect to the following attributes: + *

+ *

    + *
  • {@link RenderBlocks#enableAO}
  • + *
  • {@link RenderBlocks#partialRenderBounds}
  • + *
+ * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingZNeg(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int zOffset = renderBlocks.renderMinZ > 0.0F ? z : z - 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset); + brightness = mixedBrightness; + + float ratio = (float) (1.0F - renderBlocks.renderMinZ); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y, zOffset); + renderBlocks.aoBrightnessYZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y - 1, zOffset); + renderBlocks.aoBrightnessYZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y + 1, zOffset); + renderBlocks.aoBrightnessXZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y, zOffset); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y + 1, zOffset); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y + 1, zOffset); + renderBlocks.aoLightValueScratchXZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNPN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), ratio); + + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPN, renderBlocks.aoBrightnessXZPN, renderBlocks.aoBrightnessXYZPPN, mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNN, renderBlocks.aoBrightnessXYZPNN, renderBlocks.aoBrightnessXZPN, mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessYZNN, mixedBrightness); + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessYZPN, mixedBrightness); + + float aoMixedXYZPPN = (aoLightValue + renderBlocks.aoLightValueScratchYZPN + renderBlocks.aoLightValueScratchXZPN + renderBlocks.aoLightValueScratchXYZPPN) / 4.0F; + float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchYZNN + aoLightValue + renderBlocks.aoLightValueScratchXYZPNN + renderBlocks.aoLightValueScratchXZPN) / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + renderBlocks.aoLightValueScratchXZNN + renderBlocks.aoLightValueScratchYZNN + aoLightValue) / 4.0F; + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + renderBlocks.aoLightValueScratchXYZNPN + aoLightValue + renderBlocks.aoLightValueScratchYZPN) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + aoBottomRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxY * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxY * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinY * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinY * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + + } + + return this; + } + + /** + * Sets up lighting for the South face and returns the {@link LightingHelper}. + *

+ * This is a consolidated method that sets side shading + * with respect to the following attributes: + *

+ *

    + *
  • {@link RenderBlocks#enableAO}
  • + *
  • {@link RenderBlocks#partialRenderBounds}
  • + *
+ * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingZPos(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int zOffset = renderBlocks.renderMaxZ < 1.0F ? z : z + 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset); + brightness = mixedBrightness; + + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y, zOffset); + renderBlocks.aoBrightnessXZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y, zOffset); + renderBlocks.aoBrightnessYZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y - 1, zOffset); + renderBlocks.aoBrightnessYZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y + 1, zOffset); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y + 1, zOffset); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y + 1, zOffset); + renderBlocks.aoLightValueScratchXZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchYZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchYZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessXYZNPP, renderBlocks.aoBrightnessYZPP, mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessYZNP, mixedBrightness); + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNP, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXZPP, mixedBrightness); + int brightnessMixedXYZPPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPP, renderBlocks.aoBrightnessXZPP, renderBlocks.aoBrightnessXYZPPP, mixedBrightness); + + float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchXYZNPP + aoLightValue + renderBlocks.aoLightValueScratchYZPP) / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F; + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + aoLightValue + renderBlocks.aoLightValueScratchXYZPNP + renderBlocks.aoLightValueScratchXZPP) / 4.0F; + float aoMixedXYZPPP = (aoLightValue + renderBlocks.aoLightValueScratchYZPP + renderBlocks.aoLightValueScratchXZPP + renderBlocks.aoLightValueScratchXYZPPP) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, renderBlocks.renderMaxY * renderBlocks.renderMinX); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, renderBlocks.renderMinY * renderBlocks.renderMinX); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, renderBlocks.renderMinY * renderBlocks.renderMaxX); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, renderBlocks.renderMaxY * renderBlocks.renderMaxX); + } + + return this; + } +} -- cgit From d35bc08e43142f661163f04b28d3d19e3bffc0c5 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 1 Apr 2021 12:39:41 +0200 Subject: Allow gui enxtensibility --- .../multi/base/GT_GUIContainer_MultiMachineEM.java | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 7794d54621..070976006c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -18,13 +18,13 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; */ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { - private final String mName; - private static byte counter = 0; - private final boolean eSafeVoidButton, allowedToWorkButton,ePowerPassButton; - private final GT_Container_MultiMachineEM mContainer; + protected final String mName; + protected static byte counter = 0; + protected final boolean eSafeVoidButton, allowedToWorkButton,ePowerPassButton; + protected final GT_Container_MultiMachineEM mContainer; - public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile,boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { - super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + protected GT_GUIContainer_MultiMachineEM(GT_Container_MultiMachineEM container, String aName, String aTextureFile,boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + super(container, RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; ePowerPassButton=enablePowerPass; @@ -34,8 +34,16 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach xSize = 198; } + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile,boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + this(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity),aName,aTextureFile,enablePowerPass,enableSafeVoid,enablePowerButton); + } + + protected GT_GUIContainer_MultiMachineEM(GT_Container_MultiMachineEM container, String aName, String aTextureFile) { + this(container,aName,aTextureFile,true,true,true); + } + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - this(aInventoryPlayer,aTileEntity,aName,aTextureFile,true,true,true); + this(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity),aName,aTextureFile); } @Override @@ -198,7 +206,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } } - private void LEDdrawP(int x, int y, int i, int j, LedStatus status) { + protected void LEDdrawP(int x, int y, int i, int j, LedStatus status) { int v = 192, su = 8, sv = 6, u = 11; switch (status) { case STATUS_WTF: { @@ -287,7 +295,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } } - private void LEDtooltips(int x,int y){ + protected void LEDtooltips(int x,int y){ int renderPosX=x; int renderPosY=y; x-= (width - xSize) / 2; @@ -327,7 +335,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } } - private void hoveringText(List strings, int x, int y, FontRenderer font) { + protected void hoveringText(List strings, int x, int y, FontRenderer font) { if (!strings.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); //RenderHelper.disableStandardItemLighting(); -- cgit From 7a828e286097f62a617694fba5e8f7e827d42c37 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Wed, 21 Apr 2021 16:10:58 -0400 Subject: Add recipes for UEV, UIV, UMV energy hatches/dynamos --- .../dreamcraft/DreamCraftRecipeLoader.java | 129 ++++++++++++++++++++- 1 file changed, 128 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 00b31915c2..9ff8ec93a0 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -992,7 +992,8 @@ public class DreamCraftRecipeLoader implements Runnable { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000), Materials.SolderingAlloy.getMolten(5760), }, ItemList.Hatch_Energy_MAX.get(1L), 1000, 2000000); - + + //UHV Dynamo Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_UV.get(1L), 48000, 32, 100000, 4, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -1014,6 +1015,132 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5760)}, ItemList.Hatch_Dynamo_MAX.get(1L), 1000, 2000000); + //UEV Energy Hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_MAX.get(1L), + 48000, 32, 100000, 4, new Object[]{ + getItemContainer("Hull_UEV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 4L), + ItemList.Circuit_Chip_QPIC.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 2L}, + ItemList.UHV_Coil.get(4L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(1L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000), + Materials.SolderingAlloy.getMolten(11520), + Materials.UUMatter.getFluid(8000L)}, + getItemContainer("Hatch_Energy_UEV").get(1L), 1000, 8000000); + + //UEV Dynamo Hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_MAX.get(1L), + 96000, 64, 200000, 8, new Object[]{ + getItemContainer("Hull_UEV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 16L), + ItemList.Circuit_Chip_QPIC.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 2L}, + ItemList.UHV_Coil.get(4L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(1L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000), + Materials.SolderingAlloy.getMolten(11520), + Materials.UUMatter.getFluid(8000L)}, + getItemContainer("Hatch_Dynamo_UEV").get(1L), 1000, 8000000); + + //UIV Energy Hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UEV").get(1L), + 96000, 64, 200000, 8, new Object[]{ + getItemContainer("Hull_UIV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 8L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("NanoCircuit").get(2), + ItemList.UHV_Coil.get(8L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(2L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 64000), + Materials.SolderingAlloy.getMolten(23040), + Materials.UUMatter.getFluid(16000L)}, + getItemContainer("Hatch_Energy_UIV").get(1L), 1000, 16000000); + + //UIV Dynamo Hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UEV").get(1L), + 192000, 128, 400000, 16, new Object[]{ + getItemContainer("Hull_UIV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 32L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("NanoCircuit").get(2), + ItemList.UHV_Coil.get(8L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(2L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 64000), + Materials.SolderingAlloy.getMolten(23040), + Materials.UUMatter.getFluid(16000L)}, + getItemContainer("Hatch_Dynamo_UIV").get(1L), 1000, 16000000); + + //UMV Energy Hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UEV").get(1L), + 192000, 128, 400000, 16, new Object[]{ + getItemContainer("Hull_UMV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 16L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("PikoCircuit").get(2), + ItemList.UHV_Coil.get(16L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(4L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 128000), + Materials.SolderingAlloy.getMolten(46080), + Materials.UUMatter.getFluid(32000L)}, + getItemContainer("Hatch_Energy_UMV").get(1L), 1000, 32000000); + + //UMV Dynamo Hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UIV").get(1L), + 384000, 256, 800000, 32, new Object[]{ + getItemContainer("Hull_UMV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 64L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("PikoCircuit").get(2), + ItemList.UHV_Coil.get(16L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(4L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 128000), + Materials.SolderingAlloy.getMolten(46080), + Materials.UUMatter.getFluid(32000L)}, + getItemContainer("Hatch_Dynamo_UMV").get(1L), 1000, 32000000); + //UHV Circuit TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Wetwaresupercomputer.get(1L), 24000, 64, 50000, 4, new ItemStack[]{ -- cgit From fa568ed0b8ff6b63a5ed06f48f2f565e1ed569a1 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Wed, 21 Apr 2021 19:58:53 -0400 Subject: Fix oredict in assline recipes --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 6 +++--- .../java/com/github/technus/tectech/loader/recipe/RecipeLoader.java | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 00b31915c2..251914d313 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -445,7 +445,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Emitter_ZPM.get(8), ItemList.Robot_Arm_ZPM.get(1), ItemList.Electric_Motor_ZPM.get(2), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 1)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 2)}, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Naquadah, 16)}, CustomItemList.DATApipe.get(2), @@ -576,7 +576,7 @@ public class DreamCraftRecipeLoader implements Runnable { //Quantum Computer GT_Values.RA.addAssemblylineRecipe(ItemList.Tool_DataOrb.get(1), 20000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 2}, ItemList.Tool_DataOrb.get(1), ItemList.Cover_Screen.get(1), new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUV, 8)}, @@ -592,7 +592,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblylineRecipe(getItemContainer("ScannerZPM").get(1), 80000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), ItemList.Sensor_ZPM.get(8), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 4)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 4}, ItemList.Field_Generator_ZPM.get(1), ItemList.Electric_Motor_ZPM.get(2), new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 4)}, diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java index 8165cd7fec..5a153ce5f8 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java @@ -91,16 +91,15 @@ public class RecipeLoader implements Runnable { 'E', ItemList.Hull_IV}); //Data Bank - RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new ItemStack[]{ + RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, ItemList.Tool_DataOrb.get(1), ItemList.Cover_Screen.get(1), }, new FluidStack[]{ new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), Materials.Hydrogen.getGas(1000), }, CustomItemList.Machine_Multi_DataBank.get(1), 12000, 14000); - //CustomItemList.Machine_Multi_DataBank //Bucks //RA.addAssemblerRecipe(CustomItemList.) -- cgit From 42e11c61288e29fa0e37511c47a09296c87e9bb5 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Mon, 26 Apr 2021 20:00:21 -0400 Subject: Fix oredict for synthetic rubbers --- .../dreamcraft/DreamCraftRecipeLoader.java | 44 +++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 251914d313..ee2ea52623 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -752,12 +752,12 @@ public class DreamCraftRecipeLoader implements Runnable { //Pumps UV-UHV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Pump_UV.get(1L), - 24000, 32, 100000, 4, new ItemStack[]{ + 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Neutronium, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 4L), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 16L), - GT_OreDictUnificator.get(OrePrefixes.ring, Materials.AnySyntheticRubber, 32L), + new Object[]{OrePrefixes.ring.get(Materials.AnySyntheticRubber), 32L}, GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.CosmicNeutronium, 4L), GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L)}, new FluidStack[]{ Materials.Naquadria.getMolten(2592), @@ -765,12 +765,12 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Lubricant.getFluid(4000)}, ItemList.Electric_Pump_UHV.get(1), 1000, 200000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Pump_UHV.get(1L), - 48000, 64, 200000, 8, new ItemStack[]{ + 48000, 64, 200000, 8, new Object[]{ ItemList.Electric_Motor_UEV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.NetherStar, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 4L), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Infinity, 16L), - GT_OreDictUnificator.get(OrePrefixes.ring, (Materials.AnySyntheticRubber), 64L), + new Object[]{OrePrefixes.ring.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.Infinity, 4L), GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L)}, new FluidStack[]{ Materials.Quantium.getMolten(2592), @@ -779,24 +779,26 @@ public class DreamCraftRecipeLoader implements Runnable { //Conveyor Belt UV-UHV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Conveyor_Module_UV.get(1L), - 24000, 32, 100000, 4, new ItemStack[]{ + 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 2L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.CosmicNeutronium, 8L), GT_OreDictUnificator.get(OrePrefixes.round, Materials.CosmicNeutronium, 64L), - GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L)}, new FluidStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L), + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 40L}}, new FluidStack[]{ Materials.Naquadria.getMolten(2592), Materials.SolderingAlloy.getMolten(2592), - Materials.Lubricant.getFluid(4000), - Materials.Silicone.getMolten(5760)}, ItemList.Conveyor_Module_UHV.get(1), 1000, 200000); + Materials.Lubricant.getFluid(4000)}, ItemList.Conveyor_Module_UHV.get(1), 1000, 200000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Conveyor_Module_UHV.get(1L), - 48000, 64, 200000, 8, new ItemStack[]{ + 48000, 64, 200000, 8, new Object[]{ ItemList.Electric_Motor_UEV.get(2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 2L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Infinity, 8L), GT_OreDictUnificator.get(OrePrefixes.round, Materials.Infinity, 64L), - GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L)}, new FluidStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L), + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 64L}, + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 16L}}, new FluidStack[]{ Materials.Quantium.getMolten(2592), Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000), @@ -971,7 +973,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Field_Generator_UEV.get(1L), 4000, 800000); - //UHV Energy Hatch + //UHV Energy Hatch & Dynamo TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_UV.get(1L), 24000, 16, 50000, 2, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -1016,7 +1018,7 @@ public class DreamCraftRecipeLoader implements Runnable { //UHV Circuit TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Wetwaresupercomputer.get(1L), - 24000, 64, 50000, 4, new ItemStack[]{ + 24000, 64, 50000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 2), ItemList.Circuit_Wetwaresupercomputer.get(2L), ItemList.ZPM_Coil.get(16L), @@ -1026,7 +1028,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Parts_DiodeASMD.get(16L), ItemList.Circuit_Chip_Ram.get(48L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 64L), - GT_OreDictUnificator.get(OrePrefixes.foil, (Materials.AnySyntheticRubber), 64L), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880L), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 10000), @@ -1035,7 +1037,7 @@ public class DreamCraftRecipeLoader implements Runnable { //Bio Chips TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biowarecomputer.get(1L), - 48000, 128, 500000, 8, new ItemStack[]{ + 48000, 128, 500000, 8, new Object[]{ ItemList.Circuit_Board_Bio_Ultra.get(2L), ItemList.Circuit_Biowarecomputer.get(2L), ItemList.Circuit_Parts_TransistorASMD.get(16L), @@ -1045,7 +1047,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Chip_NOR.get(32L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.NiobiumTitanium, 32L), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 16L), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(1440L), Materials.BioMediumSterilized.getFluid(1440L), @@ -1054,7 +1056,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Biowaresupercomputer.get(1L), 4000, 500000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biowaresupercomputer.get(1L), - 96000, 256, 1000000, 16, new ItemStack[]{ + 96000, 256, 1000000, 16, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 4L), ItemList.Circuit_Biowaresupercomputer.get(2L), ItemList.UV_Coil.get(16L), @@ -1064,7 +1066,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Parts_DiodeASMD.get(24L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 64), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880L), @@ -1072,9 +1074,9 @@ public class DreamCraftRecipeLoader implements Runnable { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000) }, ItemList.Circuit_Biomainframe.get(1L), 6000, 2000000); - //GTNH Circuits + //GTNH UIV, UMV, UXV Circuits TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biomainframe.get(1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 192000, 512, 2000000, 32, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 8), ItemList.Circuit_Biomainframe.get(2L), ItemList.Circuit_Parts_CapacitorASMD.get(32L), @@ -1085,7 +1087,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Chip_NPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Draconium, 64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(3744L), @@ -1133,7 +1135,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Osmium.getMolten(2304L) }, getItemContainer("QuantumCircuit").get(1L), 20000, 32000000); - //Stargate Stuff + //Stargate Recipes if (Loader.isModLoaded("eternalsingularity") && Loader.isModLoaded("SGCraft")) { TT_recipeAdder.addResearchableAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Infinity, 1L), 192000, 512, 2000000, 32, new ItemStack[]{ -- cgit From b89872af5d70ffefdc97671284ea2344486a64bb Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Thu, 6 May 2021 07:52:27 +0800 Subject: Fix air check in structure check --- .../github/technus/tectech/mechanics/structure/StructureUtility.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 521b0e7645..28b72f8ba6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -38,7 +38,7 @@ public class StructureUtility { private static final IStructureElement AIR = new IStructureElement() { @Override public boolean check(Object t, World world, int x, int y, int z) { - return world.getBlock(x, y, z).getMaterial() == Material.air; + return world.isAirBlock(x, y, z); } @Override @@ -57,7 +57,7 @@ public class StructureUtility { private static final IStructureElement NOT_AIR = new IStructureElement() { @Override public boolean check(Object t, World world, int x, int y, int z) { - return world.getBlock(x, y, z).getMaterial() != Material.air; + return !world.isAirBlock(x, y, z); } @Override -- cgit From 5ef120d8b457671d2d37f51e5eb05fae440edb0c Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Fri, 14 May 2021 13:51:00 -0400 Subject: Fix capitalization --- src/main/resources/assets/tectech/lang/en_US.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 89d2b517a2..668f010410 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -651,7 +651,7 @@ gt.blockmachines.multimachine.em.scanner.hint.3=4 - Elemental Overflow Hatches o gt.blockmachines.multimachine.em.scanner.desc.0=What is existing here? gt.blockmachines.multimachine.em.scanner.desc.1=I HAVE NO IDEA (yet)! -gt.blockmachines.multimachine.em.research.name=Research station +gt.blockmachines.multimachine.em.research.name=Research Station gt.blockmachines.multimachine.em.research.hint.0=1 - Classic/Data Hatches or Computer casing gt.blockmachines.multimachine.em.research.hint.1=2 - Holder Hatch gt.blockmachines.multimachine.em.research.desc.0=Philosophers didn't even... -- cgit From f1cd282b009ba7687a1f090a18020c26a666fee1 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Sun, 16 May 2021 14:17:27 -0400 Subject: Fix ender fluid link and power pass cover recipes No idea if either works correctly, recipe of PPC might need changing. --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 4 ++++ .../java/com/github/technus/tectech/thing/CustomItemList.java | 2 +- .../technus/tectech/thing/item/PowerPassUpgradeCover.java | 10 +++++----- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 6eddf3c364..df52b4ad89 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1841,6 +1841,10 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Emitter_LuV.get(1), ItemList.Electric_Pump_LuV.get(1), }, Materials.Chrome.getMolten(288), CustomItemList.enderLinkFluidCover.getWithDamage(1, 0), 320, 30720); + //Power Pass Upgrade Cover + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + }, null, CustomItemList.powerPassUpgradeCover.getWithDamage(1, 0), 320, 30720); //endregion //region recycling diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 9bd69c67ed..9e555e3961 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -94,7 +94,7 @@ public enum CustomItemList implements IItemContainer { eM_avr_HV, eM_avr_EV, eM_avr_IV, eM_avr_LuV, eM_avr_ZPM, eM_avr_UV, eM_avr_UHV, eM_avr_UEV, eM_avr_UIV, eM_avr_UMV, - scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkFluidCover, + scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkFluidCover, powerPassUpgradeCover, Machine_TeslaCoil_1by1_LV, Machine_TeslaCoil_1by1_MV, Machine_TeslaCoil_1by1_HV, Machine_TeslaCoil_1by1_EV, Machine_TeslaCoil_1by1_IV, Machine_TeslaCoil_2by2_LV, Machine_TeslaCoil_2by2_MV, Machine_TeslaCoil_2by2_HV, Machine_TeslaCoil_2by2_EV, Machine_TeslaCoil_2by2_IV, diff --git a/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java index 7dcf8bb48a..06c05e5b9d 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java +++ b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java @@ -13,7 +13,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.thing.CustomItemList.enderLinkFluidCover; +import static com.github.technus.tectech.thing.CustomItemList.powerPassUpgradeCover; import static net.minecraft.util.StatCollector.translateToLocal; public final class PowerPassUpgradeCover extends Item { @@ -28,15 +28,15 @@ public final class PowerPassUpgradeCover extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - aList.add(translateToLocal("item.tm.powerpassupgradecover.desc.0"));//Ender-Fluid-Enables Machines! - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.1"));//Use on any side of a fluid tank to link it to the Ender - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.2"));//Ender Tanks so are laggy -Bot from the Chads of NH + aList.add(translateToLocal("item.tm.powerpassupgradecover.desc.0"));//Add power pass functionality to TecTech Multiblocks + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.1"));//Active transformer in a can?? + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.2"));//Chain them up like Christmas lights! } public static void run() { INSTANCE = new PowerPassUpgradeCover(); GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - enderLinkFluidCover.set(INSTANCE); + powerPassUpgradeCover.set(INSTANCE); } @Override -- cgit From bf64b321e0f1d7fa9c5f189719847f105a77ce4e Mon Sep 17 00:00:00 2001 From: GlodBlock <60341015+GlodBlock@users.noreply.github.com> Date: Sat, 19 Jun 2021 16:03:56 +0800 Subject: fix recipe conflict of power pass cover and QoS --- .../technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index df52b4ad89..998be3b251 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1844,6 +1844,7 @@ public class DreamCraftRecipeLoader implements Runnable { //Power Pass Upgrade Cover GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.Machine_Multi_Transformer.get(1), + GT_Utility.getIntegratedCircuit(1) }, null, CustomItemList.powerPassUpgradeCover.getWithDamage(1, 0), 320, 30720); //endregion -- cgit From 3c68ec3be1249dc9fc13c55921f1d203341200eb Mon Sep 17 00:00:00 2001 From: Mr-Vovikpro123 <64985356+Mr-Vovikpro123@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:20:55 +0300 Subject: Update DreamCraftRecipeLoader.java --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 998be3b251..b679d3cff8 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1096,7 +1096,7 @@ public class DreamCraftRecipeLoader implements Runnable { getItemContainer("Hatch_Dynamo_UIV").get(1L), 1000, 16000000); //UMV Energy Hatch - TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UEV").get(1L), + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UIV").get(1L), 192000, 128, 400000, 16, new Object[]{ getItemContainer("Hull_UMV").get(1L), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 16L), -- cgit From 8123af8b189f7f256e377f32cb1197f953f1a729 Mon Sep 17 00:00:00 2001 From: Sphyix Date: Mon, 26 Jul 2021 01:23:13 +0200 Subject: update gradle, moved hazmat to gt5u --- build.gradle.kts | 3 ++- src/main/java/com/github/technus/tectech/loader/MainLoader.java | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/build.gradle.kts b/build.gradle.kts index 04935c1158..864d19e399 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,8 +6,9 @@ import java.io.* buildscript { repositories { mavenCentral() - maven("http://files.minecraftforge.net/maven") + maven("https://gregtech.overminddl1.com/") maven("https://jitpack.io") + } dependencies { classpath("com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT") diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index d473da6b07..4b812e3e23 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -149,9 +149,10 @@ public final class MainLoader { new RecipeLoader().run(); TecTech.LOGGER.info("Recipe Init Done"); - progressBarPostLoad.step("Register Extra Hazmat Suits"); - registerExtraHazmats(); - TecTech.LOGGER.info("Hazmat additions done"); + //Hazmat moved to GT5U + //progressBarPostLoad.step("Register Extra Hazmat Suits"); + //registerExtraHazmats(); + //TecTech.LOGGER.info("Hazmat additions done"); if (!configTecTech.DISABLE_BLOCK_HARDNESS_NERF) { progressBarPostLoad.step("Nerf blocks blast resistance"); @@ -169,7 +170,7 @@ public final class MainLoader { ProgressManager.pop(progressBarPostLoad); } - private static void registerExtraHazmats() { + private static void registerExtraHazmats() { //Hazmat moved to GT5U ItemStack EMT_iqC=GT_ModHandler.getModItem("EMT","itemArmorQuantumChestplate",1,W); ItemStack GRAVI_gC=GT_ModHandler.getModItem("GraviSuite","graviChestPlate",1,W); ItemStack GRAVI_anC=GT_ModHandler.getModItem("GraviSuite", "advNanoChestPlate", 1, W); -- cgit From 88474a18b40c51444ec5889e6d11f80549c1eef9 Mon Sep 17 00:00:00 2001 From: Sphyix Date: Mon, 26 Jul 2021 01:49:02 +0200 Subject: removed 1 progressbar step --- src/main/java/com/github/technus/tectech/loader/MainLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 4b812e3e23..8a03bd67b8 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -121,7 +121,7 @@ public final class MainLoader { } public static void postLoad() { - ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 6); + ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 5); progressBarPostLoad.step("Dreamcraft Compatibility"); if(Loader.isModLoaded(Reference.DREAMCRAFT)){ -- cgit From 8b81ea9fd4b9446bea8f95fbcb04e550ebf23c83 Mon Sep 17 00:00:00 2001 From: "[Kiwi233]" <[huaxia0611@qq.com]> Date: Mon, 2 Aug 2021 20:57:25 +0800 Subject: Update zh_CN.lang --- src/main/resources/assets/tectech/lang/zh_CN.lang | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index c01c8f2757..56cecd80c2 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -87,6 +87,16 @@ item.tm.teslaCover.desc.4=到底谁在用电缆? item.tm.teslaStaff.name=特斯拉权杖 item.tm.teslaStaff.desc=狂妄之人窃取了众神的权柄! +item.tm.enderfluidlinkcover.name=末影流体覆盖板 +item.tm.enderfluidlinkcover.desc.0=在机器间无线传输流体! +item.tm.enderfluidlinkcover.desc.1=可贴在储罐/机器/管道的任意面以将其与末影相连 +item.tm.enderfluidlinkcover.desc.2=末影储罐太逊了! -来自Chads-of-NH的Bot + +item.tm.powerpassupgradecover.name=导能升级覆盖板 +item.tm.powerpassupgradecover.desc.0=为TecTech多方块机器添加导能功能 +item.tm.powerpassupgradecover.desc.1=罐中的有源变压器?? +item.tm.powerpassupgradecover.desc.2=将它们像圣诞彩灯一样串起来! + #Death Messages death.attack.microwaving=%1$s被辐射脱水。 death.attack.microwaving.player=%1$s在与%2$s的战斗中被辐射脱水。 @@ -771,7 +781,7 @@ gt.blockmachines.debug.tt.data.desc.0=量子数据输出 gt.blockmachines.debug.tt.data.desc.1=高速光纤接口 gt.blockmachines.debug.tt.data.desc.2=启用前必须涂色 gt.blockmachines.debug.tt.maintenance.name=Debug维护仓 -gt.blockmachines.debug.tt.maintenance.desc.0=用于维护多方块 +gt.blockmachines.debug.tt.maintenance.desc.0=自动维护多方块机器 gt.blockmachines.debug.tt.maintenance.desc.1=它能修好一切,除了自己. gt.blockmachines.debug.tt.maintenance.desc.2=为人民服务! gt.blockmachines.debug.tt.genny.name=Debug发电机 -- cgit From 565bb55ea5b2b5b12bec72860f1826319faf7f03 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Mon, 2 Aug 2021 15:09:14 +0200 Subject: Update zh_CN.lang changes from @Kiwi233 --- src/main/resources/assets/tectech/lang/zh_CN.lang | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index c01c8f2757..72fc8845b5 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -87,6 +87,16 @@ item.tm.teslaCover.desc.4=到底谁在用电缆? item.tm.teslaStaff.name=特斯拉权杖 item.tm.teslaStaff.desc=狂妄之人窃取了众神的权柄! +item.tm.enderfluidlinkcover.name=末影流体覆盖板 +item.tm.enderfluidlinkcover.desc.0=在机器间无线传输流体! +item.tm.enderfluidlinkcover.desc.1=可贴在储罐/机器/管道的任意面以将其与末影相连 +item.tm.enderfluidlinkcover.desc.2=末影储罐太逊了! -来自Chads-of-NH的Bot + +item.tm.powerpassupgradecover.name=导能升级覆盖板 +item.tm.powerpassupgradecover.desc.0=为TecTech多方块机器添加导能功能 +item.tm.powerpassupgradecover.desc.1=罐中的有源变压器?? +item.tm.powerpassupgradecover.desc.2=将它们像圣诞彩灯一样串起来! + #Death Messages death.attack.microwaving=%1$s被辐射脱水。 death.attack.microwaving.player=%1$s在与%2$s的战斗中被辐射脱水。 @@ -771,7 +781,7 @@ gt.blockmachines.debug.tt.data.desc.0=量子数据输出 gt.blockmachines.debug.tt.data.desc.1=高速光纤接口 gt.blockmachines.debug.tt.data.desc.2=启用前必须涂色 gt.blockmachines.debug.tt.maintenance.name=Debug维护仓 -gt.blockmachines.debug.tt.maintenance.desc.0=用于维护多方块 +gt.blockmachines.debug.tt.maintenance.desc.0=自动维护多方块机器 gt.blockmachines.debug.tt.maintenance.desc.1=它能修好一切,除了自己. gt.blockmachines.debug.tt.maintenance.desc.2=为人民服务! gt.blockmachines.debug.tt.genny.name=Debug发电机 @@ -865,3 +875,4 @@ tt.keyphrase.Side_capabilities=辅助功能 #OpenTurrets compatibility tile.turretHeadEM.name=元物质炮塔 tile.turretBaseEM.name=元物质炮塔基座 +© 2021 GitHub, Inc. -- cgit From 34e6ce6a4978cb235221a5812b1fcd566c4ee569 Mon Sep 17 00:00:00 2001 From: D-Cysteine <54219287+D-Cysteine@users.noreply.github.com> Date: Sun, 8 Aug 2021 09:10:43 -0600 Subject: Add number formatting --- .../tectech/nei/TT_NEI_ResearchHandler.java | 12 +++---- .../technus/tectech/nei/TT_NEI_ScannerHandler.java | 12 +++---- .../GT_MetaTileEntity_Hatch_DataConnector.java | 5 ++- .../GT_MetaTileEntity_Hatch_DynamoTunnel.java | 3 +- .../hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java | 4 ++- .../GT_MetaTileEntity_Hatch_EnergyTunnel.java | 4 ++- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 12 ++++--- .../multi/GT_MetaTileEntity_EM_decay.java | 36 +++++++++++++-------- .../multi/GT_MetaTileEntity_EM_research.java | 36 +++++++++++++-------- .../multi/GT_MetaTileEntity_EM_scanner.java | 37 ++++++++++++++-------- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 20 ++++++------ .../single/GT_MetaTileEntity_DataReader.java | 8 ++--- 12 files changed, 116 insertions(+), 73 deletions(-) (limited to 'src/main') 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 358d55be0e..114dc7399f 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,18 +215,18 @@ 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: ") + (1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20 + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + (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: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(ampere), -16777216); } else { drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); } } - drawText(10, 113, "Computation: "+computation, -16777216); - drawText(10, 123, "Min Computation: "+minComputationPerSec + " /s", -16777216); + drawText(10, 113, "Computation: " + GT_Utility.formatNumbers(computation), -16777216); + drawText(10, 123, "Min Computation: " + GT_Utility.formatNumbers(minComputationPerSec) + " /s", -16777216); } else { int i = 0; for (String descLine : recipeDesc) { 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 0c7651977e..2dc4604fd5 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,18 +215,18 @@ 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: ") + (1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20 + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + (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: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(ampere), -16777216); } else { drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); } } - drawText(10, 113, "Computation: "+computation, -16777216); - drawText(10, 123, "Min Computation: "+minComputationPerSec + " /s", -16777216); + drawText(10, 113, "Computation: " + GT_Utility.formatNumbers(computation), -16777216); + drawText(10, 123, "Min Computation: " + GT_Utility.formatNumbers(minComputationPerSec) + " /s", -16777216); } else { int i = 0; for (String descLine : recipeDesc) { 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 6cbf1e801b..4aa90339cc 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 @@ -160,7 +160,10 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector 0) { - return new String[]{translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; + return new String[]{ + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, + translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), + translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; } return new String[]{ translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java index 202dc344c2..b015d71b60 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java @@ -111,7 +111,8 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription,//TODO NOT PASS DESCRIPTION - translateToLocal("gt.blockmachines.hatch.dynamotunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + (Amperes * maxEUOutput()) + EnumChatFormatting.RESET + " EU/t"//Throughput + translateToLocal("gt.blockmachines.hatch.dynamotunnel.desc.1") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(Amperes * maxEUOutput()) + EnumChatFormatting.RESET + " EU/t"//Throughput }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java index 4410372d47..0acb9849a7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java @@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -116,7 +117,8 @@ public class GT_MetaTileEntity_Hatch_EnergyMulti extends GT_MetaTileEntity_Hatch return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription, - translateToLocal("gt.blockmachines.hatch.energymulti.desc.1") + ": " + EnumChatFormatting.AQUA + maxAmperesIn() + " A"//Amperes In + translateToLocal("gt.blockmachines.hatch.energymulti.desc.1") + ": " + + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(maxAmperesIn()) + " A"//Amperes In }; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java index 854678b79b..d44119e1ab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -108,7 +109,8 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription, - translateToLocal("gt.blockmachines.hatch.energytunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + (Amperes * maxEUInput()) + EnumChatFormatting.RESET + " EU/t"//Throughput + translateToLocal("gt.blockmachines.hatch.energytunnel.desc.1") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(Amperes * maxEUInput()) + EnumChatFormatting.RESET + " EU/t"//Throughput }; } 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 a5e6dc4d5d..ff9aca01ee 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 @@ -12,6 +12,7 @@ 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; @@ -90,8 +91,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 + String.format(Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c\u00b2", - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + String.format(Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c\u00b2)/s", + 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.3") }; } @@ -216,9 +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 + Double.toString(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", - EnumChatFormatting.GREEN + Double.toString(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", - translateToLocalFormatted("tt.keyphrase.Mass_Disposal_speed", clientLocale) + ": " + EnumChatFormatting.BLUE + overflowDisperse + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" + EnumChatFormatting.RED + GT_Utility.formatNumbers(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(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" }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index d534b41fec..35ed753de5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -21,6 +21,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.util.GT_Utility; import ic2.core.init.MainConfig; import ic2.core.util.ConfigUtil; import net.minecraft.block.Block; @@ -189,21 +190,30 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return new String[]{ translateToLocalFormatted("tt.keyword.Progress", clientLocale) + ":", - EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyword.Computation", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyword.Computation", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 889b4cfec3..9d52bafa94 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -378,21 +378,31 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB return new String[]{ translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t " + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t " + + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, translateToLocalFormatted("tt.keyphrase.Computation_Remaining", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + computationRequired / 20L + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(computationRequired / 20L) }; } 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 b418ec0fa4..5cc5108eee 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 @@ -23,6 +23,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -347,21 +348,31 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa return new String[]{ translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t " + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t " + + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, translateToLocalFormatted("tt.keyphrase.Computation_Remaining", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + computationRequired / 20L + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(computationRequired / 20L) }; } 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 9ba6235c83..dddd3420bf 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 @@ -387,21 +387,23 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return new String[]{ "Progress:", - EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", "Energy Hatches:", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt * eAmpereFlow <= 0 ? "Probably uses: " : "Probably makes: ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + + " Amp Rating: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " Efficiency: " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, - "Computation: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET + "Computation: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET }; } 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 d942786916..748b680faa 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 @@ -272,11 +272,11 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine 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: ") + ((long)time * EUt) + " EU",7,93, 0x80a0ff); - font.drawString(GT_Utility.trans("153","Usage: ") + EUt + " EU/t",7,103, 0x80a0ff); - font.drawString(GT_Utility.trans("154","Voltage: ") + EUt + " EU",7,113, 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); - font.drawString( GT_Utility.trans("158","Time: ")+String.format("%.2f " + GT_Utility.trans("161"," secs"), 0.05F * time), 7,133, 0x80a0ff); + font.drawString( GT_Utility.trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * time) + GT_Utility.trans("161"," secs"), 7,133, 0x80a0ff); for(Map.Entry entry:slots.entrySet()){ gui.renderItemSimple(entry.getKey(),entry.getValue()); -- cgit From 4027ccec69240e7f6f65cb17a5ee53f40f1473c8 Mon Sep 17 00:00:00 2001 From: D-Cysteine <54219287+D-Cysteine@users.noreply.github.com> Date: Wed, 11 Aug 2021 17:45:32 -0600 Subject: Use criticalStopMachine() when out of energy --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') 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 dddd3420bf..39b938f680 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 @@ -1677,7 +1677,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { if (!drainEnergyInput_EM(mEUt, (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { - stopMachine(); + criticalStopMachine(); return false; } } @@ -1690,7 +1690,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { if (!drainEnergyInput((long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { - stopMachine(); + criticalStopMachine(); return false; } } -- cgit From 9721acdccf9a42c57c91410c5b775e70b0c87958 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 28 Aug 2021 23:27:25 -0700 Subject: Migrated calls to StructureLib --- .../metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 329b3cbc14..0d30facf7b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -12,8 +12,6 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; @@ -23,6 +21,8 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -39,12 +39,13 @@ import java.util.HashMap; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.DoubleCount.add; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -304,7 +305,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //use multi A energy inputs, use less power the longer it runs private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition .builder() - .addShapeOldApi("main", new String[][]{ + .addShape("main", new String[][]{ {"I0A0A0", "I00000", "I0A0A0",}, {"H0000000", "G001111100", "H0000000",}, {"F22223332222", "F41155555114", "F22223332222",}, -- cgit From f82f5b9d516769392730a9ca011537e3b472c31c Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 28 Aug 2021 23:27:55 -0700 Subject: Migrated calls to StructureLib --- .../metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 06476fb62e..6765abfa5c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,14 +17,14 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHatchAdderOptional; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_INGOT_MASS_DIFF; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_MASS_TO_EU_INSTANT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -51,7 +51,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E //region structure actual private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition .builder() - .addShapeOldApi("t1",new String[][]{ + .addShape("t1",new String[][]{ {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, @@ -86,7 +86,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, }) - .addShapeOldApi("t2",new String[][]{ + .addShape("t2",new String[][]{ {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, @@ -134,7 +134,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E .build(); @Override - public IStructureDefinition getStructure_EM() { + public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; } -- cgit From e5a3d4de3bba55d2d5ad40ebc68d75ddcc4c7a9c Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 28 Aug 2021 23:28:38 -0700 Subject: Migrated calls to StructureLib --- .../metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 3e288ccafa..ea3d79443a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,7 +20,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -- cgit From 267ecbaa30211f1463050cc97369287f1d2d7ccb Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 29 Aug 2021 14:59:59 -0700 Subject: Changed to StructureLib Vec3Impl --- .../com/github/technus/tectech/mechanics/dataTransport/DataPacket.java | 2 +- .../technus/tectech/mechanics/dataTransport/QuantumDataPacket.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java index 990a48ac70..f30105f1ee 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.util.Vec3Impl; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; import java.util.Collections; diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java index 268de6f71c..0fddb53fe9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.util.Vec3Impl; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; public class QuantumDataPacket extends DataPacket { -- cgit From e005dfd76f488b52bff7c7ea4246cfab962a70be Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 29 Aug 2021 17:46:26 -0700 Subject: Changed to StructureLib Vec3Impl --- .../com/github/technus/tectech/mechanics/spark/ThaumSpark.java | 3 ++- .../technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java | 2 +- .../technus/tectech/mechanics/tesla/TeslaCoverConnection.java | 7 +++++-- .../thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java index e31e63f250..0480cfffd2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.mechanics.spark; -import com.github.technus.tectech.util.Vec3Impl; + +import com.gtnewhorizon.structurelib.util.Vec3Impl; import java.io.Serializable; import java.util.Objects; diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java index 3b56b6968c..2adc25bbed 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.tesla; -import com.github.technus.tectech.util.Vec3Impl; +import com.gtnewhorizon.structurelib.util.Vec3Impl; public interface ITeslaConnectableSimple { //-128 to -1 disables capability diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java index 5c6fef6af8..0b84236709 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.tesla; -import com.github.technus.tectech.util.Vec3Impl; import com.google.common.base.Objects; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetAdd; @@ -14,7 +14,10 @@ public class TeslaCoverConnection implements ITeslaConnectableSimple { public TeslaCoverConnection(IGregTechTileEntity IGT, byte teslaReceptionCapability) { this.IGT = IGT; - this.pos = new Vec3Impl(IGT); + this.pos = new Vec3Impl(IGT.getXCoord(), + IGT.getYCoord(), + IGT.getZCoord()); + this.teslaReceptionCapability = teslaReceptionCapability; } 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 274389b01a..3b240e4c56 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 @@ -8,10 +8,10 @@ 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.github.technus.tectech.util.Vec3Impl; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -333,7 +333,9 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @Override public Vec3Impl getTeslaPosition() { - return new Vec3Impl(this.getBaseMetaTileEntity()); + return new Vec3Impl(this.getBaseMetaTileEntity().getXCoord(), + this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord()); } @Override -- cgit From 6beca9b201b111dcc2cbb1505091f996a37694ee Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 29 Aug 2021 18:10:23 -0700 Subject: Changed to StructureLib --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 0d30facf7b..fe91be7bdc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -3,7 +3,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecayResult; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; @@ -21,6 +20,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; -- cgit From 2b9ccc57c92d48dbdda56172f3fdd5e1033ccaa7 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 1 Sep 2021 13:41:47 -0700 Subject: Deprecating on Basdxz's request --- .../GT_MetaTileEntity_TM_proccessingStack.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 38e14b9a6f..2d64e608c5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -21,7 +21,27 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static gregtech.api.GregTech_API.sBlockCasings4; import static net.minecraft.util.StatCollector.translateToLocal; +@Deprecated public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + protected GT_MetaTileEntity_TM_proccessingStack(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return new String[0]; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return null; + } + /* //region variables private boolean hasBeenPausedThisCycle = false; //endregion @@ -131,4 +151,5 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul public String[] getStructureDescription(ItemStack stackSize) { return description; } + */ } \ No newline at end of file -- cgit From 528270b9623e848af7417db60b51799d746394e3 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 1 Sep 2021 21:25:38 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_annihilation.java | 64 +++++++++++++++++----- 1 file changed, 51 insertions(+), 13 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 584e28a607..8fbd746fcd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,27 +1,30 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -31,9 +34,40 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.0"),//1 - Classic Hatches or High Power Casing + translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.1"),//2 - Elemental Hatches or Molecular Casing + }; //endregion //region structure + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "}, + {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, + {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, + {" AAA ","AA BAB AA","ACGGEGEGGCA"," G G "," G G "," G G "," G G "," G G ","ACGGEGEGGCA","AA BAB AA"," AAA "}, + {" AHHHA ","BBBBBBBBBBB","BEEEDEDEEEB","BE EB"," G G "," G G "," G G ","BE EB","BEEEDEDEEEB","BBBBBBBBBBB"," AHHHA "}, + {" AH~HA "," ABBBA "," EGGEEEGGE ","BE EB","AE EA","FD DF","AE EA","BE EB"," EGGEEEGGE "," ABBBA "," AHHHA "}, + {" AHHHA ","BBBBBBBBBBB","BEEEDEDEEEB","BE EB"," G G "," G G "," G G ","BE EB","BEEEDEDEEEB","BBBBBBBBBBB"," AHHHA "}, + {" AAA ","AA BAB AA","ACGGEGEGGCA"," G G "," G G "," G G "," G G "," G G ","ACGGEGEGGCA","AA BAB AA"," AAA "}, + {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, + {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, + {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 10)) + .addElement('E', ofBlock(sBlockCasingsTT, 12)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_MultiblockBase_EM::addElementalToMachineList, textureOffset + 4, sHintCasingsTT, 0, sBlockCasingsTT, 4)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, sHintCasingsTT, 0, sBlockCasingsTT, 0)) + .build(); + + /* private static final String[][] shape = new String[][]{ {"\u0002", "D000", "C0 0", "C0 . 0", "C0 0", "D000"}, {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, @@ -49,17 +83,14 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10}; - private static final IHatchAdder[] addingMethods = adders( + private static final IGT_HatchAdder[] addingMethods = adders( GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, GT_MetaTileEntity_EM_annihilation::addElementalToMachineList); private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.0"),//1 - Classic Hatches or High Power Casing - translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.1"),//2 - Elemental Hatches or Molecular Casing - }; + */ + //endregion public GT_MetaTileEntity_EM_annihilation(int aID, String aName, String aNameRegional) { @@ -77,7 +108,8 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); + return structureCheck_EM("main", 5, 5, 0); } @Override @@ -107,7 +139,13 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 5, 5, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 4c20c994d47522bbacf21dfb9c4cc3f96738da4b Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 2 Sep 2021 16:05:42 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_research.java | 90 ++++++++++++++++------ 1 file changed, 65 insertions(+), 25 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 889b4cfec3..1b6cf2d0fd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -22,6 +22,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockB import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -45,7 +46,11 @@ 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -64,32 +69,55 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private static LinkedHashMap lServerNames; - private String clientLocale = "en_US"; - //endregion - - //region structure - private static final String[][] shape = new String[][]{ - {E, "000", E, E, E, "000"/*,E,*/}, - {"A0", "010", "A1", "A!", "A1", "010", "A0",}, - {"A0", "010", E, E, E, "010", "A0",}, - {"000", "010", E, E, E, "010", "000",}, - {"000", "212", "010", "0.0", "010", "212", "000",}, - {"000", "212", "111", "111", "111", "212", "000",}, - {"000", "222", " ", " ", " ", "222", "000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{1, 3, 2}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_research::addClassicToMachineList, - GT_MetaTileEntity_EM_research::addHolderToMachineList); - private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; - private static final byte[] blockMetaFallback = new byte[]{1, 0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.research.hint.0"),//1 - Classic/Data Hatches or Computer casing translateToLocal("gt.blockmachines.multimachine.em.research.hint.1"),//2 - Holder Hatch }; + + private String clientLocale = "en_US"; + //endregion + + //region structure + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {" ", " E ", " ", " ", "A~A", "CCC", "DDD"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 2)) + .addElement('C', ofBlock(sBlockCasingsTT, 3)) + .addElement('D', ofChain( + ofHatchAdder(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1, sBlockCasingsTT, 1), + ofHatchAdder(GT_MetaTileEntity_EM_research::addDataConnectorToMachineList, textureOffset + 3, sBlockCasingsTT, 1) + )) + .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 1)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {E, "000", E, E, E, "000"/*,E,*/}, +// {"A0", "010", "A1", "A!", "A1", "010", "A0",}, +// {"A0", "010", E, E, E, "010", "A0",}, +// {"000", "010", E, E, E, "010", "000",}, +// {"000", "212", "010", "0.0", "010", "212", "000",}, +// {"000", "212", "111", "111", "111", "212", "000",}, +// {"000", "222", " ", " ", " ", "222", "000",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{1, 3, 2}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_research::addClassicToMachineList, +// GT_MetaTileEntity_EM_research::addHolderToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; +// private static final byte[] blockMetaFallback = new byte[]{1, 0}; + //endregion public GT_MetaTileEntity_EM_research(int aID, String aName, String aNameRegional) { @@ -262,9 +290,15 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } eHolders.clear(); + if (!structureCheck_EM("main", 1, 3, 4)) { + return false; + } + + /* if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 3, 4)) { return false; } + */ for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { @@ -559,7 +593,13 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 3, 4, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From ecc78e14047c52bb2ef41b20797b080197fdfe7d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 2 Sep 2021 16:06:19 -0700 Subject: Fixed function namespace --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 8fbd746fcd..f36d2e7a63 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -62,7 +62,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl .addElement('C', ofBlock(sBlockCasingsTT, 6)) .addElement('D', ofBlock(sBlockCasingsTT, 10)) .addElement('E', ofBlock(sBlockCasingsTT, 12)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_MultiblockBase_EM::addElementalToMachineList, textureOffset + 4, sHintCasingsTT, 0, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, textureOffset + 4, sHintCasingsTT, 0, sBlockCasingsTT, 4)) .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, sHintCasingsTT, 0, sBlockCasingsTT, 0)) .build(); -- cgit From 2501b1f9c3f53a6298b8b85b8c4880ca295d2fdb Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 06:22:19 -0700 Subject: Simplified ofChain call --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 1b6cf2d0fd..2f99b46e45 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -93,11 +93,8 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB .addElement('A', ofBlock(sBlockCasingsTT, 1)) .addElement('B', ofBlock(sBlockCasingsTT, 2)) .addElement('C', ofBlock(sBlockCasingsTT, 3)) - .addElement('D', ofChain( - ofHatchAdder(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1, sBlockCasingsTT, 1), - ofHatchAdder(GT_MetaTileEntity_EM_research::addDataConnectorToMachineList, textureOffset + 3, sBlockCasingsTT, 1) - )) - .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 1)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1,1, sBlockCasingsTT,1)) + .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 2)) .build(); // private static final String[][] shape = new String[][]{ -- cgit From 1b607fd0935b61fbd23d970b989347928805bca2 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 07:02:40 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_quantizer.java | 68 +++++++++++++++------- 1 file changed, 48 insertions(+), 20 deletions(-) (limited to 'src/main') 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 d6ab35cd4b..0cac653157 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 @@ -2,7 +2,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; @@ -10,16 +9,18 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -41,6 +42,9 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -49,27 +53,44 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"010", "101", "010",}, - {"\"\"\"", "\"0\"", "\"\"\"",}, - {"202", "0!0", "202",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; - private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, - GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"CCC","BAB","EEE","DBD"}, + {"C~C","ABA","EBE","BFB"}, + {"CCC","BAB","EEE","DBD"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList,textureOffset + 4, 2)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.1"),//2 - Elemental Output Hatch translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing }; + +// private static final String[][] shape = new String[][]{ +// {" ", " . ", " ",}, +// {"010", "101", "010",}, +// {"\"\"\"", "\"0\"", "\"\"\"",}, +// {"202", "0!0", "202",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; +// private static final byte[] blockMeta = new byte[]{4, 0, 0}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, +// GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, +// GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + //endregion public GT_MetaTileEntity_EM_quantizer(int aID, String aName, String aNameRegional) { @@ -87,7 +108,8 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -199,7 +221,13 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 0f8789da456c1c1d153085a187397c3cda931eb9 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 07:26:39 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 72 +++++++++++++++------- 1 file changed, 51 insertions(+), 21 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 9814092710..ce328fa480 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,22 +1,24 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -31,8 +33,12 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.c import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.*; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockHint; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -41,27 +47,44 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"010", "111", "010",}, - {"\"\"\"", "\"1\"", "\"\"\"",}, - {"121", "2!2", "121",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; - private static final byte[] blockMeta = new byte[]{0, 4, 0}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, - GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"CCC","ABA","EEE","BDB"}, + {"C~C","BBB","EBE","DFD"}, + {"CCC","ABA","EEE","BDB"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, textureOffset + 4, sHintCasingsTT, 1)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.0"),//1 - Classic Hatches or High Power Casing" translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.1"),//2 - Elemental Input Hatch translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing }; + +// private static final String[][] shape = new String[][]{ +// {" ", " . ", " ",}, +// {"010", "111", "010",}, +// {"\"\"\"", "\"1\"", "\"\"\"",}, +// {"121", "2!2", "121",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; +// private static final byte[] blockMeta = new byte[]{0, 4, 0}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, +// GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, +// GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; //endregion public GT_MetaTileEntity_EM_dequantizer(int aID, String aName, String aNameRegional) { @@ -92,7 +115,8 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -155,7 +179,13 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From ecf780470664ceaa4f39d0a9cbd6623d58dff3cb Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 07:29:24 -0700 Subject: migrated deprecated structure build call to use StructureLib api --- .../tectech/mechanics/structure/Structure.java | 5 +-- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 40 ++++++++++++---------- 2 files changed, 24 insertions(+), 21 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index 83951372a2..b37ae0bbda 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -1,11 +1,12 @@ package com.github.technus.tectech.mechanics.structure; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -32,7 +33,7 @@ public class Structure { String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, + IGT_HatchAdder[] addingMethods, short[] casingTextures, Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types 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 9ba6235c83..86de270ba4 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 @@ -3,24 +3,26 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.alignment.AlignmentLimits; -import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; -import com.github.technus.tectech.mechanics.alignment.IAlignment; -import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; -import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; + +import com.github.technus.tectech.mechanics.structure.Structure; +import com.gtnewhorizon.structurelib.alignment.AlignmentMessage; +import com.gtnewhorizon.structurelib.alignment.IAlignment; +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; +import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; +import com.gtnewhorizon.structurelib.structure.StructureUtility; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; +import gregtech.api.util.GT_StructureUtility; + import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; 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.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -32,6 +34,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.*; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.api.util.IGT_HatchAdder; import gregtech.common.GT_Pollution; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -46,6 +49,8 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import static gregtech.api.util.GT_StructureUtility.*; + 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.*; @@ -144,7 +149,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private boolean explodedThisTick = false; //front rotation val - private IAlignmentLimits alignmentLimits = AlignmentLimits.UNLIMITED; + private IAlignmentLimits alignmentLimits = IAlignmentLimits.UNLIMITED; private ExtendedFacing extendedFacing = ExtendedFacing.DEFAULT; //endregion @@ -189,11 +194,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return alignmentLimits; } - @Override - public void setAlignmentLimits(IAlignmentLimits limits) { - alignmentLimits=limits; - } - @Override public boolean isFacingValid(byte aFacing) { return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing)); @@ -237,7 +237,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt String[][] structure,//0-9 casing, +- air no air, a-z ignore Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, + IGT_HatchAdder[] addingMethods, short[] casingTextures, Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types @@ -648,7 +648,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ protected long getAvailableData_EM() { long result = 0; - Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) { if (in.q != null) { Long value = in.q.contentIfNotInTrace(pos); -- cgit From 18e1af912c3d22011f0d23291df7ed164fa9e840 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 13:13:30 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_decay.java | 77 +++++++++++++++------- 1 file changed, 53 insertions(+), 24 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index d534b41fec..e49a4980ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -13,6 +10,9 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -21,6 +21,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.util.IGT_HatchAdder; import ic2.core.init.MainConfig; import ic2.core.util.ConfigUtil; import net.minecraft.block.Block; @@ -33,12 +34,15 @@ import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; +import static com.github.technus.tectech.mechanics.structure.Structure.builder; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; import static com.github.technus.tectech.util.CommonValues.VN; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -58,30 +62,48 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase //endregion //region structure - private static final String[][] shape = new String[][]{ - {"0C0", "A ", "A . ", "A ", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, - {"01110", "12221", "12221", "12221", "01110",}, - {"01310", "12221", "32223", "12221", "01310",}, - {"01110", "12221", "12221", "12221", "01110",}, - {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A ", "A ", "A ", "0C0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_decay::addClassicToMachineList, - GT_MetaTileEntity_EM_decay::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.decay.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.decay.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"}, + {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, + {" F~F ","AAAAA"," EAE ","BDDDB","CDDDC","BDDDB"," EAE ","AAAAA"," FFF "}, + {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, + {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 8)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); +// private static final String[][] shape = new String[][]{ +// {"0C0", "A ", "A . ", "A ", "0C0",}, +// {"00000", "00000", "00000", "00000", "00000",}, +// {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, +// {"01110", "12221", "12221", "12221", "01110",}, +// {"01310", "12221", "32223", "12221", "01310",}, +// {"01110", "12221", "12221", "12221", "01110",}, +// {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, +// {"00000", "00000", "00000", "00000", "00000",}, +// {"0C0", "A ", "A ", "A ", "0C0",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_decay::addClassicToMachineList, +// GT_MetaTileEntity_EM_decay::addElementalToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4}; + //endregion //region parameters @@ -110,7 +132,8 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -248,7 +271,13 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 998e75712ad762c8de27b71684448f3a540ad0a0 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 14:01:23 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_crafting.java | 83 +++++++++++++++------- 1 file changed, 57 insertions(+), 26 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 7d8204c07f..b028394822 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,18 +1,19 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; @@ -22,6 +23,8 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -36,32 +39,53 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {"A000", "0 0", "0 . 0", "0 0", "A000",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, - {"22222", "22222", "22122", "22222", "22222",}, - {"23432", "33333", "43134", "33333", "23432",}, - {"23332", "33333", "33533", "33333", "23332",}, - {"23432", "33333", "43134", "33333", "23432",}, - {"22222", "22222", "22122", "22222", "22222",}, - {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"A000", "0 0", "0 0", "0 0", "A000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_crafting::addClassicToMachineList, - GT_MetaTileEntity_EM_crafting::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition + .builder() + .addShape("main", new String[][]{ + {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "}, + {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, + {"AH~HA","AAAAA"," FEF ","BBEBB","CGEGC","GGDGG","CGEGC","BBEBB"," FEF ","AAAAA","AHHHA"}, + {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, + {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 9)) + .addElement('E', ofBlock(sBlockCasingsTT, 10)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {"A000", "0 0", "0 . 0", "0 0", "A000",}, +// {"00000", "00000", "00000", "00000", "00000",}, +// {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, +// {"22222", "22222", "22122", "22222", "22222",}, +// {"23432", "33333", "43134", "33333", "23432",}, +// {"23332", "33333", "33533", "33333", "23332",}, +// {"23432", "33333", "43134", "33333", "23432",}, +// {"22222", "22222", "22122", "22222", "22222",}, +// {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, +// {"00000", "00000", "00000", "00000", "00000",}, +// {"A000", "0 0", "0 0", "0 0", "A000",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_crafting::addClassicToMachineList, +// GT_MetaTileEntity_EM_crafting::addElementalToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4}; + //endregion public GT_MetaTileEntity_EM_crafting(int aID, String aName, String aNameRegional) { @@ -79,7 +103,8 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -109,7 +134,13 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From f2bfd412ee8bca9066e430fe5e01e47c4848e306 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 14:27:10 -0700 Subject: tagged as deprecated --- .../github/technus/tectech/mechanics/structure/IBlockPosConsumer.java | 1 + .../github/technus/tectech/mechanics/structure/ICustomBlockSetting.java | 1 + .../github/technus/tectech/mechanics/structure/IStructureDefinition.java | 1 + .../github/technus/tectech/mechanics/structure/IStructureElement.java | 1 + .../technus/tectech/mechanics/structure/IStructureElementChain.java | 1 + .../technus/tectech/mechanics/structure/IStructureElementCheckOnly.java | 1 + .../technus/tectech/mechanics/structure/IStructureElementDeferred.java | 1 + .../tectech/mechanics/structure/IStructureElementNoPlacement.java | 1 + .../github/technus/tectech/mechanics/structure/IStructureNavigate.java | 1 + .../github/technus/tectech/mechanics/structure/StructureDefinition.java | 1 + .../com/github/technus/tectech/mechanics/structure/StructureUtility.java | 1 + .../github/technus/tectech/mechanics/structure/adders/IBlockAdder.java | 1 + .../github/technus/tectech/mechanics/structure/adders/IHatchAdder.java | 1 + .../github/technus/tectech/mechanics/structure/adders/ITileAdder.java | 1 + 14 files changed, 14 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java index c3ea2d3e3f..d37e29c36a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.world.World; +@Deprecated public interface IBlockPosConsumer { void consume(World world, int x, int y, int z); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java index b70e76fbac..10d9dcca73 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.block.Block; import net.minecraft.world.World; +@Deprecated public interface ICustomBlockSetting { /** * Default block setting calls {@link World#setBlock(int x, int y, int z, Block block, int meta, int updateType)} like: diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java index c8488d5cea..cb40214eac 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -9,6 +9,7 @@ import java.util.Arrays; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +@Deprecated public interface IStructureDefinition { /** * Used internally diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java index f946e71f91..ac5f4f7296 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -6,6 +6,7 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ +@Deprecated public interface IStructureElement { boolean check(T t,World world,int x,int y,int z); diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java index f9593ee1c5..2051e06c4d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java @@ -6,6 +6,7 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ +@Deprecated public interface IStructureElementChain extends IStructureElement { IStructureElement[] fallbacks(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java index ec15aea53b..a866da828d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +@Deprecated public interface IStructureElementCheckOnly extends IStructureElement { @Override default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java index dbb74312a8..e1714e520c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java @@ -3,5 +3,6 @@ package com.github.technus.tectech.mechanics.structure; /** * Use StructureUtility to instantiate */ +@Deprecated public interface IStructureElementDeferred extends IStructureElement { } diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java index 47e6060878..1ba5dc30f5 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.structure; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +@Deprecated public interface IStructureElementNoPlacement extends IStructureElement { @Override default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java index d3f4134cea..5e73f25640 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -6,6 +6,7 @@ import net.minecraft.world.World; /** * Use StructureUtility to instantiate */ +@Deprecated interface IStructureNavigate extends IStructureElement { @Override default boolean check(T t, World world, int x, int y, int z){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java index 9a1e94d98a..ca1dbce77b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -7,6 +7,7 @@ import java.util.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; +@Deprecated public class StructureDefinition implements IStructureDefinition { private final Map> elements; private final Map shapes; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 28b72f8ba6..f469925dbc 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -30,6 +30,7 @@ import static java.lang.Integer.MIN_VALUE; * * (Just import static this class to have a nice fluent syntax while defining structure definitions) */ +@Deprecated public class StructureUtility { private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz=|!@#$%&()[]{};:<>/?_,.*^'`"; @SuppressWarnings("rawtypes") diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java index 908c4c4aca..29229f7902 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.structure.adders; import net.minecraft.block.Block; +@Deprecated public interface IBlockAdder { /** * Callback on block added, needs to check if block is valid (and add it) diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java index a47befc2e8..197dd2fd45 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.structure.adders; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +@Deprecated public interface IHatchAdder { /** * Callback to add hatch, needs to check if hatch is valid (and add it) diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java index cc3c7dbb7a..c262bbb154 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.mechanics.structure.adders; import net.minecraft.tileentity.TileEntity; +@Deprecated public interface ITileAdder { /** * Callback to add hatch, needs to check if tile is valid (and add it) -- cgit From b18e9791588f985e593c6f680e54d30f65faf9ae Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 14:37:21 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_infuser.java | 60 ++++++++++++++++------ 1 file changed, 43 insertions(+), 17 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 82fd2df5ed..5a5c778f69 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -3,17 +3,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import net.minecraft.block.Block; @@ -27,7 +28,9 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static gregtech.api.GregTech_API.mEUtoRF; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -35,22 +38,38 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", "000", "1.1", "000", " ",}, - {" ", "010", "111", "010", " ",}, - {" ", "000", "111", "000", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{7, 4}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_infuser::addClassicToMachineList); - private static final short[] casingTextures = new short[]{textureOffset}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.infuser.hint"),//1 - Classic Hatches or High Power Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"CCC","CCC","CCC"}, + {"BBB","BAB","BBB"}, + {"A~A","AAA","AAA"}, + {"BBB","BAB","BBB"}, + {"CCC","CCC","CCC"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 7)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_infuser::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {" ", "000", "1.1", "000", " ",}, +// {" ", "010", "111", "010", " ",}, +// {" ", "000", "111", "000", " ",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{7, 4}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_infuser::addClassicToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0}; + //endregion public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { @@ -114,7 +133,8 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0); + return structureCheck_EM("main", 1, 2, 0); } @Override @@ -185,7 +205,13 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 2, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From a0b99f2686e4afbe4a03c60e58e6683a71453158 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 14:57:36 -0700 Subject: tweaked ofHatchAdderOptional calls --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index f36d2e7a63..c474c81b94 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -62,9 +62,9 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl .addElement('C', ofBlock(sBlockCasingsTT, 6)) .addElement('D', ofBlock(sBlockCasingsTT, 10)) .addElement('E', ofBlock(sBlockCasingsTT, 12)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, textureOffset + 4, sHintCasingsTT, 0, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, textureOffset + 4,2, sBlockCasingsTT, 4)) .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, sHintCasingsTT, 0, sBlockCasingsTT, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); /* -- cgit From c5afe1bc5bc345901a321915954eca7625109d12 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 15:58:22 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_wormhole.java | 86 +++++++++++++++------- 1 file changed, 60 insertions(+), 26 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index fa51447e9f..92eec32628 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,18 +1,19 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; @@ -22,7 +23,9 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -35,32 +38,56 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {E, E, E, "C ", "C . ", "C "/*,E,E,E,*/}, - {E, E, "D0", "C000", "B00100", "C000", "D0"/*,E,E,*/}, - {E, E, "D0", "C2A2", "B0C0", "C2A2", "D0"/*,E,E,*/}, - {E, "D0", "D0", E, "A00C00", E, "D0", "D0"/*,E,*/}, - {E, "D0", E, E, "A0E0", E, E, "D0"/*,E,*/}, - {"D0", "D0", E, E, "00E00", E, E, "D0", "D0",}, - {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, - {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, - {"B0!!!0", "A 31113 ", "031444130", "!14C41!", "!14C41!", "!14C41!", "031444130", "A 31113 ", "B0!!!0",}, - {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, - {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, - GT_MetaTileEntity_EM_wormhole::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "}, + {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, + {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, + {" EEE "," DDD "," F F "," "," "," ","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, + {" E~E "," DDBDD "," D D "," DD DD "," D D ","DD DD","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, + {" EEE "," DDD "," F F "," "," "," ","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, + {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, + {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, + {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 5)) + .addElement('B', ofBlock(sBlockCasingsTT, 10)) + .addElement('C', ofBlock(sBlockCasingsTT, 11)) + .addElement('D', ofBlock(sBlockCasingsTT, 12)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {E, E, E, "C ", "C . ", "C "/*,E,E,E,*/}, +// {E, E, "D0", "C000", "B00100", "C000", "D0"/*,E,E,*/}, +// {E, E, "D0", "C2A2", "B0C0", "C2A2", "D0"/*,E,E,*/}, +// {E, "D0", "D0", E, "A00C00", E, "D0", "D0"/*,E,*/}, +// {E, "D0", E, E, "A0E0", E, E, "D0"/*,E,*/}, +// {"D0", "D0", E, E, "00E00", E, E, "D0", "D0",}, +// {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, +// {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, +// {"B0!!!0", "A 31113 ", "031444130", "!14C41!", "!14C41!", "!14C41!", "031444130", "A 31113 ", "B0!!!0",}, +// {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, +// {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, +// GT_MetaTileEntity_EM_wormhole::addElementalToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4}; + //endregion public GT_MetaTileEntity_EM_wormhole(int aID, String aName, String aNameRegional) { @@ -78,7 +105,8 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 4, 4, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 4, 4, 0); + return structureCheck_EM("main", 4, 4, 0); } @Override @@ -108,7 +136,13 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 4, 4, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 8fb80b146813df2d3928669d32c81c0d63862ca4 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 5 Sep 2021 16:44:26 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_switch.java | 64 +++++++++++++++------- 1 file changed, 45 insertions(+), 19 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 5ade4ec965..a71a5aaa59 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -13,13 +10,17 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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.Vec3Impl; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -31,6 +32,8 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,22 +41,35 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {" ", " 0 ", " ",}, - {" ", " ", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{3}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_switch::addClassicToMachineList); - private static final short[] casingTextures = new short[]{textureOffset + 1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", "1 - Classic/Data Hatches or Computer casing",//1 - Classic/Data Hatches or Computer casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"BBB","BBB","BBB"}, + {"B~B","BAB","BBB"}, + {"BBB","BBB","BBB"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 3)) + .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_EM_switch::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {" ", " . ", " ",}, +// {" ", " 0 ", " ",}, +// {" ", " ", " ",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{3}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_switch::addClassicToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset + 1}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{1}; + //endregion //region parameters @@ -99,7 +115,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -134,7 +151,10 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } } - Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + QuantumDataPacket pack = new QuantumDataPacket(0L).unifyTraceWith(pos); if (pack == null) { return; @@ -223,7 +243,13 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //StructureUtility.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 8f4236600aba013c620835f5e388d2dc93d580ce Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 6 Sep 2021 00:07:54 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 119 +++++++++++++++------ 1 file changed, 86 insertions(+), 33 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index c2f475888f..40bc786e8e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -2,11 +2,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.spark.ThaumSpark; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; @@ -19,10 +16,12 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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.Vec3Impl; -import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; @@ -30,12 +29,15 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.implementations.*; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; @@ -43,11 +45,15 @@ import java.util.HashSet; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static java.lang.Math.*; import static net.minecraft.util.StatCollector.translateToLocal; @@ -100,35 +106,71 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //endregion //region structure - private static final String[][] shape = new String[][]{//3 16 0 - {"\u000F", "A . ",}, - {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, - {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, - {"B000", "A00000", "A00000", "A00000", "B030", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "C3", "A1A3A1", " 21212 ",}, - {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, - {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, - {"\u000F", "A ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0}; - private static final byte[] blockMetaT0 = new byte[]{7, 0, 6, 8}; - private static final byte[] blockMetaT1 = new byte[]{7, 1, 6, 8}; - private static final byte[] blockMetaT2 = new byte[]{7, 2, 6, 8}; - private static final byte[] blockMetaT3 = new byte[]{7, 3, 6, 8}; - private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8}; - private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8}; - private static final byte[] blockMetaT6 = new byte[]{7, 9, 6, 8}; - private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5, blockMetaT6}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, - GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList); - private static final short[] casingTextures = new short[]{(texturePage << 7) + 16 + 6, 0}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsBA0, null}; - private static final byte[] blockMetaFallback = new byte[]{6, 0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.0"),//1 - Classic Hatches, Capacitor Hatches or Tesla Base Casing translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.1"),//2 - Titanium Frames }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {" "," "," BBB "," BBB "," BBB "," "," "}, + {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, + {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, + {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, + {" "," "," BBB "," BCB "," BBB "," "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," "," "," C "," "," "," "}, + {" "," DDD "," D D "," D C D "," D D "," DDD "," "}, + {" EE~EE ","EAAAAAE","EADDDAE","EADADAE","EADDDAE"," AAAAAE"," EEEEE "} + }) + .addElement('A', ofBlock(sBlockCasingsBA0, 6)) + .addElement('B', ofBlock(sBlockCasingsBA0, 7)) + .addElement('C', ofBlock(sBlockCasingsBA0, 8)) + .addElement('D', lazy(t -> ofBlock(sBlockCasingsBA0, t.getCoilWindingMeta()))) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, textureOffset + 16 + 6, 1, sBlockCasingsBA0, 6)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList, 0, 2)) + .build(); + + public int getCoilWindingMeta() { + Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); + return this.getBaseMetaTileEntity().getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); + } + +// private static final String[][] shape = new String[][]{//3 16 0 +// {"\u000F", "A . ",}, +// {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, +// {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, +// {"B000", "A00000", "A00000", "A00000", "B030", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "C3", "A1A3A1", " 21212 ",}, +// {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, +// {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, +// {"\u000F", "A ",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0}; +// private static final byte[] blockMetaT0 = new byte[]{7, 0, 6, 8}; +// private static final byte[] blockMetaT1 = new byte[]{7, 1, 6, 8}; +// private static final byte[] blockMetaT2 = new byte[]{7, 2, 6, 8}; +// private static final byte[] blockMetaT3 = new byte[]{7, 3, 6, 8}; +// private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8}; +// private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8}; +// private static final byte[] blockMetaT6 = new byte[]{7, 9, 6, 8}; +// private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5, blockMetaT6}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, +// GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList); +// private static final short[] casingTextures = new short[]{(texturePage << 7) + 16 + 6, 0}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsBA0, null}; +// private static final byte[] blockMetaFallback = new byte[]{6, 0}; + //endregion //region parameters @@ -348,7 +390,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock mTier = 6; }//Hacky remap because the ZPM coils were added later - if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { + //if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { + if (structureCheck_EM("main", 3, 16, 0)) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); @@ -360,11 +403,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock oldRotation = (byte) getExtendedFacing().ordinal(); oldOrientation = iGregTechTileEntity.getFrontFacing(); + Vec3Impl posBMTE = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + //Calculate coordinates of the middle bottom - posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(getBaseMetaTileEntity()); + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(posBMTE); //Calculate coordinates of the top sphere - posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(getBaseMetaTileEntity()); + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(posBMTE); } return true; } @@ -680,9 +727,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof GT_MetaPipeEntity_Frame; } + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 7], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 7], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 3, 16, 0, hintsOnly, stackSize); } @Override -- cgit From ff5a24ee7d249f950db7160195aae8964423e5ef Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 03:57:53 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_computer.java | 106 +++++++++++++++------ 1 file changed, 79 insertions(+), 27 deletions(-) (limited to 'src/main') 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 6a6a707399..c336d08fea 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 @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; @@ -12,7 +9,10 @@ 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.Vec3Impl; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -22,6 +22,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; @@ -33,10 +34,13 @@ import java.util.ArrayList; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsNH; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -51,23 +55,58 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; - private static final String[][] terminator = new String[][]{{"A ", "A ", "A ", "A ",},}; - private static final String[][] cap = new String[][]{{"-01", "A22", "A22", "-01",},}; - private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},}; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2, 1, 3}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_computer::addToMachineList, - GT_MetaTileEntity_EM_computer::addRackToMachineList); - private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{1, 3}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.computer.hint.0"),//1 - Classic/Data Hatches or Computer casing translateToLocal("gt.blockmachines.multimachine.em.computer.hint.1"),//2 - Rack Hatches or Advanced computer casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("front", new String[][]{ + {" AA"}, + {" AA"}, + {" ~A"}, + {" AA"} + }) + .addShape("cap", new String[][]{ + {"-CB"}, + {" DD"}, + {" DD"}, + {"-CB"} + }) + .addShape("slice", new String[][]{ + {"-CB"}, + {" ED"}, + {" ED"}, + {"-CB"} + }) + .addShape("back", new String[][]{ + {" AA"}, + {" AA"}, + {" AA"}, + {" AA"} + }) + .addElement('A', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 1)) + .addElement('C', ofBlock(sBlockCasingsTT, 2)) + .addElement('D', ofBlock(sBlockCasingsTT, 3)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addRackToMachineList, textureOffset + 3, 2, sBlockCasingsTT, 3)) + .build(); + +// private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; +// private static final String[][] terminator = new String[][]{{"A ", "A ", "A ", "A ",},}; +// private static final String[][] cap = new String[][]{{"-01", "A22", "A22", "-01",},}; +// private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},}; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{2, 1, 3}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_computer::addToMachineList, +// GT_MetaTileEntity_EM_computer::addRackToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{1, 3}; + //endregion //region parameters @@ -129,15 +168,18 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } } eRacks.clear(); - if (!structureCheck_EM(front, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0)) { + //if (!structureCheck_EM(front, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0)) { + if (!structureCheck_EM("front", 1, 2, 0)) { return false; } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, -1)) { + //if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, -1)) { + if (!structureCheck_EM("cap", 1, 2, -1)) { return false; } byte offset = -2, totalLen = 4; while (offset > -16) { - if (!structureCheck_EM(slice, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, offset)) { + //if (!structureCheck_EM(slice, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, offset)) { + if (!structureCheck_EM("slice", 1, 2, offset)) { break; } totalLen++; @@ -146,10 +188,12 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB if (totalLen > 17) { return false; } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { + //if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { + if (!structureCheck_EM("cap", 1, 2, ++offset)) { return false; } - if (!structureCheck_EM(terminator, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, --offset)) { + //if (!structureCheck_EM(terminator, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, --offset)) { + if (!structureCheck_EM("back", 1, 2, --offset)) { return false; } eCertainMode = (byte) Math.min(totalLen / 3, 5); @@ -246,7 +290,10 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { if (!eOutputData.isEmpty()) { - Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + QuantumDataPacket pack = new QuantumDataPacket(eAvailableData / eOutputData.size()).unifyTraceWith(pos); if (pack == null) { return; @@ -359,16 +406,21 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity igt = getBaseMetaTileEntity(); - Structure.builder(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); - Structure.builder(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); + //Structure.builder(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("front", 1, 2, 0, hintsOnly, stackSize); + //Structure.builder(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("cap", 1, 2, -1, hintsOnly, stackSize); byte offset = -2; for (int rackSlices = Math.min(stackSize.stackSize, 12); rackSlices > 0; rackSlices--) { - Structure.builder(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + //Structure.builder(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("slice", 1 , 2, offset--, hintsOnly, stackSize); } - Structure.builder(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); - Structure.builder(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); + //Structure.builder(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("cap", 1, 2, offset--, hintsOnly, stackSize); + //Structure.builder(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("back", 1, 2, offset, hintsOnly, stackSize); } @Override -- cgit From 98cace3dadb3bfdbc2c527b29dc809bea769453e Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 04:04:36 -0700 Subject: forgot to override getStructureEM() --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main') 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 c336d08fea..95a1be159a 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 @@ -423,6 +423,11 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB structureBuild_EM("back", 1, 2, offset, hintsOnly, stackSize); } + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + @Override public String[] getStructureDescription(ItemStack stackSize) { return description; -- cgit From ce0ceebc6bab7d0e496b6c2d64b8282dc80f8b06 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 04:10:41 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_TM_microwave.java | 66 +++++++++++++++------- 1 file changed, 45 insertions(+), 21 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 674ffe8c3e..5791a67c8a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,19 +1,20 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; 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.Vec3Impl; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -30,7 +31,9 @@ import static com.github.technus.tectech.loader.MainLoader.microwaving; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static gregtech.api.GregTech_API.sBlockCasings4; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.AxisAlignedBB.getBoundingBox; import static net.minecraft.util.StatCollector.translateToLocal; @@ -44,26 +47,40 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {"00000", "00000", "00.00", "0 0",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"00000", "00000", "00000", "0 0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasings4}; - private static final byte[] blockMeta = new byte[]{1}; - - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_TM_microwave::addClassicToMachineList); - private static final short[] casingTextures = new short[]{49}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; - private static final byte[] blockMetaFallback = new byte[]{1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.microwave.hint.0"),//1 - Classic Hatches or Clean Stainless Steel Casing translateToLocal("gt.blockmachines.multimachine.tm.microwave.hint.1"),//Also acts like a hopper so give it an Output Bus }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"AAAAA","A---A","A---A","A---A","AAAAA"}, + {"AAAAA","A---A","A---A","A---A","AAAAA"}, + {"AA~AA","A---A","A---A","A---A","AAAAA"}, + {"ABBBA","BAAAB","BAAAB","BAAAB","ABBBA"} + }) + .addElement('A', ofBlock(sBlockCasings4, 1)) + .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_TM_microwave::addClassicToMachineList, 49, 1, sBlockCasings4, 1)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {"00000", "00000", "00.00", "0 0",}, +// {"0---0", "0---0", "0---0", " 000 ",}, +// {"0---0", "0---0", "0---0", " 000 ",}, +// {"0---0", "0---0", "0---0", " 000 ",}, +// {"00000", "00000", "00000", "0 0",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasings4}; +// private static final byte[] blockMeta = new byte[]{1}; +// +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_TM_microwave::addClassicToMachineList); +// private static final short[] casingTextures = new short[]{49}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; +// private static final byte[] blockMetaFallback = new byte[]{1}; + //endregion //region parameters @@ -101,7 +118,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -249,7 +267,13 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 999e4b621a60587ec211451cdd64bce93c606dad Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 11:05:51 -0700 Subject: I think I did this right --- .../em_machine/GT_MetaTileEntity_EM_machine.java | 65 +++++++++++++++------- 1 file changed, 46 insertions(+), 19 deletions(-) (limited to 'src/main') 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 6b26132292..b91a911def 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 @@ -7,9 +7,12 @@ import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_computer; 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.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -27,6 +30,8 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -41,26 +46,46 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa //endregion //region structure - private static final String[][] shape = new String[][]{ - {"B0", "A ", "0 - 0", "A ", "B0",}, - {"A000", "00000", "00.00", "00000", "A000",}, - {"A121", "1---1", "2---2", "1---1", "A121",}, - {"A131", "1---1", "3-A-3", "1---1", "A131",}, - {"A121", "1---1", "2---2", "1---1", "A121",}, - {"A000", "00000", "00-00", "00000", "A000",}, - {"B0", "A!!!", "0!!!0", "A!!!", "B0",},}; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_machine::addClassicToMachineList, - GT_MetaTileEntity_EM_machine::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.processing.hint.0"),//1 - Classic Hatches or High Power Casing - translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"),};//2 - Elemental Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"),//2 - Elemental Hatches or Molecular Casing + }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {" A "," AAA "," EBE "," ECE "," EBE "," AAA "," A "}, + {" DDD ","AAAAA","E---E","E---E","E---E","AAAAA"," FFF "}, + {"AD-DA","AA~AA","B---B","C---C","B---B","AA-AA","AFFFA"}, + {" DDD ","AAAAA","E---E","E---E","E---E","AAAAA"," FFF "}, + {" A "," AAA "," EBE "," ECE "," EBE "," AAA "," A "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {"B0", "A ", "0 - 0", "A ", "B0",}, +// {"A000", "00000", "00.00", "00000", "A000",}, +// {"A121", "1---1", "2---2", "1---1", "A121",}, +// {"A131", "1---1", "3-A-3", "1---1", "A131",}, +// {"A121", "1---1", "2---2", "1---1", "A121",}, +// {"A000", "00000", "00-00", "00000", "A000",}, +// {"B0", "A!!!", "0!!!0", "A!!!", "B0",},}; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; +// private static final IHatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_machine::addClassicToMachineList, +// GT_MetaTileEntity_EM_machine::addElementalToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4}; + //endregion //region parameters @@ -190,7 +215,8 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); + return structureCheck_EM("main", 2, 2, 1); } @Override @@ -354,7 +380,8 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 1, hintsOnly, stackSize); } @Override -- cgit From ed2ded881105c55f26ac286311c3e31f8a405e4d Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 11:15:42 -0700 Subject: forgot to override getStructure_EM() --- .../multi/em_machine/GT_MetaTileEntity_EM_machine.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main') 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 b91a911def..01142c8ccb 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 @@ -384,6 +384,11 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa structureBuild_EM("main", 2, 2, 1, hintsOnly, stackSize); } + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + @Override public String[] getStructureDescription(ItemStack stackSize) { return description; -- cgit From 61f7643451079e07e0d5a14fa52c337ce887e42e Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 11:32:54 -0700 Subject: fixed getStructure_EM return type --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java | 2 +- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java | 2 +- .../metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') 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 95a1be159a..429effb94b 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 @@ -424,7 +424,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public IStructureDefinition getStructure_EM() { + public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 5791a67c8a..1c64effb38 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -272,7 +272,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public IStructureDefinition getStructure_EM() { + public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; } 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 01142c8ccb..85ac8c1623 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 @@ -385,7 +385,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public IStructureDefinition getStructure_EM() { + public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; } -- cgit From 32a6cb64fcb1d2323b02b3f46b28be7ee47123bd Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 11:33:22 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_scanner.java | 89 +++++++++++++++------- 1 file changed, 61 insertions(+), 28 deletions(-) (limited to 'src/main') 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 b418ec0fa4..14209ca8f7 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 @@ -1,13 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -16,6 +13,9 @@ import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -45,6 +45,9 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.G 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -69,26 +72,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa //endregion //region structure - private static final String[][] shape = new String[][]{ - {" ", " 222 ", " 2.2 ", " 222 ", " ",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"00100", "01110", "11111", "01110", "00100",}, - {"01110", "1---1", "1---1", "1---1", "01110",}, - {"01110", "1---1", "1-A-1", "1---1", "01110",}, - {"01110", "1---1", "1---1", "1---1", "01110",}, - {"00100", "01110", "11\"11", "01110", "00100",}, - {"#####", "#000#", "#0!0#", "#000#", "#####",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_scanner::addClassicToMachineList, - GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, - GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, - GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.0"),//1 - Classic Hatches or High Power Casing @@ -96,6 +79,46 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.2"),//3 - Elemental Output Hatches or Molecular Casing translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"}, + {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, + {"CA~AC","BBBBB","DDDDD","D---D","D---D","D---D","DDGDD","EBFBE"}, + {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, + {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, textureOffset + 4, 2)) + .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, textureOffset + 4, 3)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {" ", " 222 ", " 2.2 ", " 222 ", " ",}, +// {"00000", "00000", "00000", "00000", "00000",}, +// {"00100", "01110", "11111", "01110", "00100",}, +// {"01110", "1---1", "1---1", "1---1", "01110",}, +// {"01110", "1---1", "1-A-1", "1---1", "01110",}, +// {"01110", "1---1", "1---1", "1---1", "01110",}, +// {"00100", "01110", "11\"11", "01110", "00100",}, +// {"#####", "#000#", "#0!0#", "#000#", "#####",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{4, 0, 0}; +// private static final IHatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_scanner::addClassicToMachineList, +// GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, +// GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, +// GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; + //endregion //region parameters @@ -108,9 +131,12 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa return LedStatus.STATUS_WRONG; } v = (int) v; - if (v == 0) return LedStatus.STATUS_NEUTRAL; - if (v >= SCAN_GET_CLASS_TYPE) return LedStatus.STATUS_TOO_HIGH; - if (v < 0) return LedStatus.STATUS_TOO_LOW; + if (v == 0) + return LedStatus.STATUS_NEUTRAL; + if (v >= SCAN_GET_CLASS_TYPE) + return LedStatus.STATUS_TOO_HIGH; + if (v < 0) + return LedStatus.STATUS_TOO_LOW; return LedStatus.STATUS_OK; }; protected Parameters.Group.ParameterIn[] scanConfiguration; @@ -209,7 +235,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { +// if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { + if (!structureCheck_EM("main", 2, 2, 0)) { return false; } return eInputHatches.size() == 1 && eOutputHatches.size() == 1 && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() == iGregTechTileEntity.getFrontFacing(); @@ -516,7 +543,13 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 115e7b212d95e3dbdf0fa2db8841f01a0e8f0075 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 20:36:16 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 71 ++++++++++++++++------ 1 file changed, 51 insertions(+), 20 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index dcd85af99d..2b7c85ffc2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,13 +1,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -15,6 +17,8 @@ import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -22,26 +26,46 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {"A010", "0 0", "1 . 1", "0 0", "A010",}, - {"23232", "32223", "22222", "32223", "23232",}, - {"12!21", "22422", "!444!", "22422", "12!21",}, - {"23232", "32223", "22222", "32223", "23232",}, - {"A010", "0 0", "1 1", "0 0", "A010",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, - GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "}, + {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, + {"FE~EF","BBBBB","GDDDG","BBBBB","FEEEF"}, + {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, + {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 9)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {"A010", "0 0", "1 . 1", "0 0", "A010",}, +// {"23232", "32223", "22222", "32223", "23232",}, +// {"12!21", "22422", "!444!", "22422", "12!21",}, +// {"23232", "32223", "22222", "32223", "23232",}, +// {"A010", "0 0", "1 1", "0 0", "A010",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, +// GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4}; + //endregion public GT_MetaTileEntity_EM_stabilizer(int aID, String aName, String aNameRegional) { @@ -59,7 +83,8 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -73,7 +98,13 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From d1c3be02533247931937b97131f8e3626ad375f5 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 20:37:43 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_dataBank.java | 62 +++++++++++++++------- 1 file changed, 44 insertions(+), 18 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 582be290ac..1b8f95f5f5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; @@ -12,6 +9,9 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContaine import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,6 +20,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -34,6 +35,9 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { @@ -43,24 +47,39 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {"0 0", "0 . 0", "0 0",}, - {"0!!!0", "01110", "0!!!0",}, - {"0!!!0", "0!!!0", "0!!!0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2, 1}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, - GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.databank.hint.0"),//1 - Classic Hatches or high power casing translateToLocal("gt.blockmachines.multimachine.em.databank.hint.1"),//2 - Data Access/Data Bank Master Hatches or computer casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"BCCCB","BDDDB","BDDDB"}, + {"BC~CB","BAAAB","BDDDB"}, + {"BCCCB","BDDDB","BDDDB"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 2)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList, textureOffset + 1, 2, sBlockCasingsTT, 1)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {"0 0", "0 . 0", "0 0",}, +// {"0!!!0", "01110", "0!!!0",}, +// {"0!!!0", "0!!!0", "0!!!0",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{2, 1}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, +// GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 1}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 1}; + //endregion public GT_MetaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { @@ -80,7 +99,8 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { eDataAccessHatches.clear(); eStacksDataOutputs.clear(); - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 1, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 1, 0); + return structureCheck_EM("main", 2, 1, 0); } @Override @@ -174,7 +194,13 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 1, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 234bdfb528d3d2719ef842cdb2b08cca5a5d6efc Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Sep 2021 23:13:39 -0700 Subject: updated STRUCTURE_DEFINITION to use uncompressed description --- .../multi/GT_MetaTileEntity_EM_collider.java | 106 ++++++++++++--------- 1 file changed, 63 insertions(+), 43 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index fe91be7bdc..773fbb5ec9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -303,49 +303,6 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //region structure //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition - .builder() - .addShape("main", new String[][]{ - {"I0A0A0", "I00000", "I0A0A0",}, - {"H0000000", "G001111100", "H0000000",}, - {"F22223332222", "F41155555114", "F22223332222",}, - {"E2000000000002", "E4155111115514", "E2000000000002",}, - {"D20000E00002", "D41511E11514", "D20000E00002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0030O0300", "0151O1510", "0030O0300",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, - {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, - {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, - }) - .addElement('0', ofBlock(sBlockCasingsTT, 4)) - .addElement('1', ofBlock(sBlockCasingsTT, 7)) - .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) - .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) - .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) - .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, - textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, - textureOffset + 4, 2, sBlockCasingsTT, 4)) - .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, - textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, - textureOffset + 4, 4, sBlockCasingsTT, 4)) - .build(); private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing @@ -355,6 +312,69 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction }; + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "}, + {" AAAAA "," AADDDDDAA "," CDDEEEEEDDC "," CDEEDDDDDEEDC "," CDEDD DDEDC "," CDED DEDC "," CDED DEDC "," ADED DEDA "," ADED DEDA ","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA"," ADED DEDA "," ADED DEDA "," CDED DEDC "," CDED DEDC "," CDEDDBJ~JBDDEDC "," CDEEDDDDDEEDC "," CDDEEEEEDDC "}, + {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) + .addElement('C', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) + .addElement('D', ofBlock(sBlockCasingsTT, 7)) + .addElement('E', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('I', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('J', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); + +// private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition +// .builder() +// .addShape("main", new String[][]{ +// {"I0A0A0", "I00000", "I0A0A0",}, +// {"H0000000", "G001111100", "H0000000",}, +// {"F22223332222", "F41155555114", "F22223332222",}, +// {"E2000000000002", "E4155111115514", "E2000000000002",}, +// {"D20000E00002", "D41511E11514", "D20000E00002",}, +// {"C2000I0002", "C4151I1514", "C2000I0002",}, +// {"B2000K0002", "B4151K1514", "B2000K0002",}, +// {"B200M002", "A0151M1510", "B200M002",}, +// {"A0200M0020", "A0151M1510", "A0200M0020",}, +// {"0020O0200", "0151O1510", "0020O0200",}, +// {"A030O030", "0151O1510", "A030O030",}, +// {"0030O0300", "0151O1510", "0030O0300",}, +// {"A030O030", "0151O1510", "A030O030",}, +// {"0020O0200", "0151O1510", "0020O0200",}, +// {"A0200M0020", "A0151M1510", "A0200M0020",}, +// {"B200M002", "A0151M1510", "B200M002",}, +// {"B2000K0002", "B4151K1514", "B2000K0002",}, +// {"C2000I0002", "C4151I1514", "C2000I0002",}, +// {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, +// {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, +// {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, +// }) +// .addElement('0', ofBlock(sBlockCasingsTT, 4)) +// .addElement('1', ofBlock(sBlockCasingsTT, 7)) +// .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), +// error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) +// .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) +// .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), +// error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) +// .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), +// error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) +// .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, +// textureOffset, 1, sBlockCasingsTT, 0)) +// .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, +// textureOffset + 4, 2, sBlockCasingsTT, 4)) +// .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, +// textureOffset + 4, 3, sBlockCasingsTT, 4)) +// .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, +// textureOffset + 4, 4, sBlockCasingsTT, 4)) +// .build(); + @Override public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; -- cgit From fc29bdc2ddae45dbbbe228820652efeca502fe0f Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 8 Sep 2021 06:28:38 -0700 Subject: moved to use StructureLib api --- .../multi/base/render/TT_RenderedExtendedFacingTexture.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java index 44bfa4445d..5ed53634de 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; -import com.github.technus.tectech.mechanics.alignment.IAlignmentProvider; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.util.LightingHelper; +import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IIconContainer; -- cgit From 5802a9d1943e58d79f70873ad90bc7a112bc46be Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 8 Sep 2021 13:25:02 -0700 Subject: updated STRUCTURE_DEFINITION to use uncompressed description --- .../multi/GT_MetaTileEntity_EM_bhg.java | 254 ++++++++++++++------- 1 file changed, 171 insertions(+), 83 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 6765abfa5c..4cc21ffc72 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -23,6 +23,7 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_INGOT_MASS_DIFF; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_MASS_TO_EU_INSTANT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -49,90 +50,172 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E //per dim disable thingies //region structure actual - private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition - .builder() - .addShape("t1",new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }) - .addShape("t2",new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, - {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, - {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, - {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, - {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, - {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, - {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, - {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, - {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, - {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, - {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, - {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, - {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, - {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, - {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, - {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, - {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, - {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, - {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, - {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, - {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, - {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, - {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, - {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, - {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, - {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, - {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }) - .addElement('0', ofBlock(sBlockCasingsTT,12)) - .addElement('1', ofBlock(sBlockCasingsTT,13)) - .addElement('2', ofBlock(sBlockCasingsTT,14)) - .addElement('3', ofBlock(sBlockCasingsTT,10)) - .addElement('4', ofBlock(sBlockCasingsTT,11)) - .addElement('5', ofBlock(QuantumGlassBlock.INSTANCE,0)) - .addElement(' ', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, - textureOffset,1,sBlockCasingsTT,0)) - .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, - textureOffset + 4,2,sBlockCasingsTT,4)) + private static final IStructureDefinition STRUCTURE_DEFINITION= + StructureDefinition.builder() + .addShape("main_t1", transpose(new String[][]{ + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," C C "," DDDDD "," DDCDCDD "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," DDCDCDD "," DDDDD "," C C "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," C C "," C C "," D "," D "," DDDDDDD "," DD DD "," D EEE D "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," D EEE D "," DD DD "," DDDDDDD "," D "," D "," C C "," C C "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," C C "," D "," D "," "," "," "," "," "," CC CC "," DD DD "," CC CC "," "," "," "," "," "," D "," D "," C C "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," C C "," CCCCC "," D "," B "," B "," "," "," "," "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," "," "," "," "," B "," B "," D "," CCCCC "," C C "," "," "," "," "," "}, + {" "," "," "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "," "," "}, + {" "," "," "," C C "," CCCCC "," D "," B "," "," "," "," "," "," "," "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," "," "," "," "," "," "," "," B "," D "," CCCCC "," C C "," "," "," "}, + {" "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "}, + {" "," "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," C C "," DB BD "," C C "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," "," "}, + {" "," C C "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," CC CC "," DB BD "," CC CC "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," C C "," "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" CCCCCCC "," C C "," DDDDDDD "," "," "," "," "," "," "," "," "," "," "," D D "," D D ","CCD DCC"," D D ","CCD DCC"," D D "," D D "," "," "," "," "," "," "," "," "," "," "," DDDDDDD "," C C "," C C "}, + {" CCHHHHHCC "," DDDDD "," DD DD "," "," "," E E "," "," E E "," "," "," "," "," D D "," D D "," D D ","CD DC"," D D ","CD DC"," D D "," D D "," D D "," "," "," "," "," E E "," "," E E "," "," "," DD DD "," DDDDD "," C C "}, + {" CHHHHHHHC "," DDCDCDD "," D EEE D "," "," C C "," E E "," C C "," E E "," "," "," "," "," D D "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," D D "," "," "," "," "," E E "," C C "," E E "," C C "," "," D EEE D "," DDCDCDD "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHF~FHHC "," DDDDDDD "," DDD EAAAE DDD "," DD DD "," CDBB BBDC "," DB BD "," CDB BDC "," DB BD "," DB BD "," DB BD "," D D "," D D "," D D "," D D "," DE ED ","CDA ADC"," DA AD ","CDA ADC"," DE ED "," D D "," D D "," D D "," D D "," DB BD "," DB BD "," DB BD "," CDB BDC "," DB BD "," CDBB BBDC "," DD DD "," DDD EAAAE DDD "," DDDDDDD "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHHHHHHC "," DDCDCDD "," D EEE D "," "," C C "," E E "," C C "," E E "," "," "," "," "," D D "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," D D "," "," "," "," "," E E "," C C "," E E "," C C "," "," D EEE D "," DDCDCDD "," C C "}, + {" CCHHHHHCC "," DDDDD "," DD DD "," "," "," E E "," "," E E "," "," "," "," "," D D "," D D "," D D ","CD DC"," D D ","CD DC"," D D "," D D "," D D "," "," "," "," "," E E "," "," E E "," "," "," DD DD "," DDDDD "," C C "}, + {" CCCCCCC "," C C "," DDDDDDD "," "," "," "," "," "," "," "," "," "," "," D D "," D D ","CCD DCC"," D D ","CCD DCC"," D D "," D D "," "," "," "," "," "," "," "," "," "," "," DDDDDDD "," C C "," C C "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" "," C C "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," CC CC "," DB BD "," CC CC "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," C C "," "}, + {" "," "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," C C "," DB BD "," C C "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," "," "}, + {" "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "}, + {" "," "," "," C C "," CCCCC "," D "," B "," "," "," "," "," "," "," "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," "," "," "," "," "," "," "," B "," D "," CCCCC "," C C "," "," "," "}, + {" "," "," "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "," "," "}, + {" "," "," "," "," "," C C "," CCCCC "," D "," B "," B "," "," "," "," "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," "," "," "," "," B "," B "," D "," CCCCC "," C C "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," C C "," D "," D "," "," "," "," "," "," CC CC "," DD DD "," CC CC "," "," "," "," D "," D "," D "," D "," C C "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," C C "," C C "," D "," D "," DDDDDDD "," DD DD "," D EEE D "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," D EEE D "," DD DD "," DDDDDDD "," D "," D "," C C "," C C "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," C C "," DDDDD "," DDCDCDD "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," DDCDCDD "," DDDDD "," C C "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "} + })) + .addShape("main_t2", transpose(new String[][]{ + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," GGC CGG "," GGGC CGGG "," GGGGC CGGGG "," GGGGDDDDDGGGG "," GGGDDCDCDDGGG "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," GGGDDCDCDDGGG "," GGGGDDDDDGGGG "," GGGGC CGGGG "," GGGC CGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," GGC CGG "," GGGGC CGGGG "," GGG D GGG "," GGG D GGG "," GG DDDDDDD GG "," GG DD DD GG "," GG D EEE D GG "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," GG D EEE D GG "," GG DD DD GG "," GG DDDDDDD GG "," GGG D GGG "," GGG D GGG "," GGGGC CGGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," GGGC CGGG "," GGG D GGG "," GG D GG "," GG GG "," G G "," GG GG "," G G "," G G "," CC CC "," DD DD "," CC CC "," G G "," G G "," GG GG "," G G "," GG GG "," GG D GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," GG B GG "," G G "," GG GG "," G G "," G G "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," G G "," G G "," GG GG "," G G "," GG B GG "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "," "," "}, + {" "," "," "," "," C C "," GGGGGC CGGGGG "," GGG D GGG "," GG EEEBEEE GG "," GG GG "," G G "," GG GG "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," GG GG "," G G "," GG GG "," GG EEEBEEE GG "," GGG D GGG "," GGGGGC CGGGGG "," C C "," "," "," "," "}, + {" "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "}, + {" "," "," C C "," GGGC CGGG "," GGG D GGG "," GG EEEBEEE GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG EEEBEEE GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "}, + {" "," "," GGC CGG "," GGG D GGG "," GG B GG "," GG GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," DB BD "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG GG "," GG B GG "," GGG D GGG "," GGC CGG "," "," "}, + {" "," C C "," GGGGC CGGGG "," GG D GG "," GG B GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," CC CC "," DB BD "," CC CC "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG B GG "," GG D GG "," GGGGC CGGGG "," C C "," "}, + {" "," GGC CGG "," GGG D GGG "," GG GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG GG "," GGG D GGG "," GGC CGG "," "}, + {" "," GGGC CGGG "," GGG D GGG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GGG D GGG "," GGGC CGGG "," "}, + {" CCCCCCC "," GGGGC CGGGG "," GG DDDDDDD GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GD DG "," GD DG ","CCD DCC"," D D ","CCD DCC"," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG DDDDDDD GG "," GGGGC CGGGG "," C C "}, + {" CCHHHHHCC "," GGGGDDDDDGGGG "," GG DD DD GG "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," GD DG "," D D ","CD DC"," D D ","CD DC"," D D "," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," GG DD DD GG "," GGGGDDDDDGGGG "," C C "}, + {" CHHHHHHHC "," GGGDDCDCDDGGG "," GG D EEE D GG "," G G "," C C "," G E E G "," C C "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," C C "," G E E G "," C C "," G G "," GG D EEE D GG "," GGGDDCDCDDGGG "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHF~FHHC "," DDDDDDD "," DDD EAAAE DDD "," DD DD "," CDBB BBDC "," DB BD "," CDB BDC "," DB BD "," DB BD "," DB BD "," D D "," D D "," D D "," D D "," DE ED ","CDA ADC"," DA AD ","CDA ADC"," DE ED "," D D "," D D "," D D "," D D "," DB BD "," DB BD "," DB BD "," CDB BDC "," DB BD "," CDBB BBDC "," DD DD "," DDD EAAAE DDD "," DDDDDDD "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHHHHHHC "," GGGDDCDCDDGGG "," GG D EEE D GG "," G G "," C C "," G E E G "," C C "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," C C "," G E E G "," C C "," G G "," GG D EEE D GG "," GGGDDCDCDDGGG "," C C "}, + {" CCHHHHHCC "," GGGGDDDDDGGGG "," GG DD DD GG "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," GD DG "," D D ","CD DC"," D D ","CD DC"," D D "," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," GG DD DD GG "," GGGGDDDDDGGGG "," C C "}, + {" CCCCCCC "," GGGGC CGGGG "," GG DDDDDDD GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GD DG "," GD DG ","CCD DCC"," D D ","CCD DCC"," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG DDDDDDD GG "," GGGGC CGGGG "," C C "}, + {" "," GGGC CGGG "," GGG D GGG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GGG D GGG "," GGGC CGGG "," "}, + {" "," GGC CGG "," GGG D GGG "," GG GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG GG "," GGG D GGG "," GGC CGG "," "}, + {" "," C C "," GGGGC CGGGG "," GG D GG "," GG B GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," CC CC "," DB BD "," CC CC "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG B GG "," GG D GG "," GGGGC CGGGG "," C C "," "}, + {" "," "," GGC CGG "," GGG D GGG "," GG B GG "," GG GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," DB BD "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG GG "," GG B GG "," GGG D GGG "," GGC CGG "," "," "}, + {" "," "," C C "," GGGC CGGG "," GGG D GGG "," GG EEEBEEE GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG EEEBEEE GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "}, + {" "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "}, + {" "," "," "," "," C C "," GGGGGC CGGGGG "," GGG D GGG "," GG EEEBEEE GG "," GG GG "," G G "," GG GG "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," GG GG "," G G "," GG GG "," GG EEEBEEE GG "," GGG D GGG "," GGGGGC CGGGGG "," C C "," "," "," "," "}, + {" "," "," "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," GG B GG "," G G "," GG GG "," G G "," G G "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," G G "," G G "," GG GG "," G G "," GG B GG "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," GGGC CGGG "," GGG D GGG "," GG D GG "," GG GG "," G G "," GG GG "," G G "," G G "," CC CC "," DD DD "," CC CC "," G G "," G G "," GG GG "," G D G "," GG D GG "," GG D GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," GGC CGG "," GGGGC CGGGG "," GGG D GGG "," GGG D GGG "," GG DDDDDDD GG "," GG DD DD GG "," GG D EEE D GG "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," GG D EEE D GG "," GG DD DD GG "," GG DDDDDDD GG "," GGG D GGG "," GGG D GGG "," GGGGC CGGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," GGC CGG "," GGGC CGGG "," GGGGC CGGGG "," GGGGDDDDDGGGG "," GGGDDCDCDDGGG "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," GGGDDCDCDDGGG "," GGGGDDDDDGGGG "," GGGGC CGGGG "," GGGC CGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 10)) + .addElement('B', ofBlock(sBlockCasingsTT, 11)) + .addElement('C', ofBlock(sBlockCasingsTT, 12)) + .addElement('D', ofBlock(sBlockCasingsTT, 13)) + .addElement('E', ofBlock(sBlockCasingsTT, 14)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); +// private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition +// .builder() +// .addShape("t1",new String[][]{ +// {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, +// {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, +// {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, +// {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, +// {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, +// {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, +// {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, +// {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, +// {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, +// {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, +// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, +// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, +// {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, +// {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, +// {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, +// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, +// {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, +// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, +// {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, +// {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, +// {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, +// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, +// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, +// {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, +// {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, +// {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, +// {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, +// {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, +// {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, +// {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, +// {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, +// {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, +// {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, +// }) +// .addShape("t2",new String[][]{ +// {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, +// {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, +// {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, +// {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, +// {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, +// {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, +// {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, +// {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, +// {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, +// {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, +// {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, +// {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, +// {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, +// {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, +// {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, +// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, +// {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, +// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, +// {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, +// {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, +// {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, +// {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, +// {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, +// {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, +// {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, +// {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, +// {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, +// {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, +// {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, +// {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, +// {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, +// {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, +// {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, +// }) +// .addElement('0', ofBlock(sBlockCasingsTT,12)) +// .addElement('1', ofBlock(sBlockCasingsTT,13)) +// .addElement('2', ofBlock(sBlockCasingsTT,14)) +// .addElement('3', ofBlock(sBlockCasingsTT,10)) +// .addElement('4', ofBlock(sBlockCasingsTT,11)) +// .addElement('5', ofBlock(QuantumGlassBlock.INSTANCE,0)) +// .addElement(' ', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, +// textureOffset,1,sBlockCasingsTT,0)) +// .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, +// textureOffset + 4,2,sBlockCasingsTT,4)) +// .build(); + @Override public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; @@ -308,7 +391,12 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM((stackSize.stackSize&1)==1?"t1":"t2", 16, 16, 0, hintsOnly,stackSize); + try { + structureBuild_EM((stackSize.stackSize & 1) == 1 ? "main_t1" : "main_t2", 16, 16, 0, hintsOnly, stackSize); + } + catch (Exception e) { + e.printStackTrace(); + } } @Override -- cgit From 63c1c84e5b8f4d43712db484e8d7558342fd8d44 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 02:23:29 -0700 Subject: Gleese told me how to fix this bug --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main') 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 86de270ba4..75e9d016c2 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 @@ -5,15 +5,18 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.structure.Structure; +import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.AlignmentMessage; import com.gtnewhorizon.structurelib.alignment.IAlignment; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; import com.gtnewhorizon.structurelib.structure.StructureUtility; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.util.Vec3Impl; +import cpw.mods.fml.common.network.NetworkRegistry; import gregtech.api.util.GT_StructureUtility; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; @@ -180,9 +183,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt IGregTechTileEntity base = getBaseMetaTileEntity(); mMachine = false; if (getBaseMetaTileEntity().isServerSide()) { - NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), - base.getWorld().provider.dimensionId, - base.getXCoord(), base.getYCoord(), base.getZCoord(), 512); + //NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), + // base.getWorld().provider.dimensionId, + // base.getXCoord(), base.getYCoord(), base.getZCoord(), 512); + StructureLibAPI.sendAlignment((IAlignmentProvider) base, + new NetworkRegistry.TargetPoint(base.getWorld().provider.dimensionId, + base.getXCoord(), base.getYCoord(), base.getZCoord(), 512)); }else{ base.issueTextureUpdate(); } -- cgit From 88f564f102b2d54f6699c79ab9c0ac38e8147b8f Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 04:34:32 -0700 Subject: some minor fixes --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 773fbb5ec9..10619522d6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -314,11 +314,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "}, {" AAAAA "," AADDDDDAA "," CDDEEEEEDDC "," CDEEDDDDDEEDC "," CDEDD DDEDC "," CDED DEDC "," CDED DEDC "," ADED DEDA "," ADED DEDA ","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA"," ADED DEDA "," ADED DEDA "," CDED DEDC "," CDED DEDC "," CDEDDBJ~JBDDEDC "," CDEEDDDDDEEDC "," CDDEEEEEDDC "}, {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) .addElement('C', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) @@ -376,7 +376,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB // .build(); @Override - public IStructureDefinition getStructure_EM() { + public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; } -- cgit From b6dabec16a277ed1ac812c89451e10b7fed128c1 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 04:58:16 -0700 Subject: now uses StructureLib API --- .../GT_MetaTileEntity_DebugStructureWriter.java | 34 +++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/main') 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 3b194c516b..01d5e2321e 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 @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.structure.StructureUtility; 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.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.structure.StructureUtility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,9 +20,13 @@ 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; @@ -115,11 +119,18 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isAllowedToWork()) { - String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), - ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), +// ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), +// numbers[0], numbers[1], numbers[2], +// numbers[3], numbers[4], numbers[5],false); + String pseudoJavaCode = StructureUtility.getPseudoJavaCode( + aBaseMetaTileEntity.getWorld(), ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), numbers[0], numbers[1], numbers[2], - numbers[3], numbers[4], numbers[5],false); + te -> te.getClass().getCanonicalName(), + numbers[3], numbers[4], numbers[5], + false); TecTech.LOGGER.info(pseudoJavaCode); result = pseudoJavaCode.split("\\n"); aBaseMetaTileEntity.disableWorking(); @@ -129,11 +140,18 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); - String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), - ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), +// ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), +// numbers[0], numbers[1], numbers[2], +// numbers[3], numbers[4], numbers[5],true); + String pseudoJavaCode = StructureUtility.getPseudoJavaCode( + aBaseMetaTileEntity.getWorld(), ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), numbers[0], numbers[1], numbers[2], - numbers[3], numbers[4], numbers[5],true); + te -> te.getClass().getCanonicalName(), + numbers[3], numbers[4], numbers[5], + false); TecTech.LOGGER.info(pseudoJavaCode); result = pseudoJavaCode.split("\\n"); aBaseMetaTileEntity.disableWorking(); -- cgit From f841902897850cf35787173219543fd54b300c59 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 05:13:59 -0700 Subject: marked as deprecated --- src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java | 1 + .../java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java | 1 + .../com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java | 1 + .../com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java | 1 + .../com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java | 1 + .../java/com/github/technus/tectech/mechanics/alignment/IAlignment.java | 1 + .../com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java | 1 + .../github/technus/tectech/mechanics/alignment/IAlignmentProvider.java | 1 + .../com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java | 1 + .../github/technus/tectech/mechanics/alignment/enumerable/Direction.java | 1 + .../technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java | 1 + .../com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java | 1 + .../github/technus/tectech/mechanics/alignment/enumerable/Rotation.java | 1 + .../technus/tectech/mechanics/constructable/ConstructableUtility.java | 1 + .../github/technus/tectech/mechanics/constructable/IConstructable.java | 1 + .../tectech/mechanics/constructable/IMultiblockInfoContainer.java | 1 + .../com/github/technus/tectech/thing/item/ConstructableTriggerItem.java | 1 + .../com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java | 1 + 18 files changed, 18 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java index dd5cd59ac7..3c7f18ff32 100644 --- a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java +++ b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java @@ -13,6 +13,7 @@ import net.minecraft.world.World; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) +@Deprecated public class BlockHint extends EntityFX { private IIcon[] icons = new IIcon[6]; private short[] mRGBa = Dyes._NULL.mRGBa; diff --git a/src/main/java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java b/src/main/java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java index d1d2ed611c..92fa34990e 100644 --- a/src/main/java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java +++ b/src/main/java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java @@ -6,6 +6,7 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; @SideOnly(Side.CLIENT) +@Deprecated public class WeightlessParticleFX extends EntityFX { public WeightlessParticleFX(World p_i1205_1_, double p_i1205_2_, double p_i1205_4_, double p_i1205_6_, double p_i1205_8_, double p_i1205_10_, double p_i1205_12_) diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java index 26a6d80dd8..779406371a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java @@ -12,6 +12,7 @@ import java.util.function.Function; import static com.github.technus.tectech.mechanics.alignment.IAlignment.STATES_COUNT; +@Deprecated public class AlignmentLimits implements IAlignmentLimits { protected final boolean[] validStates=new boolean[STATES_COUNT]; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java index 07a3e02c1f..61fc398171 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java @@ -16,6 +16,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +@Deprecated public class AlignmentMessage implements IMessage { int mPosX; int mPosY; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java index 68e11b77af..af3369465c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java @@ -8,6 +8,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; +@Deprecated public class AlignmentUtility { private AlignmentUtility(){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java index a2a6301070..0ea202cc98 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java @@ -8,6 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.Arrays; +@Deprecated public interface IAlignment extends IAlignmentLimits,IAlignmentProvider { int DIRECTIONS_COUNT= Direction.VALUES.length; int ROTATIONS_COUNT= Rotation.VALUES.length; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java index 68b4d84dab..a1f505baff 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated public interface IAlignmentLimits { IAlignmentLimits UNLIMITED= (direction, rotation, flip) -> true; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java index 07dc972aac..23bf9ae266 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.alignment; +@Deprecated public interface IAlignmentProvider { IAlignment getAlignment(); } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java index 1c44164731..2ec6ea6893 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java @@ -7,6 +7,7 @@ import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.mechanics.alignment.enumerable.Direction.getAxisVector; import static java.lang.Math.abs; +@Deprecated public class IntegerAxisSwap { private final Vec3Impl forFirstAxis; private final Vec3Impl forSecondAxis; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java index cc3971fedb..56356b3606 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.alignment.enumerable; import com.github.technus.tectech.util.Vec3Impl; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated public enum Direction { DOWN(ForgeDirection.DOWN), UP(ForgeDirection.UP), diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java index 5949b432df..04f2a55bd5 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -14,6 +14,7 @@ import static java.lang.Math.abs; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toMap; +@Deprecated public enum ExtendedFacing { DOWN_NORMAL_NONE("down normal none"), DOWN_NORMAL_HORIZONTAL("down normal horizontal"), diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java index 4b1dff70ec..0b85c5197e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java @@ -9,6 +9,7 @@ import static java.lang.Math.abs; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toMap; +@Deprecated public enum Flip { NONE(3, "none"), HORIZONTAL(2, "horizontal"), diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java index 5d41f54a11..b6cd1aa015 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java @@ -9,6 +9,7 @@ import static java.lang.Math.abs; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toMap; +@Deprecated public enum Rotation { NORMAL(2, "normal"), CLOCKWISE(3, "clockwise"), diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java index 2dc74330f9..6d605eef6e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java @@ -13,6 +13,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated public class ConstructableUtility { private ConstructableUtility(){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java index 1de0381f1f..ed0cdfbf7d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java @@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack; /** * Created by Tec on 24.03.2017. */ +@Deprecated public interface IConstructable { void construct(ItemStack stackSize, boolean hintsOnly); diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java index 173e0d16ec..da124fcf4d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java @@ -12,6 +12,7 @@ import java.util.HashMap; /** * To implement IConstructable on not own TileEntities */ +@Deprecated public interface IMultiblockInfoContainer { HashMap> MULTIBLOCK_MAP = new HashMap<>(); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 752f2d1bcc..81fec52ebd 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -18,6 +18,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. */ +@Deprecated public final class ConstructableTriggerItem extends Item { public static ConstructableTriggerItem INSTANCE; diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index d71abb34b7..39193fd598 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -18,6 +18,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. */ +@Deprecated public final class FrontRotationTriggerItem extends Item { public static FrontRotationTriggerItem INSTANCE; -- cgit From e93e0546e67215cb05161cdbdb09899bbc781005 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 09:24:07 -0700 Subject: marked as deprecated --- src/main/java/com/github/technus/tectech/util/Vec3Impl.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java index 9ba96d741a..56a9176767 100644 --- a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java +++ b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java @@ -4,6 +4,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.dispenser.IPosition; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated public class Vec3Impl implements Comparable { public static final Vec3Impl NULL_VECTOR = new Vec3Impl(0, 0, 0); private final int val0; -- cgit From d84c3d5ea6559f997de70887adddc00ffd8c42dd Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 10:35:08 -0700 Subject: I think I did this right --- .../multi/GT_MetaTileEntity_EM_junction.java | 92 ++++++++++++++++------ 1 file changed, 66 insertions(+), 26 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index b63079d2dc..4aeb537226 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,7 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; @@ -10,9 +8,14 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureUtility; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -22,7 +25,9 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -31,32 +36,55 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"000", "000", "000",}, - {"!!!", "!0!", "!!!",}, - {"!!!", "!!!", "!!!",}, - }; - private static final String[][] shapeBig = new String[][]{ - {E, "A ", "A . ", "A ",}, - {"A!!!", "!000!", "!010!", "!000!", "A!!!",}, - {"!!!!!", "!000!", "!000!", "!000!", "!!!!!",}, - {"A!!!", "!000!", "!000!", "!000!", "A!!!",}, - {"A!!!", "!!!!!", "!!!!!", "!!!!!", "A!!!",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_junction::addClassicToMachineList, - GT_MetaTileEntity_EM_junction::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.junction.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.junction.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"CCC", "C~C", "CCC"}, + {"AAA", "AAA", "AAA"}, + {"CCC", "CAC", "CCC"}, + {"CCC", "CCC", "CCC"} + }) + .addShape("mainBig", new String[][]{ + {" ", " CCC ", " C~C ", " CCC ", " "}, + {" DDD ", "DAAAD", "DABAD", "DAAAD", " DDD "}, + {"DDDDD", "DAAAD", "DAAAD", "DAAAD", "DDDDD"}, + {" DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD "}, + {" DDD ", "DDDDD", "DDDDD", "DDDDD", " DDD "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {" ", " . ", " ",}, +// {"000", "000", "000",}, +// {"!!!", "!0!", "!!!",}, +// {"!!!", "!!!", "!!!",}, +// }; +// private static final String[][] shapeBig = new String[][]{ +// {E, "A ", "A . ", "A ",}, +// {"A!!!", "!000!", "!010!", "!000!", "A!!!",}, +// {"!!!!!", "!000!", "!000!", "!000!", "!!!!!",}, +// {"A!!!", "!000!", "!000!", "!000!", "A!!!",}, +// {"A!!!", "!!!!!", "!!!!!", "!!!!!", "A!!!",}, +// }; +// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{4, 5}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_junction::addClassicToMachineList, +// GT_MetaTileEntity_EM_junction::addElementalToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4}; + //endregion //region parameters @@ -106,9 +134,11 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { int meta = iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); if (meta == 4) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } else if (meta == 5) { - return structureCheck_EM(shapeBig, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + //return structureCheck_EM(shapeBig, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("mainBig", 2, 2, 0); } return false; } @@ -177,7 +207,17 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + //Structure.builder((stackSize.stackSize & 1) == 1 ? shape : shapeBig, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + if ((stackSize.stackSize & 1) == 1) { + structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + } else { + structureBuild_EM("mainBig", 2, 2, 0, hintsOnly, stackSize); + } + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 15d761b22ccff56ec7927381140b0abff11982d9 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 10:40:02 -0700 Subject: tweaked the structure definition --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 4aeb537226..67667f0e1a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -47,8 +47,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB .addShape("main", new String[][]{ {"CCC", "C~C", "CCC"}, {"AAA", "AAA", "AAA"}, - {"CCC", "CAC", "CCC"}, - {"CCC", "CCC", "CCC"} + {"DDD", "DAD", "DDD"}, + {"DDD", "DDD", "DDD"} }) .addShape("mainBig", new String[][]{ {" ", " CCC ", " C~C ", " CCC ", " "}, -- cgit From 6c7410682705189a62e9500008f6b89a9be6159d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 12:00:29 -0700 Subject: required StructureLib to load before TecTech --- src/main/java/com/github/technus/tectech/TecTech.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 809a7e877d..bca0bbba70 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -32,7 +32,7 @@ import java.util.Iterator; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" - + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;") + + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;" + "required-after:StructureLib") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) public static CommonProxy proxy; -- cgit From b4b990ffc31ee34c6f2781d40206d55d4ef401ad Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 12:27:23 -0700 Subject: I think I did this right --- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 67 ++++++++++++++++------ 1 file changed, 48 insertions(+), 19 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index a716420e81..4111e04c61 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -12,10 +12,13 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; @@ -27,9 +30,13 @@ import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsNH; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,29 +45,49 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"0A0", E, "0A0",}, - {"121", "232", "121",}, - {"\"\"\"", "\"1\"", "\"\"\"",}, - {"010", "1!1", "010",}, - }; - private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, - GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.1"),//2 - Elemental Output Hatch - translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing + translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.3"),//General - Some sort of Essentia Storage }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"FFF", "F~F", "FFF"}, + {"E E", " ", "E E"}, + {"BAB", "ACA", "BAB"}, + {"DDD", "DBD", "DDD"}, + {"EBE", "BGB", "EBE"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofBlock(sBlockCasingsTT, 8)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {" ", " . ", " ",}, +// {"0A0", E, "0A0",}, +// {"121", "232", "121",}, +// {"\"\"\"", "\"1\"", "\"\"\"",}, +// {"010", "1!1", "010",}, +// }; +// private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, +// GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, +// GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + //endregion public GT_MetaTileEntity_EM_essentiaQuantizer(int aID, String aName, String aNameRegional) { @@ -78,7 +105,8 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + //return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); } @Override @@ -144,7 +172,8 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } @Override -- cgit From 86b3f5847d19226c4f704666dcb1770410b5fcb1 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 12:28:01 -0700 Subject: forgot getStructure_EM() --- .../metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 4111e04c61..91e822da94 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -176,6 +176,11 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + @Override public String[] getStructureDescription(ItemStack stackSize) { return description; -- cgit From 55e0ee4122188d3c2b5425a1a2456963e678060a Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 12:41:03 -0700 Subject: I think I did this right --- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 72 ++++++++++++++++------ 1 file changed, 53 insertions(+), 19 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 87e2660e01..51a5ba66cd 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -9,13 +9,17 @@ import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_dequantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.IGT_HatchAdder; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; @@ -29,7 +33,10 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,29 +45,49 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"0A0", E, "0A0",}, - {"121", "232", "121",}, - {"\"\"\"", "\"2\"", "\"\"\"",}, - {"202", "0!0", "202",}, - }; - private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, - GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.1"),//2 - Elemental Input Hatch - translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing + translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.3"),//General - Some sort of Essentia Storage }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"DDD", "DHD", "DDD"}, + {"E E", " ", "E E"}, + {"ABA", "BCB", "ABA"}, + {"FFF", "FBF", "FFF"}, + {"BEB", "EGE", "BEB"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofBlock(sBlockCasingsTT, 8)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) + .build(); + +// private static final String[][] shape = new String[][]{ +// {" ", " . ", " ",}, +// {"0A0", E, "0A0",}, +// {"121", "232", "121",}, +// {"\"\"\"", "\"2\"", "\"\"\"",}, +// {"202", "0!0", "202",}, +// }; +// private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; +// private static final IGT_HatchAdder[] addingMethods = adders( +// GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, +// GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, +// GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList); +// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; +// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; +// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + //endregion public GT_MetaTileEntity_EM_essentiaDequantizer(int aID, String aName, String aNameRegional) { @@ -78,7 +105,8 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + //return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); } @Override @@ -140,7 +168,13 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override -- cgit From 3b79f996eff82e5625b13399c3ee8a822a06037e Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 15:39:50 -0700 Subject: reverting structurelib dependency in TecTech since gt5u depends on it --- src/main/java/com/github/technus/tectech/TecTech.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index bca0bbba70..809a7e877d 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -32,7 +32,7 @@ import java.util.Iterator; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" - + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;" + "required-after:StructureLib") + + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) public static CommonProxy proxy; -- cgit From 0d94e73a28cf0669e790d00957b3407e5b026ffb Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 15:40:24 -0700 Subject: minor tweaks --- .../multi/GT_MetaTileEntity_EM_essentiaDequantizer.java | 4 ++-- .../metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 51a5ba66cd..abe8900ac7 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; @@ -13,6 +12,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_E import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; @@ -56,7 +56,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() .addShape("main", new String[][]{ - {"DDD", "DHD", "DDD"}, + {"DDD", "D~D", "DDD"}, {"E E", " ", "E E"}, {"ABA", "BCB", "ABA"}, {"FFF", "FBF", "FFF"}, diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 91e822da94..d900ec8c30 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; @@ -12,6 +11,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; -- cgit From 0abfa743383ae2e54221d59d539598c768b723d3 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 22:12:15 -0700 Subject: transposed structure definitions --- .../multi/GT_MetaTileEntity_EM_annihilation.java | 7 +++---- .../multi/GT_MetaTileEntity_EM_computer.java | 17 +++++++++-------- .../multi/GT_MetaTileEntity_EM_crafting.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_dataBank.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_decay.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 7 +++---- .../multi/GT_MetaTileEntity_EM_infuser.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_quantizer.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_research.java | 7 +++---- .../multi/GT_MetaTileEntity_EM_scanner.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_switch.java | 5 +++-- .../multi/GT_MetaTileEntity_EM_wormhole.java | 5 +++-- .../multi/GT_MetaTileEntity_TM_microwave.java | 5 +++-- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 4 ++-- 15 files changed, 50 insertions(+), 42 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index c474c81b94..e7cd3948ef 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -21,8 +21,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -44,7 +43,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl //region structure private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "}, {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, @@ -56,7 +55,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) 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 429effb94b..51779d7f28 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 @@ -40,6 +40,7 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -63,30 +64,30 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("front", new String[][]{ + .addShape("front", transpose(new String[][]{ {" AA"}, {" AA"}, {" ~A"}, {" AA"} - }) - .addShape("cap", new String[][]{ + })) + .addShape("cap", transpose(new String[][]{ {"-CB"}, {" DD"}, {" DD"}, {"-CB"} - }) - .addShape("slice", new String[][]{ + })) + .addShape("slice", transpose(new String[][]{ {"-CB"}, {" ED"}, {" ED"}, {"-CB"} - }) - .addShape("back", new String[][]{ + })) + .addShape("back", transpose(new String[][]{ {" AA"}, {" AA"}, {" AA"}, {" AA"} - }) + })) .addElement('A', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) .addElement('B', ofBlock(sBlockCasingsTT, 1)) .addElement('C', ofBlock(sBlockCasingsTT, 2)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index b028394822..f6584d8d27 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -24,6 +24,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -47,13 +48,13 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition .builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "}, {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, {"AH~HA","AAAAA"," FEF ","BBEBB","CGEGC","GGDGG","CGEGC","BBEBB"," FEF ","AAAAA","AHHHA"}, {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 1b8f95f5f5..dc78b264b3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -36,6 +36,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -55,11 +56,11 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {"BCCCB","BDDDB","BDDDB"}, {"BC~CB","BAAAB","BDDDB"}, {"BCCCB","BDDDB","BDDDB"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 1)) .addElement('B', ofBlock(sBlockCasingsTT, 2)) .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index e49a4980ed..acffd600c1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -42,6 +42,7 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; import static com.github.technus.tectech.util.CommonValues.VN; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -70,13 +71,13 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main",transpose(new String[][]{ {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"}, {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, {" F~F ","AAAAA"," EAE ","BDDDB","CDDDC","BDDDB"," EAE ","AAAAA"," FFF "}, {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index ce328fa480..d45e8d7e7f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -35,8 +35,7 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.*; import static com.github.technus.tectech.util.CommonValues.V; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockHint; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -50,11 +49,11 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {"CCC","ABA","EEE","BDB"}, {"C~C","BBB","EBE","DFD"}, {"CCC","ABA","EEE","BDB"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 0)) .addElement('B', ofBlock(sBlockCasingsTT, 4)) .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 5a5c778f69..e18c4596bf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -29,6 +29,7 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.GregTech_API.mEUtoRF; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -45,13 +46,13 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {"CCC","CCC","CCC"}, {"BBB","BAB","BBB"}, {"A~A","AAA","AAA"}, {"BBB","BAB","BBB"}, {"CCC","CCC","CCC"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 7)) .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_infuser::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) 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 0cac653157..d4e5ed9d59 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 @@ -43,6 +43,7 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.Util.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; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -55,11 +56,11 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock //use multi A energy inputs, use less power the longer it runs private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {"CCC","BAB","EEE","DBD"}, {"C~C","ABA","EBE","BFB"}, {"CCC","BAB","EEE","DBD"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 0)) .addElement('B', ofBlock(sBlockCasingsTT, 4)) .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 2f99b46e45..c8d6f23ae3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -46,8 +46,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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; @@ -81,7 +80,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB //region structure private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"}, {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, @@ -89,7 +88,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 1)) .addElement('B', ofBlock(sBlockCasingsTT, 2)) .addElement('C', ofBlock(sBlockCasingsTT, 3)) 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 14209ca8f7..80f65a55ba 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 @@ -46,6 +46,7 @@ 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -82,13 +83,13 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"}, {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, {"CA~AC","BBBBB","DDDDD","D---D","D---D","D---D","DDGDD","EBFBE"}, {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 0)) .addElement('B', ofBlock(sBlockCasingsTT, 4)) .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 2b7c85ffc2..573c1ef4e9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -18,6 +18,7 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -34,13 +35,13 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "}, {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, {"FE~EF","BBBBB","GDDDG","BBBBB","FEEEF"}, {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index a71a5aaa59..8e68ca944b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -33,6 +33,7 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -48,11 +49,11 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {"BBB","BBB","BBB"}, {"B~B","BAB","BBB"}, {"BBB","BBB","BBB"} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 3)) .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_EM_switch::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) .build(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 92eec32628..29956c962f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -24,6 +24,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,7 +47,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "}, {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, @@ -56,7 +57,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 5)) .addElement('B', ofBlock(sBlockCasingsTT, 10)) .addElement('C', ofBlock(sBlockCasingsTT, 11)) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 1c64effb38..e5ec4b9983 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -32,6 +32,7 @@ import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.GregTech_API.sBlockCasings4; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.AxisAlignedBB.getBoundingBox; @@ -55,12 +56,12 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {"AAAAA","A---A","A---A","A---A","AAAAA"}, {"AAAAA","A---A","A---A","A---A","AAAAA"}, {"AA~AA","A---A","A---A","A---A","AAAAA"}, {"ABBBA","BAAAB","BAAAB","BAAAB","ABBBA"} - }) + })) .addElement('A', ofBlock(sBlockCasings4, 1)) .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_TM_microwave::addClassicToMachineList, 49, 1, sBlockCasings4, 1)) .build(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 40bc786e8e..eeb89f6812 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -114,7 +114,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" "," "," BBB "," BBB "," BBB "," "," "}, {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, @@ -132,7 +132,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock {" "," "," "," C "," "," "," "}, {" "," DDD "," D D "," D C D "," D D "," DDD "," "}, {" EE~EE ","EAAAAAE","EADDDAE","EADADAE","EADDDAE"," AAAAAE"," EEEEE "} - }) + })) .addElement('A', ofBlock(sBlockCasingsBA0, 6)) .addElement('B', ofBlock(sBlockCasingsBA0, 7)) .addElement('C', ofBlock(sBlockCasingsBA0, 8)) -- cgit From 7c53dac7767c6d8042caedfa046c59ef5c75fa07 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 23:19:46 -0700 Subject: removed commented code --- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 19 ----- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 20 ------ .../multi/GT_MetaTileEntity_EM_annihilation.java | 27 ------- .../multi/GT_MetaTileEntity_EM_bhg.java | 84 ---------------------- .../multi/GT_MetaTileEntity_EM_collider.java | 44 ------------ .../multi/GT_MetaTileEntity_EM_computer.java | 24 ------- .../multi/GT_MetaTileEntity_EM_crafting.java | 25 ------- .../multi/GT_MetaTileEntity_EM_dataBank.java | 17 ----- .../multi/GT_MetaTileEntity_EM_decay.java | 22 ------ .../multi/GT_MetaTileEntity_EM_dequantizer.java | 18 ----- .../multi/GT_MetaTileEntity_EM_infuser.java | 16 ----- .../multi/GT_MetaTileEntity_EM_junction.java | 26 ------- .../multi/GT_MetaTileEntity_EM_quantizer.java | 19 ----- .../multi/GT_MetaTileEntity_EM_research.java | 26 ------- .../multi/GT_MetaTileEntity_EM_scanner.java | 24 ------- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 19 ----- .../multi/GT_MetaTileEntity_EM_switch.java | 16 ----- .../multi/GT_MetaTileEntity_EM_wormhole.java | 25 ------- .../multi/GT_MetaTileEntity_TM_microwave.java | 19 ----- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 28 -------- .../em_machine/GT_MetaTileEntity_EM_machine.java | 20 ------ 21 files changed, 538 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index abe8900ac7..d77502fcc3 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -71,23 +71,6 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) .build(); -// private static final String[][] shape = new String[][]{ -// {" ", " . ", " ",}, -// {"0A0", E, "0A0",}, -// {"121", "232", "121",}, -// {"\"\"\"", "\"2\"", "\"\"\"",}, -// {"202", "0!0", "202",}, -// }; -// private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, -// GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, -// GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; - //endregion public GT_MetaTileEntity_EM_essentiaDequantizer(int aID, String aName, String aNameRegional) { @@ -105,7 +88,6 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); } @@ -168,7 +150,6 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index d900ec8c30..332f162025 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -70,24 +70,6 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) .build(); - -// private static final String[][] shape = new String[][]{ -// {" ", " . ", " ",}, -// {"0A0", E, "0A0",}, -// {"121", "232", "121",}, -// {"\"\"\"", "\"1\"", "\"\"\"",}, -// {"010", "1!1", "010",}, -// }; -// private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, -// GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, -// GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; - //endregion public GT_MetaTileEntity_EM_essentiaQuantizer(int aID, String aName, String aNameRegional) { @@ -105,7 +87,6 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); } @@ -172,7 +153,6 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index e7cd3948ef..4510294f63 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -65,31 +65,6 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); - - /* - private static final String[][] shape = new String[][]{ - {"\u0002", "D000", "C0 0", "C0 . 0", "C0 0", "D000"}, - {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, - {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, - {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, - {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, - {"00C!C00", "02444544420", "A4G4", "A4G4", "A4G4", "!5G5!", "A4G4", "A4G4", "A4G4", "02444544420", "00C!C00",}, - {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, - {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, - {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, - {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, - {"\u0002", "D000", "C0 0", "C0 0", "C0 0", "D000"}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10}; - private static final IGT_HatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, - GT_MetaTileEntity_EM_annihilation::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; - */ - //endregion public GT_MetaTileEntity_EM_annihilation(int aID, String aName, String aNameRegional) { @@ -107,7 +82,6 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); return structureCheck_EM("main", 5, 5, 0); } @@ -138,7 +112,6 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 5, 5, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 4cc21ffc72..0ed2b38c19 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -132,90 +132,6 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); -// private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition -// .builder() -// .addShape("t1",new String[][]{ -// {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, -// {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, -// {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, -// {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, -// {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, -// {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, -// {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, -// {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, -// {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, -// {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, -// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, -// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, -// {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, -// {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, -// {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, -// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, -// {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, -// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, -// {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, -// {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, -// {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, -// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, -// {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, -// {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, -// {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, -// {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, -// {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, -// {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, -// {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, -// {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, -// {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, -// {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, -// {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, -// }) -// .addShape("t2",new String[][]{ -// {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, -// {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, -// {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, -// {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, -// {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, -// {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, -// {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, -// {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, -// {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, -// {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, -// {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, -// {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, -// {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, -// {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, -// {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, -// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, -// {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, -// {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, -// {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, -// {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, -// {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, -// {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, -// {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, -// {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, -// {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, -// {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, -// {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, -// {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, -// {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, -// {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, -// {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, -// {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, -// {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, -// }) -// .addElement('0', ofBlock(sBlockCasingsTT,12)) -// .addElement('1', ofBlock(sBlockCasingsTT,13)) -// .addElement('2', ofBlock(sBlockCasingsTT,14)) -// .addElement('3', ofBlock(sBlockCasingsTT,10)) -// .addElement('4', ofBlock(sBlockCasingsTT,11)) -// .addElement('5', ofBlock(QuantumGlassBlock.INSTANCE,0)) -// .addElement(' ', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, -// textureOffset,1,sBlockCasingsTT,0)) -// .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, -// textureOffset + 4,2,sBlockCasingsTT,4)) -// .build(); - @Override public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 10619522d6..49c43d6b4e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -331,50 +331,6 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB .addElement('J', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); -// private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition -// .builder() -// .addShape("main", new String[][]{ -// {"I0A0A0", "I00000", "I0A0A0",}, -// {"H0000000", "G001111100", "H0000000",}, -// {"F22223332222", "F41155555114", "F22223332222",}, -// {"E2000000000002", "E4155111115514", "E2000000000002",}, -// {"D20000E00002", "D41511E11514", "D20000E00002",}, -// {"C2000I0002", "C4151I1514", "C2000I0002",}, -// {"B2000K0002", "B4151K1514", "B2000K0002",}, -// {"B200M002", "A0151M1510", "B200M002",}, -// {"A0200M0020", "A0151M1510", "A0200M0020",}, -// {"0020O0200", "0151O1510", "0020O0200",}, -// {"A030O030", "0151O1510", "A030O030",}, -// {"0030O0300", "0151O1510", "0030O0300",}, -// {"A030O030", "0151O1510", "A030O030",}, -// {"0020O0200", "0151O1510", "0020O0200",}, -// {"A0200M0020", "A0151M1510", "A0200M0020",}, -// {"B200M002", "A0151M1510", "B200M002",}, -// {"B2000K0002", "B4151K1514", "B2000K0002",}, -// {"C2000I0002", "C4151I1514", "C2000I0002",}, -// {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, -// {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, -// {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, -// }) -// .addElement('0', ofBlock(sBlockCasingsTT, 4)) -// .addElement('1', ofBlock(sBlockCasingsTT, 7)) -// .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), -// error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) -// .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) -// .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), -// error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) -// .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), -// error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) -// .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, -// textureOffset, 1, sBlockCasingsTT, 0)) -// .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, -// textureOffset + 4, 2, sBlockCasingsTT, 4)) -// .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, -// textureOffset + 4, 3, sBlockCasingsTT, 4)) -// .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, -// textureOffset + 4, 4, sBlockCasingsTT, 4)) -// .build(); - @Override public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; 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 51779d7f28..16167b74a2 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 @@ -94,20 +94,6 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB .addElement('D', ofBlock(sBlockCasingsTT, 3)) .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addRackToMachineList, textureOffset + 3, 2, sBlockCasingsTT, 3)) .build(); - -// private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; -// private static final String[][] terminator = new String[][]{{"A ", "A ", "A ", "A ",},}; -// private static final String[][] cap = new String[][]{{"-01", "A22", "A22", "-01",},}; -// private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},}; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{2, 1, 3}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_computer::addToMachineList, -// GT_MetaTileEntity_EM_computer::addRackToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{1, 3}; - //endregion //region parameters @@ -169,17 +155,14 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } } eRacks.clear(); - //if (!structureCheck_EM(front, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0)) { if (!structureCheck_EM("front", 1, 2, 0)) { return false; } - //if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, -1)) { if (!structureCheck_EM("cap", 1, 2, -1)) { return false; } byte offset = -2, totalLen = 4; while (offset > -16) { - //if (!structureCheck_EM(slice, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, offset)) { if (!structureCheck_EM("slice", 1, 2, offset)) { break; } @@ -189,11 +172,9 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB if (totalLen > 17) { return false; } - //if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { if (!structureCheck_EM("cap", 1, 2, ++offset)) { return false; } - //if (!structureCheck_EM(terminator, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, --offset)) { if (!structureCheck_EM("back", 1, 2, --offset)) { return false; } @@ -407,20 +388,15 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity igt = getBaseMetaTileEntity(); - //Structure.builder(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); structureBuild_EM("front", 1, 2, 0, hintsOnly, stackSize); - //Structure.builder(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); structureBuild_EM("cap", 1, 2, -1, hintsOnly, stackSize); byte offset = -2; for (int rackSlices = Math.min(stackSize.stackSize, 12); rackSlices > 0; rackSlices--) { - //Structure.builder(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); structureBuild_EM("slice", 1 , 2, offset--, hintsOnly, stackSize); } - //Structure.builder(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); structureBuild_EM("cap", 1, 2, offset--, hintsOnly, stackSize); - //Structure.builder(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); structureBuild_EM("back", 1, 2, offset, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index f6584d8d27..ad72a069a9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -64,29 +64,6 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); - -// private static final String[][] shape = new String[][]{ -// {"A000", "0 0", "0 . 0", "0 0", "A000",}, -// {"00000", "00000", "00000", "00000", "00000",}, -// {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, -// {"22222", "22222", "22122", "22222", "22222",}, -// {"23432", "33333", "43134", "33333", "23432",}, -// {"23332", "33333", "33533", "33333", "23332",}, -// {"23432", "33333", "43134", "33333", "23432",}, -// {"22222", "22222", "22122", "22222", "22222",}, -// {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, -// {"00000", "00000", "00000", "00000", "00000",}, -// {"A000", "0 0", "0 0", "0 0", "A000",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_crafting::addClassicToMachineList, -// GT_MetaTileEntity_EM_crafting::addElementalToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4}; - //endregion public GT_MetaTileEntity_EM_crafting(int aID, String aName, String aNameRegional) { @@ -104,7 +81,6 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); return structureCheck_EM("main", 2, 2, 0); } @@ -135,7 +111,6 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index dc78b264b3..54d936fe0c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -66,21 +66,6 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList, textureOffset + 1, 2, sBlockCasingsTT, 1)) .build(); - -// private static final String[][] shape = new String[][]{ -// {"0 0", "0 . 0", "0 0",}, -// {"0!!!0", "01110", "0!!!0",}, -// {"0!!!0", "0!!!0", "0!!!0",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{2, 1}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, -// GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 1}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 1}; - //endregion public GT_MetaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { @@ -100,7 +85,6 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { eDataAccessHatches.clear(); eStacksDataOutputs.clear(); - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 1, 0); return structureCheck_EM("main", 2, 1, 0); } @@ -195,7 +179,6 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 2, 1, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index acffd600c1..62187f750d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -85,26 +85,6 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); -// private static final String[][] shape = new String[][]{ -// {"0C0", "A ", "A . ", "A ", "0C0",}, -// {"00000", "00000", "00000", "00000", "00000",}, -// {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, -// {"01110", "12221", "12221", "12221", "01110",}, -// {"01310", "12221", "32223", "12221", "01310",}, -// {"01110", "12221", "12221", "12221", "01110",}, -// {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, -// {"00000", "00000", "00000", "00000", "00000",}, -// {"0C0", "A ", "A ", "A ", "0C0",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_decay::addClassicToMachineList, -// GT_MetaTileEntity_EM_decay::addElementalToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4}; - //endregion //region parameters @@ -133,7 +113,6 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); return structureCheck_EM("main", 2, 2, 0); } @@ -272,7 +251,6 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index d45e8d7e7f..74ff85c698 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -68,22 +68,6 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.1"),//2 - Elemental Input Hatch translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing }; - -// private static final String[][] shape = new String[][]{ -// {" ", " . ", " ",}, -// {"010", "111", "010",}, -// {"\"\"\"", "\"1\"", "\"\"\"",}, -// {"121", "2!2", "121",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; -// private static final byte[] blockMeta = new byte[]{0, 4, 0}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, -// GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, -// GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; //endregion public GT_MetaTileEntity_EM_dequantizer(int aID, String aName, String aNameRegional) { @@ -114,7 +98,6 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); return structureCheck_EM("main", 1, 1, 0); } @@ -178,7 +161,6 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index e18c4596bf..ec9cbcdb13 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -57,20 +57,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa .addElement('B', ofBlock(sBlockCasingsTT, 7)) .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_infuser::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); - -// private static final String[][] shape = new String[][]{ -// {" ", "000", "1.1", "000", " ",}, -// {" ", "010", "111", "010", " ",}, -// {" ", "000", "111", "000", " ",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{7, 4}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_infuser::addClassicToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0}; - //endregion public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { @@ -134,7 +120,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0); return structureCheck_EM("main", 1, 2, 0); } @@ -206,7 +191,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 1, 2, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 67667f0e1a..3860f25701 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -62,29 +62,6 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); - -// private static final String[][] shape = new String[][]{ -// {" ", " . ", " ",}, -// {"000", "000", "000",}, -// {"!!!", "!0!", "!!!",}, -// {"!!!", "!!!", "!!!",}, -// }; -// private static final String[][] shapeBig = new String[][]{ -// {E, "A ", "A . ", "A ",}, -// {"A!!!", "!000!", "!010!", "!000!", "A!!!",}, -// {"!!!!!", "!000!", "!000!", "!000!", "!!!!!",}, -// {"A!!!", "!000!", "!000!", "!000!", "A!!!",}, -// {"A!!!", "!!!!!", "!!!!!", "!!!!!", "A!!!",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{4, 5}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_junction::addClassicToMachineList, -// GT_MetaTileEntity_EM_junction::addElementalToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4}; - //endregion //region parameters @@ -134,10 +111,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { int meta = iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); if (meta == 4) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); return structureCheck_EM("main", 1, 1, 0); } else if (meta == 5) { - //return structureCheck_EM(shapeBig, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); return structureCheck_EM("mainBig", 2, 2, 0); } return false; @@ -207,7 +182,6 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder((stackSize.stackSize & 1) == 1 ? shape : shapeBig, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); if ((stackSize.stackSize & 1) == 1) { structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } else { 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 d4e5ed9d59..62e3aca008 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 @@ -75,23 +75,6 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.1"),//2 - Elemental Output Hatch translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing }; - -// private static final String[][] shape = new String[][]{ -// {" ", " . ", " ",}, -// {"010", "101", "010",}, -// {"\"\"\"", "\"0\"", "\"\"\"",}, -// {"202", "0!0", "202",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; -// private static final byte[] blockMeta = new byte[]{4, 0, 0}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, -// GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, -// GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; - //endregion public GT_MetaTileEntity_EM_quantizer(int aID, String aName, String aNameRegional) { @@ -109,7 +92,6 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); return structureCheck_EM("main", 1, 1, 0); } @@ -222,7 +204,6 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index c8d6f23ae3..959004bba4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -95,25 +95,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1,1, sBlockCasingsTT,1)) .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 2)) .build(); - -// private static final String[][] shape = new String[][]{ -// {E, "000", E, E, E, "000"/*,E,*/}, -// {"A0", "010", "A1", "A!", "A1", "010", "A0",}, -// {"A0", "010", E, E, E, "010", "A0",}, -// {"000", "010", E, E, E, "010", "000",}, -// {"000", "212", "010", "0.0", "010", "212", "000",}, -// {"000", "212", "111", "111", "111", "212", "000",}, -// {"000", "222", " ", " ", " ", "222", "000",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{1, 3, 2}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_research::addClassicToMachineList, -// GT_MetaTileEntity_EM_research::addHolderToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; -// private static final byte[] blockMetaFallback = new byte[]{1, 0}; - //endregion public GT_MetaTileEntity_EM_research(int aID, String aName, String aNameRegional) { @@ -290,12 +271,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB return false; } - /* - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 3, 4)) { - return false; - } - */ - for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); @@ -589,7 +564,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 1, 3, 4, hintsOnly, stackSize); } 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 80f65a55ba..8466069d99 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 @@ -98,28 +98,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, textureOffset + 4, 2)) .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, textureOffset + 4, 3)) .build(); - -// private static final String[][] shape = new String[][]{ -// {" ", " 222 ", " 2.2 ", " 222 ", " ",}, -// {"00000", "00000", "00000", "00000", "00000",}, -// {"00100", "01110", "11111", "01110", "00100",}, -// {"01110", "1---1", "1---1", "1---1", "01110",}, -// {"01110", "1---1", "1-A-1", "1---1", "01110",}, -// {"01110", "1---1", "1---1", "1---1", "01110",}, -// {"00100", "01110", "11\"11", "01110", "00100",}, -// {"#####", "#000#", "#0!0#", "#000#", "#####",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{4, 0, 0}; -// private static final IHatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_scanner::addClassicToMachineList, -// GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, -// GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, -// GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; - //endregion //region parameters @@ -236,7 +214,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { -// if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { if (!structureCheck_EM("main", 2, 2, 0)) { return false; } @@ -544,7 +521,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 573c1ef4e9..0569d7533e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -50,23 +50,6 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); - -// private static final String[][] shape = new String[][]{ -// {"A010", "0 0", "1 . 1", "0 0", "A010",}, -// {"23232", "32223", "22222", "32223", "23232",}, -// {"12!21", "22422", "!444!", "22422", "12!21",}, -// {"23232", "32223", "22222", "32223", "23232",}, -// {"A010", "0 0", "1 1", "0 0", "A010",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, -// GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4}; - //endregion public GT_MetaTileEntity_EM_stabilizer(int aID, String aName, String aNameRegional) { @@ -84,7 +67,6 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); return structureCheck_EM("main", 2, 2, 0); } @@ -99,7 +81,6 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 8e68ca944b..19ec588bc5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -57,20 +57,6 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas .addElement('A', ofBlock(sBlockCasingsTT, 3)) .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_EM_switch::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) .build(); - -// private static final String[][] shape = new String[][]{ -// {" ", " . ", " ",}, -// {" ", " 0 ", " ",}, -// {" ", " ", " ",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{3}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_switch::addClassicToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset + 1}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{1}; - //endregion //region parameters @@ -116,7 +102,6 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); return structureCheck_EM("main", 1, 1, 0); } @@ -244,7 +229,6 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //StructureUtility.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 29956c962f..0b74d36c78 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -66,29 +66,6 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); - -// private static final String[][] shape = new String[][]{ -// {E, E, E, "C ", "C . ", "C "/*,E,E,E,*/}, -// {E, E, "D0", "C000", "B00100", "C000", "D0"/*,E,E,*/}, -// {E, E, "D0", "C2A2", "B0C0", "C2A2", "D0"/*,E,E,*/}, -// {E, "D0", "D0", E, "A00C00", E, "D0", "D0"/*,E,*/}, -// {E, "D0", E, E, "A0E0", E, E, "D0"/*,E,*/}, -// {"D0", "D0", E, E, "00E00", E, E, "D0", "D0",}, -// {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, -// {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, -// {"B0!!!0", "A 31113 ", "031444130", "!14C41!", "!14C41!", "!14C41!", "031444130", "A 31113 ", "B0!!!0",}, -// {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, -// {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, -// GT_MetaTileEntity_EM_wormhole::addElementalToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4}; - //endregion public GT_MetaTileEntity_EM_wormhole(int aID, String aName, String aNameRegional) { @@ -106,7 +83,6 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 4, 4, 0); return structureCheck_EM("main", 4, 4, 0); } @@ -137,7 +113,6 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 4, 4, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index e5ec4b9983..1dfbc7c1d4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -65,23 +65,6 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock .addElement('A', ofBlock(sBlockCasings4, 1)) .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_TM_microwave::addClassicToMachineList, 49, 1, sBlockCasings4, 1)) .build(); - -// private static final String[][] shape = new String[][]{ -// {"00000", "00000", "00.00", "0 0",}, -// {"0---0", "0---0", "0---0", " 000 ",}, -// {"0---0", "0---0", "0---0", " 000 ",}, -// {"0---0", "0---0", "0---0", " 000 ",}, -// {"00000", "00000", "00000", "0 0",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasings4}; -// private static final byte[] blockMeta = new byte[]{1}; -// -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_TM_microwave::addClassicToMachineList); -// private static final short[] casingTextures = new short[]{49}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; -// private static final byte[] blockMetaFallback = new byte[]{1}; - //endregion //region parameters @@ -119,7 +102,6 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); return structureCheck_EM("main", 2, 2, 0); } @@ -268,7 +250,6 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index eeb89f6812..19701b69b3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -145,32 +145,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); return this.getBaseMetaTileEntity().getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); } - -// private static final String[][] shape = new String[][]{//3 16 0 -// {"\u000F", "A . ",}, -// {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, -// {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, -// {"B000", "A00000", "A00000", "A00000", "B030", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "C3", "A1A3A1", " 21212 ",}, -// {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, -// {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, -// {"\u000F", "A ",}, -// }; -// private static final Block[] blockType = new Block[]{sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0}; -// private static final byte[] blockMetaT0 = new byte[]{7, 0, 6, 8}; -// private static final byte[] blockMetaT1 = new byte[]{7, 1, 6, 8}; -// private static final byte[] blockMetaT2 = new byte[]{7, 2, 6, 8}; -// private static final byte[] blockMetaT3 = new byte[]{7, 3, 6, 8}; -// private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8}; -// private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8}; -// private static final byte[] blockMetaT6 = new byte[]{7, 9, 6, 8}; -// private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5, blockMetaT6}; -// private static final IGT_HatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, -// GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList); -// private static final short[] casingTextures = new short[]{(texturePage << 7) + 16 + 6, 0}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsBA0, null}; -// private static final byte[] blockMetaFallback = new byte[]{6, 0}; - //endregion //region parameters @@ -390,7 +364,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock mTier = 6; }//Hacky remap because the ZPM coils were added later - //if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { if (structureCheck_EM("main", 3, 16, 0)) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { @@ -734,7 +707,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 7], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 3, 16, 0, hintsOnly, stackSize); } 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 85ac8c1623..5ae2d05b14 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 @@ -68,24 +68,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); - -// private static final String[][] shape = new String[][]{ -// {"B0", "A ", "0 - 0", "A ", "B0",}, -// {"A000", "00000", "00.00", "00000", "A000",}, -// {"A121", "1---1", "2---2", "1---1", "A121",}, -// {"A131", "1---1", "3-A-3", "1---1", "A131",}, -// {"A121", "1---1", "2---2", "1---1", "A121",}, -// {"A000", "00000", "00-00", "00000", "A000",}, -// {"B0", "A!!!", "0!!!0", "A!!!", "B0",},}; -// private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; -// private static final IHatchAdder[] addingMethods = adders( -// GT_MetaTileEntity_EM_machine::addClassicToMachineList, -// GT_MetaTileEntity_EM_machine::addElementalToMachineList); -// private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; -// private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; -// private static final byte[] blockMetaFallback = new byte[]{0, 4}; - //endregion //region parameters @@ -215,7 +197,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); return structureCheck_EM("main", 2, 2, 1); } @@ -380,7 +361,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - //Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); structureBuild_EM("main", 2, 2, 1, hintsOnly, stackSize); } -- cgit From 9763950732e7f4e73f19eb2744405d7a6a3e9073 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 9 Sep 2021 23:21:23 -0700 Subject: optimized imports --- .../multi/GT_MetaTileEntity_EM_essentiaDequantizer.java | 7 ------- .../multi/GT_MetaTileEntity_EM_essentiaQuantizer.java | 7 ------- .../multi/GT_MetaTileEntity_EM_annihilation.java | 5 ++--- .../metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java | 1 - .../multi/GT_MetaTileEntity_EM_computer.java | 4 ---- .../multi/GT_MetaTileEntity_EM_crafting.java | 3 --- .../multi/GT_MetaTileEntity_EM_dataBank.java | 4 ---- .../metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java | 4 ---- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 10 ++++------ .../multi/GT_MetaTileEntity_EM_infuser.java | 3 --- .../multi/GT_MetaTileEntity_EM_junction.java | 6 ------ .../multi/GT_MetaTileEntity_EM_quantizer.java | 3 --- .../multi/GT_MetaTileEntity_EM_research.java | 8 ++------ .../multi/GT_MetaTileEntity_EM_scanner.java | 1 - .../multi/GT_MetaTileEntity_EM_stabilizer.java | 4 ---- .../metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java | 3 --- .../multi/GT_MetaTileEntity_EM_transformer.java | 4 ++-- .../multi/GT_MetaTileEntity_EM_wormhole.java | 4 ---- .../multi/GT_MetaTileEntity_TM_microwave.java | 3 --- .../multi/GT_MetaTileEntity_TM_proccessingStack.java | 15 --------------- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 8 +------- .../multi/em_machine/GT_MetaTileEntity_EM_machine.java | 4 ---- 22 files changed, 11 insertions(+), 100 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index d77502fcc3..8e8aee4795 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -4,11 +4,8 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_dequantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; @@ -19,8 +16,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -29,12 +24,10 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 332f162025..1e23408a0b 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -4,8 +4,6 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; @@ -18,8 +16,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -28,13 +24,10 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsNH; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 4510294f63..05829c89e4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -20,9 +20,8 @@ import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 0ed2b38c19..448c930351 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -24,7 +24,6 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_MASS_TO_EU_INSTANT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; 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 16167b74a2..31d41fb39e 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 @@ -22,8 +22,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -31,10 +29,8 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsNH; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index ad72a069a9..9c631c8af6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -13,13 +13,10 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 54d936fe0c..bea2b8a0ba 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -20,8 +20,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -29,7 +27,6 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.GT_Block_CasingsTT.texturePage; @@ -37,7 +34,6 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 62187f750d..b3a8e52bbf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -21,10 +21,8 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.util.IGT_HatchAdder; import ic2.core.init.MainConfig; import ic2.core.util.ConfigUtil; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -33,8 +31,6 @@ import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; -import static com.github.technus.tectech.mechanics.structure.Structure.builder; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 74ff85c698..f0dca07f9c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -7,7 +7,6 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; @@ -18,8 +17,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -31,11 +28,12 @@ import java.util.ArrayList; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.*; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index ec9cbcdb13..18416e70f6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -14,10 +14,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -25,7 +23,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 3860f25701..53cf072293 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -11,22 +10,17 @@ import com.github.technus.tectech.util.CommonValues; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureUtility; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; 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 62e3aca008..5b6b2c18e7 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 @@ -20,8 +20,6 @@ import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -35,7 +33,6 @@ import static com.github.technus.tectech.mechanics.elementalMatter.core.template import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 959004bba4..9f3068aca8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -22,11 +22,8 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockB import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -37,7 +34,6 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; import java.util.LinkedHashMap; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -46,8 +42,8 @@ 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.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; 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 8466069d99..20f4fd5d28 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 @@ -36,7 +36,6 @@ import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 0569d7533e..0ff238e4c3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -2,19 +2,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.util.CommonValues; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 19ec588bc5..1ca125977d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -20,13 +20,10 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index ea3d79443a..b2f7da7bc3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -20,13 +20,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.GregTech_API.sBlockCasings1; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static net.minecraft.util.StatCollector.translateToLocal; /** diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 0b74d36c78..7b85d3406a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -13,19 +13,15 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 1dfbc7c1d4..b99ed26f5b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -14,8 +14,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -28,7 +26,6 @@ import java.util.ArrayList; import java.util.HashSet; import static com.github.technus.tectech.loader.MainLoader.microwaving; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 2d64e608c5..3a1a5a5418 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,25 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import static com.github.technus.tectech.mechanics.structure.Structure.adders; -import static gregtech.api.GregTech_API.sBlockCasings4; -import static net.minecraft.util.StatCollector.translateToLocal; @Deprecated public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 19701b69b3..a1e871adf4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -29,21 +29,16 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.implementations.*; -import gregtech.api.util.IGT_HatchAdder; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.HashSet; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -51,10 +46,9 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.enums.GT_Values.E; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static java.lang.Math.*; +import static java.lang.Math.min; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { 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 5ae2d05b14..a43bf2b128 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 @@ -3,11 +3,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_computer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Util; @@ -26,7 +23,6 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; -- cgit From 838021277e8a585975ce3f602997ce238ad744d9 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 10 Sep 2021 05:26:15 -0700 Subject: made requested changes --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index a1e871adf4..c8e7f90675 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -46,8 +46,7 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static gregtech.api.util.GT_StructureUtility.*; import static java.lang.Math.min; import static net.minecraft.util.StatCollector.translateToLocal; @@ -130,9 +129,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock .addElement('A', ofBlock(sBlockCasingsBA0, 6)) .addElement('B', ofBlock(sBlockCasingsBA0, 7)) .addElement('C', ofBlock(sBlockCasingsBA0, 8)) - .addElement('D', lazy(t -> ofBlock(sBlockCasingsBA0, t.getCoilWindingMeta()))) + .addElement('D', defer(t -> ofBlock(sBlockCasingsBA0, t.getCoilWindingMeta()))) .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, textureOffset + 16 + 6, 1, sBlockCasingsBA0, 6)) - .addElement('F', ofHatchAdder(GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList, 0, 2)) + .addElement('F', ofFrame(Materials.get("Titanium"))) .build(); public int getCoilWindingMeta() { -- cgit From 32165c5d1aaf731044bc3ab4f87746d430ed70a5 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 10 Sep 2021 05:37:49 -0700 Subject: made requested changes --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index c8e7f90675..cbc20143b3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -102,7 +102,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.0"),//1 - Classic Hatches, Capacitor Hatches or Tesla Base Casing - translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.1"),//2 - Titanium Frames }; private static final IStructureDefinition STRUCTURE_DEFINITION = -- cgit From dd9b39c21339b591724a44c68c8b0c68fe1cafbe Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 10 Sep 2021 13:17:08 -0700 Subject: tesla tower will accept any frame again --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index cbc20143b3..0778feb1fd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -46,7 +46,8 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.util.GT_StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static java.lang.Math.min; import static net.minecraft.util.StatCollector.translateToLocal; @@ -102,6 +103,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.0"),//1 - Classic Hatches, Capacitor Hatches or Tesla Base Casing + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.1"),//2 - Titanium Frames }; private static final IStructureDefinition STRUCTURE_DEFINITION = @@ -130,7 +132,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock .addElement('C', ofBlock(sBlockCasingsBA0, 8)) .addElement('D', defer(t -> ofBlock(sBlockCasingsBA0, t.getCoilWindingMeta()))) .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, textureOffset + 16 + 6, 1, sBlockCasingsBA0, 6)) - .addElement('F', ofFrame(Materials.get("Titanium"))) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList, 0, 2)) .build(); public int getCoilWindingMeta() { -- cgit From 08b8723025ea530d929cfad738e659b13d7f2f91 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 10 Sep 2021 13:24:55 -0700 Subject: updated adders method --- .../java/com/github/technus/tectech/mechanics/structure/Structure.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java index b37ae0bbda..44cad98791 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -22,7 +22,7 @@ public class Structure { @Deprecated @SafeVarargs - public static IHatchAdder[] adders(IHatchAdder... iHatchAdder) { + public static IGT_HatchAdder[] adders(IGT_HatchAdder... iHatchAdder) { return iHatchAdder; } -- cgit From 68923e9a5468506b9cfcfb7da4ca4078a6fe6229 Mon Sep 17 00:00:00 2001 From: GlodBlock <60341015+GlodBlock@users.noreply.github.com> Date: Sat, 18 Sep 2021 16:03:34 +0800 Subject: fix `NoClassDefFoundError` spam --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/main') 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 49d5eaf2f3..5e56f531bf 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 @@ -2,22 +2,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.structure.Structure; import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.AlignmentMessage; import com.gtnewhorizon.structurelib.alignment.IAlignment; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; -import com.gtnewhorizon.structurelib.structure.StructureUtility; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.common.network.NetworkRegistry; -import gregtech.api.util.GT_StructureUtility; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; @@ -1105,7 +1101,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { isFacingValid(aBaseMetaTileEntity.getFrontFacing()); if (getBaseMetaTileEntity().isClientSide()) { - NetworkDispatcher.INSTANCE.sendToServer(new AlignmentMessage.AlignmentQuery(this)); + StructureLibAPI.sendAlignment((IAlignmentProvider) aBaseMetaTileEntity, + new NetworkRegistry.TargetPoint(aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), 512)); } onFirstTick_EM(aBaseMetaTileEntity); } -- cgit From 9512c2657c73a24c0ce7caf5e78f2318d160892c Mon Sep 17 00:00:00 2001 From: GlodBlock <60341015+GlodBlock@users.noreply.github.com> Date: Sat, 18 Sep 2021 17:49:07 +0800 Subject: change as requested --- .../multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/main') 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 5e56f531bf..a0755b947b 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 @@ -48,8 +48,6 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import static gregtech.api.util.GT_StructureUtility.*; - 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.*; @@ -1101,9 +1099,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { isFacingValid(aBaseMetaTileEntity.getFrontFacing()); if (getBaseMetaTileEntity().isClientSide()) { - StructureLibAPI.sendAlignment((IAlignmentProvider) aBaseMetaTileEntity, - new NetworkRegistry.TargetPoint(aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), 512)); + StructureLibAPI.queryAlignment((IAlignmentProvider) aBaseMetaTileEntity); } onFirstTick_EM(aBaseMetaTileEntity); } -- cgit From 8c882a8d5d6ff47ebe72345ebfd3e8759eb88a3f Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Mon, 20 Sep 2021 19:13:41 -0400 Subject: Fixes silicone --- .../dreamcraft/DreamCraftRecipeLoader.java | 28 ++++++++-------------- 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b679d3cff8..ef15a9d55b 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -711,7 +711,7 @@ public class DreamCraftRecipeLoader implements Runnable { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), }, CustomItemList.Machine_Multi_Infuser.get(1), 8000, 2000000); - //Motor UV-UHV + //Motor UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Motor_UV.get(1L), 24000, 32, 100000, 4, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.SamariumMagnetic, 4L), @@ -750,7 +750,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Motor_UEV.get(1L), 2000, 800000); - //Pumps UV-UHV + //Pumps UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Pump_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(1L), @@ -777,7 +777,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Pump_UEV.get(1), 2000, 800000); - //Conveyor Belt UV-UHV + //Conveyor Belt UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Conveyor_Module_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(2L), @@ -801,10 +801,9 @@ public class DreamCraftRecipeLoader implements Runnable { new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 16L}}, new FluidStack[]{ Materials.Quantium.getMolten(2592), Materials.SolderingAlloy.getMolten(5184), - Materials.Lubricant.getFluid(8000), - Materials.Silicone.getMolten(11520)}, ItemList.Conveyor_Module_UEV.get(1), 2000, 800000); + Materials.Lubricant.getFluid(8000)}, ItemList.Conveyor_Module_UEV.get(1), 2000, 800000); - //Piston UV-UHV + //Piston UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Piston_UV.get(1L), 24000, 32, 100000, 4, new ItemStack[]{ ItemList.Electric_Motor_UHV.get(1L), @@ -833,7 +832,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Piston_UEV.get(1), 2000, 800000); - //Robot Arm UV-UHV + //Robot Arm UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Robot_Arm_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.CosmicNeutronium, 8L), @@ -864,7 +863,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216), Materials.Lubricant.getFluid(8000)}, ItemList.Robot_Arm_UEV.get(1L), 2000, 800000); - //Emitter UV-UHV + //Emitter UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Emitter_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -897,7 +896,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Emitter_UEV.get(1L), 2000, 800000); - //Sensor UV-UHV + //Sensor UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Sensor_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -930,7 +929,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Sensor_UEV.get(1L), 2000, 800000); - //Fieldgen UV and UHV + //Fieldgen UHV and UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Field_Generator_UV.get(1), 48000, 64, 200000, 8, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -973,7 +972,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Field_Generator_UEV.get(1L), 4000, 800000); - //UHV Energy Hatch & Dynamo + //UHV-UMV Energy Hatch & Dynamo TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_UV.get(1L), 24000, 16, 50000, 2, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -995,7 +994,6 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5760), }, ItemList.Hatch_Energy_MAX.get(1L), 1000, 2000000); - //UHV Dynamo Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_UV.get(1L), 48000, 32, 100000, 4, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -1017,7 +1015,6 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5760)}, ItemList.Hatch_Dynamo_MAX.get(1L), 1000, 2000000); - //UEV Energy Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_MAX.get(1L), 48000, 32, 100000, 4, new Object[]{ getItemContainer("Hull_UEV").get(1L), @@ -1035,7 +1032,6 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.UUMatter.getFluid(8000L)}, getItemContainer("Hatch_Energy_UEV").get(1L), 1000, 8000000); - //UEV Dynamo Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_MAX.get(1L), 96000, 64, 200000, 8, new Object[]{ getItemContainer("Hull_UEV").get(1L), @@ -1053,7 +1049,6 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.UUMatter.getFluid(8000L)}, getItemContainer("Hatch_Dynamo_UEV").get(1L), 1000, 8000000); - //UIV Energy Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UEV").get(1L), 96000, 64, 200000, 8, new Object[]{ getItemContainer("Hull_UIV").get(1L), @@ -1074,7 +1069,6 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.UUMatter.getFluid(16000L)}, getItemContainer("Hatch_Energy_UIV").get(1L), 1000, 16000000); - //UIV Dynamo Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UEV").get(1L), 192000, 128, 400000, 16, new Object[]{ getItemContainer("Hull_UIV").get(1L), @@ -1095,7 +1089,6 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.UUMatter.getFluid(16000L)}, getItemContainer("Hatch_Dynamo_UIV").get(1L), 1000, 16000000); - //UMV Energy Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UIV").get(1L), 192000, 128, 400000, 16, new Object[]{ getItemContainer("Hull_UMV").get(1L), @@ -1119,7 +1112,6 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.UUMatter.getFluid(32000L)}, getItemContainer("Hatch_Energy_UMV").get(1L), 1000, 32000000); - //UMV Dynamo Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UIV").get(1L), 384000, 256, 800000, 32, new Object[]{ getItemContainer("Hull_UMV").get(1L), -- cgit From 4e776b2f63e22c6f65f39972d34f9928615c440c Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Wed, 13 Oct 2021 17:58:30 +0000 Subject: Fix UXV Multi Amp Dynamo Hatch Names --- src/main/resources/assets/tectech/lang/en_US.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 668f010410..adec911faa 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -313,9 +313,9 @@ gt.blockmachines.hatch.dynamomulti64.tier.11.name=UIV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti04.tier.12.name=UMV 4A Dynamo Hatch gt.blockmachines.hatch.dynamomulti16.tier.12.name=UMV 16A Dynamo Hatch gt.blockmachines.hatch.dynamomulti64.tier.12.name=UMV 64A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti04.tier.13.name=IV 4A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti16.tier.13.name=IV 16A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti64.tier.13.name=IV 64A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti04.tier.13.name=UXV 4A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti16.tier.13.name=UXV 16A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti64.tier.13.name=UXV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti.desc.0=Multiple Ampere Energy Extractor for Multiblocks gt.blockmachines.hatch.dynamomulti.desc.1=Amperes Out -- cgit From fbe8484b9975e2b68285084936f91fb070c64d6d Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Mon, 18 Oct 2021 15:25:26 +0800 Subject: Fix cycle in class initialization order ExtendedFacing depends on IAlignment being fully initialized to be instantiated as part of its class initializer, which in turn require ExtendedFacing to be fully initialized to complete class initialization. How does this even work before? --- .../tectech/mechanics/alignment/enumerable/ExtendedFacing.java | 6 +++--- .../github/technus/tectech/mechanics/alignment/enumerable/Flip.java | 1 + .../technus/tectech/mechanics/alignment/enumerable/Rotation.java | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java index 04f2a55bd5..8e384e098c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -138,9 +138,9 @@ public enum ExtendedFacing { ExtendedFacing(String name) { this.name = name; - direction= Direction.VALUES[ordinal()/(ROTATIONS_COUNT*FLIPS_COUNT)].getForgeDirection(); - rotation=Rotation.VALUES[ordinal()/FLIPS_COUNT-direction.ordinal()*ROTATIONS_COUNT]; - flip=Flip.VALUES[ordinal()%FLIPS_COUNT]; + direction= Direction.VALUES[ordinal()/(Rotation.COUNT*Flip.COUNT)].getForgeDirection(); + rotation=Rotation.VALUES[ordinal()/Flip.COUNT-direction.ordinal()*Rotation.COUNT]; + flip=Flip.VALUES[ordinal()%Flip.COUNT]; ForgeDirection a,b,c; switch (direction){ case DOWN: diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java index 0b85c5197e..400f94f869 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java @@ -20,6 +20,7 @@ public enum Flip { private final String name; public static final Flip[] VALUES = values(); + public static final int COUNT = VALUES.length; private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(Flip::getName2, (flip) -> flip)); Flip(int oppositeIn, String nameIn) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java index b6cd1aa015..ed4872828a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java @@ -20,6 +20,7 @@ public enum Rotation { private final String name; public static final Rotation[] VALUES = values(); + public static final int COUNT = VALUES.length; private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(Rotation::getName2, (rotation) -> rotation)); Rotation(int oppositeIn, String nameIn) { -- cgit From 5a160bdd841a52007a9972f7f2a14eb108ec3ae1 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Mon, 18 Oct 2021 21:04:12 +0200 Subject: remove blueprint recipe. It has no use anymore use structurelib blueprint instead --- .../java/com/github/technus/tectech/loader/recipe/RecipeLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java index 5a153ce5f8..a2e2f65384 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java @@ -55,10 +55,10 @@ public class RecipeLoader implements Runnable { 'S', OrePrefixes.stick.get(Materials.Wood),}); //BLUEprint - GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), + /*GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); - + */ //GT EU reader GT_ModHandler.addCraftingRecipe(new ItemStack(EuMeterGT.INSTANCE,1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, -- cgit From 106ed318dad013382092ba05eed41c345be52651 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Mon, 18 Oct 2021 18:20:06 -0400 Subject: Change to make it divisible by 144 --- .../compatibility/dreamcraft/DreamCraftRecipeLoader.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index ef15a9d55b..ba72375f80 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -260,9 +260,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_dynamoMulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_dynamoMulti64_UEV.get(1), 400, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Dynamo_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_dynamoMulti4_UIV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Dynamo_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(9216), CustomItemList.eM_dynamoMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(9216), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(9216), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); //Energy Hatches IV-UIV GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); @@ -289,9 +289,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_energyMulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_energyMulti64_UEV.get(1), 400, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(9216), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(9216), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(9216), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); //Buck Converter IV-UIV if (Loader.isModLoaded("bartworks")) { -- cgit From 6228969677376c721923efc47d6f205ed3a5498d Mon Sep 17 00:00:00 2001 From: "[Kiwi233]" <[huaxia0611@qq.com]> Date: Sun, 31 Oct 2021 11:43:05 +0800 Subject: Update zh_CN.lang --- src/main/resources/assets/tectech/lang/zh_CN.lang | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 72fc8845b5..2d594ffb8e 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -50,8 +50,8 @@ item.em.EuMeterGT.desc.1=只需右键方块. item.em.frontRotate.name=正面旋转扳手 item.em.frontRotate.desc.0=触发正面旋转界面 -item.em.frontRotate.desc.1=仅旋转前面板, -item.em.frontRotate.desc.2=允许结构旋转. +item.em.frontRotate.desc.1=可以旋转多方块控制器, +item.em.frontRotate.desc.2=从而使整个结构可以旋转. item.em.parametrizerMemoryCard.name=数据化储存卡 item.em.parametrizerMemoryCard.desc.0=存储参数 @@ -313,9 +313,9 @@ gt.blockmachines.hatch.dynamomulti64.tier.11.name=64安UIV动力仓 gt.blockmachines.hatch.dynamomulti04.tier.12.name=4安UMV动力仓 gt.blockmachines.hatch.dynamomulti16.tier.12.name=16安UMV动力仓 gt.blockmachines.hatch.dynamomulti64.tier.12.name=64安UMV动力仓 -gt.blockmachines.hatch.dynamomulti04.tier.13.name=4安IV动力仓 -gt.blockmachines.hatch.dynamomulti16.tier.13.name=16安IV动力仓 -gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安IV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.13.name=4安UXV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.13.name=16安UXV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安UXV动力仓 gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 @@ -875,4 +875,3 @@ tt.keyphrase.Side_capabilities=辅助功能 #OpenTurrets compatibility tile.turretHeadEM.name=元物质炮塔 tile.turretBaseEM.name=元物质炮塔基座 -© 2021 GitHub, Inc. -- cgit From ebd719987402bb4a60bf01a10f5b8e1480184f69 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 5 Dec 2021 09:03:50 +0100 Subject: Fix Junctions --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index b63079d2dc..29ba91d4b7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -69,7 +69,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_NEUTRAL; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + if (v > base.eOutputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; }; private static final IStatusFunction DST_STATUS = @@ -80,7 +80,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_LOW; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + if (v > base.eInputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; } return STATUS_NEUTRAL; -- cgit From 1c8fd630d6654098d1820ee437d390a06e33faa0 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Wed, 8 Dec 2021 14:11:35 +0100 Subject: Unify build script --- .github/scripts/test-no-crash-reports.sh | 9 + .github/workflows/build-and-test.yml | 45 ++ .github/workflows/release-tags.yml | 45 ++ .gitignore | 62 +-- addon.gradle | 14 + build.gradle | 529 +++++++++++++++++++++ build.gradle.kts | 282 ----------- dependencies.gradle | 41 ++ .../OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar | Bin 0 -> 988221 bytes draw_io_graph.png | Bin 0 -> 113460 bytes gradle.properties | 70 ++- gradle/wrapper/gradle-wrapper.jar | Bin 54417 -> 55616 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 22 +- gradlew.bat | 18 +- jitpack.yml | 2 + libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar | Bin 1213993 -> 0 bytes libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar | Bin 4458558 -> 0 bytes .../OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar | Bin 988221 -> 0 bytes real.gradle.properties | 20 - repositories.gradle | 26 + src/main/resources/mcmod.info | 8 +- 22 files changed, 839 insertions(+), 356 deletions(-) create mode 100644 .github/scripts/test-no-crash-reports.sh create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/release-tags.yml create mode 100644 addon.gradle create mode 100644 build.gradle delete mode 100644 build.gradle.kts create mode 100644 dependencies.gradle create mode 100644 dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar create mode 100644 draw_io_graph.png create mode 100644 jitpack.yml delete mode 100644 libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar delete mode 100644 libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar delete mode 100644 libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar delete mode 100644 real.gradle.properties create mode 100644 repositories.gradle (limited to 'src/main') diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh new file mode 100644 index 0000000000..c67e342c06 --- /dev/null +++ b/.github/scripts/test-no-crash-reports.sh @@ -0,0 +1,9 @@ +directory="run/crash-reports" +if [ -d $directory ]; then + echo "Crash reports detected:" + cat $directory/* + exit 1 +else + echo "No crash reports detected" + exit 0 +fi diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000000..a60a2b6468 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Build and test + +on: + pull_request: + branches: [ master, main ] + push: + branches: [ master, main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Run server for 1 minute + run: | + mkdir run + echo "eula=true" > run/eula.txt + timeout 60 ./gradlew runServer || true + + - name: Test no crashes happend + run: | + chmod +x .github/scripts/test-no-crash-reports.sh + .github/scripts/test-no-crash-reports.sh diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml new file mode 100644 index 0000000000..25c354b227 --- /dev/null +++ b/.github/workflows/release-tags.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release tagged build + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Release under current tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.RELEASE_VERSION }}" + prerelease: false + title: "${{ env.RELEASE_VERSION }}" + files: build/libs/*.jar diff --git a/.gitignore b/.gitignore index 3d66b81105..558ad12d27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,28 @@ -.gradle/ -run/ -.settings/ +.gradle +.settings +/.idea/ +/run/ +/build/ +/eclipse/ .classpath .project -bin/ -out/ -libs/gregtech* -CREDITS-fml.txt -LICENSE-fml.txt -MinecraftForge-Credits.txt -MinecraftForge-License.txt -CoreMod.iml -CoreMod.ipr -CoreMod.iws -Idea.bat -SetupDevWorkspaces.bat +/bin/ +/config/ +/crash-reports/ +/logs/ +options.txt +/saves/ +usernamecache.json +banned-ips.json +banned-players.json +eula.txt +ops.json +server.properties +servers.dat +usercache.json +whitelist.json +/out/ *.iml *.ipr *.iws -*.bat -.idea/workspace.xml -*.db -*.log -.idea/ -\.directory -asm/ -config/ -saves/ -usernamecache.json -PlayerCache.dat -GregTech.cfg -options.txt -GregTech.lang -mods/ -classes/ -logs/ -libs/AsieLib-1.7.10-0.4.9-deobf.jar -libs/Computronics-1.7.10-1.6.6-deobf.jar -libs/Galacticraft-API-1.7-3.0.12.504.jar -libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar -libs/MicdoodleCore-1.7-3.0.12.504.jar -libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar -eclipse/ +src/main/resources/mixins.*.json diff --git a/addon.gradle b/addon.gradle new file mode 100644 index 0000000000..599a5cf195 --- /dev/null +++ b/addon.gradle @@ -0,0 +1,14 @@ +sourceSets.main { + java.srcDir("AVRcore/src") +} + +task initAVRcore(type: Exec) { + description = "Updates (and inits) git submodules" + group = "Build Setup" + commandLine("git", "submodule", "update", "--init", "--recursive", "--remote") +} + +tasks.setupCIWorkspace.dependsOn initAVRcore +tasks.setupDevWorkspace.dependsOn initAVRcore +tasks.setupDecompWorkspace.dependsOn initAVRcore +tasks.compileJava.dependsOn initAVRcore diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..cc7c49c4d7 --- /dev/null +++ b/build.gradle @@ -0,0 +1,529 @@ +//version: aa8aff90655e0509464d4a8dc42c38d3614c1260 +/* +DO NOT CHANGE THIS FILE! + +Also, you may replace this file at any time if there is an update available. +Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates. + */ + + +import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +import java.util.concurrent.TimeUnit + +buildscript { + repositories { + maven { + name = "forge" + url = "https://maven.minecraftforge.net" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + name = "Scala CI dependencies" + url = "https://repo1.maven.org/maven2/" + } + maven { + name = "jitpack" + url = "https://jitpack.io" + } + } + dependencies { + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' + } +} + +plugins { + id 'idea' + id 'scala' + id("org.ajoberstar.grgit") version("3.1.1") + id("com.github.johnrengelman.shadow") version("4.0.4") + id("com.palantir.git-version") version("0.12.3") +} + +apply plugin: 'forge' + +def projectJavaVersion = JavaLanguageVersion.of(8) + +java { + toolchain { + languageVersion.set(projectJavaVersion) + } +} + +idea { + module { + inheritOutputDirs = true + downloadJavadoc = true + downloadSources = true + } +} + +if(JavaVersion.current() != JavaVersion.VERSION_1_8) { + throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) +} + +checkPropertyExists("modName") +checkPropertyExists("modId") +checkPropertyExists("modGroup") +checkPropertyExists("autoUpdateBuildScript") +checkPropertyExists("minecraftVersion") +checkPropertyExists("forgeVersion") +checkPropertyExists("replaceGradleTokenInFile") +checkPropertyExists("gradleTokenModId") +checkPropertyExists("gradleTokenModName") +checkPropertyExists("gradleTokenVersion") +checkPropertyExists("gradleTokenGroupName") +checkPropertyExists("apiPackage") +checkPropertyExists("accessTransformersFile") +checkPropertyExists("usesMixins") +checkPropertyExists("mixinPlugin") +checkPropertyExists("mixinsPackage") +checkPropertyExists("coreModClass") +checkPropertyExists("containsMixinsAndOrCoreModOnly") +checkPropertyExists("usesShadowedDependencies") +checkPropertyExists("developmentEnvironmentUserName") + + +String javaSourceDir = "src/main/java/" +String scalaSourceDir = "src/main/scala/" + +String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") +String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") +if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +} + +if(apiPackage) { + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } +} + +if(accessTransformersFile) { + String targetFile = "src/main/resources/META-INF/" + accessTransformersFile + if(getFile(targetFile).exists() == false) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + } +} + +if(usesMixins.toBoolean()) { + if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { + throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") + } + + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } + + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +if(coreModClass) { + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) + + // Make sure GregTech build won't time out + System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) + System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) +} + +// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version +'git config core.fileMode false'.execute() +// Pulls version from git tag +try { + version = minecraftVersion + "-" + gitVersion() +} +catch (Exception e) { + throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!"); +} + +group = modGroup +if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { + archivesBaseName = customArchiveBaseName +} +else { + archivesBaseName = modId +} + +minecraft { + version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion + runDir = "run" + + if (replaceGradleTokenInFile) { + replaceIn replaceGradleTokenInFile + if(gradleTokenModId) { + replace gradleTokenModId, modId + } + if(gradleTokenModName) { + replace gradleTokenModName, modName + } + if(gradleTokenVersion) { + replace gradleTokenVersion, versionDetails().lastTag + } + if(gradleTokenGroupName) { + replace gradleTokenGroupName, modGroup + } + } +} + +if(file("addon.gradle").exists()) { + apply from: "addon.gradle" +} + +apply from: 'repositories.gradle' + +configurations { + implementation.extendsFrom(shadowImplementation) +} + +repositories { + maven { + name = "Overmind forge repo mirror" + url = "https://gregtech.overminddl1.com/" + } + if(usesMixins.toBoolean()) { + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + url = "https://jitpack.io" + } + } +} + +dependencies { + if(usesMixins.toBoolean()) { + annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") + annotationProcessor("com.google.guava:guava:24.1.1-jre") + annotationProcessor("com.google.code.gson:gson:2.8.6") + annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + // using 0.8 to workaround a issue in 0.7 which fails mixin application + compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { + // Mixin includes a lot of dependencies that are too up-to-date + exclude module: "launchwrapper" + exclude module: "guava" + exclude module: "gson" + exclude module: "commons-io" + exclude module: "log4j-core" + } + compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") + } +} + +apply from: 'dependencies.gradle' + +def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" + +task generateAssets { + if(usesMixins.toBoolean()) { + getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + "required": true, + "minVersion": "0.7.11", + "package": "${modGroup}.${mixinsPackage}", + "plugin": "${modGroup}.${mixinPlugin}", + "refmap": "${mixingConfigRefMap}", + "target": "@env(DEFAULT)", + "compatibilityLevel": "JAVA_8" +} + +""" + } +} + +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" +} + +shadowJar { + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] + dependsOn(relocateShadowJar) +} + +jar { + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } +} + +reobf { + if(usesMixins.toBoolean()) { + addExtraSrgFile mixinSrg + } +} + +afterEvaluate { + if(usesMixins.toBoolean()) { + tasks.compileJava { + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" + ] + } + } +} + +runClient { + def arguments = [] + + if(usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + if(developmentEnvironmentUserName) { + arguments += [ + "--username", + developmentEnvironmentUserName + ] + } + + args(arguments) +} + +runServer { + def arguments = [] + + if (usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + args(arguments) +} + +tasks.withType(JavaExec).configureEach { + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } + ) +} + +processResources + { + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +def getManifestAttributes() { + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] + } + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + return manifestAttributes +} + +task sourcesJar(type: Jar) { + from (sourceSets.main.allJava) + from (file("$projectDir/LICENSE")) + getArchiveClassifier().set('sources') +} + +task shadowDevJar(type: ShadowJar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] +} + +task relocateShadowDevJar(type: ConfigureShadowRelocation) { + target = tasks.shadowDevJar + prefix = modGroup + ".shadow" +} + +task circularResolverJar(type: Jar) { + dependsOn(relocateShadowDevJar) + dependsOn(shadowDevJar) + enabled = false +} + +task devJar(type: Jar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(circularResolverJar) + enabled = false + } +} + +task apiJar(type: Jar) { + from (sourceSets.main.allJava) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.output) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.resources.srcDirs) { + include("LICENSE") + } + + getArchiveClassifier().set('api') +} + +artifacts { + archives sourcesJar + archives devJar + if(apiPackage) { + archives apiJar + } +} + +// Updating +task updateBuildScript { + doLast { + if (performBuildScriptUpdate(projectDir.toString())) return + + print("Build script already up-to-date!") + } +} + +if (isNewBuildScriptVersionAvailable(projectDir.toString())) { + if (autoUpdateBuildScript.toBoolean()) { + performBuildScriptUpdate(projectDir.toString()) + } else { + println("Build script update available! Run 'gradle updateBuildScript'") + } +} + +static URL availableBuildScriptUrl() { + new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") +} + +boolean performBuildScriptUpdate(String projectDir) { + if (isNewBuildScriptVersionAvailable(projectDir)) { + def buildscriptFile = getFile("build.gradle") + availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + return true + } + return false +} + +boolean isNewBuildScriptVersionAvailable(String projectDir) { + Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] + + String currentBuildScript = getFile("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) + + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate +} + +static String getVersionHash(String buildScriptContent) { + String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") + if(versionLine != null) { + return versionLine.split(": ").last() + } + return "" +} + +configure(updateBuildScript) { + group = 'forgegradle' + description = 'Updates the build script to the latest version' +} + +// Helper methods + +def checkPropertyExists(String propertyName) { + if (project.hasProperty(propertyName) == false) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties") + } +} + +def getFile(String relativePath) { + return new File(projectDir, relativePath) +} diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 5688298c49..0000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,282 +0,0 @@ -import net.minecraftforge.gradle.user.UserExtension -import java.io.FileInputStream -import java.util.* -import java.io.* - -buildscript { - repositories { - mavenCentral() - maven("https://gregtech.overminddl1.com/") - maven("https://jitpack.io") - - } - dependencies { - classpath("com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT") - } -} - -plugins { - idea - java - signing -} - -apply(plugin = "forge") - -//Downloads Javadocs and sources by default -idea { - module { - this.isDownloadJavadoc = true - this.isDownloadSources = true - } -} - -//Set Java to version 1.8 -java { - this.sourceCompatibility = JavaVersion.VERSION_1_8 - this.targetCompatibility = JavaVersion.VERSION_1_8 -} - -//Set standard encoding -tasks.withType { - options.encoding = "UTF-8" -} - -//Add extra sources here -sourceSets.getByName("main") { - java.srcDir("src/main/java") - java.srcDir("AVRcore/src") -} - -//Load Minecraft Version -val Project.minecraft: UserExtension - get() = extensions.getByName("minecraft") - -//TODO Delete this! This exists to load the configs from the real properties file, which is needed for Jenkins to build -//Gradle will load gradle.properties from it's home, it's install, and the project folder. Clearly whoever setup the -//Jenkins jar signing needs to be reminded of this! -val prop = Properties() -prop.load(FileInputStream("real.gradle.properties")) -val propSign = Properties() -propSign.load(FileInputStream("gradle.properties")) - -//TODO Delete -val projectVersion: String = prop.getProperty("projectVersion") -//TODO Uncomment -//val projectVersion: String by project - -//Generates a hash for each new commit to differentiate versions -var commitHash = Runtime - .getRuntime() - .exec("git rev-parse --short HEAD") - .let { process -> - process.waitFor() - val output = process.inputStream.use { - it.bufferedReader().use(BufferedReader::readText) - } - process.destroy() - output.trim() - } - -minecraft.version = "1.7.10-10.13.4.1614-1.7.10" -version = "$projectVersion-$commitHash" -group = "com.github.technus" - -//Minecraft Block -configure { - //Replaces version inside the mod - this.includes.addAll( - arrayOf( - "Reference.java" - ) - ) - this.replacements.putAll( - mapOf( - Pair("GRADLETOKEN_VERSION", project.version) - ) - ) - - //This is sometimes called 'eclipse' instead - this.runDir = "run" -} - -repositories { - mavenLocal() - maven("https://gregtech.overminddl1.com/") { this.name = "GT6Maven" } - maven("http://maven.ic2.player.to/") { this.name = "ic2" } - maven("http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/") { this.name = "UsrvDE/GTNH" } - ivy { - this.name = "gtnh_download_source_underscores" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]") - } - ivy { - this.name = "gtnh_download_source" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]") - } - ivy { - this.name = "BuildCraft" - this.artifactPattern("http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision](-[classifier]).[ext]") - } - maven("http://maven.cil.li/") { this.name = "OpenComputers" } - maven("http://default.mobiusstrip.eu/maven") { this.name = "Jabba" } - maven("http://chickenbones.net/maven/") { this.name = "CodeChicken" } - maven("http://www.ryanliptak.com/maven/") { this.name = "appleCore" } - maven("https://jitpack.io") -} - -dependencies { - //Local Libraries - compile(fileTree("libs") { this.include("*.jar") }) - - //TODO Uncomment - //Versions from properties - //val ic2Version: String by project - //val gt5uVersion: String by project - //val yamcoreVersion: String by project - //val opencomputersVersion: String by project - //val computercraftVersion: String by project - //val baublesVersion: String by project - //val thaumcraftVersion: String by project - //val codechickenlibVersion: String by project - //val codechickencoreVersion: String by project - //val neiVersion: String by project - //val wailaVersion: String by project - //val galacticraftVersion: String by project - //val galacticGregVersion: String by project - //val buildcraftVersion: String by project - //val forestryVersion: String by project - //val enderioVersion: String by project - //val enderCoreVersion: String by project - - //TODO Delete - val ic2Version: String = prop.getProperty("ic2Version") - val gt5uVersion: String = prop.getProperty("gt5uVersion") - val yamcoreVersion: String = prop.getProperty("yamcoreVersion") - val opencomputersVersion: String = prop.getProperty("opencomputersVersion") - val computercraftVersion: String = prop.getProperty("computercraftVersion") - val baublesVersion: String = prop.getProperty("baublesVersion") - val thaumcraftVersion: String = prop.getProperty("thaumcraftVersion") - val codechickenlibVersion: String = prop.getProperty("codechickenlibVersion") - val codechickencoreVersion: String = prop.getProperty("codechickencoreVersion") - val neiVersion: String = prop.getProperty("neiVersion") - val wailaVersion: String = prop.getProperty("wailaVersion") - val galacticraftVersion: String = prop.getProperty("galacticraftVersion") - val galacticGregVersion: String = prop.getProperty("galacticGregVersion") - val buildcraftVersion: String = prop.getProperty("buildcraftVersion") - val forestryVersion: String = prop.getProperty("forestryVersion") - val enderioVersion: String = prop.getProperty("enderioVersion") - val enderCoreVersion: String = prop.getProperty("enderCoreVersion") - - //Hard Dependencies - compile("net.industrial-craft:industrialcraft-2:$ic2Version:dev") - compile("com.github.GTNewHorizons:StructureLib:1.0.9:deobf") - compile("com.github.GTNewHorizons:GT5-Unofficial:$gt5uVersion:dev"){ - exclude("net.industrial-craft", "industrialcraft-2") - } - compile("eu.usrv:YAMCore:$yamcoreVersion:deobf") - - //Compile Dependencies - compileOnly("li.cil.oc:OpenComputers:$opencomputersVersion:dev") - compileOnly("dan200.computercraft:ComputerCraft:$computercraftVersion") - compile("com.azanor.baubles:Baubles:$baublesVersion:deobf") - compile("thaumcraft:Thaumcraft:$thaumcraftVersion:dev") - compile("codechicken:CodeChickenLib:$codechickenlibVersion:dev") - compile("codechicken:CodeChickenCore:$codechickencoreVersion:dev") - compile("codechicken:NotEnoughItems:$neiVersion:dev") - - //Optional Libraries for Testing - runtimeOnly("mcp.mobius.waila:Waila:$wailaVersion") - - //runtimeOnly("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev") - //runtimeOnly("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev") - //runtimeOnly("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev") - //runtimeOnly("com.github.GTNewHorizons:GalacticGregGT5:$galacticGregVersion") - //runtimeOnly("com.mod-buildcraft:buildcraft:$buildcraftVersion:dev") - //runtimeOnly("net.sengir.forestry:forestry_1.7.10:$forestryVersion:dev") - //runtimeOnly("com.enderio.core:EnderCore:$enderCoreVersion:dev") - //runtimeOnly("com.enderio:EnderIO:$enderioVersion:dev"){ - // exclude("com.enderio.core", "EnderCore") - // exclude("mcp.mobius.waila", "Waila") - //} -} - -tasks.withType { - //Mark as outdated if versions change - this.inputs.properties += "version" to project.version - this.inputs.properties += "mcversion" to project.minecraft.version - this.archiveBaseName.set("TecTech-${project.minecraft.version}") - - //Replace versions in mcmod.info - this.filesMatching("/mcmod.info") { - this.expand( - mapOf( - "version" to project.version, - "mcversion" to project.minecraft.version - ) - ) - } -} - -//Load AVRcore -val submodulesUpdate by tasks.creating(Exec::class) { - this.description = "Updates (and inits) git submodules" - this.group = "Build Setup" - this.commandLine("git", "submodule", "update", "--init", "--recursive", "--remote") -} -tasks.named("setupCIWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("setupDevWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("setupDecompWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("compileJava") { - dependsOn(":submodulesUpdate") -} -tasks.named("sourceMainJava") { - dependsOn(":submodulesUpdate") -} - -tasks.jar { - //Needed for access transformer which allows nerfing hardness of blocks - this.manifest.attributes( - mapOf( - Pair("FMLAT", "tectech_at.cfg") - ) - ) -} - -val sourcesJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().allSource) - this.archiveClassifier.set("sources") -} - -val devJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().output) - this.archiveClassifier.set("dev") -} - -artifacts { - this.archives(sourcesJar) - this.archives(devJar) -} - -tasks.register("signJar") { - dependsOn("reobf") -} - -//TODO Fix, but technically it was never fully implemented -//signing { -// sign(tasks["jar"]) -//} -// -//tasks.named("signJar") { -// allprojects { -// extra["signing.keyId"] = propSign.getProperty("keyStoreAlias") -// extra["signing.secretKeyRingFile"] = propSign.getProperty("keyStore") -// extra["signing.password"] = propSign.getProperty("keyStorePass") -// } -// dependsOn(":reobf") -//} diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000000..7cff792573 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,41 @@ +// Add your dependencies here + +dependencies { + compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") + compile("com.github.GTNewHorizons:Yamcl:master-SNAPSHOT:dev") + + /*compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev") { // Transitive by GT5-Unofficial + transitive = false + } + compile("com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev") { // Transitive by GT5-Unofficial + transitive = false + } + compile("com.github.GTNewHorizons:StructureLib:master-SNAPSHOT:dev") { // Transitive by GT5-Unofficial + transitive = false + } + compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") { // Transitive by GT5-Unofficial + transitive = false + }*/ + + compileOnly("com.github.GTNewHorizons:GTplusplus:unified-build-script-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev") { + transitive = false + } + + compileOnly("dan200.computercraft:ComputerCraft:1.75") { + transitive = false + } + compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.7.5.1356:dev") { + transitive = false + } + compileOnly("curse.maven:cofh-core-69162:2388751") { + transitive = false + } + compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { + transitive = false + } + + compileOnly files("dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar") +} diff --git a/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar b/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar new file mode 100644 index 0000000000..e854bf7df9 Binary files /dev/null and b/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar differ diff --git a/draw_io_graph.png b/draw_io_graph.png new file mode 100644 index 0000000000..241c41d604 Binary files /dev/null and b/draw_io_graph.png differ diff --git a/gradle.properties b/gradle.properties index 7fc32d532c..d18a0daa12 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,64 @@ -#Dummy File, replaced in Jenkins -systemProp.org.gradle.internal.http.connectionTimeout=120000 -systemProp.org.gradle.internal.http.socketTimeout=120000 -keyStoreAlias=w -keyStore=w -keyStorePass=w +modName = TecTech - Tec Technology! + +# This is a case-sensitive string to identify your mod. Convention is to use lower case. +modId = tectech + +modGroup = com.github.technus.tectech + +# WHY is there no version field? +# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the +# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ + +# Will update your build.gradle automatically whenever an update is available +autoUpdateBuildScript = false + +minecraftVersion = 1.7.10 +forgeVersion = 10.13.4.1614 + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you +# restart Minecraft in development. Choose this dependent on your mod: +# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name +# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +developmentEnvironmentUserName = "Developer" + +# Define a source file of your project with: +# public static final String VERSION = "GRADLETOKEN_VERSION"; +# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's +# version in @Mod([...], version = VERSION, [...]) +# Leave these properties empty to skip individual token replacements +replaceGradleTokenInFile = Reference.java +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = GRADLETOKEN_VERSION +gradleTokenGroupName = + +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can +# leave this property empty. +# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +apiPackage = + +# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ +# Example value: mymodid_at.cfg +accessTransformersFile = tectech_at.cfg + +# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! +usesMixins = false +# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. +mixinPlugin = +# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +mixinsPackage = +# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! +# This parameter is for legacy compatability only +# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +coreModClass = +# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class +# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! +containsMixinsAndOrCoreModOnly = false + +# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# responsibility check the licence and request permission for distribution, if required. +usesShadowedDependencies = false + +# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older +# projects. New projects should not use this parameter. +customArchiveBaseName = TecTech diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 758de960ec..5c2d1cf016 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28f8e..3ab0b725ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d517..83f2acfdc3 100644 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/gradlew.bat b/gradlew.bat index f9553162f1..9618d8d960 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000000..09bbb514fc --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +before_install: + - ./gradlew setupCIWorkspace \ No newline at end of file diff --git a/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar b/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar deleted file mode 100644 index 7a53464d53..0000000000 Binary files a/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar and /dev/null differ diff --git a/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar b/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar deleted file mode 100644 index 181475fc38..0000000000 Binary files a/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar and /dev/null differ diff --git a/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar b/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar deleted file mode 100644 index e854bf7df9..0000000000 Binary files a/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar and /dev/null differ diff --git a/real.gradle.properties b/real.gradle.properties deleted file mode 100644 index 5cf1722acc..0000000000 --- a/real.gradle.properties +++ /dev/null @@ -1,20 +0,0 @@ -systemProp.org.gradle.internal.http.connectionTimeout=120000 -systemProp.org.gradle.internal.http.socketTimeout=120000 -projectVersion=4.10.8 -ic2Version=2.2.828-experimental -gt5uVersion=experimental-SNAPSHOT -yamcoreVersion=1.7.10-0.5.79 -opencomputersVersion=MC1.7.10-1.7.5.1291 -computercraftVersion=1.75 -baublesVersion=1.7.10-1.0.1.10 -thaumcraftVersion=1.7.10-4.2.3.5 -codechickenlibVersion=1.7.10-1.1.3.140 -codechickencoreVersion=1.7.10-1.0.7.47 -neiVersion=1.7.10-1.0.5.120 -wailaVersion=1.5.10_1.7.10 -galacticraftVersion=1.7-3.0.12.504 -galacticGregVersion=master-SNAPSHOT -buildcraftVersion=7.1.23 -forestryVersion=4.4.0.0 -enderioVersion=1.7.10-2.3.0.429_beta -enderCoreVersion=1.7.10-0.2.0.39_beta diff --git a/repositories.gradle b/repositories.gradle new file mode 100644 index 0000000000..130197c8aa --- /dev/null +++ b/repositories.gradle @@ -0,0 +1,26 @@ +// Add any additional repositories for your dependencies here + +repositories { + maven { + name "OpenComputers Repo" + url = "http://maven.cil.li/" + } + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url "https://cursemaven.com" + } + maven { + url = "https://jitpack.io" + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f7fc68f278..21ecee23f8 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,10 +1,10 @@ [ { - "modid": "tectech", - "name": "TecTech", + "modid": "${modId}", + "name": "${modName}", "description": "TecTech - Tec Technology Interdimensional! Replace UUMatter with something overly complicated and annoying! (GT5u Addon)", - "version": "${version}", - "mcversion": "${mcversion}", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", "url": "", "updateUrl": "", "authorList": ["_Technus_"], -- cgit From 090004325fe88859e70642587a617794f815987a Mon Sep 17 00:00:00 2001 From: boubou_19 Date: Sat, 11 Dec 2021 18:57:24 +0100 Subject: add recipe for infinite oil rig --- .../dreamcraft/DreamCraftRecipeLoader.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index ba72375f80..0b40facca7 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -170,6 +170,23 @@ public class DreamCraftRecipeLoader implements Runnable { getOrDefault("Trinium", Materials.Osmium).getMolten(1296), }, CustomItemList.eM_Coil.get(4), 800, 2000000); + //infinite oil rig + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.OilDrill3.get(1), + 1843200, 1024, 2000000, 4, new ItemStack[]{ + ItemList.OilDrill3.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 4), + ItemList.Electric_Motor_UHV.get(4), + ItemList.Electric_Pump_UHV.get(4), + GT_OreDictUnificator.get(OrePrefixes.gearGt, Materials.Neutronium, 4), + ItemList.Sensor_UHV.get(3), + ItemList.Field_Generator_UHV.get(3), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 12) + }, new FluidStack[]{ + Materials.SolderingAlloy.getMolten(1296), + Materials.Neutronium.getMolten(576) + }, ItemList.OilDrillInfinite.get(1), 1200, 2000000); + //Tesla Base GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NickelZincFerrite, 6), -- cgit From 3c9a892a341a1461f7a0b0c8467e501c99449b77 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Mon, 13 Dec 2021 00:27:28 +0800 Subject: Fix compat with gtpp, also fixed the build --- build.gradle.kts | 8 ++++++-- real.gradle.properties | 2 +- .../technus/tectech/compatibility/gtpp/GtppAtomLoader.java | 12 ++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/build.gradle.kts b/build.gradle.kts index 5688298c49..fe1dfcb909 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ buildscript { } dependencies { - classpath("com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT") + classpath("com.github.GTNewHorizons:ForgeGradle:1.2.4") } } @@ -169,9 +169,13 @@ dependencies { //Hard Dependencies compile("net.industrial-craft:industrialcraft-2:$ic2Version:dev") - compile("com.github.GTNewHorizons:StructureLib:1.0.9:deobf") + compile("com.github.GTNewHorizons:StructureLib:1.0.11:dev") compile("com.github.GTNewHorizons:GT5-Unofficial:$gt5uVersion:dev"){ exclude("net.industrial-craft", "industrialcraft-2") + exclude("com.github.GTNewHorizons", "StructureLib") + } + compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev") { + isTransitive = false } compile("eu.usrv:YAMCore:$yamcoreVersion:deobf") diff --git a/real.gradle.properties b/real.gradle.properties index 5cf1722acc..d97131bc7f 100644 --- a/real.gradle.properties +++ b/real.gradle.properties @@ -2,7 +2,7 @@ systemProp.org.gradle.internal.http.connectionTimeout=120000 systemProp.org.gradle.internal.http.socketTimeout=120000 projectVersion=4.10.8 ic2Version=2.2.828-experimental -gt5uVersion=experimental-SNAPSHOT +gt5uVersion=master-SNAPSHOT yamcoreVersion=1.7.10-0.5.79 opencomputersVersion=MC1.7.10-1.7.5.1291 computercraftVersion=1.75 diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index 32db2caed9..bf96d61795 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -40,6 +40,14 @@ public class GtppAtomLoader implements Runnable{ } //endregion + private static Method getMethodWithReplacements(Class owner, String name1, String name2, Class... arguments) throws ReflectiveOperationException { + try { + return owner.getMethod(name1, arguments); + } catch (ReflectiveOperationException e) { + return owner.getMethod(name2, arguments); + } + } + @Override public void run() { //region reflect a bit @@ -47,9 +55,9 @@ public class GtppAtomLoader implements Runnable{ ELEMENT=Class.forName("gtPlusPlus.core.material.ELEMENT"); ELEMENT_INSTANCE=ELEMENT.getMethod("getInstance").invoke(null); - Class clazz=Class.forName("gtPlusPlus.core.material.Material"); + Class clazz=Class.forName("gtPlusPlus.core.material.Material"); getUnlocalizedName=clazz.getMethod("getUnlocalizedName"); - getFluid=clazz.getMethod("getFluid", int.class); + getFluid=getMethodWithReplacements(clazz,"getFluidStack", "getFluid", int.class); clazz=Class.forName("gtPlusPlus.core.material.MaterialGenerator"); generate=clazz.getMethod("generate", Class.forName("gtPlusPlus.core.material.Material"), boolean.class, boolean.class); -- cgit From 6a35a18be754743973e339ee2adf7ee26235d4af Mon Sep 17 00:00:00 2001 From: GTNH-Afx237v7 <64365566+GTNH-Afx237v7@users.noreply.github.com> Date: Wed, 15 Dec 2021 13:08:06 +0100 Subject: Adjust ultimate battery soldering alloy amount see #9131 --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 0b40facca7..b8fa84543d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1401,7 +1401,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Parts_DiodeASMD.get(64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760), + Materials.SolderingAlloy.getMolten(4608), Materials.Naquadria.getMolten(9216), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) }, ItemList.ZPM3.get(1), 4000, 1600000); -- cgit From 062fb04b02b9291741fdc4e79441e07cedee8796 Mon Sep 17 00:00:00 2001 From: Bass Date: Fri, 24 Dec 2021 18:49:07 +0000 Subject: Merge pull request #19 from GTNewHorizons/unified-build-script GTNewHorizons/TecTech/pull/19 Update buildscript Unify build script --- .github/scripts/test-no-error-reports.sh | 27 + .github/workflows/build-and-test.yml | 45 ++ .github/workflows/release-tags.yml | 61 +++ .gitignore | 62 +-- .gitmodules | 3 - build.gradle | 562 +++++++++++++++++++++ build.gradle.kts | 292 ----------- dependencies.gradle | 43 ++ .../OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar | Bin 0 -> 988221 bytes draw_io_graph.png | Bin 0 -> 113460 bytes gradle.properties | 70 ++- gradle/wrapper/gradle-wrapper.jar | Bin 54417 -> 55616 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 22 +- gradlew.bat | 18 +- jitpack.yml | 2 + libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar | Bin 1213993 -> 0 bytes libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar | Bin 4458558 -> 0 bytes .../OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar | Bin 988221 -> 0 bytes real.gradle.properties | 20 - repositories.gradle | 26 + src/main/resources/mcmod.info | 8 +- 22 files changed, 894 insertions(+), 369 deletions(-) create mode 100644 .github/scripts/test-no-error-reports.sh create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/release-tags.yml delete mode 100644 .gitmodules create mode 100644 build.gradle delete mode 100644 build.gradle.kts create mode 100644 dependencies.gradle create mode 100644 dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar create mode 100644 draw_io_graph.png create mode 100644 jitpack.yml delete mode 100644 libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar delete mode 100644 libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar delete mode 100644 libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar delete mode 100644 real.gradle.properties create mode 100644 repositories.gradle (limited to 'src/main') diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh new file mode 100644 index 0000000000..e3876606d5 --- /dev/null +++ b/.github/scripts/test-no-error-reports.sh @@ -0,0 +1,27 @@ +if [[ -d "run/crash-reports" ]]; then + echo "Crash reports detected:" + cat $directory/* + exit 1 +fi + +if grep --quiet "Fatal errors were detected" server.log; then + echo "Fatal errors detected:" + cat server.log + exit 1 +fi + +if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then + echo "Server force stopped:" + cat server.log + exit 1 +fi + +if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then + echo "Server didn't finish startup:" + cat server.log + exit 1 +fi + +echo "No crash reports detected" +exit 0 + diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000000..08df9fe89f --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Build and test + +on: + pull_request: + branches: [ master, main ] + push: + branches: [ master, main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Run server for 1.5 minutes + run: | + mkdir run + echo "eula=true" > run/eula.txt + timeout 90 ./gradlew runServer | tee --append server.log || true + + - name: Test no errors reported during server run + run: | + chmod +x .github/scripts/test-no-error-reports.sh + .github/scripts/test-no-error-reports.sh diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml new file mode 100644 index 0000000000..96d37f7d9a --- /dev/null +++ b/.github/workflows/release-tags.yml @@ -0,0 +1,61 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release tagged build + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Release under current tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.RELEASE_VERSION }}" + prerelease: false + title: "${{ env.RELEASE_VERSION }}" + files: build/libs/*.jar + + - name: Set repository owner and name + run: | + echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV + echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV + + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ARTIFACT_GROUP_ID: com.github.${{ env.REPOSITORY_OWNER }} + ARTIFACT_ID: "${{ env.REPOSITORY_NAME }}" + ARTIFACT_VERSION: "${{ env.RELEASE_VERSION }}" + REPOSITORY_NAME: "${{ env.REPOSITORY_NAME }}" + REPOSITORY_OWNER: "${{ env.REPOSITORY_OWNER }}" + diff --git a/.gitignore b/.gitignore index 3d66b81105..558ad12d27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,28 @@ -.gradle/ -run/ -.settings/ +.gradle +.settings +/.idea/ +/run/ +/build/ +/eclipse/ .classpath .project -bin/ -out/ -libs/gregtech* -CREDITS-fml.txt -LICENSE-fml.txt -MinecraftForge-Credits.txt -MinecraftForge-License.txt -CoreMod.iml -CoreMod.ipr -CoreMod.iws -Idea.bat -SetupDevWorkspaces.bat +/bin/ +/config/ +/crash-reports/ +/logs/ +options.txt +/saves/ +usernamecache.json +banned-ips.json +banned-players.json +eula.txt +ops.json +server.properties +servers.dat +usercache.json +whitelist.json +/out/ *.iml *.ipr *.iws -*.bat -.idea/workspace.xml -*.db -*.log -.idea/ -\.directory -asm/ -config/ -saves/ -usernamecache.json -PlayerCache.dat -GregTech.cfg -options.txt -GregTech.lang -mods/ -classes/ -logs/ -libs/AsieLib-1.7.10-0.4.9-deobf.jar -libs/Computronics-1.7.10-1.6.6-deobf.jar -libs/Galacticraft-API-1.7-3.0.12.504.jar -libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar -libs/MicdoodleCore-1.7-3.0.12.504.jar -libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar -eclipse/ +src/main/resources/mixins.*.json diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 58eebb4aa5..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "AVRcore"] - path = AVRcore - url = https://github.com/Technus/AVRcore diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..2ec9a2ebac --- /dev/null +++ b/build.gradle @@ -0,0 +1,562 @@ +//version: be36e1399d5622c152db7c530c48e17cde0ce1bb +/* +DO NOT CHANGE THIS FILE! + +Also, you may replace this file at any time if there is an update available. +Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates. + */ + + +import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +import java.util.concurrent.TimeUnit + +buildscript { + repositories { + maven { + name = "forge" + url = "https://maven.minecraftforge.net" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + name = "Scala CI dependencies" + url = "https://repo1.maven.org/maven2/" + } + maven { + name = "jitpack" + url = "https://jitpack.io" + } + } + dependencies { + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' + } +} + +plugins { + id 'idea' + id 'scala' + id("org.ajoberstar.grgit") version("3.1.1") + id("com.github.johnrengelman.shadow") version("4.0.4") + id("com.palantir.git-version") version("0.12.3") + id("maven-publish") +} + +apply plugin: 'forge' + +def projectJavaVersion = JavaLanguageVersion.of(8) + +java { + toolchain { + languageVersion.set(projectJavaVersion) + } +} + +idea { + module { + inheritOutputDirs = true + downloadJavadoc = true + downloadSources = true + } +} + +if(JavaVersion.current() != JavaVersion.VERSION_1_8) { + throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) +} + +checkPropertyExists("modName") +checkPropertyExists("modId") +checkPropertyExists("modGroup") +checkPropertyExists("autoUpdateBuildScript") +checkPropertyExists("minecraftVersion") +checkPropertyExists("forgeVersion") +checkPropertyExists("replaceGradleTokenInFile") +checkPropertyExists("gradleTokenModId") +checkPropertyExists("gradleTokenModName") +checkPropertyExists("gradleTokenVersion") +checkPropertyExists("gradleTokenGroupName") +checkPropertyExists("apiPackage") +checkPropertyExists("accessTransformersFile") +checkPropertyExists("usesMixins") +checkPropertyExists("mixinPlugin") +checkPropertyExists("mixinsPackage") +checkPropertyExists("coreModClass") +checkPropertyExists("containsMixinsAndOrCoreModOnly") +checkPropertyExists("usesShadowedDependencies") +checkPropertyExists("developmentEnvironmentUserName") + + +String javaSourceDir = "src/main/java/" +String scalaSourceDir = "src/main/scala/" + +String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") +String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") +if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +} + +if(apiPackage) { + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } +} + +if(accessTransformersFile) { + String targetFile = "src/main/resources/META-INF/" + accessTransformersFile + if(getFile(targetFile).exists() == false) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + } +} + +if(usesMixins.toBoolean()) { + if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { + throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") + } + + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } + + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +if(coreModClass) { + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) + + // Make sure GregTech build won't time out + System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) + System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) +} + +// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version +'git config core.fileMode false'.execute() +// Pulls version from git tag +try { + version = minecraftVersion + "-" + gitVersion() +} +catch (Exception e) { + throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!"); +} + +group = modGroup +if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { + archivesBaseName = customArchiveBaseName +} +else { + archivesBaseName = modId +} + +minecraft { + version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion + runDir = "run" + + if (replaceGradleTokenInFile) { + replaceIn replaceGradleTokenInFile + if(gradleTokenModId) { + replace gradleTokenModId, modId + } + if(gradleTokenModName) { + replace gradleTokenModName, modName + } + if(gradleTokenVersion) { + replace gradleTokenVersion, versionDetails().lastTag + } + if(gradleTokenGroupName) { + replace gradleTokenGroupName, modGroup + } + } +} + +if(file("addon.gradle").exists()) { + apply from: "addon.gradle" +} + +apply from: 'repositories.gradle' + +configurations { + implementation.extendsFrom(shadowImplementation) +} + +repositories { + maven { + name = "Overmind forge repo mirror" + url = "https://gregtech.overminddl1.com/" + } + if(usesMixins.toBoolean()) { + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + url = "https://jitpack.io" + } + } +} + +dependencies { + if(usesMixins.toBoolean()) { + annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") + annotationProcessor("com.google.guava:guava:24.1.1-jre") + annotationProcessor("com.google.code.gson:gson:2.8.6") + annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + // using 0.8 to workaround a issue in 0.7 which fails mixin application + compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { + // Mixin includes a lot of dependencies that are too up-to-date + exclude module: "launchwrapper" + exclude module: "guava" + exclude module: "gson" + exclude module: "commons-io" + exclude module: "log4j-core" + } + compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") + } +} + +apply from: 'dependencies.gradle' + +def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" + +task generateAssets { + if(usesMixins.toBoolean()) { + getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + "required": true, + "minVersion": "0.7.11", + "package": "${modGroup}.${mixinsPackage}", + "plugin": "${modGroup}.${mixinPlugin}", + "refmap": "${mixingConfigRefMap}", + "target": "@env(DEFAULT)", + "compatibilityLevel": "JAVA_8" +} + +""" + } +} + +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" +} + +shadowJar { + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] + dependsOn(relocateShadowJar) +} + +jar { + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } +} + +reobf { + if(usesMixins.toBoolean()) { + addExtraSrgFile mixinSrg + } +} + +afterEvaluate { + if(usesMixins.toBoolean()) { + tasks.compileJava { + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" + ] + } + } +} + +runClient { + def arguments = [] + + if(usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + if(developmentEnvironmentUserName) { + arguments += [ + "--username", + developmentEnvironmentUserName + ] + } + + args(arguments) +} + +runServer { + def arguments = [] + + if (usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + args(arguments) +} + +tasks.withType(JavaExec).configureEach { + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } + ) +} + +processResources + { + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +def getManifestAttributes() { + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] + } + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + return manifestAttributes +} + +task sourcesJar(type: Jar) { + from (sourceSets.main.allJava) + from (file("$projectDir/LICENSE")) + getArchiveClassifier().set('sources') +} + +task shadowDevJar(type: ShadowJar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] +} + +task relocateShadowDevJar(type: ConfigureShadowRelocation) { + target = tasks.shadowDevJar + prefix = modGroup + ".shadow" +} + +task circularResolverJar(type: Jar) { + dependsOn(relocateShadowDevJar) + dependsOn(shadowDevJar) + enabled = false +} + +task devJar(type: Jar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(circularResolverJar) + enabled = false + } +} + +task apiJar(type: Jar) { + from (sourceSets.main.allJava) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.output) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.resources.srcDirs) { + include("LICENSE") + } + + getArchiveClassifier().set('api') +} + +artifacts { + archives sourcesJar + archives devJar + if(apiPackage) { + archives apiJar + } +} + +// publishing +publishing { + publications { + maven(MavenPublication) { + artifact source: jar + artifact source: sourcesJar, classifier: "src" + artifact source: devJar, classifier: "dev" + if (apiPackage) { + archives source: apiJar, classifier: "api" + } + + groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group + artifactId = System.getenv("ARTIFACT_ID") ?: project.name + version = System.getenv("ARTIFACT_VERSION") ?: project.version + } + } + + repositories { + maven { + String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown" + String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown" + String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName" + name = "GitHubPackages" + url = githubRepositoryUrl + credentials { + username = System.getenv("GITHUB_ACTOR") ?: "NONE" + password = System.getenv("GITHUB_TOKEN") ?: "NONE" + } + } + } +} + +// Updating +task updateBuildScript { + doLast { + if (performBuildScriptUpdate(projectDir.toString())) return + + print("Build script already up-to-date!") + } +} + +if (isNewBuildScriptVersionAvailable(projectDir.toString())) { + if (autoUpdateBuildScript.toBoolean()) { + performBuildScriptUpdate(projectDir.toString()) + } else { + println("Build script update available! Run 'gradle updateBuildScript'") + } +} + +static URL availableBuildScriptUrl() { + new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") +} + +boolean performBuildScriptUpdate(String projectDir) { + if (isNewBuildScriptVersionAvailable(projectDir)) { + def buildscriptFile = getFile("build.gradle") + availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + return true + } + return false +} + +boolean isNewBuildScriptVersionAvailable(String projectDir) { + Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] + + String currentBuildScript = getFile("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) + + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate +} + +static String getVersionHash(String buildScriptContent) { + String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") + if(versionLine != null) { + return versionLine.split(": ").last() + } + return "" +} + +configure(updateBuildScript) { + group = 'forgegradle' + description = 'Updates the build script to the latest version' +} + +// Helper methods + +def checkPropertyExists(String propertyName) { + if (project.hasProperty(propertyName) == false) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties") + } +} + +def getFile(String relativePath) { + return new File(projectDir, relativePath) +} diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 29a4f8b6de..0000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,292 +0,0 @@ -import net.minecraftforge.gradle.user.UserExtension -import java.io.FileInputStream -import java.util.* -import java.io.* - -buildscript { - repositories { - mavenCentral() - maven("https://gregtech.overminddl1.com/") - maven("https://jitpack.io") - - } - dependencies { - classpath("com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT"){ - isChanging = true - } - } -} - -plugins { - idea - java - signing -} - -apply(plugin = "forge") - -//Downloads Javadocs and sources by default -idea { - module { - this.isDownloadJavadoc = true - this.isDownloadSources = true - } -} - -//Set Java to version 1.8 -java { - this.sourceCompatibility = JavaVersion.VERSION_1_8 - this.targetCompatibility = JavaVersion.VERSION_1_8 -} - -//Set standard encoding -tasks.withType { - options.encoding = "UTF-8" -} - -//Add extra sources here -sourceSets.getByName("main") { - java.srcDir("src/main/java") - java.srcDir("AVRcore/src") -} - -//Load Minecraft Version -val Project.minecraft: UserExtension - get() = extensions.getByName("minecraft") - -//TODO Delete this! This exists to load the configs from the real properties file, which is needed for Jenkins to build -//Gradle will load gradle.properties from it's home, it's install, and the project folder. Clearly whoever setup the -//Jenkins jar signing needs to be reminded of this! -val prop = Properties() -prop.load(FileInputStream("real.gradle.properties")) -val propSign = Properties() -propSign.load(FileInputStream("gradle.properties")) - -//TODO Delete -val projectVersion: String = prop.getProperty("projectVersion") -//TODO Uncomment -//val projectVersion: String by project - -//Generates a hash for each new commit to differentiate versions -var commitHash = Runtime - .getRuntime() - .exec("git rev-parse --short HEAD") - .let { process -> - process.waitFor() - val output = process.inputStream.use { - it.bufferedReader().use(BufferedReader::readText) - } - process.destroy() - output.trim() - } - -minecraft.version = "1.7.10-10.13.4.1614-1.7.10" -version = "$projectVersion-$commitHash" -group = "com.github.technus" - -//Minecraft Block -configure { - //Replaces version inside the mod - this.includes.addAll( - arrayOf( - "Reference.java" - ) - ) - this.replacements.putAll( - mapOf( - Pair("GRADLETOKEN_VERSION", project.version) - ) - ) - - //This is sometimes called 'eclipse' instead - this.runDir = "run" -} - -repositories { - mavenLocal() - maven("https://gregtech.overminddl1.com/") { this.name = "GT6Maven" } - maven("http://maven.ic2.player.to/") { this.name = "ic2" } - maven("http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/") { this.name = "UsrvDE/GTNH" } - ivy { - this.name = "gtnh_download_source_underscores" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]") - } - ivy { - this.name = "gtnh_download_source" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]") - } - ivy { - this.name = "BuildCraft" - this.artifactPattern("http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision](-[classifier]).[ext]") - } - maven("http://maven.cil.li/") { this.name = "OpenComputers" } - maven("http://default.mobiusstrip.eu/maven") { this.name = "Jabba" } - maven("http://chickenbones.net/maven/") { this.name = "CodeChicken" } - maven("http://www.ryanliptak.com/maven/") { this.name = "appleCore" } - maven("https://jitpack.io") -} - -dependencies { - //Local Libraries - compile(fileTree("libs") { this.include("*.jar") }) - - //TODO Uncomment - //Versions from properties - //val ic2Version: String by project - //val gt5uVersion: String by project - //val yamcoreVersion: String by project - //val opencomputersVersion: String by project - //val computercraftVersion: String by project - //val baublesVersion: String by project - //val thaumcraftVersion: String by project - //val codechickenlibVersion: String by project - //val codechickencoreVersion: String by project - //val neiVersion: String by project - //val wailaVersion: String by project - //val galacticraftVersion: String by project - //val galacticGregVersion: String by project - //val buildcraftVersion: String by project - //val forestryVersion: String by project - //val enderioVersion: String by project - //val enderCoreVersion: String by project - - //TODO Delete - val ic2Version: String = prop.getProperty("ic2Version") - val gt5uVersion: String = prop.getProperty("gt5uVersion") - val yamcoreVersion: String = prop.getProperty("yamcoreVersion") - val opencomputersVersion: String = prop.getProperty("opencomputersVersion") - val computercraftVersion: String = prop.getProperty("computercraftVersion") - val baublesVersion: String = prop.getProperty("baublesVersion") - val thaumcraftVersion: String = prop.getProperty("thaumcraftVersion") - val codechickenlibVersion: String = prop.getProperty("codechickenlibVersion") - val codechickencoreVersion: String = prop.getProperty("codechickencoreVersion") - val neiVersion: String = prop.getProperty("neiVersion") - val wailaVersion: String = prop.getProperty("wailaVersion") - val galacticraftVersion: String = prop.getProperty("galacticraftVersion") - val galacticGregVersion: String = prop.getProperty("galacticGregVersion") - val buildcraftVersion: String = prop.getProperty("buildcraftVersion") - val forestryVersion: String = prop.getProperty("forestryVersion") - val enderioVersion: String = prop.getProperty("enderioVersion") - val enderCoreVersion: String = prop.getProperty("enderCoreVersion") - - //Hard Dependencies - compile("net.industrial-craft:industrialcraft-2:$ic2Version:dev") - compile("com.github.GTNewHorizons:StructureLib:1.0.9:deobf") - compile("com.github.GTNewHorizons:GT5-Unofficial:$gt5uVersion:dev"){ - exclude("net.industrial-craft", "industrialcraft-2") - isChanging = true - } - compile("eu.usrv:YAMCore:$yamcoreVersion:deobf") - - //Compile Dependencies - compileOnly("li.cil.oc:OpenComputers:$opencomputersVersion:dev") - compileOnly("dan200.computercraft:ComputerCraft:$computercraftVersion") - compile("com.azanor.baubles:Baubles:$baublesVersion:deobf") - compile("thaumcraft:Thaumcraft:$thaumcraftVersion:dev") - compile("codechicken:CodeChickenLib:$codechickenlibVersion:dev") - compile("codechicken:CodeChickenCore:$codechickencoreVersion:dev") - compile("codechicken:NotEnoughItems:$neiVersion:dev") - - //Optional Libraries for Testing - runtimeOnly("mcp.mobius.waila:Waila:$wailaVersion") - - //runtimeOnly("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev") - //runtimeOnly("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev") - //runtimeOnly("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev") - //runtimeOnly("com.github.GTNewHorizons:GalacticGregGT5:$galacticGregVersion") - //runtimeOnly("com.mod-buildcraft:buildcraft:$buildcraftVersion:dev") - //runtimeOnly("net.sengir.forestry:forestry_1.7.10:$forestryVersion:dev") - //runtimeOnly("com.enderio.core:EnderCore:$enderCoreVersion:dev") - //runtimeOnly("com.enderio:EnderIO:$enderioVersion:dev"){ - // exclude("com.enderio.core", "EnderCore") - // exclude("mcp.mobius.waila", "Waila") - //} - - configurations.all { - resolutionStrategy.cacheDynamicVersionsFor(30, "seconds") - } -} - - - - -tasks.withType { - //Mark as outdated if versions change - this.inputs.properties += "version" to project.version - this.inputs.properties += "mcversion" to project.minecraft.version - this.archiveBaseName.set("TecTech-${project.minecraft.version}") - - //Replace versions in mcmod.info - this.filesMatching("/mcmod.info") { - this.expand( - mapOf( - "version" to project.version, - "mcversion" to project.minecraft.version - ) - ) - } -} - -//Load AVRcore -val submodulesUpdate by tasks.creating(Exec::class) { - this.description = "Updates (and inits) git submodules" - this.group = "Build Setup" - this.commandLine("git", "submodule", "update", "--init", "--recursive", "--remote") -} -tasks.named("setupCIWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("setupDevWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("setupDecompWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("compileJava") { - dependsOn(":submodulesUpdate") -} -tasks.named("sourceMainJava") { - dependsOn(":submodulesUpdate") -} - -tasks.jar { - //Needed for access transformer which allows nerfing hardness of blocks - this.manifest.attributes( - mapOf( - Pair("FMLAT", "tectech_at.cfg") - ) - ) -} - -val sourcesJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().allSource) - this.archiveClassifier.set("sources") -} - -val devJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().output) - this.archiveClassifier.set("dev") -} - -artifacts { - this.archives(sourcesJar) - this.archives(devJar) -} - -tasks.register("signJar") { - dependsOn("reobf") -} - -//TODO Fix, but technically it was never fully implemented -//signing { -// sign(tasks["jar"]) -//} -// -//tasks.named("signJar") { -// allprojects { -// extra["signing.keyId"] = propSign.getProperty("keyStoreAlias") -// extra["signing.secretKeyRingFile"] = propSign.getProperty("keyStore") -// extra["signing.password"] = propSign.getProperty("keyStorePass") -// } -// dependsOn(":reobf") -//} diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000000..6d229574c1 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,43 @@ +// Add your dependencies here + +dependencies { + shadowImplementation("com.github.GTNewHorizons:AVRcore:add-build-script-SNAPSHOT") + + compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") + compile("com.github.GTNewHorizons:Yamcl:master-SNAPSHOT:dev") + + /*compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev") { // Transitive by GT5-Unofficial + transitive = false + } + compile("com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev") { // Transitive by GT5-Unofficial + transitive = false + } + compile("com.github.GTNewHorizons:StructureLib:master-SNAPSHOT:dev") { // Transitive by GT5-Unofficial + transitive = false + } + compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") { // Transitive by GT5-Unofficial + transitive = false + }*/ + + compileOnly("com.github.GTNewHorizons:GTplusplus:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev") { + transitive = false + } + + compileOnly("dan200.computercraft:ComputerCraft:1.75") { + transitive = false + } + compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.7.5.1356:dev") { + transitive = false + } + compileOnly("curse.maven:cofh-core-69162:2388751") { + transitive = false + } + compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { + transitive = false + } + + compileOnly files("dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar") +} diff --git a/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar b/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar new file mode 100644 index 0000000000..e854bf7df9 Binary files /dev/null and b/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar differ diff --git a/draw_io_graph.png b/draw_io_graph.png new file mode 100644 index 0000000000..241c41d604 Binary files /dev/null and b/draw_io_graph.png differ diff --git a/gradle.properties b/gradle.properties index 7fc32d532c..3d49d30e98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,64 @@ -#Dummy File, replaced in Jenkins -systemProp.org.gradle.internal.http.connectionTimeout=120000 -systemProp.org.gradle.internal.http.socketTimeout=120000 -keyStoreAlias=w -keyStore=w -keyStorePass=w +modName = TecTech - Tec Technology! + +# This is a case-sensitive string to identify your mod. Convention is to use lower case. +modId = tectech + +modGroup = com.github.technus.tectech + +# WHY is there no version field? +# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the +# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ + +# Will update your build.gradle automatically whenever an update is available +autoUpdateBuildScript = false + +minecraftVersion = 1.7.10 +forgeVersion = 10.13.4.1614 + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you +# restart Minecraft in development. Choose this dependent on your mod: +# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name +# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +developmentEnvironmentUserName = "Developer" + +# Define a source file of your project with: +# public static final String VERSION = "GRADLETOKEN_VERSION"; +# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's +# version in @Mod([...], version = VERSION, [...]) +# Leave these properties empty to skip individual token replacements +replaceGradleTokenInFile = Reference.java +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = GRADLETOKEN_VERSION +gradleTokenGroupName = + +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can +# leave this property empty. +# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +apiPackage = + +# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ +# Example value: mymodid_at.cfg +accessTransformersFile = tectech_at.cfg + +# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! +usesMixins = false +# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. +mixinPlugin = +# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +mixinsPackage = +# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! +# This parameter is for legacy compatability only +# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +coreModClass = +# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class +# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! +containsMixinsAndOrCoreModOnly = false + +# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# responsibility check the licence and request permission for distribution, if required. +usesShadowedDependencies = true + +# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older +# projects. New projects should not use this parameter. +customArchiveBaseName = TecTech diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 758de960ec..5c2d1cf016 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28f8e..3ab0b725ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d517..83f2acfdc3 100644 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/gradlew.bat b/gradlew.bat index f9553162f1..9618d8d960 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000000..09bbb514fc --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +before_install: + - ./gradlew setupCIWorkspace \ No newline at end of file diff --git a/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar b/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar deleted file mode 100644 index 7a53464d53..0000000000 Binary files a/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar and /dev/null differ diff --git a/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar b/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar deleted file mode 100644 index 181475fc38..0000000000 Binary files a/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar and /dev/null differ diff --git a/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar b/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar deleted file mode 100644 index e854bf7df9..0000000000 Binary files a/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar and /dev/null differ diff --git a/real.gradle.properties b/real.gradle.properties deleted file mode 100644 index 5cf1722acc..0000000000 --- a/real.gradle.properties +++ /dev/null @@ -1,20 +0,0 @@ -systemProp.org.gradle.internal.http.connectionTimeout=120000 -systemProp.org.gradle.internal.http.socketTimeout=120000 -projectVersion=4.10.8 -ic2Version=2.2.828-experimental -gt5uVersion=experimental-SNAPSHOT -yamcoreVersion=1.7.10-0.5.79 -opencomputersVersion=MC1.7.10-1.7.5.1291 -computercraftVersion=1.75 -baublesVersion=1.7.10-1.0.1.10 -thaumcraftVersion=1.7.10-4.2.3.5 -codechickenlibVersion=1.7.10-1.1.3.140 -codechickencoreVersion=1.7.10-1.0.7.47 -neiVersion=1.7.10-1.0.5.120 -wailaVersion=1.5.10_1.7.10 -galacticraftVersion=1.7-3.0.12.504 -galacticGregVersion=master-SNAPSHOT -buildcraftVersion=7.1.23 -forestryVersion=4.4.0.0 -enderioVersion=1.7.10-2.3.0.429_beta -enderCoreVersion=1.7.10-0.2.0.39_beta diff --git a/repositories.gradle b/repositories.gradle new file mode 100644 index 0000000000..130197c8aa --- /dev/null +++ b/repositories.gradle @@ -0,0 +1,26 @@ +// Add any additional repositories for your dependencies here + +repositories { + maven { + name "OpenComputers Repo" + url = "http://maven.cil.li/" + } + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url "https://cursemaven.com" + } + maven { + url = "https://jitpack.io" + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f7fc68f278..21ecee23f8 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,10 +1,10 @@ [ { - "modid": "tectech", - "name": "TecTech", + "modid": "${modId}", + "name": "${modName}", "description": "TecTech - Tec Technology Interdimensional! Replace UUMatter with something overly complicated and annoying! (GT5u Addon)", - "version": "${version}", - "mcversion": "${mcversion}", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", "url": "", "updateUrl": "", "authorList": ["_Technus_"], -- cgit From 048b3f5fec7d0e04ec748a279c47734567d84678 Mon Sep 17 00:00:00 2001 From: GTNH-Afx237v7 <64365566+GTNH-Afx237v7@users.noreply.github.com> Date: Wed, 15 Dec 2021 13:08:06 +0100 Subject: Adjust ultimate battery soldering alloy amount see #9131 --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index ba72375f80..85db52223c 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1384,7 +1384,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Parts_DiodeASMD.get(64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760), + Materials.SolderingAlloy.getMolten(4608), Materials.Naquadria.getMolten(9216), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) }, ItemList.ZPM3.get(1), 4000, 1600000); -- cgit From 174827add16a3c4e539d46ac278cc032569ccfa4 Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Mon, 3 Jan 2022 11:10:58 +0000 Subject: Change computation & time requirements on infinite pump. Discussed in discord. --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b8fa84543d..646158cc5b 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -172,7 +172,7 @@ public class DreamCraftRecipeLoader implements Runnable { //infinite oil rig TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.OilDrill3.get(1), - 1843200, 1024, 2000000, 4, new ItemStack[]{ + 16777216, 2048, 2000000, 4, new ItemStack[]{ ItemList.OilDrill3.get(1), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 4), @@ -185,7 +185,7 @@ public class DreamCraftRecipeLoader implements Runnable { }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(1296), Materials.Neutronium.getMolten(576) - }, ItemList.OilDrillInfinite.get(1), 1200, 2000000); + }, ItemList.OilDrillInfinite.get(1), 6000, 2000000); //Tesla Base GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ -- cgit From bb064e24a37791838c49f5db2537acfe3cfbc36f Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 8 Jan 2022 21:16:46 +0100 Subject: Add aspect EM containers to creative tab --- .../thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java | 2 +- .../elementalMatter/definitions/AspectDefinitionCompatEnabled.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java index 2d531858d0..c3231e6132 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java @@ -11,7 +11,7 @@ import java.util.HashMap; */ public class AspectDefinitionCompat { public static AspectDefinitionCompat aspectDefinitionCompat; - static final HashMap defToAspect = new HashMap<>(); + public static final HashMap defToAspect = new HashMap<>(); public static final HashMap aspectToDef = new HashMap<>(); public void run(){} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java index da930a1d79..3cb2eafccd 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java @@ -8,6 +8,7 @@ import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; /** * Created by Tec on 21.05.2017. @@ -58,6 +59,8 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } } } + + STACKS_REGISTERED.addAll(defToAspect.keySet()); } @Override -- cgit From de8bf3e68e9e4d7cee485d0d6951a4e4ccb5859d Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 9 Jan 2022 19:19:04 +0100 Subject: Cleanup and update EM turret projectile --- .../entity/projectiles/projectileEM.java | 55 +++++++++------------- .../tileentity/turret/TileTurretHeadEM.java | 19 +++++++- .../core/transformations/bTransformationInfo.java | 7 ++- .../item/DebugElementalInstanceContainer_EM.java | 5 +- 4 files changed, 49 insertions(+), 37 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index 702ed77315..92acd71ecd 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -18,6 +18,8 @@ import openmodularturrets.tileentity.turretbase.TurretBase; import openmodularturrets.util.PlayerUtil; import openmodularturrets.util.TurretHeadUtil; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; + /** * Created by Bass on 27/07/2017. @@ -26,7 +28,7 @@ public class projectileEM extends LaserProjectile { public float gravity=0; private TurretBase turretBase; - private boolean exotic, antiMatter,isAmped; + private boolean strange, antiMatter,isAmped; private int ampLevel; @@ -45,36 +47,23 @@ public class projectileEM extends LaserProjectile { } } - public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStackMap avalableEM) { + public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStack projectileContent) { super(par1World, turretBase); this.turretBase = turretBase; - boolean onlyQuarks=true; - if(avalableEM!=null && avalableEM.hasStacks()) { - for (cElementalInstanceStack stack : avalableEM.values()) { - if (!(stack.definition instanceof eQuarkDefinition)) { - onlyQuarks = false; - } - } - if (onlyQuarks) { - avalableEM.clear(); - } else { - cElementalInstanceStack consumeFromThis=avalableEM.get(TecTech.RANDOM.nextInt(avalableEM.size())); - massFactor =(float) (consumeFromThis.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); + if(projectileContent != null){ + massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); - if(consumeFromThis.definition.getType()>1 || consumeFromThis.definition.getType()<-1) { - exotic = true; - } - if(consumeFromThis.definition.getType()<0) { - antiMatter = true; - } - - if (consumeFromThis.definition.getCharge() == 0) { - gravity = massFactor / 100f; - } else { - gravity = Math.min(0.0025F / Math.abs(consumeFromThis.definition.getCharge()), massFactor / 100f); - } + if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) { + strange = true; + } + if(projectileContent.definition.getType()<0) { + antiMatter = true; + } - avalableEM.removeAmount(false,consumeFromThis.definition.getStackForm(1)); + if (projectileContent.definition.getCharge() == 0) { + gravity = massFactor / 100f; + } else { + gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f); } } //todo make the recipe require some overflow hatches @@ -97,7 +86,8 @@ public class projectileEM extends LaserProjectile { worldObj.createExplosion(null, movingobjectposition.blockX + 0.5D, movingobjectposition.blockY + 0.5D, - movingobjectposition.blockZ + 0.5D, (exotic?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); + movingobjectposition.blockZ + 0.5D, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } else { return; } @@ -107,18 +97,18 @@ public class projectileEM extends LaserProjectile { if(movingobjectposition.entityHit != null && !worldObj.isRemote) { worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); if(movingobjectposition.entityHit != null && !worldObj.isRemote) { - float damage = (exotic?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); + float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); if(movingobjectposition.entityHit instanceof EntityPlayer) { if(canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { - movingobjectposition.entityHit.setFire((exotic?10:1)*2); + movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; } } } else { - movingobjectposition.entityHit.setFire((exotic?10:1)*2); + movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; @@ -133,7 +123,8 @@ public class projectileEM extends LaserProjectile { worldObj.createExplosion(null, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, - movingobjectposition.entityHit.posZ, (exotic?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); + movingobjectposition.entityHit.posZ, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 2de6b39c4c..1c8d476a36 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -1,8 +1,12 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -13,6 +17,8 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; + /** * Created by Bass on 27/07/2017. */ @@ -64,7 +70,18 @@ public class TileTurretHeadEM extends TurretHead{ @Override public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { - return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), hatchContentPointer); + while(hatchContentPointer!=null && hatchContentPointer.hasStacks()) { + cElementalInstanceStack stack = hatchContentPointer.get(TecTech.RANDOM.nextInt(hatchContentPointer.size())); + if(stack.amount fluidQuantization=new HashMap<>(32); public static final Map itemQuantization=new HashMap<>(32); 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 6850b24e0f..bfd7d266c0 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 @@ -31,8 +31,7 @@ import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -145,7 +144,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE for(iElementalDefinition definition: STACKS_REGISTERED){ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT)))); list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 144 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT *1000)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); } } -- cgit From e84ef7e2100575e7941a6329edc56dafa261aee7 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 13 Jan 2022 22:27:27 +0100 Subject: This should make the EM anomaly and projectile as it was --- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 53 ++--- .../openComputers/AvrArchitecture.java | 2 +- .../entity/projectiles/projectileEM.java | 105 ++++----- .../tileentity/turret/TileTurretHeadEM.java | 11 +- .../definitions/AspectDefinitionCompat.java | 30 --- .../definitions/AspectDefinitionCompatEnabled.java | 81 ------- .../definitions/dComplexAspectDefinition.java | 8 +- .../definitions/ePrimalAspectDefinition.java | 7 +- .../definitions/iElementalAspect.java | 8 - .../transformations/AspectDefinitionCompat.java | 29 +++ .../AspectDefinitionCompatEnabled.java | 81 +++++++ .../thing/metaTileEntity/multi/EssentiaCompat.java | 10 +- .../multi/EssentiaCompatEnabled.java | 33 +-- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 74 ++++-- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 14 +- .../github/technus/tectech/loader/MainLoader.java | 6 +- .../tectech/loader/thing/MachineLoader.java | 13 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 247 +++++++++++++-------- .../tectech/mechanics/anomaly/CancerCommand.java | 10 +- .../tectech/mechanics/anomaly/ChargeCommand.java | 10 +- .../core/transformations/bTransformationInfo.java | 53 +++-- .../definitions/complex/dAtomDefinition.java | 163 +++++++------- .../definitions/complex/dHadronDefinition.java | 4 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 10 +- .../multi/GT_MetaTileEntity_EM_decay.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 12 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 +- .../thing/tileEntity/ReactorSimTileEntity.java | 2 +- 28 files changed, 590 insertions(+), 490 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index 32db2caed9..f3120fda25 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.gtpp; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; @@ -58,34 +59,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); generate("GERMANIUM",true,true); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java index 2842a71df3..595d814fc5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java @@ -21,7 +21,7 @@ import li.cil.oc.api.machine.Signal; import li.cil.oc.common.SaveHandler; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import org.apache.commons.io.IOUtils; +import org.apache.commons.compress.utils.IOUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index 92acd71ecd..a0b6106151 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -1,10 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -18,8 +16,6 @@ import openmodularturrets.tileentity.turretbase.TurretBase; import openmodularturrets.util.PlayerUtil; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; - /** * Created by Bass on 27/07/2017. @@ -33,6 +29,7 @@ public class projectileEM extends LaserProjectile { private int ampLevel; private float massFactor; + private double mass,charge; public projectileEM(World par1World) { super(par1World); @@ -51,6 +48,8 @@ public class projectileEM extends LaserProjectile { super(par1World, turretBase); this.turretBase = turretBase; if(projectileContent != null){ + mass=projectileContent.getMass(); + charge=projectileContent.getCharge(); massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) { @@ -66,66 +65,70 @@ public class projectileEM extends LaserProjectile { gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f); } } - //todo make the recipe require some overflow hatches - - //todo add more subspace pollution } @Override protected void onImpact(MovingObjectPosition movingobjectposition) { if(ticksExisted > 1) { - if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - if(hitBlock != null){ - if (hitBlock.getMaterial().isSolid() && TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - movingobjectposition.blockX, - movingobjectposition.blockY, - movingobjectposition.blockZ); - worldObj.createExplosion(null, - movingobjectposition.blockX + 0.5D, - movingobjectposition.blockY + 0.5D, - movingobjectposition.blockZ + 0.5D, - (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } else { - return; - } - } - } - - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { + if(!worldObj.isRemote){ worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { - float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); - - if(movingobjectposition.entityHit instanceof EntityPlayer) { - if(canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { + switch (movingobjectposition.typeOfHit){ + case BLOCK: + Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + if(hitBlock != null){ + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter && hitBlock.getMaterial().isSolid()) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + movingobjectposition.blockX, + movingobjectposition.blockY, + movingobjectposition.blockZ); + worldObj.createExplosion(null, + movingobjectposition.blockX + 0.5D, + movingobjectposition.blockY + 0.5D, + movingobjectposition.blockZ + 0.5D, + TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * (strange ? 10 : 1) * massFactor * (isAmped ? ampLevel * .1f + 1 : 1) * (ticksExisted / 250f), true); + } else { + return; + } + } + break; + case ENTITY: + float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); + + if(movingobjectposition.entityHit instanceof EntityPlayer) { + EntityPlayer player=(EntityPlayer)movingobjectposition.entityHit; + if(canDamagePlayer(player)) { + movingobjectposition.entityHit.setFire((strange ?10:1)*2); + movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); + if(antiMatter) { + movingobjectposition.entityHit.hurtResistantTime = 0; + } + if(strange){ + TecTech.anomalyHandler.addCancer(player,mass); + } + if(charge!=0) { + TecTech.anomalyHandler.addCharge(player,charge); + } + } + } else { movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; } } - } else { - movingobjectposition.entityHit.setFire((strange ?10:1)*2); - movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); - if(antiMatter) { - movingobjectposition.entityHit.hurtResistantTime = 0; + + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + (int)movingobjectposition.entityHit.posX, + (int)movingobjectposition.entityHit.posY, + (int)movingobjectposition.entityHit.posZ); + worldObj.createExplosion(null, + movingobjectposition.entityHit.posX, + movingobjectposition.entityHit.posY, + movingobjectposition.entityHit.posZ, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } - } - - if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - (int)movingobjectposition.entityHit.posX, - (int)movingobjectposition.entityHit.posY, - (int)movingobjectposition.entityHit.posZ); - worldObj.createExplosion(null, - movingobjectposition.entityHit.posX, - movingobjectposition.entityHit.posY, - movingobjectposition.entityHit.posZ, - (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } + break; } } setDead(); diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 1c8d476a36..fd039a0630 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -5,8 +5,6 @@ import com.github.technus.tectech.compatibility.openmodularturrets.entity.projec import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -17,7 +15,8 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; /** * Created by Bass on 27/07/2017. @@ -72,8 +71,8 @@ public class TileTurretHeadEM extends TurretHead{ public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { while(hatchContentPointer!=null && hatchContentPointer.hasStacks()) { cElementalInstanceStack stack = hatchContentPointer.get(TecTech.RANDOM.nextInt(hatchContentPointer.size())); - if(stack.amount defToAspect = new HashMap<>(); - public static final HashMap aspectToDef = new HashMap<>(); - - public void run(){} - - Object getAspect(cElementalDefinition definition){ - return null; - } - - String getAspectTag(cElementalDefinition definition){ - return null; - } - - iElementalDefinition getDefinition(String aspect){ - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java deleted file mode 100644 index 3cb2eafccd..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import thaumcraft.api.aspects.Aspect; - -import java.util.ArrayList; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; - -/** - * Created by Tec on 21.05.2017. - */ -public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { - @Override - public void run(){ - defToAspect.put(magic_air,"aer"); - defToAspect.put(magic_earth,"terra"); - defToAspect.put(magic_fire,"ignis"); - defToAspect.put(magic_water,"aqua"); - defToAspect.put(magic_order,"ordo"); - defToAspect.put(magic_entropy,"perditio"); - - aspectToDef.put("aer",magic_air); - aspectToDef.put("terra",magic_earth); - aspectToDef.put("ignis",magic_fire); - aspectToDef.put("aqua",magic_water); - aspectToDef.put("ordo",magic_order); - aspectToDef.put("perditio",magic_entropy); - - ArrayList list=Aspect.getCompoundAspects(); - Aspect[] array= list.toArray(new Aspect[0]); - while (!list.isEmpty()) { - for (Aspect aspect : array) { - if (list.contains(aspect)) { - Aspect[] content = aspect.getComponents(); - if (content.length != 2) { - list.remove(aspect); - }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ - try { - dComplexAspectDefinition newAspect; - if(content[0].getTag().equals(content[1].getTag())){ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(2) - ); - }else{ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(1), aspectToDef.get(content[1].getTag()).getStackForm(1) - ); - } - aspectToDef.put(aspect.getTag(),newAspect); - defToAspect.put(newAspect,aspect.getTag()); - }catch (tElementalException e) { - /**/ - }finally { - list.remove(aspect); - } - } - } - } - } - - STACKS_REGISTERED.addAll(defToAspect.keySet()); - } - - @Override - Aspect getAspect(cElementalDefinition definition) { - return Aspect.getAspect(defToAspect.get(definition)); - } - - @Override - String getAspectTag(cElementalDefinition definition) { - return defToAspect.get(definition); - } - - @Override - iElementalDefinition getDefinition(String aspect) { - return aspectToDef.get(aspect); - } - -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java index ddef29b214..8f570c1247 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; @@ -24,7 +25,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class dComplexAspectDefinition extends cElementalDefinition implements iElementalAspect { +public final class dComplexAspectDefinition extends cElementalDefinition { private final int hash; public final double mass; @@ -252,11 +253,6 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme return null; } - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - @Override public iElementalDefinition getAnti() { return null; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java index 02e7d2fe21..9c6d107bff 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java @@ -8,7 +8,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class ePrimalAspectDefinition extends cElementalPrimitive implements iElementalAspect { +public final class ePrimalAspectDefinition extends cElementalPrimitive { public static final ePrimalAspectDefinition magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), @@ -35,11 +35,6 @@ public final class ePrimalAspectDefinition extends cElementalPrimitive implement return translateToLocal("tt.keyword.Primal") + ": " + name; } - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - @Override public boolean isTimeSpanHalfLife() { return false; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java deleted file mode 100644 index 3cb2d8e5e8..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -/** - * Created by Tec on 21.05.2017. - */ -public interface iElementalAspect { - Object materializeIntoAspect(); -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java new file mode 100644 index 0000000000..343071e26e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -0,0 +1,29 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import java.util.HashMap; + +/** + * Created by Tec on 21.05.2017. + */ +public class AspectDefinitionCompat { + public static AspectDefinitionCompat aspectDefinitionCompat; + public final HashMap defToAspect = new HashMap<>(); + public final HashMap aspectToDef = new HashMap<>(); + + public void run(){} + + public Object getAspect(iElementalDefinition definition){ + return null; + } + + public String getAspectTag(iElementalDefinition definition){ + return null; + } + + public iElementalDefinition getDefinition(String aspect){ + return null; + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java new file mode 100644 index 0000000000..446e9b66d5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -0,0 +1,81 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import thaumcraft.api.aspects.Aspect; + +import java.util.ArrayList; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; + +/** + * Created by Tec on 21.05.2017. + */ +public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { + @Override + public void run(){ + defToAspect.put(magic_air,"aer"); + defToAspect.put(magic_earth,"terra"); + defToAspect.put(magic_fire,"ignis"); + defToAspect.put(magic_water,"aqua"); + defToAspect.put(magic_order,"ordo"); + defToAspect.put(magic_entropy,"perditio"); + + aspectToDef.put("aer",magic_air); + aspectToDef.put("terra",magic_earth); + aspectToDef.put("ignis",magic_fire); + aspectToDef.put("aqua",magic_water); + aspectToDef.put("ordo",magic_order); + aspectToDef.put("perditio",magic_entropy); + + ArrayList list=Aspect.getCompoundAspects(); + Aspect[] array= list.toArray(new Aspect[0]); + while (!list.isEmpty()) { + for (Aspect aspect : array) { + if (list.contains(aspect)) { + Aspect[] content = aspect.getComponents(); + if (content.length != 2) { + list.remove(aspect); + }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ + try { + dComplexAspectDefinition newAspect; + if(content[0].getTag().equals(content[1].getTag())){ + newAspect = new dComplexAspectDefinition( + aspectToDef.get(content[0].getTag()).getStackForm(2)); + }else{ + newAspect = new dComplexAspectDefinition( + aspectToDef.get(content[0].getTag()).getStackForm(1), + aspectToDef.get(content[1].getTag()).getStackForm(1)); + } + aspectToDef.put(aspect.getTag(),newAspect); + defToAspect.put(newAspect,aspect.getTag()); + }catch (tElementalException e) { + /**/ + }finally { + list.remove(aspect); + } + } + } + } + } + + STACKS_REGISTERED.addAll(defToAspect.keySet()); + } + + @Override + public Aspect getAspect(iElementalDefinition definition) { + return Aspect.getAspect(defToAspect.get(definition)); + } + + @Override + public String getAspectTag(iElementalDefinition definition) { + return defToAspect.get(definition); + } + + @Override + public iElementalDefinition getDefinition(String aspect) { + return aspectToDef.get(aspect); + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index e77cab2734..63f55912a6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; @@ -18,11 +18,15 @@ public class EssentiaCompat { return null; } - public boolean putElementalInstanceStack(TileEntity conatainer, cElementalInstanceStack stack){ + public String getEssentiaName(iElementalDefinition stack){ + return null; + } + + public boolean putInContainer(TileEntity container, String name){ return false; } - public cElementalInstanceStack getFromContainer(TileEntity container){ + public iElementalDefinition getFromContainer(TileEntity container){ return null; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index 484377b179..03ff92b4e0 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,8 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.iElementalAspect; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; @@ -11,7 +9,7 @@ import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.common.tiles.TileEssentiaReservoir; import thaumcraft.common.tiles.TileJarFillable; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectToDef; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; /** * Created by Tec on 21.05.2017. @@ -30,22 +28,28 @@ public class EssentiaCompatEnabled extends EssentiaCompat { } @Override - public boolean putElementalInstanceStack(TileEntity container,cElementalInstanceStack stack){ - if(container==null || container.isInvalid()) { + public String getEssentiaName(iElementalDefinition stack) { + return aspectDefinitionCompat.defToAspect.get(stack); + } + + @Override + public boolean putInContainer(TileEntity container, String aspectName) { + if (container == null || container.isInvalid() || aspectName == null || aspectName.isEmpty()) { return false; } - if(container instanceof IAspectContainer && stack.definition instanceof iElementalAspect){ - Aspect aspect=(Aspect) ((iElementalAspect) stack.definition).materializeIntoAspect(); - if(aspect!=null){ - ((IAspectContainer) container).addToContainer(aspect,1); - return true; + if (container instanceof IAspectContainer) { + Aspect aspect = Aspect.getAspect(aspectName); + if(aspect==null){ + return false; } + int remaining=((IAspectContainer) container).addToContainer(aspect, 1); + return remaining==0; } return false; } @Override - public cElementalInstanceStack getFromContainer(TileEntity container){ + public iElementalDefinition getFromContainer(TileEntity container){ if(container==null || container.isInvalid()) { return null; } @@ -55,10 +59,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { Aspect[] aspectsArr= aspects.getAspects(); if(aspectsArr!=null && aspectsArr[0]!=null){ if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){ - cElementalDefinition def=aspectToDef.get(aspectsArr[0].getTag()); - if(def!=null){ - return new cElementalInstanceStack(def,1); - } + return aspectDefinitionCompat.aspectToDef.get(aspectsArr[0].getTag()); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 87e2660e01..c11a68b5d0 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,12 +1,11 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; @@ -19,12 +18,16 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -61,6 +64,8 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.3"),//General - Some sort of Essentia Storage }; + + private String outputEssentiaName; //endregion public GT_MetaTileEntity_EM_essentiaDequantizer(int aID, String aName, String aNameRegional) { @@ -88,24 +93,49 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ stopMachine(); return false; } + cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContainerHandler(); - if (inputHatchContainer.hasStacks()) { - cElementalInstanceStack stack = inputHatchContainer.getFirst(); - inputHatchContainer.removeAmount(false, new cElementalInstanceStack(stack.definition, 1)); - if (!essentiaContainerCompat.putElementalInstanceStack(container, stack)) { - cleanStackEM_EM(stack); - } - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - eAmpereFlow = 1; - if (stack.definition instanceof ePrimalAspectDefinition) { - mEUt = (int) -V[8]; + if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) { + return false; + } + + cElementalInstanceStack stack = inputHatchContainer.get(TecTech.RANDOM.nextInt(inputHatchContainer.size())); + if (stack.amount < AVOGADRO_CONSTANT_DIMINISHED) { + cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + mEUt = (int) -V[6]; + } else { + outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.definition); + Aspect aspect = Aspect.getAspect(outputEssentiaName); + if (aspect == null) { + outputEssentiaName = null; + cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + mEUt = (int) -V[7]; } else { - mEUt = (int) -V[10]; + inputHatchContainer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT)); + if (aspect.isPrimal()) { + mEUt = (int) -V[8]; + } else { + mEUt = (int) -V[10]; + } + } + } + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eAmpereFlow = 1; + return true; + } + + @Override + public void outputAfterRecipe_EM() { + TileEntity container = essentiaContainerCompat.getContainer(this); + if (container == null) { + stopMachine(); + }else{ + if(!essentiaContainerCompat.putInContainer(container,outputEssentiaName)){ + stopMachine(); } - return true; } - return false; + outputEssentiaName=null; } @Override @@ -147,4 +177,16 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ public String[] getStructureDescription(ItemStack stackSize) { return description; } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setString("eOutputEssentia",outputEssentiaName); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + outputEssentiaName=aNBT.getString("eOutputEssentia"); + } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index a716420e81..74dff47aa4 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -5,8 +5,9 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defin import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; @@ -19,12 +20,12 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -83,16 +84,15 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkRecipe_EM(ItemStack itemStack) { - TileEntity container = essentiaContainerCompat.getContainer(this); - cElementalInstanceStack newStack = essentiaContainerCompat.getFromContainer(container); - if (newStack != null) { + iElementalDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); + if (definition != null) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; eAmpereFlow = 1; outputEM = new cElementalInstanceStackMap[]{ - new cElementalInstanceStackMap(newStack) + new cElementalInstanceStackMap(new cElementalInstanceStack(definition,AVOGADRO_CONSTANT)) }; - if (newStack.definition instanceof ePrimalAspectDefinition) { + if (definition instanceof ePrimalAspectDefinition) { mEUt = (int) -V[8]; } else { mEUt = (int) -V[10]; diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index d473da6b07..b3c8d24a7c 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompatEnabled; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompatEnabled; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; @@ -40,7 +40,7 @@ import java.util.HashSet; import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.TecTech.*; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectDefinitionCompat; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 0bf8c57f24..91dbffa71f 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -15,6 +15,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; @@ -73,22 +74,22 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f*AVOGADRO_CONSTANT).getStackForm(1L)); // =================================================================================================== 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 dd388bc233..0e1771e88d 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 @@ -1,7 +1,6 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; @@ -9,6 +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.dAtomDefinition; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -20,6 +20,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -28,15 +29,20 @@ import net.minecraftforge.event.world.ChunkEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; public class AnomalyHandler implements IChunkMetaDataHandler { - public static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 10000D; - public static final int COUNT_DIV=32; - public static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; - public static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; - public static final int MEAN_DELAY =50; - private static final float CHARGE_EFFECTIVENESS = 10; - private static final float CHARGE_EXPLOSIVENESS = 5; + private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... + private static final int COUNT_DIV=32; + private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; + private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; + private static final int MEAN_DELAY =50; + private static final double CANCER_EFFECTIVENESS = 1/AVOGADRO_CONSTANT; + private static final double CHARGE_EFFECTIVENESS = 10/AVOGADRO_CONSTANT; + private static final double CHARGE_EXPLOSIVENESS = 5/AVOGADRO_CONSTANT; private boolean fixMe=false; private final ArrayList playersWithCharge = new ArrayList<>(); @@ -62,8 +68,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { public void tickWorld(HashMap data, TickEvent.WorldTickEvent aEvent) { if (TecTech.RANDOM.nextInt(MEAN_DELAY) == 0) { int dim = aEvent.world.provider.dimensionId; - data.get(dim).forEach((chunkCoordIntPair, compound) -> { - if (compound.getDouble(INTENSITY) >= SWAP_THRESHOLD) { + ChunkDataHandler.ChunkHashMap chunkHashMap = data.get(dim); + chunkHashMap.forEach((chunkCoordIntPair, compound) -> { + if (compound.getDouble(INTENSITY) > SWAP_THRESHOLD) { Chunk chunk = aEvent.world.getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos, chunkCoordIntPair.chunkZPos); if (chunk.isChunkLoaded) { worldDataArrayList.add(chunk); @@ -72,21 +79,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { }); if (worldDataArrayList.size() >= 2) { Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - Chunk b = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - double avg = .5 * (data.get(dim).get(a.getChunkCoordIntPair()).getDouble(INTENSITY) + - data.get(dim).get(b.getChunkCoordIntPair()).getDouble(INTENSITY)); - data.get(dim).get(a.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).get(b.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).markForTransmissionToClient(a.getChunkCoordIntPair()); - data.get(dim).markForTransmissionToClient(b.getChunkCoordIntPair()); - swapSomething(a, b, (float) Math.min(Math.log10(avg), 20)); + Chunk b = worldDataArrayList.get(TecTech.RANDOM.nextInt(worldDataArrayList.size())); + ChunkCoordIntPair aCoords = a.getChunkCoordIntPair(); + ChunkCoordIntPair bCoords = b.getChunkCoordIntPair(); + + double newValue = (chunkHashMap.get(aCoords).getDouble(INTENSITY) + + chunkHashMap.get(bCoords).getDouble(INTENSITY))/2-SWAP_THRESHOLD/8; + float split=TecTech.RANDOM.nextFloat(); + + chunkHashMap.get(aCoords).setDouble(INTENSITY, newValue * split); + chunkHashMap.get(bCoords).setDouble(INTENSITY, newValue * (1-split)); + chunkHashMap.markForTransmissionToClient(aCoords); + chunkHashMap.markForTransmissionToClient(bCoords); + swapSomething(a, b, newValue); } worldDataArrayList.clear(); } for (Object o : aEvent.world.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { - float charge = TecTech.playerPersistence.getDataOrSetToNewTag((EntityPlayer) o).getFloat(SPACE_CHARGE); - if (charge != 0) { + if (getCharge((EntityPlayer) o) != 0) { playersWithCharge.add((EntityPlayer) o); } } @@ -94,25 +105,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { if (playersWithCharge.size() > 0) { outer: for (EntityPlayer other : playersWithCharge) { - float fieldOther = TecTech.playerPersistence.getDataOrSetToNewTag(other).getFloat(SPACE_CHARGE); + double fieldOther = getCharge(other); for (EntityPlayer player : playersWithCharge) { if (other == player) { continue outer; } - float field = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); - float difference = Math.abs(field - fieldOther); - if (difference != 0) { + double field = getCharge(player); + double absDifference = Math.abs(field - fieldOther); + if (absDifference != 0) { if (player.getDistanceSqToEntity(other) < 1) { - float avg = (fieldOther + field) / 2; - addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * difference)); - other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.getDataOrSetToNewTag(other).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.saveData(player); - TecTech.playerPersistence.saveData(other); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(other)); + double avg = (fieldOther + field) / 2; + //addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * absDifference)); + if(TecTech.configTecTech.BOOM_ENABLE){ + other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ,(float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, (float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + } + GT_Utility.sendSoundToPlayers(other.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)other.posX, (int)other.posY, (int)other.posZ); + GT_Utility.sendSoundToPlayers(player.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)player.posX, (int)player.posY, (int)player.posZ); + setCharge(player,avg); + setCharge(other,avg); } } } @@ -121,8 +132,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - private void swapSomething(Chunk a,Chunk b,float power) { - for (int i = 0; i < 64; i++) { + private void swapSomething(Chunk a,Chunk b,double mass) { + float explosionPower=(float) Math.log(mass/AVOGADRO_CONSTANT); + for (int i = 0; i < Math.min((int)explosionPower,64); i++) { int x = TecTech.RANDOM.nextInt(16); int y = TecTech.RANDOM.nextInt(a.worldObj.getActualHeight()); int z = TecTech.RANDOM.nextInt(16); @@ -143,12 +155,14 @@ public class AnomalyHandler implements IChunkMetaDataHandler { a.worldObj.setBlockToAir((a.xPosition << 4) + x, y, (a.zPosition << 4) + z); b.worldObj.setBlockToAir((b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } - if (TecTech.RANDOM.nextBoolean()) { - a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, power, true); + if(TecTech.configTecTech.BOOM_ENABLE){ + if (TecTech.RANDOM.nextBoolean()) { + a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(a.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (a.xPosition << 4) + x, y, (a.zPosition << 4) + z); - } - if (TecTech.RANDOM.nextBoolean()) { - b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, power, true); + if (TecTech.RANDOM.nextBoolean()) { + b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(b.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } } @@ -156,13 +170,13 @@ public class AnomalyHandler implements IChunkMetaDataHandler { 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)); - aE.forEach(o -> { + for (EntityLivingBase entityLivingBase : aE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (entityLivingBase instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) entityLivingBase); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.hunger.id, 1200)); player.addPotionEffect(new PotionEffect(Potion.weakness.id, 1000)); player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 800)); @@ -171,36 +185,35 @@ public class AnomalyHandler implements IChunkMetaDataHandler { player.addPotionEffect(new PotionEffect(Potion.poison.id, 200)); player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); player.addPotionEffect(new PotionEffect(Potion.wither.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)-(float)Math.abs(TecTech.RANDOM.nextGaussian())); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, -mass * TecTech.RANDOM.nextFloat()); } + } else { + entityLivingBase.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + entityLivingBase.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); - bE.forEach(o -> { + } + for (EntityLivingBase o : bE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (o instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) o); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) -(explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 800)); player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 600)); player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 400)); player.addPotionEffect(new PotionEffect(Potion.jump.id, 200)); player.addPotionEffect(new PotionEffect(Potion.resistance.id, 100)); player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)+(float)Math.abs(TecTech.RANDOM.nextGaussian())); - - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, mass * TecTech.RANDOM.nextFloat()); } + } else { + o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); + o.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); + } } @Override @@ -218,38 +231,36 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - data.get(player.worldObj.provider.dimensionId).forEach((chunkCoordIntPair, dat) -> { + for (Map.Entry entry : data.get(player.worldObj.provider.dimensionId).entrySet()) { + ChunkCoordIntPair chunkCoordIntPair = entry.getKey(); + NBTTagCompound dat = entry.getValue(); if (Math.abs(chunkCoordIntPair.getCenterXPos() - player.posX) + Math.abs(chunkCoordIntPair.getCenterZPosition() - player.posZ) < 256) { - for (int i = 0, pow = (int) Math.min(32, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { + for (int i = 0, pow = (int) Math.min(COUNT_DIV, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { TecTech.proxy.em_particle(player.worldObj, chunkCoordIntPair.getCenterXPos() + TecTech.RANDOM.nextGaussian() * 32D, player.posY + TecTech.RANDOM.nextFloat() * 128D - 64D, chunkCoordIntPair.getCenterZPosition() + TecTech.RANDOM.nextGaussian() * 32D); } } - }); + } } else if (TecTech.RANDOM.nextInt(50) == 0) { EntityPlayer player = aEvent.player; ChunkCoordIntPair pair = new ChunkCoordIntPair(player.chunkCoordX, player.chunkCoordZ); NBTTagCompound compound = data.get(player.worldObj.provider.dimensionId).get(pair); NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); boolean saveRequired = false; - if(player.capabilities.isCreativeMode){ - if (playerTag.getDouble(SPACE_CANCER) != 0) { - playerTag.setDouble(SPACE_CANCER, 0); - saveRequired = true; - } - }else { + if (!player.capabilities.isCreativeMode) { + double cancer=getCancer(player); if (compound != null) { int badness = (int) Math.min(COUNT_DIV, compound.getDouble(INTENSITY) / PER_PARTICLE); if (badness > 0) { - playerTag.setDouble(SPACE_CANCER, Math.min(2, playerTag.getDouble(SPACE_CANCER) + 9.765625E-4f * badness)); + playerTag.setDouble(SPACE_CANCER, Math.min(2, cancer + 9.765625E-4f * badness)); player.attackEntityFrom(MainLoader.subspace,Math.max(1,badness/8f)); saveRequired = true; } } else if (playerTag.getDouble(SPACE_CANCER) > 0 && !player.isDead) { if (player.ticksExisted % 10 == 0) { - playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-5f)); + playerTag.setDouble(SPACE_CANCER, Math.max(0, cancer - 7.6293945E-5f)); saveRequired = true; } } @@ -267,29 +278,26 @@ public class AnomalyHandler implements IChunkMetaDataHandler { EntityPlayer player=TecTech.proxy.getPlayer(); if(player!=null) { if(!player.capabilities.isCreativeMode) { - NBTTagCompound tagCompound = TecTech.playerPersistence.getDataOrSetToNewTag(player); - if (tagCompound != null) { - float cancer = tagCompound.getFloat(SPACE_CANCER); - if (cancer > 0) { - player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); - player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer); - cancer*=cancer/2F; - if (cancer > 1.75f) { - player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } else { - player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } + double cancer = getCancer(player)*CANCER_EFFECTIVENESS; + if (cancer > 0) { + player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); + player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer); + cancer*=cancer/2F; + if (cancer > 1.75f) { + player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); + } else { + player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); } } - float charge = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); + double charge = getCharge(player); if(charge!=0) { for (Object o : player.worldObj.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { EntityPlayer otherPlayer=(EntityPlayer)o; - float chargeOther = TecTech.playerPersistence.getDataOrSetToNewTag(otherPlayer).getFloat(SPACE_CHARGE); + double chargeOther = getCharge(otherPlayer); if (chargeOther != 0 && player != o) { - float reaction = chargeOther * charge; + double reaction = chargeOther * charge; if (reaction !=0) { double distanceSq = otherPlayer.getDistanceSqToEntity(player); if (distanceSq >= 1) { @@ -328,19 +336,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { return 100; } - public void addAnomaly(IGregTechTileEntity iGregTechTileEntity, double amount) { - if (iGregTechTileEntity.isServerSide()) { - World w = iGregTechTileEntity.getWorld(); + public void addAnomaly(IGregTechTileEntity gtTile, double amount) { + addAnomaly(gtTile.getWorld(),gtTile.getXCoord(),gtTile.getZCoord(),amount); + } + + public void addAnomaly(TileEntity tileEntity, double amount) { + addAnomaly(tileEntity.getWorldObj(),tileEntity.xCoord,tileEntity.zCoord,amount); + } + + public void addAnomaly(World w,int x,int z, double amount) { + if (!w.isRemote) { addAnomaly(w.provider.dimensionId, new ChunkCoordIntPair( - iGregTechTileEntity.getXCoord() >> 4, - iGregTechTileEntity.getZCoord() >> 4), + x >> 4, + z >> 4), amount); } } public void addAnomaly(int world, ChunkCoordIntPair chunk, double amount) { - amount=Math.abs(amount); NBTTagCompound old = TecTech.chunkDataHandler.getChunkData(this, world, chunk); if (old == null) { NBTTagCompound data = new NBTTagCompound(); @@ -351,4 +365,45 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } TecTech.chunkDataHandler.getChunkData(this, world).markForTransmissionToClient(chunk); } + + public double getCharge(EntityPlayer player){ + return getDouble(player,SPACE_CHARGE); + } + + public void setCharge(EntityPlayer player, double amount){ + setDouble(player,SPACE_CHARGE,amount); + } + + public void addCharge(EntityPlayer player, double amount){ + addDouble(player,SPACE_CHARGE,amount); + } + + public double getCancer(EntityPlayer player){ + return getDouble(player,SPACE_CANCER); + } + + public void setCancer(EntityPlayer player, double amount){ + setDouble(player,SPACE_CANCER,amount); + } + + public void addCancer(EntityPlayer player, double amount){ + addDouble(player,SPACE_CANCER,amount); + } + + public double getDouble(EntityPlayer player,String name){ + return TecTech.playerPersistence.getDataOrSetToNewTag(player).getDouble(name); + } + + public void setDouble(EntityPlayer player,String name, double amount){ + TecTech.playerPersistence.getDataOrSetToNewTag(player).setDouble(name, amount); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } + + public void addDouble(EntityPlayer player,String name, double amount){ + NBTTagCompound data = TecTech.playerPersistence.getDataOrSetToNewTag(player); + data.setDouble(name, amount+data.getDouble(name)); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java index a153671a59..bb61f50aab 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CANCER; - public class CancerCommand implements ICommand { ArrayList aliases=new ArrayList<>(); @@ -39,13 +34,10 @@ public class CancerCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CANCER, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), player); + TecTech.anomalyHandler.setCancer(player,amount); sender.addChatMessage(new ChatComponentText("Cancer set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java index da365a92f8..4190cd0dba 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CHARGE; - public class ChargeCommand implements ICommand { ArrayList aliases=new ArrayList<>(); @@ -33,13 +28,10 @@ public class ChargeCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CHARGE, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + TecTech.anomalyHandler.setCharge(player,amount); sender.addChatMessage(new ChatComponentText("Charge set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java index ec5391a0b4..69a4b9683c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.item.ItemStack; @@ -10,36 +9,64 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static java.lang.Math.pow; /** * Created by Tec on 26.05.2017. */ public class bTransformationInfo { + /** + * Atom count per Mol + */ public static final double AVOGADRO_CONSTANT =6.02214076e23D; - public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000)/AVOGADRO_CONSTANT; - public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / (144 * 1000); - public static final double AVOGADRO_CONSTANT_KIND_OF_SMALLER =AVOGADRO_CONSTANT-AVOGADRO_CONSTANT_EPSILON; - public static final double AVOGADRO_CONSTANT_KIND_OF_BIGGER =AVOGADRO_CONSTANT+AVOGADRO_CONSTANT_EPSILON; + /** + * Min. chance of existing + */ + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48); + public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON; public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; + public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON*144D; public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D; + public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON*1000D; - public static final Map fluidQuantization=new HashMap<>(32); - public static final Map itemQuantization=new HashMap<>(32); - public static final Map oredictQuantization=new HashMap<>(32); + public static bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(); + + public Map fluidQuantization; + public Map itemQuantization; + public Map oredictQuantization; public Map fluidDequantization; public Map itemDequantization; public Map oredictDequantization; - public bTransformationInfo(int fluidCap,int itemCap, int oreCap){ - fluidDequantization = fluidCap > 0 ? new HashMap<>(fluidCap) : Collections.emptyMap(); - itemDequantization = itemCap > 0 ? new HashMap<>(itemCap) : Collections.emptyMap(); - oredictDequantization = oreCap > 0 ? new HashMap<>(oreCap) : Collections.emptyMap(); + private bTransformationInfo() { + this( + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) + ); + } + + public bTransformationInfo( + Map fluidQuantization, + Map itemQuantization, + Map oredictQuantization, + Map fluidDequantization, + Map itemDequantization, + Map oredictDequantization) { + this.fluidQuantization = fluidQuantization; + this.itemQuantization = itemQuantization; + this.oredictQuantization = oredictQuantization; + this.fluidDequantization = fluidDequantization; + this.itemDequantization = itemDequantization; + this.oredictDequantization = oredictDequantization; } public void addFluid(iHasElementalDefinition em, FluidStack fluidStack){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index 965c46cef6..e97d5994e9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -42,7 +42,6 @@ public final class dAtomDefinition extends cElementalDefinition { private static final byte BYTE_OFFSET=32; private final int hash; - public static final bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(16,0,64); public static double refMass, refUnstableMass; private static final byte nbtType = (byte) 'a'; @@ -1319,17 +1318,17 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { - return TRANSFORMATION_INFO.fluidDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.fluidDequantization.get(this); } @Override public aItemDequantizationInfo someAmountIntoItemsStack() { - return TRANSFORMATION_INFO.itemDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.itemDequantization.get(this); } @Override public aOredictDequantizationInfo someAmountIntoOredictStack() { - return TRANSFORMATION_INFO.oredictDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.oredictDequantization.get(this); } private static final class Nomenclature { @@ -1475,119 +1474,119 @@ public final class dAtomDefinition extends cElementalDefinition { /*----STABLE ATOMS----**/ refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); /*----UNSTABLE ATOMS----**/ refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); try { dAtomDefinition temp; - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); double tempMass=temp.getMass(); @@ -1596,7 +1595,7 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); @@ -1605,14 +1604,14 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); somethingHeavy=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index c5efaf1403..4ea5eb3776 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -25,7 +25,7 @@ import java.util.Map; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.TRANSFORMATION_INFO; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; @@ -467,7 +467,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //Added to atom map, but should be in its own cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); - bTransformationInfo.oredictQuantization.put( + TRANSFORMATION_INFO.oredictQuantization.put( OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) ); 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 a5e6dc4d5d..6a9b24ef55 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 @@ -1,7 +1,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.CommonValues; import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -28,9 +28,9 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.Locale; +import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static com.github.technus.tectech.util.CommonValues.DISPERSE_AT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static net.minecraft.util.StatCollector.translateToLocal; @@ -148,10 +148,10 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == DISPERSE_AT) { if (aBaseMetaTileEntity.isActive()) { if (overflowMatter > overflowDisperse) { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse/(Math.pow(2,mTier))); overflowMatter -= overflowDisperse; } else { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter/(Math.pow(2,mTier))); overflowMatter = 0; aBaseMetaTileEntity.setActive(false); aBaseMetaTileEntity.setLightValue((byte) 0); @@ -225,7 +225,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity @Override public void onRemoval() { if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter * 8D); + TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter); if (TecTech.configTecTech.BOOM_ENABLE) { getBaseMetaTileEntity().doExplosion(V[15]); } else { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index d534b41fec..ad7a2c91a6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -51,7 +51,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenON; public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT; - private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; + private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; private String clientLocale = "en_US"; 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 d6ab35cd4b..c3e35ba90c 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 @@ -9,9 +9,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElem import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; @@ -32,6 +31,7 @@ import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; @@ -98,9 +98,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - aItemQuantizationInfo aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); + aItemQuantizationInfo aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -109,7 +109,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - aOredictQuantizationInfo aOQI = bTransformationInfo.oredictQuantization.get(ID); + aOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.oredictQuantization.get(ID); if (aOQI == null) { continue; } @@ -136,7 +136,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - aFluidQuantizationInfo aFQI = bTransformationInfo.fluidQuantization.get(fs.getFluid().getID()); + aFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.fluidQuantization.get(fs.getFluid().getID()); if (aFQI == null) { continue; } 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 9ba6235c83..1fcc0b42f2 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 @@ -2094,13 +2094,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public void doExplosion(long aExplosionPower) { - explodeMultiblock(); if (!TecTech.configTecTech.BOOM_ENABLE) { TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord()); StackTraceElement[] ste = Thread.currentThread().getStackTrace(); TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + ste[2].toString()); return; } + explodeMultiblock(); super.doExplosion(aExplosionPower); }//Redirecting to explodemultiblock //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java index 4d66b28ca6..55fa327364 100644 --- a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -89,7 +89,7 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override public double getReactorEUEnergyOutput() { - return (double)(getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + return getReactorEnergyOutput() * 5.0F * ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear"); } //public List getSubTiles() { -- cgit From dee0db40e8be451b69bc889dca009267f176b758 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 15 Jan 2022 00:16:05 +0100 Subject: Cleanup EM maps --- .../tileentity/turret/TileTurretHeadEM.java | 27 +- .../tileentity/turretbase/TileTurretBaseEM.java | 4 +- .../definitions/dComplexAspectDefinition.java | 42 +- .../definitions/ePrimalAspectDefinition.java | 2 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 6 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 4 +- .../elementalMatter/core/cElementalDecay.java | 75 --- .../core/cElementalDecayResult.java | 41 -- .../core/cElementalDefinitionStackMap.java | 65 --- .../core/cElementalInstanceStackMap.java | 565 --------------------- .../core/cElementalMutableDefinitionStackMap.java | 278 ---------- .../elementalMatter/core/cElementalStackMap.java | 181 ------- .../elementalMatter/core/commands/GiveEM.java | 6 +- .../core/decay/cElementalDecay.java | 77 +++ .../core/decay/cElementalDecayResult.java | 43 ++ .../elementalMatter/core/iElementalContainer.java | 12 + .../core/iElementalInstanceContainer.java | 10 - .../core/maps/cElementalConstantStackMap.java | 58 +++ .../core/maps/cElementalDefinitionStackMap.java | 56 ++ .../core/maps/cElementalInstanceStackMap.java | 214 ++++++++ .../core/maps/cElementalStackMap.java | 50 ++ .../elementalMatter/core/maps/iElementalMapR.java | 187 +++++++ .../elementalMatter/core/maps/iElementalMapRW.java | 130 +++++ .../elementalMatter/core/rElementalRecipe.java | 56 -- .../elementalMatter/core/rElementalRecipeMap.java | 70 --- .../core/recipes/rElementalRecipe.java | 57 +++ .../core/recipes/rElementalRecipeMap.java | 73 +++ .../core/stacks/cElementalDefinitionStack.java | 35 +- .../core/stacks/cElementalInstanceStack.java | 54 +- .../core/stacks/iElementalStack.java | 23 + .../core/stacks/iHasElementalDefinition.java | 18 - .../core/templates/cElementalDefinition.java | 10 +- .../core/templates/cElementalPrimitive.java | 6 +- .../core/templates/iElementalDefinition.java | 6 +- .../transformations/aFluidDequantizationInfo.java | 14 +- .../transformations/aFluidQuantizationInfo.java | 14 +- .../transformations/aItemDequantizationInfo.java | 14 +- .../transformations/aItemQuantizationInfo.java | 16 +- .../aOredictDequantizationInfo.java | 18 +- .../transformations/aOredictQuantizationInfo.java | 18 +- .../core/transformations/bTransformationInfo.java | 16 +- .../definitions/complex/dAtomDefinition.java | 194 ++++--- .../definitions/complex/dHadronDefinition.java | 68 ++- .../primitive/cPrimitiveDefinition.java | 2 +- .../definitions/primitive/eBosonDefinition.java | 4 +- .../definitions/primitive/eLeptonDefinition.java | 2 +- .../definitions/primitive/eNeutrinoDefinition.java | 2 +- .../definitions/primitive/eQuarkDefinition.java | 2 +- .../github/technus/tectech/recipe/TT_recipe.java | 30 +- .../technus/tectech/recipe/TT_recipeAdder.java | 14 +- .../item/DebugElementalInstanceContainer_EM.java | 12 +- .../item/ElementalDefinitionContainer_EM.java | 18 +- .../item/ElementalDefinitionScanStorage_EM.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 8 +- .../GT_MetaTileEntity_Hatch_OutputElemental.java | 2 +- .../multi/GT_MetaTileEntity_EM_collider.java | 36 +- .../multi/GT_MetaTileEntity_EM_decay.java | 8 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 10 +- .../multi/GT_MetaTileEntity_EM_junction.java | 6 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 14 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 10 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 16 +- .../multi/em_machine/Behaviour_Centrifuge.java | 8 +- .../multi/em_machine/Behaviour_Electrolyzer.java | 2 +- .../Behaviour_ElectromagneticSeparator.java | 6 +- .../multi/em_machine/Behaviour_PrecisionLaser.java | 2 +- .../multi/em_machine/Behaviour_Recycler.java | 2 +- .../multi/em_machine/Behaviour_Scanner.java | 2 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 6 +- 69 files changed, 1360 insertions(+), 1779 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index fd039a0630..e027c83107 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -1,9 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; @@ -16,7 +15,6 @@ import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; /** * Created by Bass on 27/07/2017. @@ -54,7 +52,7 @@ public class TileTurretHeadEM extends TurretHead{ @Override public boolean requiresAmmo() { - return hatchContentPointer == null || !hatchContentPointer.hasStacks(); + return hatchContentPointer == null || hatchContentPointer.isEmpty(); } @Override @@ -69,20 +67,15 @@ public class TileTurretHeadEM extends TurretHead{ @Override public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { - while(hatchContentPointer!=null && hatchContentPointer.hasStacks()) { - cElementalInstanceStack stack = hatchContentPointer.get(TecTech.RANDOM.nextInt(hatchContentPointer.size())); - if(stack.amount(); - } - - @Deprecated - public cElementalDefinitionStackMap(iElementalDefinition... in) { - map=new cElementalMutableDefinitionStackMap(in).map; - } - - public cElementalDefinitionStackMap(cElementalDefinitionStack... in) { - map=new cElementalMutableDefinitionStackMap(in).map; - } - - public cElementalDefinitionStackMap(TreeMap in) { - map = new TreeMap<>(in); - } - - cElementalDefinitionStackMap(cElementalMutableDefinitionStackMap unsafeMap){ - map=unsafeMap.map; - } - - //IMMUTABLE DON'T NEED IT - @Override - public cElementalDefinitionStackMap clone() { - return this; - } - - public cElementalMutableDefinitionStackMap toMutable() { - return new cElementalMutableDefinitionStackMap(map); - } - - @Override - @Deprecated//BETTER TO JUST MAKE A MUTABLE VERSION AND DO SHIT ON IT - public TreeMap getRawMap() { - return toMutable().getRawMap(); - } - - public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalDefinitionStackMap(defStacks); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java deleted file mode 100644 index e1fdc6a553..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ /dev/null @@ -1,565 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.*; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.util.DoubleCount.add; -import static com.github.technus.tectech.util.DoubleCount.sub; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalInstanceStackMap implements Comparable { - TreeMap map; - - //Constructors - public cElementalInstanceStackMap() { - map = new TreeMap<>(); - } - - public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) { - this(true, inSafe); - } - - public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) { - map = new TreeMap<>(); - if (clone) { - cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length]; - for(int i=0;i inSafe) { - this(true, inSafe); - } - - @Deprecated - private cElementalInstanceStackMap(boolean clone, TreeMap in) { - if (clone) { - map = new TreeMap<>(); - for(cElementalInstanceStack stack:in.values()) { - putUnify(stack.clone()); - } - } else { - map = in; - } - } - - public cElementalInstanceStackMap(cElementalInstanceStackMap inSafe) { - this(true, inSafe.map); - } - - public cElementalInstanceStackMap(boolean copy, cElementalInstanceStackMap in) { - this(copy, in.map); - } - - @Override - public cElementalInstanceStackMap clone() { - return new cElementalInstanceStackMap(map); - } - - public cElementalMutableDefinitionStackMap toDefinitionMapForComparison() { - cElementalDefinitionStack[] list = new cElementalDefinitionStack[map.size()]; - int i = 0; - for (cElementalInstanceStack stack : map.values()) { - list[i++] = new cElementalDefinitionStack(stack.definition, stack.amount); - } - return new cElementalMutableDefinitionStackMap(list); - } - - //@Deprecated - //public cElementalStackMap toDefinitionMap(boolean mutable) { - // TreeMap newMap = new TreeMap<>(); - // for (cElementalInstanceStack stack : map.values()) { - // newMap.put(stack.definition, new cElementalDefinitionStack(stack.definition, stack.amount)); - // } - // if (mutable) { - // return new cElementalMutableDefinitionStackMap(newMap); - // } - // return new cElementalDefinitionStackMap(newMap); - //} - - @Deprecated - public Map getRawMap() { - return map; - } - - public Set> getEntrySet() { - return map.entrySet(); - } - - - //Removers - public void clear() { - map.clear(); - } - - public cElementalInstanceStack remove(iElementalDefinition def) { - return map.remove(def); - } - - @Deprecated - public cElementalInstanceStack remove(iHasElementalDefinition has) { - return map.remove(has.getDefinition()); - } - - public void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - map.remove(def); - } - } - - @Deprecated - private void removeAll(iHasElementalDefinition... hasElementalDefinition) { - for (iHasElementalDefinition has : hasElementalDefinition) { - map.remove(has.getDefinition()); - } - } - - //Remove amounts - public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - cElementalInstanceStack target = map.get(instance.definition); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= instance.amount; - } else { - double diff = sub(target.amount,instance.amount); - if (diff > 0) { - target.amount = diff; - return true; - } else if (diff == 0) { - map.remove(instance.definition); - return true; - } - } - return false; - } - - public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - cElementalInstanceStack target = map.get(stack.getDefinition()); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= stack.getAmount(); - } else { - double diff = sub(target.amount,stack.getAmount()); - if (diff > 0) { - target.amount = diff; - return true; - } else if (diff == 0) { - map.remove(stack.getDefinition()); - return true; - } - } - return false; - } - - @Deprecated - public boolean removeAmount(boolean testOnly, iElementalDefinition def) { - return removeAmount(testOnly, new cElementalDefinitionStack(def, 1D)); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { - boolean test = true; - for (cElementalInstanceStack stack : instances) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (cElementalInstanceStack stack : instances) { - removeAmount(false, stack); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, iHasElementalDefinition... stacks) { - boolean test = true; - for (iHasElementalDefinition stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iHasElementalDefinition stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - @Deprecated - public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = new cElementalDefinitionStack(definitions[i], 1); - } - return removeAllAmounts(testOnly, stacks); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(false, entry.getValue()); - } - return true; - } - - //Remove overflow - public double removeOverflow(int stacksCount, double stackCapacity) { - double massRemoved = 0; - - if (map.size() > stacksCount) { - iElementalDefinition[] keys = keys(); - for (int i = stacksCount; i < keys.length; i++) { - massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); - map.remove(keys[i]); - } - } - - for (cElementalInstanceStack instance : values()) { - if (instance.amount > stackCapacity) { - massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); - instance.amount = stackCapacity; - } - } - return massRemoved; - } - - //Put replace - public cElementalInstanceStack putReplace(cElementalInstanceStack instanceUnsafe) { - return map.put(instanceUnsafe.definition, instanceUnsafe); - } - - public void putReplaceAll(cElementalInstanceStack... instances) { - for (cElementalInstanceStack instance : instances) { - map.put(instance.definition, instance); - } - } - - private void putReplaceAll(Map inTreeUnsafe) { - map.putAll(inTreeUnsafe); - } - - public void putReplaceAll(cElementalInstanceStackMap inContainerUnsafe) { - putReplaceAll(inContainerUnsafe.map); - } - - //Put unify - public cElementalInstanceStack putUnify(cElementalInstanceStack instance) { - cElementalInstanceStack stack=map.get(instance.definition); - if(stack==null) { - return map.put(instance.definition, instance); - } - return map.put(instance.definition, stack.unifyIntoThis(instance)); - } - - public void putUnifyAll(cElementalInstanceStack... instances) { - for (cElementalInstanceStack instance : instances) { - putUnify(instance); - } - } - - private void putUnifyAll(Map inTreeUnsafe) { - for (cElementalInstanceStack in : inTreeUnsafe.values()) { - putUnify(in); - } - } - - public void putUnifyAll(cElementalInstanceStackMap containerUnsafe) { - putUnifyAll(containerUnsafe.map); - } - - //Getters - public cElementalInstanceStack getFirst(){ - return map.firstEntry().getValue(); - } - - public cElementalInstanceStack getLast(){ - return map.lastEntry().getValue(); - } - - public cElementalInstanceStack getInstance(iElementalDefinition def) { - return map.get(def); - } - - public cElementalInstanceStack get(int i){ - Collection var = map.values(); - return var.toArray(new cElementalInstanceStack[0])[i]; - } - - public String[] getShortSymbolsInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i++] = instance.definition.getShortSymbol(); - } - return info; - } - - public String[] getElementalInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ - " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ - " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ - " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ - " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); - } - return info; - } - - public ArrayList getScanShortSymbols(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanShortSymbols(list,capabilities); - } - return list; - } - - public ArrayList getScanInfo(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanResults(list,capabilities); - } - return list; - } - - public cElementalInstanceStack[] values() { - Collection var = map.values(); - return var.toArray(new cElementalInstanceStack[0]); - } - - public iElementalDefinition[] keys() { - Set var = map.keySet(); - return var.toArray(new iElementalDefinition[0]); - } - - public double getMass() { - double mass = 0; - for (cElementalInstanceStack stack : map.values()) { - mass += stack.getMass(); - } - return mass; - } - - public double getCharge() { - double charge = 0; - for (cElementalInstanceStack stack : map.values()) { - charge += stack.getCharge(); - } - return charge; - } - - public double getCountOfAllAmounts(){ - double sum=0; - for(cElementalInstanceStack stack:map.values()){ - sum= add(sum,stack.amount); - } - return sum; - } - - //Tests - public boolean containsDefinition(iElementalDefinition def) { - return map.containsKey(def); - } - - public boolean containsInstance(cElementalInstanceStack inst) { - return map.containsValue(inst); - } - - public int size() { - return map.size(); - } - - public boolean hasStacks() { - return !map.isEmpty(); - } - - public boolean isEmpty(){ - return map.isEmpty(); - } - - //Tick Content - public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { - return tickContent(lifeTimeMult,postEnergize,1D); - } - - public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ - cleanUp(); - double diff=0; - for (cElementalInstanceStack instance : values()) { - cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); - if (newInstances == null) { - instance.nextColor(); - } else { - diff=add(diff,newInstances.getMassDiff()); - removeAmount(false,instance); - putUnifyAll(newInstances.getOutput()); - } - } - return diff; - } - - //NBT - public NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanShortSymbols(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound getScanInfoNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanInfo(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", map.size()); - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - nbt.setTag(Integer.toString(i++), instance.toNBT()); - } - return nbt; - } - - public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; - for (int i = 0; i < instances.length; i++) { - instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (instances[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalInstanceStackMap(false, instances); - } - - //stackUp - public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { - cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); - inTree.putUnifyAll(in); - return inTree.values(); - } - - @Override - public int compareTo(cElementalInstanceStackMap o) { - int sizeDiff = map.size() - o.map.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - cElementalInstanceStack[] ofThis = values(), ofThat = o.values(); - for (int i = 0; i < ofThat.length; i++) { - int result = ofThis[i].compareTo(ofThat[i]); - if (result != 0) { - return result; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalInstanceStackMap) { - return compareTo((cElementalInstanceStackMap) obj) == 0; - } - if (obj instanceof cElementalStackMap) { - return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0; - } - return false; - } - - @Override - public int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (cElementalInstanceStack stack : map.values()) { - hash += stack.definition.hashCode(); - } - return hash; - } - - @Override - public String toString() { - StringBuilder build=new StringBuilder("Instance Stack Map\n"); - for(cElementalInstanceStack stack:map.values()){ - build.append(stack.toString()).append('\n'); - } - return build.toString(); - } - - public cElementalInstanceStackMap takeAllToNewMap(){ - TreeMap map=this.map; - this.map=new TreeMap<>(); - return new cElementalInstanceStackMap(map); - } - - public void cleanUp(){ - map.entrySet().removeIf(entry -> entry.getValue().amount < AVOGADRO_CONSTANT_UNCERTAINTY); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java deleted file mode 100644 index 020f5a5f8c..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java +++ /dev/null @@ -1,278 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.Map; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.util.DoubleCount.sub; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalMutableDefinitionStackMap extends cElementalStackMap {//Transient class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public cElementalMutableDefinitionStackMap() { - map = new TreeMap<>(); - } - - @Deprecated - public cElementalMutableDefinitionStackMap(iElementalDefinition... in) { - map=new TreeMap<>(); - for (iElementalDefinition def : in) { - putUnify(new cElementalDefinitionStack(def, 1)); - } - } - - public cElementalMutableDefinitionStackMap(cElementalDefinitionStack... in) { - map=new TreeMap<>(); - putUnifyAll(in); - } - - public cElementalMutableDefinitionStackMap(TreeMap in) { - this(true, in); - } - - public cElementalMutableDefinitionStackMap(boolean clone, TreeMap in) { - if (clone) { - map = new TreeMap<>(in); - } else { - map = in; - } - } - - @Override - public cElementalMutableDefinitionStackMap clone() { - return new cElementalMutableDefinitionStackMap(map); - } - - public cElementalDefinitionStackMap toImmutable() { - return new cElementalDefinitionStackMap(map); - } - public cElementalDefinitionStackMap toImmutable_optimized_unsafeLeavesExposedElementalTree() { - return new cElementalDefinitionStackMap(this); - } - - @Override - @Deprecated - public TreeMap getRawMap() { - return map; - } - - - //Removers - public void clear() { - map.clear(); - } - - public cElementalDefinitionStack remove(iElementalDefinition def) { - return map.remove(def); - } - - @Deprecated - public cElementalDefinitionStack remove(iHasElementalDefinition has) { - return map.remove(has.getDefinition()); - } - - public void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - map.remove(def); - } - } - - @Deprecated - public void removeAll(iHasElementalDefinition... hasElementalDefinition) { - for (iHasElementalDefinition has : hasElementalDefinition) { - map.remove(has.getDefinition()); - } - } - - //Remove amounts - public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - cElementalDefinitionStack target = map.get(instance.definition); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= instance.amount; - } else { - double diff = sub(target.amount,instance.amount); - if (diff > 0) { - map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); - return true; - } else if (diff == 0) { - map.remove(instance.definition); - return true; - } - } - return false; - } - - public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - cElementalDefinitionStack target = map.get(stack.getDefinition()); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= stack.getAmount(); - } else { - double diff = sub(target.amount,stack.getAmount()); - if (diff > 0) { - map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); - return true; - } else if (diff == 0) { - map.remove(stack.getDefinition()); - return true; - } - } - return false; - } - - @Deprecated - public boolean removeAmount(boolean testOnly, iElementalDefinition def) { - return removeAmount(testOnly, new cElementalDefinitionStack(def, 1)); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { - boolean test = true; - for (cElementalInstanceStack stack : instances) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (cElementalInstanceStack stack : instances) { - removeAmount(false, stack); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, iHasElementalDefinition... stacks) { - boolean test = true; - for (iHasElementalDefinition stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iHasElementalDefinition stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - @Deprecated - public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = new cElementalDefinitionStack(definitions[i], 1); - } - return removeAllAmounts(testOnly, stacks); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(false, entry.getValue()); - } - return true; - } - - //Put replace - public cElementalDefinitionStack putReplace(cElementalDefinitionStack defStackUnsafe) { - return map.put(defStackUnsafe.definition, defStackUnsafe); - } - - public void putReplaceAll(cElementalDefinitionStack... defStacks) { - for (cElementalDefinitionStack defStack : defStacks) { - map.put(defStack.definition, defStack); - } - } - - public void putReplaceAll(cElementalStackMap inContainerUnsafe) { - map.putAll(inContainerUnsafe.map); - } - - //Put unify - public cElementalDefinitionStack putUnify(cElementalDefinitionStack def) { - cElementalDefinitionStack stack=map.get(def.definition); - if(stack==null) { - return map.put(def.definition, def); - } - return map.put(def.definition, stack.addAmountIntoNewInstance(def.amount)); - } - - @Deprecated - public cElementalDefinitionStack putUnify(iElementalDefinition def) { - return putUnify(new cElementalDefinitionStack(def, 1)); - } - - public void putUnifyAll(cElementalDefinitionStack... defs) { - for (cElementalDefinitionStack def : defs) { - putUnify(def); - } - } - - @Deprecated - public void putUnifyAll(iElementalDefinition... defs) { - for (iElementalDefinition def : defs) { - putUnify(def); - } - } - - private void putUnifyAll(Map inTreeUnsafe) { - for (cElementalDefinitionStack in : inTreeUnsafe.values()) { - putUnify(in); - } - } - - public void putUnifyAll(cElementalStackMap containerUnsafe) { - for (cElementalDefinitionStack in : containerUnsafe.map.values()) { - putUnify(in); - } - } - - public static cElementalMutableDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalMutableDefinitionStackMap(defStacks); - } - - public void cleanUp(){ - for(Map.Entry entry:map.entrySet()){ - if(entry.getValue().amount<=0) { - map.remove(entry.getKey()); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java deleted file mode 100644 index f8e7aa39e4..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.Collection; -import java.util.Set; -import java.util.TreeMap; - -import static com.github.technus.tectech.util.DoubleCount.add; - -/** - * Created by Tec on 12.05.2017. - */ -abstract class cElementalStackMap implements Comparable { - protected TreeMap map; - - @Override - public abstract cElementalStackMap clone(); - - @Deprecated - public abstract TreeMap getRawMap(); - - //Getters - public final cElementalDefinitionStack getFirst(){ - return map.firstEntry().getValue(); - } - - public final cElementalDefinitionStack getLast(){ - return map.lastEntry().getValue(); - } - - public final cElementalDefinitionStack getDefinitionStack(iElementalDefinition def) { - return map.get(def); - } - - public String[] getShortSymbolsInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalDefinitionStack instance : map.values()) { - info[i++] = instance.definition.getShortSymbol(); - } - return info; - } - - public final String[] getElementalInfo() { - String[] info = new String[map.size() * 3]; - int i = 0; - for (cElementalDefinitionStack defStack : map.values()) { - info[i] = EnumChatFormatting.BLUE + defStack.definition.getName(); - info[i + 1] = EnumChatFormatting.AQUA + defStack.definition.getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.amount; - i += 3; - } - return info; - } - - public final cElementalDefinitionStack[] values() { - Collection var = map.values(); - return var.toArray(new cElementalDefinitionStack[0]); - } - - public final iElementalDefinition[] keys() { - Set var = map.keySet(); - return var.toArray(new iElementalDefinition[0]); - } - - public double getCountOfAllAmounts(){ - double sum=0; - for(cElementalDefinitionStack stack:map.values()){ - sum= add(sum,stack.amount); - } - return sum; - } - - //Tests - public final boolean containsDefinition(iElementalDefinition def) { - return map.containsKey(def); - } - - public final boolean containsDefinitionStack(cElementalDefinitionStack inst) { - return map.containsValue(inst); - } - - public final int size() { - return map.size(); - } - - public final boolean hasStacks() { - return !map.isEmpty(); - } - - public final boolean isEmpty(){ - return map.isEmpty(); - } - - //NBT - public final NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public final NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", map.size()); - int i = 0; - for (cElementalDefinitionStack defStack : map.values()) { - nbt.setTag(Integer.toString(i++), defStack.toNBT()); - } - return nbt; - } - - @Override - public final int compareTo(cElementalStackMap o) {//this actually compares rest - int sizeDiff = map.size() - o.map.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - cElementalDefinitionStack[] ofThis = values(), ofO = o.values(); - for (int i = 0; i < ofO.length; i++) { - int result = ofThis[i].compareTo(ofO[i]); - if (result != 0) { - return result; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalStackMap) { - return compareTo((cElementalStackMap) obj) == 0; - } - if (obj instanceof cElementalInstanceStackMap) { - return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; - } - return false; - } - - @Override - public final int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (cElementalDefinitionStack stack : map.values()) { - hash += stack.definition.hashCode(); - } - return hash; - } - - public double getMass(){ - double mass=0; - for(cElementalDefinitionStack stack:map.values()){ - mass+=stack.getMass(); - } - return mass; - } - - public long getCharge(){ - long charge=0; - for(cElementalDefinitionStack stack:map.values()){ - charge+=stack.getCharge(); - } - return charge; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java index 912d44ff43..8b1f6d0c14 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; @@ -83,7 +83,7 @@ public class GiveEM implements ICommand { byte clazz = (byte) args.remove(0).charAt(0); Method constructor = cElementalDefinition.getBindsComplex().get(clazz); - cElementalMutableDefinitionStackMap stacks=new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap stacks =new cElementalDefinitionStackMap(); while(args.size()>0){ cElementalDefinitionStack tempStack=getDefinitionStack(args); if(tempStack==null) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java new file mode 100644 index 0000000000..79103f7fa0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java @@ -0,0 +1,77 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import static com.github.technus.tectech.util.DoubleCount.add; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class cElementalDecay { + public static final cElementalDecay[] noDecay = null; + //DECAY IMPOSSIBLE!!! + //Do not use regular NULL java will not make it work with varargs!!! + //Or cast null into ARRAY type but this static is more convenient!!! + public static final cElementalDecay[] noProduct = new cElementalDecay[0]; + //this in turn can be used to tell that the thing should just vanish + public final cElementalConstantStackMap outputStacks; + public final double probability; + + public cElementalDecay(iElementalDefinition... outSafe) { + this(1D, outSafe); + } + + public cElementalDecay(double probability, iElementalDefinition... outSafe) { + cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; + for (int i = 0; i < outArr.length; i++) { + outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D); + } + outputStacks = new cElementalConstantStackMap(outArr); + this.probability = probability; + } + + public cElementalDecay(cElementalDefinitionStack... outSafe) { + this(1D, outSafe); + } + + public cElementalDecay(double probability, cElementalDefinitionStack... out) { + outputStacks = new cElementalConstantStackMap(out); + this.probability = probability; + } + + public cElementalDecay(cElementalConstantStackMap tree) { + this(1D, tree); + } + + public cElementalDecay(double probability, cElementalConstantStackMap tree) { + outputStacks = tree; + this.probability = probability; + } + + public cElementalInstanceStackMap getResults(double lifeMult, double age, long energyTotalForProducts, double amountDecaying) { + cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); + if (outputStacks == null) { + return decayResult;//This is to prevent null pointer exceptions. + } + //Deny decay code is in instance! + double qtty = 0D; + for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { + qtty= add(qtty,stack.amount); + } + if (qtty <= 0D) { + return decayResult; + } + //energyTotalForProducts /= qtty; + //lifeMult /= (float) qtty; + for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { + decayResult.putUnify(new cElementalInstanceStack(stack.definition, + amountDecaying * stack.amount, + lifeMult, age/*new products*/, (long)(energyTotalForProducts / Math.max(1D, Math.abs(stack.amount)))));//get instances from stack + } + return decayResult; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java new file mode 100644 index 0000000000..43f4341720 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; + +public class cElementalDecayResult { + private final cElementalInstanceStackMap output; + private double massAffected; + private double massDiff; + + public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) { + this.output = output; + this.massAffected = massAffected; + this.massDiff = massDiff; + } + + public cElementalInstanceStackMap getOutput() { + return output; + } + + /** + * How much was lost in the process (decayed or removed) + * @return + */ + public double getMassAffected() { + return massAffected; + } + + /** + * Difference of mass of actually decayed elements + * @return + */ + public double getMassDiff() { + return massDiff; + } + + public void setMassAffected(double massAffected) { + this.massAffected = massAffected; + } + + public void setMassDiff(double massDiff) { + this.massDiff = massDiff; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java new file mode 100644 index 0000000000..457a37f7b9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; + +/** + * Created by danie_000 on 25.01.2017. + */ +public interface iElementalContainer { + cElementalInstanceStackMap getContentHandler(); + + void purgeOverflow(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java deleted file mode 100644 index 20fe1ffc5b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -/** - * Created by danie_000 on 25.01.2017. - */ -public interface iElementalInstanceContainer extends Cloneable { - cElementalInstanceStackMap getContainerHandler(); - - void purgeOverflow(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java new file mode 100644 index 0000000000..cde1d55561 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java @@ -0,0 +1,58 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Collections; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; + +/** + * Created by Tec on 12.05.2017. + */ +public final class cElementalConstantStackMap/*IMMUTABLE*/ extends cElementalStackMap {//Target class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public static final cElementalConstantStackMap EMPTY = new cElementalConstantStackMap(); + + private cElementalConstantStackMap() { + super(Collections.emptyNavigableMap()); + } + + public cElementalConstantStackMap(cElementalDefinitionStack... in) { + this(new cElementalDefinitionStackMap(in).map); + } + + public cElementalConstantStackMap(NavigableMap in) { + super(Collections.unmodifiableNavigableMap(in)); + } + + @Override + public Class getType() { + return cElementalDefinitionStack.class; + } + + //IMMUTABLE DON'T NEED IT + @Override + public cElementalConstantStackMap clone() { + return this; + } + + public cElementalDefinitionStackMap toMutable() { + return new cElementalDefinitionStackMap(new TreeMap<>(map)); + } + + public static cElementalConstantStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { + cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].definition.equals(nbtE__)) { + throw new tElementalException("Something went Wrong"); + } + } + return new cElementalConstantStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java new file mode 100644 index 0000000000..1273119bb3 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class cElementalDefinitionStackMap extends cElementalStackMap implements iElementalMapRW {//Transient class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public cElementalDefinitionStackMap() {} + + public cElementalDefinitionStackMap(cElementalDefinitionStack... in) { + putUnifyAll(in); + } + + public cElementalDefinitionStackMap(NavigableMap in) { + super(in); + } + + @Override + public Class getType() { + return cElementalDefinitionStack.class; + } + + @Override + public cElementalDefinitionStackMap clone() { + return new cElementalDefinitionStackMap(new TreeMap<>(map)); + } + + public cElementalConstantStackMap toImmutable() { + return new cElementalConstantStackMap(new TreeMap<>(map)); + } + + public cElementalConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { + return new cElementalConstantStackMap(map); + } + + public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { + cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].definition.equals(nbtE__)) { + throw new tElementalException("Something went Wrong"); + } + } + return new cElementalDefinitionStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java new file mode 100644 index 0000000000..aab1f93990 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java @@ -0,0 +1,214 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; +import java.util.Map; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class cElementalInstanceStackMap extends cElementalStackMap implements iElementalMapRW { + //Constructors + public cElementalInstanceStackMap() {} + + public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) { + this(true, inSafe); + } + + public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) { + if (clone) { + cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length]; + for(int i=0;i inSafe) { + this(true, inSafe); + } + + private cElementalInstanceStackMap(boolean clone, NavigableMap in) { + if (clone) { + map = new TreeMap<>(); + for(cElementalInstanceStack stack:in.values()) { + putUnify(stack.clone()); + } + } else { + map = in; + } + } + + @Override + public Class getType() { + return cElementalInstanceStack.class; + } + + @Override + public cElementalInstanceStackMap clone() { + return new cElementalInstanceStackMap(map); + } + + //Remove overflow + public double removeOverflow(int stacksCount, double stackCapacity) { + double massRemoved = 0; + + if (map.size() > stacksCount) { + iElementalDefinition[] keys = keySetToArray(); + for (int i = stacksCount; i < keys.length; i++) { + massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); + map.remove(keys[i]); + } + } + + for (cElementalInstanceStack instance : valuesToArray()) { + if (instance.amount > stackCapacity) { + massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); + instance.amount = stackCapacity; + } + } + return massRemoved; + } + + //Getters + public String[] getElementalInfo() { + String[] info = new String[map.size()]; + int i = 0; + for (cElementalInstanceStack instance : map.values()) { + info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ + " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ + " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ + " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ + " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); + } + return info; + } + + public ArrayList getScanShortSymbols(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e:map.entrySet()){ + e.getValue().addScanShortSymbols(list,capabilities); + } + return list; + } + + public ArrayList getScanInfo(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e:map.entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + + //Tick Content + public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { + return tickContent(lifeTimeMult,postEnergize,1D); + } + + public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ + cleanUp(); + double diff=0; + for (cElementalInstanceStack instance : valuesToArray()) { + cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); + if (newInstances == null) { + instance.nextColor(); + } else { + diff=add(diff,newInstances.getMassDiff()); + removeAmount(false,instance); + putUnifyAll(newInstances.getOutput()); + } + } + return diff; + } + + //NBT + public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanShortSymbols(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public NBTTagCompound getScanInfoNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { + cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; + for (int i = 0; i < instances.length; i++) { + instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (instances[i].definition.equals(nbtE__)) { + throw new tElementalException("Something went Wrong"); + } + } + return new cElementalInstanceStackMap(false, instances); + } + + //stackUp + public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { + cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); + inTree.putUnifyAll(in); + return inTree.valuesToArray(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof cElementalInstanceStackMap) { + return compareTo((cElementalInstanceStackMap) obj) == 0; + } + if (obj instanceof cElementalStackMap) { + return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0; + } + return false; + } + + @Override + public String toString() { + StringBuilder build=new StringBuilder("Instance Stack Map\n"); + for(cElementalInstanceStack stack:map.values()){ + build.append(stack.toString()).append('\n'); + } + return build.toString(); + } + + public cElementalInstanceStackMap takeAll(){ + cElementalInstanceStackMap newStack=new cElementalInstanceStackMap(false,new TreeMap<>(this.map));//just in case to uncouple The map + this.map.clear(); + return newStack; + } + + public cElementalDefinitionStackMap toDefinitionMapForComparison() { + cElementalDefinitionStack[] list = new cElementalDefinitionStack[size()]; + int i = 0; + for (Map.Entry entry : entrySet()) { + cElementalInstanceStack value = entry.getValue(); + list[i++] = new cElementalDefinitionStack(value.getDefinition(), value.getAmount()); + } + return new cElementalDefinitionStackMap(list); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java new file mode 100644 index 0000000000..2b144df128 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import java.util.NavigableMap; +import java.util.TreeMap; + +/** + * Created by Tec on 12.05.2017. + */ +abstract class cElementalStackMap implements iElementalMapR { + protected NavigableMap map; + + protected cElementalStackMap() { + this(new TreeMap<>()); + } + + protected cElementalStackMap(NavigableMap map) { + this.map = map; + } + + @Override + public NavigableMap getBackingMap() { + return map; + } + + @Override + public abstract cElementalStackMap clone(); + + @Override + public boolean equals(Object obj) { + if (obj instanceof cElementalInstanceStackMap) { + return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; + } + if (obj instanceof cElementalStackMap) { + return compareTo((cElementalStackMap) obj) == 0; + } + return false; + } + + @Override + public int hashCode() {//Hash only definitions to compare contents not amounts or data + int hash = -(map.size() << 4); + for (T stack : map.values()) { + hash += stack.getDefinition().hashCode(); + } + return hash; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java new file mode 100644 index 0000000000..0491c43ebc --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java @@ -0,0 +1,187 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.lang.reflect.Array; +import java.util.*; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; + +public interface iElementalMapR extends Comparable>, Cloneable { + NavigableMap getBackingMap(); + + iElementalMapR clone(); + + default Set> entrySet(){ + return getBackingMap().entrySet(); + } + + default Set keySet(){ + return getBackingMap().keySet(); + } + + default iElementalDefinition[] keySetToArray() { + return keySetToArray(new iElementalDefinition[size()]); + } + + default iElementalDefinition[] keySetToArray(iElementalDefinition[] array) { + return getBackingMap().keySet().toArray(array); + } + + default Collection values(){ + return getBackingMap().values(); + } + + @SuppressWarnings("unchecked") + default T[] valuesToArray(){ + return valuesToArray((T[]) Array.newInstance(getType(),size())); + } + + default T[] valuesToArray(T[] array){ + return getBackingMap().values().toArray(array); + } + + Class getType(); + + //Getters + default T getFirst(){ + return getBackingMap().firstEntry().getValue(); + } + + default T getLast(){ + return getBackingMap().lastEntry().getValue(); + } + + default T get(iElementalDefinition def) { + return getBackingMap().get(def); + } + + default T getNaturallySorted(int pos) { + if(pos<0 || pos>=size()){ + throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size()); + } + for (Map.Entry entry : entrySet()) { + if(pos==0){ + return entry.getValue(); + } + pos--; + } + return null; + } + + default T getRandom() { + return getNaturallySorted(TecTech.RANDOM.nextInt(size())); + } + + default String[] getShortSymbolsInfo() { + String[] info = new String[size()]; + int i = 0; + for (T instance : values()) { + info[i++] = instance.getDefinition().getShortSymbol(); + } + return info; + } + + default String[] getElementalInfo() { + String[] info = new String[size() * 3]; + int i = 0; + for (T defStack : values()) { + info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getName(); + info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); + info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; + i += 3; + } + return info; + } + + //NBT + default NBTTagCompound getShortSymbolsNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getShortSymbolsInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound getInfoNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getElementalInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger("i", size()); + int i = 0; + for (T stack : values()) { + nbt.setTag(Integer.toString(i++), stack.toNBT()); + } + return nbt; + } + + @Override + default int compareTo(iElementalMapR o) {//this actually compares rest + int sizeDiff = size() - o.size(); + if (sizeDiff != 0) { + return sizeDiff; + } + + Iterator iterator = values().iterator(); + Iterator iteratorO = o.values().iterator(); + + while (iterator.hasNext()) { + int result = iterator.next().compareTo(iteratorO.next()); + if (result != 0) { + return result; + } + } + return 0; + } + + default double getMass(){ + double mass=0; + for (Map.Entry entry : getBackingMap().entrySet()) { + mass+=entry.getValue().getMass(); + } + return mass; + } + + default long getCharge(){ + long charge=0; + for (Map.Entry entry : getBackingMap().entrySet()) { + charge+=entry.getValue().getCharge(); + } + return charge; + } + + //Tests + default boolean containsKey(iElementalDefinition def) { + return getBackingMap().containsKey(def); + } + + default boolean containsKey(iElementalStack def) { + return containsKey(def.getDefinition()); + } + + default int size() { + return getBackingMap().size(); + } + + default boolean hasStacks() { + return !isEmpty(); + } + + default boolean isEmpty(){ + return getBackingMap().isEmpty(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java new file mode 100644 index 0000000000..7f8d314858 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java @@ -0,0 +1,130 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; +import static com.github.technus.tectech.util.DoubleCount.sub; + +public interface iElementalMapRW extends iElementalMapR { + iElementalMapRW clone(); + + default void cleanUp(){ + getBackingMap().entrySet().removeIf(entry -> entry.getValue().getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY); + } + + default void clear() { + getBackingMap().clear(); + } + + //Remove + default T remove(iElementalDefinition def) { + return getBackingMap().remove(def); + } + + default T remove(iElementalStack has) { + return remove(has.getDefinition()); + } + + default void removeAll(iElementalDefinition... definitions) { + for (iElementalDefinition def : definitions) { + getBackingMap().remove(def); + } + } + + default void removeAll(iElementalStack... hasElementalDefinition) { + for (iElementalStack has : hasElementalDefinition) { + getBackingMap().remove(has.getDefinition()); + } + } + + default boolean removeAmount(boolean testOnly, iElementalStack stack) { + return removeAmount(testOnly,stack.getDefinition(),stack.getAmount()); + } + + default boolean removeAmount(boolean testOnly, iElementalDefinition def,double amount) { + T target = getBackingMap().get(def); + if (target == null) { + return false; + } + if (testOnly) { + return target.getAmount() >= amount; + } else { + double newAmount = sub(target.getAmount(),amount); + if (newAmount > 0) { + getBackingMap().put(target.getDefinition(), (T)target.mutateAmount(newAmount)); + return true; + } else if (newAmount == 0) { + getBackingMap().remove(def); + return true; + } + } + return false; + } + + default boolean removeAllAmounts(boolean testOnly, iElementalStack... stacks) { + boolean test = true; + for (iElementalStack stack : stacks) { + test &= removeAmount(true, stack); + } + if (testOnly || !test) { + return test; + } + for (iElementalStack stack : stacks) { + removeAmount(false, stack); + } + return true; + } + + default boolean removeAllAmounts(boolean testOnly, iElementalMapR container) { + boolean test=true; + for (Map.Entry entry : container.entrySet()) { + test &= removeAmount(true, entry.getValue()); + } + if (testOnly || !test) { + return test; + } + for (Map.Entry entry : container.entrySet()) { + removeAmount(false, entry.getValue()); + } + return true; + } + + //Put replace + default T putReplace(T defStackUnsafe) { + return getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); + } + + default void putReplaceAll(T... defStacks) { + for (T defStack : defStacks) { + getBackingMap().put(defStack.getDefinition(), defStack); + } + } + + default void putReplaceAll(iElementalMapR inContainerUnsafe) { + getBackingMap().putAll(inContainerUnsafe.getBackingMap()); + } + + //Put unify + default T putUnify(T def) { + T stack=getBackingMap().get(def.getDefinition()); + if(stack==null) { + return getBackingMap().put(def.getDefinition(), def); + } + return getBackingMap().put(def.getDefinition(), (T)stack.mutateAmount(def.getAmount()+stack.getAmount())); + } + + default void putUnifyAll(T... defs) { + for (T def : defs) { + putUnify(def); + } + } + + default void putUnifyAll(iElementalMapR inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnify(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java deleted file mode 100644 index e191cc0e0a..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipe implements Comparable { - public final short ID; - public final cElementalDefinitionStackMap inEM; - public final cElementalDefinitionStackMap outEM; - public final ItemStack[] outItems; - public final FluidStack[] outFluids; - public Object[] extension; - - public rElementalRecipe( - cElementalDefinitionStackMap inEM,//not null plz - short id, - cElementalDefinitionStackMap outEM, - ItemStack[] outItems, - FluidStack[] outFluids) { - this.inEM = inEM; - this.outEM = outEM; - this.outItems = outItems; - this.outFluids = outFluids; - ID = id;//allows multiple recipes with the same input EM,so u can actually extend... - } - - public rElementalRecipe extend(Object... data) { - extension = data; - return this; - } - - @Override - public int compareTo(rElementalRecipe o) { - int compare = inEM.compareTo(o.inEM); - if(compare!=0) { - return compare; - } - return Short.compare(ID, o.ID); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof rElementalRecipe) { - return compareTo((rElementalRecipe) obj) == 0; - } - return false; - } - - @Override - public int hashCode() { - return inEM.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java deleted file mode 100644 index ed5e46f43f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipeMap {//TODO FIX - //Multimap for multiple recipes from the same thing - you know parameters might differ the output - private final HashMap> recipes; - - public rElementalRecipeMap() { - recipes = new HashMap<>(); - } - - public rElementalRecipe put(rElementalRecipe in) { - HashMap r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>()); - return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) - //It is either bad, or unimportant if you use different id's - } - - public void putAll(rElementalRecipe... contents) { - for (rElementalRecipe recipe : contents) { - put(recipe); - } - } - - public rElementalRecipe remove(cElementalStackMap map, short id) { - return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap remove(cElementalStackMap map) { - return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap findExact(cElementalInstanceStackMap in) { - return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! - //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) - @Deprecated - public HashMap findExact(cElementalStackMap in) { - return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //this does check if the map contains all the requirements for any recipe, and the required amounts - //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! - @Deprecated - public HashMap findMatch(cElementalMutableDefinitionStackMap in, boolean testOnlyTruePreferred) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - public HashMap findMatch(cElementalInstanceStackMap in, boolean testOnly) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - //To check for instance data and other things use recipe extensions! -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java new file mode 100644 index 0000000000..8c0fb40a4b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java @@ -0,0 +1,57 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 02.03.2017. + */ +public class rElementalRecipe implements Comparable { + public final short ID; + public final cElementalConstantStackMap inEM; + public final cElementalConstantStackMap outEM; + public final ItemStack[] outItems; + public final FluidStack[] outFluids; + public Object[] extension; + + public rElementalRecipe( + cElementalConstantStackMap inEM,//not null plz + short id, + cElementalConstantStackMap outEM, + ItemStack[] outItems, + FluidStack[] outFluids) { + this.inEM = inEM; + this.outEM = outEM; + this.outItems = outItems; + this.outFluids = outFluids; + ID = id;//allows multiple recipes with the same input EM,so u can actually extend... + } + + public rElementalRecipe extend(Object... data) { + extension = data; + return this; + } + + @Override + public int compareTo(rElementalRecipe o) { + int compare = inEM.compareTo(o.inEM); + if(compare!=0) { + return compare; + } + return Short.compare(ID, o.ID); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof rElementalRecipe) { + return compareTo((rElementalRecipe) obj) == 0; + } + return false; + } + + @Override + public int hashCode() { + return inEM.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java new file mode 100644 index 0000000000..56a9030354 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Tec on 02.03.2017. + */ +public class rElementalRecipeMap {//TODO FIX + //Multimap for multiple recipes from the same thing - you know parameters might differ the output + private final HashMap> recipes; + + public rElementalRecipeMap() { + recipes = new HashMap<>(); + } + + public rElementalRecipe put(rElementalRecipe in) { + HashMap r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>()); + return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) + //It is either bad, or unimportant if you use different id's + } + + public void putAll(rElementalRecipe... contents) { + for (rElementalRecipe recipe : contents) { + put(recipe); + } + } + + public rElementalRecipe remove(iElementalMapR map, short id) { + return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + public HashMap remove(iElementalMapR map) { + return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + public HashMap findExact(cElementalInstanceStackMap in) { + return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that + } + + //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! + //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) + @Deprecated + public HashMap findExact(iElementalMapR in) { + return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + //this does check if the map contains all the requirements for any recipe, and the required amounts + //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! + @Deprecated + public HashMap findMatch(cElementalDefinitionStackMap in, boolean testOnlyTruePreferred) { + for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { + if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) { + return cElementalDefinitionStackMapHashMapEntry.getValue(); + } + } + return null; + } + + public HashMap findMatch(cElementalInstanceStackMap in, boolean testOnly) { + for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { + if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) { + return cElementalDefinitionStackMapHashMapEntry.getValue(); + } + } + return null; + } + + //To check for instance data and other things use recipe extensions! +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java index a2d22c30ed..1e03c8130f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java @@ -5,12 +5,11 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElem import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.util.DoubleCount.add; /** * Created by danie_000 on 20.11.2016. */ -public final class cElementalDefinitionStack implements iHasElementalDefinition { +public final class cElementalDefinitionStack implements iElementalStack { public final iElementalDefinition definition; public final double amount; @@ -24,6 +23,14 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition return this;//IMMUTABLE } + @Override + public cElementalDefinitionStack mutateAmount(double amount) { + if(this.amount==amount){ + return this; + } + return new cElementalDefinitionStack(definition,amount);//IMMUTABLE + } + @Override public iElementalDefinition getDefinition() { return definition;//IMMUTABLE @@ -57,26 +64,8 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition nbt.getLong("q")+nbt.getDouble("Q")); } - public cElementalDefinitionStack addAmountIntoNewInstance(double amount) { - if(amount==0) { - return this; - } - return new cElementalDefinitionStack(definition, add(amount,this.amount)); - } - - public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) { - if (other == null || other.length == 0) { - return this; - } - double l = 0; - for (cElementalDefinitionStack stack : other) { - l= add(l,stack.amount); - } - return addAmountIntoNewInstance(l); - } - @Override - public int compareTo(iHasElementalDefinition o) { + public int compareTo(iElementalStack o) { return definition.compareTo(o.getDefinition()); } @@ -85,8 +74,8 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition if (obj instanceof iElementalDefinition) { return definition.compareTo((iElementalDefinition) obj) == 0; } - if (obj instanceof iHasElementalDefinition) { - return definition.compareTo(((iHasElementalDefinition) obj).getDefinition()) == 0; + if (obj instanceof iElementalStack) { + return definition.compareTo(((iElementalStack) obj).getDefinition()) == 0; } return false; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index 559d7ab8d9..1c06e560db 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -1,10 +1,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.util.Util; @@ -24,7 +24,7 @@ import static java.lang.Math.*; /** * Created by danie_000 on 22.10.2016. */ -public final class cElementalInstanceStack implements iHasElementalDefinition { +public final class cElementalInstanceStack implements iElementalStack { public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16; public static double DECAY_CALL_PER=AVOGADRO_CONSTANT;//todo @@ -81,6 +81,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return new cElementalInstanceStack(this); } + @Override + public cElementalInstanceStack mutateAmount(double amount) { + this.amount = amount; + return this; + } + @Override public double getAmount() { return amount; @@ -170,7 +176,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { if (newInstances == null) { nextColor(); } else { - for (cElementalInstanceStack newInstance : newInstances.getOutput().values()) { + for (cElementalInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { newInstance.nextColor(); } } @@ -290,20 +296,20 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { cElementalInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); if(newProductsAge<0){ if(output.size()==1) { - if(output.size()==1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age=age; + if(output.size()==1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); + output.getFirst().age=age; } }else { - for (cElementalInstanceStack stack : output.values()) { + for (cElementalInstanceStack stack : output.valuesToArray()) { if (stack.definition.equals(definition)) { stack.age = age; } } } }else{ - if(output.size()==1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); + if(output.size()==1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); } } if(energy <= 0 && output.getMass() > mass){ @@ -390,20 +396,20 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } if(newProductsAge<0) { - if (output.size() == 1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age = age; + if (output.size() == 1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); + output.getFirst().age = age; } else { - for (cElementalInstanceStack stack : output.values()) { + for (cElementalInstanceStack stack : output.valuesToArray()) { if (stack.definition.equals(definition)) { stack.age = age; } } } }else{ - if(output.size()==1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age=age; + if(output.size()==1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); + output.getFirst().age=age; } } if(energy <= 0 && output.getMass() > getMass()){ @@ -491,10 +497,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); } - private void scanContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + private void scanContents(ArrayList lines, cElementalConstantStackMap definitions, int depth, int[] detailsOnDepthLevels){ if(definitions!=null && depth decaysList, iaeaNuclide.iaeaDecay decay, long energy){ - cElementalMutableDefinitionStackMap withThis=elementalStacks.toMutable(),newStuff=new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new cElementalDefinitionStackMap(); switch (decay.decayName){ case "D": { if (withThis.removeAllAmounts(false, deuterium.definition.getSubParticles())){ withThis.putReplace(deuterium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; case "3H": { if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){ withThis.putReplace(tritium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; case "3HE": { if (withThis.removeAllAmounts(false, helium_3.definition.getSubParticles())){ withThis.putReplace(helium_3); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; case "8BE": { if (withThis.removeAllAmounts(false, beryllium_8.definition.getSubParticles())){ withThis.putReplace(beryllium_8); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; @@ -518,8 +508,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){ newStuff.putReplace(carbon_14); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -532,8 +522,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){ newStuff.putReplace(neon_24); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -546,8 +536,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){ newStuff.putReplace(silicon_34); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -560,8 +550,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -576,8 +566,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -592,8 +582,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -608,8 +598,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -624,8 +614,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -639,8 +629,8 @@ public final class dAtomDefinition extends cElementalDefinition { withThis.putUnify(dHadronDefinition.hadron_n1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -654,8 +644,8 @@ public final class dAtomDefinition extends cElementalDefinition { withThis.putUnify(dHadronDefinition.hadron_n2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -670,8 +660,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -686,8 +676,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -703,8 +693,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -720,8 +710,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -736,8 +726,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -753,8 +743,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_n1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -770,8 +760,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_n2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -786,8 +776,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -801,8 +791,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -817,8 +807,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -833,8 +823,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -849,8 +839,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(dHadronDefinition.hadron_p3); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -863,8 +853,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ newStuff.putReplace(dHadronDefinition.hadron_n1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -877,8 +867,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ newStuff.putReplace(dHadronDefinition.hadron_n2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -891,8 +881,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -905,8 +895,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -1001,8 +991,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(eBosonDefinition.boson_Y__1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -1023,10 +1013,10 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean Emmision(ArrayList decaysList, cElementalDefinitionStack emit) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, emit)) { try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), emit)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1038,10 +1028,10 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean alphaDecay(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), alpha)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1053,11 +1043,11 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean MbetaDecay(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { try { tree.putUnify(dHadronDefinition.hadron_p1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1069,11 +1059,11 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean PbetaDecay(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1085,11 +1075,11 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean ElectronCapture(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1100,11 +1090,11 @@ public final class dAtomDefinition extends cElementalDefinition { return false; } - private boolean Fission(ArrayList decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,double probability,boolean spontaneousCheck) { - cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); - double[] liquidDrop= liquidDropFunction(Math.abs(element)<=97); + private boolean Fission(ArrayList decaysList, cElementalDefinitionStackMap fissile, cElementalDefinitionStackMap particles, double probability, boolean spontaneousCheck) { + cElementalDefinitionStackMap heavy = new cElementalDefinitionStackMap(); + double[] liquidDrop = liquidDropFunction(Math.abs(element)<=97); - for(cElementalDefinitionStack stack: fissile.values()){ + for(cElementalDefinitionStack stack: fissile.valuesToArray()){ if(spontaneousCheck && stack.definition instanceof dHadronDefinition && (stack.amount<=80 || stack.amount<90 && XSTR_INSTANCE.nextInt(10) decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { + for (cElementalDefinitionStack elementalStack : elementalStacks.valuesToArray()) { if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { //covers both quarks and antiquarks decaysInto.add(elementalStack); @@ -1302,12 +1292,12 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public dAtomDefinition getAnti() { - cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); - for (cElementalDefinitionStack stack : elementalStacks.values()) { + cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); + for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) { anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); } try { - return new dAtomDefinition(anti.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + return new dAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 4ea5eb3776..aa0951d98c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; @@ -58,31 +58,21 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //private final FluidStack fluidThing; //private final ItemStack itemThing; - private final cElementalDefinitionStackMap quarkStacks; - - @Deprecated - public dHadronDefinition(eQuarkDefinition... quarks) throws tElementalException { - this(true, new cElementalDefinitionStackMap(quarks)); - } - - @Deprecated - private dHadronDefinition(boolean check, eQuarkDefinition... quarks) throws tElementalException { - this(check, new cElementalDefinitionStackMap(quarks)); - } + private final cElementalConstantStackMap quarkStacks; public dHadronDefinition(cElementalDefinitionStack... quarks) throws tElementalException { - this(true, new cElementalDefinitionStackMap(quarks)); + this(true, new cElementalConstantStackMap(quarks)); } private dHadronDefinition(boolean check, cElementalDefinitionStack... quarks) throws tElementalException { - this(check, new cElementalDefinitionStackMap(quarks)); + this(check, new cElementalConstantStackMap(quarks)); } - public dHadronDefinition(cElementalDefinitionStackMap quarks) throws tElementalException { + public dHadronDefinition(cElementalConstantStackMap quarks) throws tElementalException { this(true, quarks); } - private dHadronDefinition(boolean check, cElementalDefinitionStackMap quarks) throws tElementalException { + private dHadronDefinition(boolean check, cElementalConstantStackMap quarks) throws tElementalException { if (check && !canTheyBeTogether(quarks)) { throw new tElementalException("Hadron Definition error"); } @@ -93,7 +83,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi int type = 0; boolean containsAnti = false; double mass = 0; - for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { + for (cElementalDefinitionStack quarkStack : quarkStacks.valuesToArray()) { amount += quarkStack.amount; if((int)quarkStack.amount!=quarkStack.amount){ throw new ArithmeticException("Amount cannot be safely converted to int!"); @@ -131,9 +121,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { + private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { long amount = 0; - for (cElementalDefinitionStack quarks : stacks.values()) { + for (cElementalDefinitionStack quarks : stacks.valuesToArray()) { if (!(quarks.definition instanceof eQuarkDefinition)) { return false; } @@ -153,7 +143,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi if(sym!=null){ name.append(' ').append(sym); }else { - for (cElementalDefinitionStack quark : quarkStacks.values()) { + for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount); } } @@ -184,7 +174,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi return sym; }else { StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.values()) { + for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.amount; i++) { symbol.append(quark.definition.getSymbol()); } @@ -200,7 +190,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi return sym; }else { StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.values()) { + for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.amount; i++) { symbol.append(quark.definition.getShortSymbol()); } @@ -215,13 +205,13 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public cElementalDefinitionStackMap getSubParticles() { + public cElementalConstantStackMap getSubParticles() { return quarkStacks; } @Override public cElementalDecay[] getNaturalDecayInstant() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); + cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } @@ -243,7 +233,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); + cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } @@ -277,7 +267,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public cElementalDecay[] getDecayArray() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); + cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { @@ -297,15 +287,17 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi cElementalDefinitionStack[] decay; if (Math.abs(lastQuark.getType()) > 1) { - decay = lastQuark.getDecayArray()[1].outputStacks.values(); + decay = lastQuark.getDecayArray()[1].outputStacks.valuesToArray(); } else { - decay = lastQuark.getDecayArray()[2].outputStacks.values(); + decay = lastQuark.getDecayArray()[2].outputStacks.valuesToArray(); } newBaryon.add((eQuarkDefinition) decay[0].definition); Particles[0] = decay[1].definition; Particles[1] = decay[2].definition; - eQuarkDefinition[] contentOfBaryon = newBaryon.toArray(new eQuarkDefinition[3]); + cElementalDefinitionStack[] contentOfBaryon = newBaryon.stream() + .map(eQuarkDefinition -> new cElementalDefinitionStack(eQuarkDefinition,1)) + .toArray(cElementalDefinitionStack[]::new); try { return new cElementalDecay[]{ @@ -363,12 +355,12 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public iElementalDefinition getAnti() { - cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); - for (cElementalDefinitionStack stack : quarkStacks.values()) { + cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); + for (cElementalDefinitionStack stack : quarkStacks.valuesToArray()) { anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); } try { - return new dHadronDefinition(anti.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + return new dHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -414,10 +406,10 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public static void run() { try { - hadron_p = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); + hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); protonMass = hadron_p.mass; //redefine the proton with proper lifetime (the lifetime is based on mass comparison) - hadron_p = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); + hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); SYMBOL_MAP.put(hadron_p,"p"); NAME_MAP.put(hadron_p,"Proton"); DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); @@ -425,10 +417,10 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi SYMBOL_MAP.put(hadron_p_,"~p"); NAME_MAP.put(hadron_p_,"Anti Proton"); DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); - hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); + hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.mass; //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) - hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); + hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); NAME_MAP.put(hadron_n, "Neutron"); DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java index a3efe12b7e..8096743b78 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.noDecay; +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; /** * Created by danie_000 on 22.10.2016. diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java index 9a82cdd6c0..e87df806d3 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java @@ -1,10 +1,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java index 1e3b7189a8..c8e3b07f02 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java index c55e7f6364..0f0725d208 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java index 9e5b2e66bb..798066466b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index b0b349a268..05f251924e 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import cpw.mods.fml.common.registry.GameRegistry; @@ -17,16 +17,16 @@ import java.util.HashSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; public class TT_recipe extends GT_Recipe { - public static final String E_RECIPE_ID = "eRecipeID"; - public final cElementalDefinitionStackMap[] input; - public final cElementalDefinitionStackMap[] output; - public final cElementalDefinitionStackMap[] eCatalyst; - public final IAdditionalCheck additionalCheck; + public static final String E_RECIPE_ID = "eRecipeID"; + public final cElementalConstantStackMap[] input; + public final cElementalConstantStackMap[] output; + public final cElementalConstantStackMap[] eCatalyst; + public final IAdditionalCheck additionalCheck; public TT_recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check){ + cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check){ super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue); input=in; output=out; @@ -110,7 +110,7 @@ public class TT_recipe extends GT_Recipe { } if (input != null) { if (in != null) { - for (cElementalDefinitionStackMap anInput : input) { + for (cElementalConstantStackMap anInput : input) { if (anInput != null && anInput.hasStacks()) { if (in.hasStacks()) { if (!in.removeAllAmounts(consume, anInput)) { @@ -181,7 +181,7 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) { + cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchItem=researchItem; } @@ -189,7 +189,7 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in) { + cElementalConstantStackMap[] in) { this(aOptimize, researchItem, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } @@ -199,9 +199,9 @@ public class TT_recipe extends GT_Recipe { public final GT_Recipe scannerRecipe; public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, - ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, - FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) { + ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, + FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, + cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchEM=researchEM; this.scannerRecipe=scannerRecipe; @@ -210,7 +210,7 @@ public class TT_recipe extends GT_Recipe { public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in) { + cElementalConstantStackMap[] in) { this(aOptimize, scannerRecipe, researchEM, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index b08265d2c5..93d6f4ea2b 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.CustomItemList; @@ -131,7 +131,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMmachineRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalDefinitionStackMap[] eInputs, + ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -165,7 +165,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMcrafterRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -188,7 +188,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addScannableEMmachineRecipe( iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalDefinitionStackMap[] eInputs, + ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -215,7 +215,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); @@ -224,7 +224,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addScannableEMcrafterRecipe( iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -240,7 +240,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); 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 bfd7d266c0..b1f6d8887b 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 @@ -3,8 +3,8 @@ 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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; @@ -58,8 +58,8 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE aStack.stackSize = 1; if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof iElementalInstanceContainer) { - cElementalInstanceStackMap content = ((iElementalInstanceContainer) metaTE).getContainerHandler(); + if (metaTE instanceof iElementalContainer) { + cElementalInstanceStackMap content = ((iElementalContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); @@ -69,12 +69,12 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } return true; } - ((iElementalInstanceContainer) metaTE).purgeOverflow(); + ((iElementalContainer) metaTE).purgeOverflow(); tNBT.removeTag("content"); tNBT.removeTag("symbols"); tNBT.removeTag("info"); } else if (content.hasStacks()) { - ((iElementalInstanceContainer) metaTE).purgeOverflow(); + ((iElementalContainer) metaTE).purgeOverflow(); tNBT.setTag("info", content.getInfoNBT()); tNBT.setTag("content", content.toNBT()); tNBT.setTag("symbols", content.getShortSymbolsNBT()); 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 fa1c25cbf5..2513bdf8bf 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 @@ -3,7 +3,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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; @@ -38,17 +38,17 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem } //return previous thing - public static cElementalDefinitionStackMap setContent(ItemStack containerItem, cElementalDefinitionStackMap definitions){ + public static cElementalConstantStackMap setContent(ItemStack containerItem, cElementalConstantStackMap definitions){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { tNBT = containerItem.stackTagCompound = new NBTTagCompound(); } - cElementalDefinitionStackMap oldMap=null; + cElementalConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -63,7 +63,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalDefinitionStackMap getContent(ItemStack containerItem){ + public static cElementalConstantStackMap getContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; @@ -71,7 +71,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } try { - return cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + return cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -81,17 +81,17 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalDefinitionStackMap clearContent(ItemStack containerItem){ + public static cElementalConstantStackMap clearContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { return null; } - cElementalDefinitionStackMap oldMap=null; + cElementalConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); 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 c951229c92..e43feb2351 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index c8606f68f0..d25a0c62ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; import com.github.technus.tectech.util.Util; @@ -34,7 +34,7 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 11.12.2016. */ -public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalInstanceContainer, IConnectsToElementalPipe { +public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalContainer, IConnectsToElementalPipe { private static Textures.BlockIcons.CustomIcon EM_T_SIDES; private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; private static Textures.BlockIcons.CustomIcon EM_T_CONN; @@ -165,7 +165,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } @Override - public cElementalInstanceStackMap getContainerHandler() { + public cElementalInstanceStackMap getContentHandler() { return content; } 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 a1e4f5a8a5..1426e8a702 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 @@ -62,7 +62,7 @@ public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_H if (aMetaTileEntity != null) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental && opposite == tGTTileEntity.getFrontFacing()) { - ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContainerHandler().putUnifyAll(content); + ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContentHandler().putUnifyAll(content); ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).updateSlots(); content.clear(); return; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 329b3cbc14..a61bf27fe3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -4,9 +4,9 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; @@ -85,10 +85,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnifyAll(in2.definition.getSubParticles()); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -114,10 +114,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnifyAll(in2.definition.getSubParticles()); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -139,10 +139,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -183,10 +183,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB PRIMITIVE_FUSE_HANDLERS.put(eQuarkDefinition.class.getName() + '\0' + eQuarkDefinition.class.getName(), (in1, in2, out) -> { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnify(in1.definition.getStackForm(1)); defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -210,10 +210,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static boolean fuseAspects(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnify(in1.definition.getStackForm(1)); defs.putUnify(in2.definition.getStackForm(1)); - dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(aspect, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -246,10 +246,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnify(in2.definition.getStackForm(1)); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -394,7 +394,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } - for (cElementalInstanceStack newStack : map.values()) { + for (cElementalInstanceStack newStack : map.valuesToArray()) { check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); } //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); @@ -525,7 +525,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB if (started) { if (stack == null) { for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - cElementalInstanceStackMap container = inputElemental.getContainerHandler(); + cElementalInstanceStackMap container = inputElemental.getContentHandler(); if (container.isEmpty()) { continue; } @@ -590,7 +590,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB if (outputEM != null) { for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { if (outputEM[i] != null) { - eOutputHatches.get(i).getContainerHandler().putUnifyAll(outputEM[i]); + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); outputEM[i] = null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index ad7a2c91a6..ed245b0e97 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; @@ -118,7 +118,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase cElementalInstanceStackMap map = getInputsClone_EM(); if (map != null && map.hasStacks()) { for (GT_MetaTileEntity_Hatch_InputElemental i : eInputHatches) { - i.getContainerHandler().clear(); + i.getContentHandler().clear(); } return startRecipe(map); } @@ -132,7 +132,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase outputEM[0] = input; outputEM[1] = new cElementalInstanceStackMap(); - for (cElementalInstanceStack stack : outputEM[0].values()) { + for (cElementalInstanceStack stack : outputEM[0].valuesToArray()) { if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && getBaseMetaTileEntity().decreaseStoredEnergyUnits( (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { @@ -156,7 +156,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public void outputAfterRecipe_EM() { for (int i = 0; i < 2 && i < eOutputHatches.size(); i++) { - eOutputHatches.get(i).getContainerHandler().putUnifyAll(outputEM[i]); + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); outputEM[i] = null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 9814092710..208219cd59 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; @@ -72,7 +72,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo super(aName); } - private void startRecipe(iHasElementalDefinition from, long energy) { + private void startRecipe(iElementalStack from, long energy) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = from.getMass(); @@ -98,8 +98,8 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - cElementalInstanceStackMap map = in.getContainerHandler(); - for (cElementalInstanceStack stack : map.values()) { + cElementalInstanceStackMap map = in.getContentHandler(); + for (cElementalInstanceStack stack : map.valuesToArray()) { { aFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); if (info != null) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 29ba91d4b7..d4e85de6f9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -116,7 +116,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - if (in.getContainerHandler().hasStacks()) { + if (in.getContentHandler().hasStacks()) { mEUt = -(int) V[8]; eAmpereFlow = 1 + (eInputHatches.size() + eOutputHatches.size() >> 1); mMaxProgresstime = 20; @@ -149,8 +149,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB continue; } GT_MetaTileEntity_Hatch_OutputElemental out = eOutputHatches.get(outIndex); - out.getContainerHandler().putUnifyAll(in.getContainerHandler()); - in.getContainerHandler().clear(); + out.getContentHandler().putUnifyAll(in.getContentHandler()); + in.getContentHandler().clear(); } } } 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 c3e35ba90c..f5504eadc7 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 @@ -3,9 +3,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; @@ -113,7 +113,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (aOQI == null) { continue; } - iHasElementalDefinition into = aOQI.output(); + iElementalStack into = aOQI.output(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -124,7 +124,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage()); } - iHasElementalDefinition into = aIQI.output(); + iElementalStack into = aIQI.output(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -140,7 +140,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (aFQI == null) { continue; } - iHasElementalDefinition into = aFQI.output(); + iElementalStack into = aFQI.output(); if (into != null && fs.amount >= aFQI.input().amount && isInputEqual(true, false, new FluidStack[]{aFQI.input()}, nullItem, inF, (ItemStack[]) null)) { startRecipe(into); @@ -152,7 +152,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock return false; } - private void startRecipe(iHasElementalDefinition into) { + private void startRecipe(iElementalStack into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = into.getMass(); @@ -176,7 +176,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock stopMachine(); return; } - eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); + eOutputHatches.get(0).getContentHandler().putUnifyAll(outputEM[0]); outputEM = null; } 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 b418ec0fa4..d02088e805 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 @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; @@ -218,11 +218,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkRecipe_EM(ItemStack itemStack) { eRecipe = null; - if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContainerHandler().hasStacks() && !eOutputHatches.isEmpty()) { - cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContainerHandler(); + if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContentHandler().hasStacks() && !eOutputHatches.isEmpty()) { + cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { GT_Recipe scannerRecipe = null; - for (cElementalInstanceStack stackEM : researchEM.values()) { + for (cElementalInstanceStack stackEM : researchEM.valuesToArray()) { objectsScanned = null; eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.definition); if (eRecipe != null) { @@ -258,7 +258,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } else if (CustomItemList.scanContainer.isStackEqual(itemStack, false, true)) { eRecipe = null; if (researchEM.hasStacks()) { - objectsScanned = researchEM.takeAllToNewMap(); + objectsScanned = researchEM.takeAll(); cleanMassEM_EM(objectsScanned.getMass()); computationRequired = 0; 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 1fcc0b42f2..ba6ae223f6 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 @@ -10,7 +10,7 @@ import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; @@ -1297,26 +1297,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } double remaining = voider.overflowMax - voider.getOverflowMatter(); for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContainerHandler().values()) { + for (cElementalInstanceStack instance : in.getContentHandler().valuesToArray()) { double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + in.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); } } } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContainerHandler().values()) { + for (cElementalInstanceStack instance : out.getContentHandler().valuesToArray()) { double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + out.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); } } } @@ -1932,7 +1932,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final cElementalInstanceStackMap getInputsClone_EM() { cElementalInstanceStackMap in = new cElementalInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) { - in.putUnifyAll(hatch.getContainerHandler()); + in.putUnifyAll(hatch.getContentHandler()); } return in.hasStacks() ? in : null; } @@ -1941,7 +1941,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final cElementalInstanceStackMap getOutputsClone_EM() { cElementalInstanceStackMap out = new cElementalInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) { - out.putUnifyAll(hatch.getContainerHandler()); + out.putUnifyAll(hatch.getContentHandler()); } return out.hasStacks() ? out : null; } @@ -1971,7 +1971,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (target == null) { return; } - cleanMassEM_EM(target.getContainerHandler().getMass()); + cleanMassEM_EM(target.getContentHandler().getMass()); } public void cleanStackEM_EM(cElementalInstanceStack target) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 1ed1278bce..093a418056 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; @@ -116,7 +116,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav cElementalInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.values(); + cElementalInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; for (cElementalInstanceStack stack : stacks) { @@ -129,7 +129,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); - stacks = input.values(); + stacks = input.valuesToArray(); } double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; @@ -162,7 +162,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav //take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAllToNewMap().values();//cleanup stacks + stacks = input.takeAll().valuesToArray();//cleanup stacks if (stacks.length > 1) { Arrays.sort(stacks, (o1, o2) -> { double m1 = o1.definition.getMass(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java index df21feb9f2..d335bac7ab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 40e2942bab..6ac6ac74c4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; @@ -147,7 +147,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ cElementalInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.values(); + cElementalInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; for (cElementalInstanceStack stack : stacks) { @@ -185,7 +185,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ double levelsCountPlus1=precisionFullIn-precisionMinimalIn+1; //take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAllToNewMap().values();//cleanup stacks + stacks = input.takeAll().valuesToArray();//cleanup stacks for(cElementalInstanceStack stack:stacks){ double charge=stack.definition.getCharge()-offsetIn; if(charge-precisionMinimalIn){ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java index cd6f637d61..97ece16fb1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index c86c06b2a0..f7aa945d69 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java index 95bb8dce40..2dc9067e22 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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 6b26132292..d9217171d3 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 @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -258,7 +258,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa for (int i = 0; i < 6; i++) { int pointer = (int) inputMux[i].get(); if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[i] = eInputHatches.get(pointer).getContainerHandler(); + handles[i] = eInputHatches.get(pointer).getContentHandler(); } } @@ -315,7 +315,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa for (int i = 0; i < 6; i++) { int pointer = (int) outputMux[i].get(); if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[i] = eOutputHatches.get(pointer).getContainerHandler(); + handles[i] = eOutputHatches.get(pointer).getContentHandler(); } } //output -- cgit From 27946d59f2f7c272f2f91ec393a35f5d26f5293e Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 17 Jan 2022 22:21:58 +0100 Subject: Cleanup EM api, encapsulate --- .../java/com/github/technus/tectech/TecTech.java | 8 +- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 60 +- .../entity/projectiles/projectileEM.java | 16 +- .../tileentity/turret/TileTurretHeadEM.java | 16 +- .../tileentity/turretbase/TileTurretBaseEM.java | 6 +- .../definitions/EMComplexAspectDefinition.java | 308 ++++ .../definitions/EMPrimalAspectDefinition.java | 42 + .../definitions/dComplexAspectDefinition.java | 308 ---- .../definitions/ePrimalAspectDefinition.java | 42 - .../transformations/AspectDefinitionCompat.java | 20 +- .../AspectDefinitionCompatEnabled.java | 68 +- .../thing/metaTileEntity/multi/EssentiaCompat.java | 6 +- .../multi/EssentiaCompatEnabled.java | 10 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 22 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 18 +- .../technus/tectech/loader/ElementalLoader.java | 34 +- .../tectech/loader/recipe/RecipeLoader.java | 8 +- .../tectech/loader/thing/MachineLoader.java | 2 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 8 +- .../elementalMatter/core/EMException.java | 10 + .../elementalMatter/core/IEMContainer.java | 12 + .../elementalMatter/core/commands/EMGive.java | 160 ++ .../elementalMatter/core/commands/EMList.java | 95 ++ .../elementalMatter/core/commands/GiveEM.java | 160 -- .../elementalMatter/core/commands/ListEM.java | 95 -- .../elementalMatter/core/decay/EMDecay.java | 90 ++ .../elementalMatter/core/decay/EMDecayResult.java | 45 + .../core/decay/cElementalDecay.java | 77 - .../core/decay/cElementalDecayResult.java | 43 - .../elementalMatter/core/iElementalContainer.java | 12 - .../core/maps/EMConstantStackMap.java | 58 + .../core/maps/EMDefinitionStackMap.java | 56 + .../core/maps/EMInstanceStackMap.java | 242 +++ .../elementalMatter/core/maps/EMStackMap.java | 50 + .../elementalMatter/core/maps/IEMMapRead.java | 275 ++++ .../elementalMatter/core/maps/IEMMapWrite.java | 112 ++ .../core/maps/IEMMapWriteExact.java | 166 ++ .../core/maps/cElementalConstantStackMap.java | 58 - .../core/maps/cElementalDefinitionStackMap.java | 56 - .../core/maps/cElementalInstanceStackMap.java | 214 --- .../core/maps/cElementalStackMap.java | 50 - .../elementalMatter/core/maps/iElementalMapR.java | 187 --- .../elementalMatter/core/maps/iElementalMapRW.java | 130 -- .../elementalMatter/core/recipes/EMRecipe.java | 87 + .../elementalMatter/core/recipes/EMRecipeMap.java | 65 + .../core/recipes/rElementalRecipe.java | 57 - .../core/recipes/rElementalRecipeMap.java | 73 - .../core/stacks/EMDefinitionStack.java | 73 + .../core/stacks/EMInstanceStack.java | 605 +++++++ .../elementalMatter/core/stacks/IEMStack.java | 37 + .../core/stacks/cElementalDefinitionStack.java | 88 - .../core/stacks/cElementalInstanceStack.java | 566 ------- .../core/stacks/iElementalStack.java | 23 - .../elementalMatter/core/tElementalException.java | 10 - .../elementalMatter/core/templates/EMComplex.java | 135 ++ .../core/templates/EMPrimitive.java | 283 ++++ .../core/templates/IEMDefinition.java | 84 + .../core/templates/cElementalDefinition.java | 135 -- .../core/templates/cElementalPrimitive.java | 275 ---- .../core/templates/iElementalDefinition.java | 85 - .../transformations/EMFluidDequantizationInfo.java | 43 + .../transformations/EMFluidQuantizationInfo.java | 43 + .../transformations/EMItemDequantizationInfo.java | 45 + .../transformations/EMItemQuantizationInfo.java | 69 + .../EMOredictDequantizationInfo.java | 60 + .../transformations/EMOredictQuantizationInfo.java | 60 + .../core/transformations/EMTransformationInfo.java | 172 ++ .../core/transformations/IEMExchangeInfo.java | 11 + .../transformations/aFluidDequantizationInfo.java | 43 - .../transformations/aFluidQuantizationInfo.java | 43 - .../transformations/aItemDequantizationInfo.java | 45 - .../transformations/aItemQuantizationInfo.java | 69 - .../aOredictDequantizationInfo.java | 52 - .../transformations/aOredictQuantizationInfo.java | 52 - .../core/transformations/bTransformationInfo.java | 124 -- .../core/transformations/iExchangeInfo.java | 11 - .../definitions/complex/EMAtomDefinition.java | 1694 ++++++++++++++++++++ .../definitions/complex/EMHadronDefinition.java | 520 ++++++ .../definitions/complex/EMNuclideIAEA.java | 336 ++++ .../definitions/complex/dAtomDefinition.java | 1678 ------------------- .../definitions/complex/dHadronDefinition.java | 512 ------ .../definitions/complex/iaeaNuclide.java | 307 ---- .../definitions/primitive/EMBosonDefinition.java | 45 + .../definitions/primitive/EMLeptonDefinition.java | 69 + .../primitive/EMNeutrinoDefinition.java | 59 + .../primitive/EMPrimitiveDefinition.java | 39 + .../definitions/primitive/EMQuarkDefinition.java | 106 ++ .../primitive/cPrimitiveDefinition.java | 39 - .../definitions/primitive/eBosonDefinition.java | 45 - .../definitions/primitive/eLeptonDefinition.java | 69 - .../definitions/primitive/eNeutrinoDefinition.java | 59 - .../definitions/primitive/eQuarkDefinition.java | 106 -- .../github/technus/tectech/recipe/TT_recipe.java | 104 +- .../technus/tectech/recipe/TT_recipeAdder.java | 22 +- .../item/DebugElementalInstanceContainer_EM.java | 40 +- .../item/ElementalDefinitionContainer_EM.java | 26 +- .../item/ElementalDefinitionScanStorage_EM.java | 4 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 22 +- .../multi/GT_MetaTileEntity_EM_collider.java | 251 +-- .../multi/GT_MetaTileEntity_EM_decay.java | 22 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 38 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 48 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 48 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 52 +- .../multi/em_machine/Behaviour_Centrifuge.java | 69 +- .../multi/em_machine/Behaviour_Electrolyzer.java | 4 +- .../Behaviour_ElectromagneticSeparator.java | 47 +- .../multi/em_machine/Behaviour_PrecisionLaser.java | 4 +- .../multi/em_machine/Behaviour_Recycler.java | 6 +- .../multi/em_machine/Behaviour_Scanner.java | 4 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 10 +- .../tectech/thing/metaTileEntity/multi/other todo | 4 +- .../github/technus/tectech/util/DoubleCount.java | 122 +- 113 files changed, 7090 insertions(+), 6618 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 809a7e877d..ef5e146bfa 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -9,8 +9,8 @@ import com.github.technus.tectech.mechanics.commands.ConvertFloat; import com.github.technus.tectech.mechanics.commands.ConvertInteger; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; import com.github.technus.tectech.mechanics.data.PlayerPersistence; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.GiveEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.ListEM; +import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMGive; +import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList; import com.github.technus.tectech.proxy.CommonProxy; import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.FMLCommonHandler; @@ -203,9 +203,9 @@ public class TecTech { public void serverLoad(FMLServerStartingEvent pEvent) { pEvent.registerServerCommand(new ConvertInteger()); pEvent.registerServerCommand(new ConvertFloat()); - pEvent.registerServerCommand(new ListEM()); + pEvent.registerServerCommand(new EMList()); if(DEBUG_MODE) { - pEvent.registerServerCommand(new GiveEM()); + pEvent.registerServerCommand(new EMGive()); pEvent.registerServerCommand(new CancerCommand()); pEvent.registerServerCommand(new ChargeCommand()); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index f3120fda25..ee7d293e08 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.compatibility.gtpp; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.*; public class GtppAtomLoader implements Runnable{ //region reflect a bit @@ -59,34 +59,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); generate("GERMANIUM",true,true); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index a0b6106151..d594a826bc 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -44,25 +44,25 @@ public class projectileEM extends LaserProjectile { } } - public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStack projectileContent) { + public projectileEM(World par1World, TurretBase turretBase, EMInstanceStack projectileContent) { super(par1World, turretBase); this.turretBase = turretBase; if(projectileContent != null){ mass=projectileContent.getMass(); charge=projectileContent.getCharge(); - massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); + massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass()); - if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) { + if(projectileContent.getDefinition().getType()>1 || projectileContent.getDefinition().getType()<-1) { strange = true; } - if(projectileContent.definition.getType()<0) { + if(projectileContent.getDefinition().getType()<0) { antiMatter = true; } - if (projectileContent.definition.getCharge() == 0) { + if (projectileContent.getDefinition().getCharge() == 0) { gravity = massFactor / 100f; } else { - gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f); + gravity = Math.min(0.0025F / Math.abs(projectileContent.getDefinition().getCharge()), massFactor / 100f); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index e027c83107..6dc5c4f60a 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.t import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -14,13 +14,13 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; /** * Created by Bass on 27/07/2017. */ public class TileTurretHeadEM extends TurretHead{ - private cElementalInstanceStackMap hatchContentPointer; + private EMInstanceStackMap hatchContentPointer; @Override public int getTurretRange() { @@ -70,11 +70,11 @@ public class TileTurretHeadEM extends TurretHead{ if (hatchContentPointer == null || hatchContentPointer.isEmpty()) { return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null); } - cElementalInstanceStack stack = hatchContentPointer.getRandom(); - double amount = Math.min(AVOGADRO_CONSTANT,stack.amount); - hatchContentPointer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT)); + EMInstanceStack stack = hatchContentPointer.getRandom(); + double amount = Math.min(AVOGADRO_CONSTANT, stack.getAmount()); + hatchContentPointer.removeAmount(stack.getDefinition(),AVOGADRO_CONSTANT); stack=stack.clone(); - stack.amount = amount; + stack.setAmount(amount); return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java index a5d64fb886..0dbc33e007 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import cpw.mods.fml.common.Optional; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -25,7 +25,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { return "turretBaseEM"; } - public final cElementalInstanceStackMap getContainerHandler() { + public final EMInstanceStackMap getContainerHandler() { World worldIn = getWorldObj(); TileEntity te; if ((te = worldIn.getTileEntity(xCoord + 1, yCoord, zCoord)) instanceof IGregTechTileEntity && @@ -61,7 +61,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { return null; } - private cElementalInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) { + private EMInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) { hatch.updateTexture((byte) 8,(byte) 4); return hatch.getContentHandler(); } 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 new file mode 100644 index 0000000000..432d151b80 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java @@ -0,0 +1,308 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +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.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by Tec on 06.05.2017. + */ +public final class EMComplexAspectDefinition extends EMComplex { + private final int hash; + private final double mass; + + private static final byte nbtType = (byte) 'c'; + + private final EMConstantStackMap aspectStacks; + + public EMComplexAspectDefinition(EMDefinitionStack... aspects) throws EMException { + this(true, new EMConstantStackMap(aspects)); + } + + private EMComplexAspectDefinition(boolean check, EMDefinitionStack... aspects) throws EMException { + this(check, new EMConstantStackMap(aspects)); + } + + public EMComplexAspectDefinition(EMConstantStackMap aspects) throws EMException { + this(true, aspects); + } + + private EMComplexAspectDefinition(boolean check, EMConstantStackMap aspects) throws EMException { + if (check && !canTheyBeTogether(aspects)) { + throw new EMException("Hadron Definition error"); + } + aspectStacks = aspects; + float mass = 0; + for (EMDefinitionStack stack : aspects.valuesToArray()) { + mass += stack.getMass(); + } + this.mass = mass; + hash = super.hashCode(); + } + + //public but u can just try{}catch(){} the constructor it still calls this method + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + long amount = 0; + for (EMDefinitionStack aspects : stacks.valuesToArray()) { + if (!(aspects.getDefinition() instanceof EMComplexAspectDefinition) && !(aspects.getDefinition() instanceof EMPrimalAspectDefinition)) { + return false; + } + if((int) aspects.getAmount() != aspects.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + amount += aspects.getAmount(); + } + return amount == 2; + } + + @Override + public String getLocalizedName() { + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this); + if (name != null) { + name = name.substring(0, 1).toUpperCase() + name.substring(1); + } else { + name = getSymbol(); + } + return translateToLocal("tt.keyword.Aspect") + ": " + name; + } + + @Override + public String getSymbol() { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { + if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getSymbol()); + } + } else { + symbol.append('('); + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getSymbol()); + } + symbol.append(')'); + } + } + return symbol.toString(); + } + + @Override + public String getShortSymbol() { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { + if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getShortSymbol()); + } + } else { + symbol.append('('); + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getShortSymbol()); + } + symbol.append(')'); + } + } + return symbol.toString(); + } + + @Override + public NBTTagCompound toNBT() { + return getNbtTagCompound(nbtType, aspectStacks); + } + + public static NBTTagCompound getNbtTagCompound(byte nbtType, EMConstantStackMap aspectStacks) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setByte("t", nbtType); + EMDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray(); + nbt.setInteger("i", quarkStacksValues.length); + for (int i = 0; i < quarkStacksValues.length; i++) { + nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); + } + return nbt; + } + + public static EMComplexAspectDefinition fromNBT(NBTTagCompound nbt) { + EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < stacks.length; i++) { + stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + } + try { + return new EMComplexAspectDefinition(stacks); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return -1; + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } + + @Override + public int getCharge() { + return 0; + } + + @Override + public byte getType() { + return 0; + } + + @Override + public byte getColor() { + return -1; + } + + @Override + public EMConstantStackMap getSubParticles() { + return aspectStacks; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + return new EMDecay[]{new EMDecay(0.75F, aspectStacks), EMBosonDefinition.deadEnd}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + return NO_DECAY; + } + + @Override + public EMDecay[] getDecayArray() { + return NO_DECAY; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public IEMDefinition getAnti() { + return null; + } + + public static void run() { + try { + EMComplex.addCreatorFromNBT(nbtType, EMComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if (DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + -96); + } + } + + @Override + public byte getClassType() { + return -96; + } + + public static byte getClassTypeStatic() { + return -96; + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { + if (Util.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)) { + lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType()); + } + if (Util.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)) { + lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); + } + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { + lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); + } + if (Util.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/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java new file mode 100644 index 0000000000..bf9703d6d7 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -0,0 +1,42 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by Tec on 06.05.2017. + */ +public final class EMPrimalAspectDefinition extends EMPrimitive { + public static final EMPrimalAspectDefinition + magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), + magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), + magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), + magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), + magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), + magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); + + private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID) { + super(name, symbol, 0, mass, 0, -1, ID); + } + + public static void run() { + magic_air.init(null, -1F, -1, -1, NO_DECAY); + magic_earth.init(null, -1F, -1, -1, NO_DECAY); + magic_fire.init(null, -1F, -1, -1, NO_DECAY); + magic_water.init(null, -1F, -1, -1, NO_DECAY); + magic_order.init(null, -1F, -1, -1, NO_DECAY); + magic_entropy.init(null, -1F, -1, -1, NO_DECAY); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.Primal") + ": " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java deleted file mode 100644 index 98ad5bbf63..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ /dev/null @@ -1,308 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 06.05.2017. - */ -public final class dComplexAspectDefinition extends cElementalDefinition { - private final int hash; - public final double mass; - - private static final byte nbtType = (byte) 'c'; - - private final cElementalConstantStackMap aspectStacks; - - public dComplexAspectDefinition(cElementalDefinitionStack... aspects) throws tElementalException { - this(true, new cElementalConstantStackMap(aspects)); - } - - private dComplexAspectDefinition(boolean check, cElementalDefinitionStack... aspects) throws tElementalException { - this(check, new cElementalConstantStackMap(aspects)); - } - - public dComplexAspectDefinition(cElementalConstantStackMap aspects) throws tElementalException { - this(true, aspects); - } - - private dComplexAspectDefinition(boolean check, cElementalConstantStackMap aspects) throws tElementalException { - if (check && !canTheyBeTogether(aspects)) { - throw new tElementalException("Hadron Definition error"); - } - aspectStacks = aspects; - float mass = 0; - for (cElementalDefinitionStack stack : aspects.valuesToArray()) { - mass += stack.getMass(); - } - this.mass = mass; - hash = super.hashCode(); - } - - //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { - long amount = 0; - for (cElementalDefinitionStack aspects : stacks.valuesToArray()) { - if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) { - return false; - } - if((int)aspects.amount!=aspects.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - amount += aspects.amount; - } - return amount == 2; - } - - @Override - public String getName() { - String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this); - if (name != null) { - name = name.substring(0, 1).toUpperCase() + name.substring(1); - } else { - name = getSymbol(); - } - return translateToLocal("tt.keyword.Aspect") + ": " + name; - } - - @Override - public String getSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) { - if (aspect.definition instanceof ePrimalAspectDefinition) { - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - public String getShortSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) { - if (aspect.definition instanceof ePrimalAspectDefinition) { - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getShortSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getShortSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, aspectStacks); - } - - public static NBTTagCompound getNbtTagCompound(byte nbtType, cElementalConstantStackMap aspectStacks) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - cElementalDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray(); - nbt.setInteger("i", quarkStacksValues.length); - for (int i = 0; i < quarkStacksValues.length; i++) { - nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); - } - return nbt; - } - - public static dComplexAspectDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new dComplexAspectDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return -1; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } - - @Override - public int getCharge() { - return 0; - } - - @Override - public byte getType() { - return 0; - } - - @Override - public byte getColor() { - return -1; - } - - @Override - public cElementalConstantStackMap getSubParticles() { - return aspectStacks; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - return new cElementalDecay[]{new cElementalDecay(0.75F, aspectStacks), eBosonDefinition.deadEnd}; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - return noDecay; - } - - @Override - public cElementalDecay[] getDecayArray() { - return noDecay; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public iElementalDefinition getAnti() { - return null; - } - - public static void run() { - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if (DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + -96); - } - } - - @Override - public byte getClassType() { - return -96; - } - - public static byte getClassTypeStatic() { - return -96; - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if (Util.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)) { - lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType()); - } - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { - lines.add(translateToLocal("tt.keyword.NAME") + " = " + getName()); - //lines.add("SYMBOL = "+getSymbol()); - } - if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { - lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); - } - if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); - } - if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { - lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); - } - if (Util.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/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java deleted file mode 100644 index 5db067a552..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 06.05.2017. - */ -public final class ePrimalAspectDefinition extends cElementalPrimitive { - public static final ePrimalAspectDefinition - magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), - magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), - magic_fire = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), - magic_water = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), - magic_order = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), - magic_entropy = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); - - private ePrimalAspectDefinition(String name, String symbol, double mass, int ID) { - super(name, symbol, 0, mass, 0, -1, ID); - } - - public static void run() { - magic_air.init(null, -1F, -1, -1, noDecay); - magic_earth.init(null, -1F, -1, -1, noDecay); - magic_fire.init(null, -1F, -1, -1, noDecay); - magic_water.init(null, -1F, -1, -1, noDecay); - magic_order.init(null, -1F, -1, -1, noDecay); - magic_entropy.init(null, -1F, -1, -1, noDecay); - } - - @Override - public String getName() { - return translateToLocal("tt.keyword.Primal") + ": " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java index 343071e26e..c7f38eb21d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import java.util.HashMap; @@ -9,21 +9,25 @@ import java.util.HashMap; * Created by Tec on 21.05.2017. */ public class AspectDefinitionCompat { - public static AspectDefinitionCompat aspectDefinitionCompat; - public final HashMap defToAspect = new HashMap<>(); - public final HashMap aspectToDef = new HashMap<>(); + public static AspectDefinitionCompat aspectDefinitionCompat; + private final HashMap defToAspect = new HashMap<>(); + private final HashMap aspectToDef = new HashMap<>(); public void run(){} - public Object getAspect(iElementalDefinition definition){ + public String getAspectTag(IEMDefinition definition){ return null; } - public String getAspectTag(iElementalDefinition definition){ + public IEMDefinition getDefinition(String aspect){ return null; } - public iElementalDefinition getDefinition(String aspect){ - return null; + public HashMap getDefToAspect() { + return defToAspect; + } + + public HashMap getAspectToDef() { + return aspectToDef; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java index 446e9b66d5..c9ca5d7b9f 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; /** @@ -16,19 +16,19 @@ import static com.github.technus.tectech.thing.item.DebugElementalInstanceContai public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { @Override public void run(){ - defToAspect.put(magic_air,"aer"); - defToAspect.put(magic_earth,"terra"); - defToAspect.put(magic_fire,"ignis"); - defToAspect.put(magic_water,"aqua"); - defToAspect.put(magic_order,"ordo"); - defToAspect.put(magic_entropy,"perditio"); + getDefToAspect().put(magic_air,"aer"); + getDefToAspect().put(magic_earth,"terra"); + getDefToAspect().put(magic_fire,"ignis"); + getDefToAspect().put(magic_water,"aqua"); + getDefToAspect().put(magic_order,"ordo"); + getDefToAspect().put(magic_entropy,"perditio"); - aspectToDef.put("aer",magic_air); - aspectToDef.put("terra",magic_earth); - aspectToDef.put("ignis",magic_fire); - aspectToDef.put("aqua",magic_water); - aspectToDef.put("ordo",magic_order); - aspectToDef.put("perditio",magic_entropy); + getAspectToDef().put("aer",magic_air); + getAspectToDef().put("terra",magic_earth); + getAspectToDef().put("ignis",magic_fire); + getAspectToDef().put("aqua",magic_water); + getAspectToDef().put("ordo",magic_order); + getAspectToDef().put("perditio",magic_entropy); ArrayList list=Aspect.getCompoundAspects(); Aspect[] array= list.toArray(new Aspect[0]); @@ -38,20 +38,20 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat Aspect[] content = aspect.getComponents(); if (content.length != 2) { list.remove(aspect); - }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ + }else if(getAspectToDef().containsKey(content[0].getTag()) && getAspectToDef().containsKey(content[1].getTag())){ try { - dComplexAspectDefinition newAspect; + EMComplexAspectDefinition newAspect; if(content[0].getTag().equals(content[1].getTag())){ - newAspect = new dComplexAspectDefinition( - aspectToDef.get(content[0].getTag()).getStackForm(2)); + newAspect = new EMComplexAspectDefinition( + getAspectToDef().get(content[0].getTag()).getStackForm(2)); }else{ - newAspect = new dComplexAspectDefinition( - aspectToDef.get(content[0].getTag()).getStackForm(1), - aspectToDef.get(content[1].getTag()).getStackForm(1)); + newAspect = new EMComplexAspectDefinition( + getAspectToDef().get(content[0].getTag()).getStackForm(1), + getAspectToDef().get(content[1].getTag()).getStackForm(1)); } - aspectToDef.put(aspect.getTag(),newAspect); - defToAspect.put(newAspect,aspect.getTag()); - }catch (tElementalException e) { + getAspectToDef().put(aspect.getTag(),newAspect); + getDefToAspect().put(newAspect,aspect.getTag()); + }catch (EMException e) { /**/ }finally { list.remove(aspect); @@ -60,22 +60,16 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } } } - - STACKS_REGISTERED.addAll(defToAspect.keySet()); - } - - @Override - public Aspect getAspect(iElementalDefinition definition) { - return Aspect.getAspect(defToAspect.get(definition)); + STACKS_REGISTERED.addAll(getDefToAspect().keySet()); } @Override - public String getAspectTag(iElementalDefinition definition) { - return defToAspect.get(definition); + public String getAspectTag(IEMDefinition definition) { + return getDefToAspect().get(definition); } @Override - public iElementalDefinition getDefinition(String aspect) { - return aspectToDef.get(aspect); + public IEMDefinition getDefinition(String aspect) { + return getAspectToDef().get(aspect); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index 63f55912a6..d51bc8dc2d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; @@ -18,7 +18,7 @@ public class EssentiaCompat { return null; } - public String getEssentiaName(iElementalDefinition stack){ + public String getEssentiaName(IEMDefinition stack){ return null; } @@ -26,7 +26,7 @@ public class EssentiaCompat { return false; } - public iElementalDefinition getFromContainer(TileEntity container){ + public IEMDefinition getFromContainer(TileEntity container){ return null; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index 03ff92b4e0..ab682ba1a5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; @@ -28,8 +28,8 @@ public class EssentiaCompatEnabled extends EssentiaCompat { } @Override - public String getEssentiaName(iElementalDefinition stack) { - return aspectDefinitionCompat.defToAspect.get(stack); + public String getEssentiaName(IEMDefinition stack) { + return aspectDefinitionCompat.getDefToAspect().get(stack); } @Override @@ -49,7 +49,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { } @Override - public iElementalDefinition getFromContainer(TileEntity container){ + public IEMDefinition getFromContainer(TileEntity container){ if(container==null || container.isInvalid()) { return null; } @@ -59,7 +59,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { Aspect[] aspectsArr= aspects.getAspects(); if(aspectsArr!=null && aspectsArr[0]!=null){ if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){ - return aspectDefinitionCompat.aspectToDef.get(aspectsArr[0].getTag()); + return aspectDefinitionCompat.getAspectToDef().get(aspectsArr[0].getTag()); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index c939f10d6b..dbcbe7d86b 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -26,8 +26,8 @@ import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -94,24 +94,24 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ return false; } - cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler(); + EMInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler(); if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) { return false; } - cElementalInstanceStack stack = inputHatchContainer.getRandom(); - if (stack.amount < AVOGADRO_CONSTANT_DIMINISHED) { - cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + EMInstanceStack stack = inputHatchContainer.getRandom(); + if (stack.getAmount() < AVOGADRO_CONSTANT_DIMINISHED) { + cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[6]; } else { - outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.definition); + outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.getDefinition()); Aspect aspect = Aspect.getAspect(outputEssentiaName); if (aspect == null) { outputEssentiaName = null; - cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[7]; } else { - inputHatchContainer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT)); + inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(AVOGADRO_CONSTANT)); if (aspect.isPrimal()) { mEUt = (int) -V[8]; } else { diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 62ac339155..5606442c37 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -25,7 +25,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -84,15 +84,15 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkRecipe_EM(ItemStack itemStack) { - iElementalDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); + IEMDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); if (definition != null) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; eAmpereFlow = 1; - outputEM = new cElementalInstanceStackMap[]{ - new cElementalInstanceStackMap(new cElementalInstanceStack(definition,AVOGADRO_CONSTANT)) + outputEM = new EMInstanceStackMap[]{ + new EMInstanceStackMap(new EMInstanceStack(definition,AVOGADRO_CONSTANT)) }; - if (definition instanceof ePrimalAspectDefinition) { + if (definition instanceof EMPrimalAspectDefinition) { mEUt = (int) -V[8]; } else { mEUt = (int) -V[10]; diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index b481b82646..7ce371e57e 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.loader; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.iaeaNuclide; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMNuclideIAEA; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*; /** @@ -18,23 +18,23 @@ public class ElementalLoader implements Runnable { // Definition init // =================================================================================================== - cElementalPrimitive.run(); + EMPrimitive.run(); - cPrimitiveDefinition.run(); + EMPrimitiveDefinition.run(); - eQuarkDefinition.run(); - eLeptonDefinition.run(); - eNeutrinoDefinition.run(); - eBosonDefinition.run(); + EMQuarkDefinition.run(); + EMLeptonDefinition.run(); + EMNeutrinoDefinition.run(); + EMBosonDefinition.run(); - dHadronDefinition.run(); + EMHadronDefinition.run(); - iaeaNuclide.run(); + EMNuclideIAEA.run(); - dAtomDefinition.run(); + EMAtomDefinition.run(); - ePrimalAspectDefinition.run(); + EMPrimalAspectDefinition.run(); - dComplexAspectDefinition.run(); + EMComplexAspectDefinition.run(); } } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java index 8165cd7fec..3572e601e4 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java @@ -3,8 +3,8 @@ package com.github.technus.tectech.loader.recipe; import com.github.technus.tectech.Reference; import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.item.ConstructableTriggerItem; @@ -35,8 +35,8 @@ public class RecipeLoader implements Runnable { @Override public void run() { - dAtomDefinition.setTransformation(); - dHadronDefinition.setTransformations(); + EMAtomDefinition.setTransformation(); + EMHadronDefinition.setTransformations(); // =================================================================================================== // Recipes init - common goes here rest goes into methods below diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 91dbffa71f..b3df7483f5 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -15,7 +15,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; 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 0e1771e88d..c6ac34b66d 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 @@ -7,7 +7,7 @@ import com.github.technus.tectech.mechanics.data.ChunkDataHandler; 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.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.api.GregTech_API; @@ -31,11 +31,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; public class AnomalyHandler implements IChunkMetaDataHandler { - private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... + private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... private static final int COUNT_DIV=32; private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java new file mode 100644 index 0000000000..23ca5d77d9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +/** + * Created by danie_000 on 19.11.2016. + */ +public final class EMException extends Exception { + public EMException(String message) { + super(message); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java new file mode 100644 index 0000000000..d731078988 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; + +/** + * Created by danie_000 on 25.01.2017. + */ +public interface IEMContainer { + EMInstanceStackMap getContentHandler(); + + void purgeOverflow(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java new file mode 100644 index 0000000000..64e9bcea1e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -0,0 +1,160 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.commands; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +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.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 30.12.2017. + */ +public class EMGive implements ICommand { + ArrayList aliases=new ArrayList<>(); + + public EMGive(){ + aliases.add("em_give"); + aliases.add("give_em"); + aliases.add("gib_em"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { + if(args.length < 3) { + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + }else{ + TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args)); + + ArrayList list = new ArrayList<>(Arrays.asList(args)); + String energy=list.remove(0); + + EMDefinitionStack def = getDefinitionStack(list); + if(def!=null) { + EMInstanceStack instanceStack = new EMInstanceStack(def, 1D, 0D, Long.parseLong(energy)); + + sender.addChatMessage(new ChatComponentText(instanceStack.getDefinition().getSymbol() + " - " + instanceStack.getDefinition().getLocalizedName())); + + EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack); + + ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); + NBTTagCompound contents = new NBTTagCompound(); + contents.setTag("info", instanceMap.getInfoNBT()); + contents.setTag("content", instanceMap.toNBT()); + itemStack.setTagCompound(contents); + + ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); + } + } + } + } + + private EMDefinitionStack getDefinitionStack(ArrayList args){ + if(args.get(0).equals("<")){ + args.remove(0); + return null; + } + double amount=Double.parseDouble(args.remove(0)); + try{ + int id=Integer.parseInt(args.get(0)); + args.remove(0); + IEMDefinition primitive = EMPrimitive.getBindsPrimitive().get(id); + return new EMDefinitionStack(primitive,amount); + }catch (NumberFormatException e){ + byte clazz = (byte) args.remove(0).charAt(0); + Method constructor = EMComplex.getBindsComplex().get(clazz); + + EMDefinitionStackMap stacks =new EMDefinitionStackMap(); + while(args.size()>0){ + EMDefinitionStack tempStack =getDefinitionStack(args); + if(tempStack==null) { + break; + }else { + stacks.putUnifyExact(tempStack); + } + } + + try { + return ((IEMDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount); + } catch (Exception e1) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return nbtE__.getStackForm(amount); + } + } + } + + @Override + public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { + return false; + } + + @Override + public List getCommandAliases() { + return aliases; + } + + @Override + public String getCommandName() { + return aliases.get(0); + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args) { + if(args.length==2){ + return completionsForClassOrID(); + } + return null; + } + + private List completionsForClassOrID(){ + ArrayList strings=new ArrayList<>(8); + Map binds= EMComplex.getBindsComplex(); + for (Map.Entry e:binds.entrySet()) { + strings.add(String.valueOf((char)e.getKey().byteValue())); + } + Map bindsBO = EMPrimitive.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { + strings.add(String.valueOf(e.getKey().byteValue())); + } + return strings; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "em_give Energy Count ClassOrId (Count ClassOrId ... <)"; + } + + @Override + public int compareTo(Object o) { + if(o instanceof ICommand){ + return getCommandName().compareTo(((ICommand) o).getCommandName()); + } + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } +} 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 new file mode 100644 index 0000000000..395592036f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java @@ -0,0 +1,95 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.commands; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Created by danie_000 on 30.12.2017. + */ +public class EMList implements ICommand { + ArrayList aliases=new ArrayList<>(); + + public EMList(){ + aliases.add("em_list"); + aliases.add("list_em"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (!sender.getEntityWorld().isRemote) { + if(args.length == 0) { + sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); + Map binds= EMComplex.getBindsComplex(); + for (Map.Entry e:binds.entrySet()) { + sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); + } + }else if(args.length==1){ + sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); + if(args[0].equals(String.valueOf((char) EMPrimitive.nbtType))){ + Map bindsBO = EMPrimitive.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { + sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName())); + } + }else{ + sender.addChatMessage(new ChatComponentText("Complex definition - needs contents")); + } + }else{ + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + } + } + } + + @Override + public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { + return false; + } + + @Override + public List getCommandAliases() { + return aliases; + } + + @Override + public String getCommandName() { + return aliases.get(0); + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args) { + if(args.length==0){ + Map binds= EMComplex.getBindsComplex(); + ArrayList strings=new ArrayList<>(binds.size()); + for (Map.Entry e:binds.entrySet()) { + strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); + } + return strings; + } + return null; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "em_list (optional class tag)"; + } + + @Override + public int compareTo(Object o) { + if(o instanceof ICommand){ + return getCommandName().compareTo(((ICommand) o).getCommandName()); + } + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java deleted file mode 100644 index 8b1f6d0c14..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class GiveEM implements ICommand { - ArrayList aliases=new ArrayList<>(); - - public GiveEM(){ - aliases.add("em_give"); - aliases.add("give_em"); - aliases.add("gib_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - if(args.length < 3) { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - }else{ - TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args)); - - ArrayList list = new ArrayList<>(Arrays.asList(args)); - String energy=list.remove(0); - - cElementalDefinitionStack def= getDefinitionStack(list); - if(def!=null) { - cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1D, 0D, Long.parseLong(energy)); - - sender.addChatMessage(new ChatComponentText(instanceStack.definition.getSymbol() + " - " + instanceStack.definition.getName())); - - cElementalInstanceStackMap instanceMap = new cElementalInstanceStackMap(instanceStack); - - ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); - NBTTagCompound contents = new NBTTagCompound(); - contents.setTag("info", instanceMap.getInfoNBT()); - contents.setTag("content", instanceMap.toNBT()); - itemStack.setTagCompound(contents); - - ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); - } - } - } - } - - private cElementalDefinitionStack getDefinitionStack(ArrayList args){ - if(args.get(0).equals("<")){ - args.remove(0); - return null; - } - double amount=Double.parseDouble(args.remove(0)); - try{ - int id=Integer.parseInt(args.get(0)); - args.remove(0); - iElementalDefinition primitive=cElementalPrimitive.getBindsPrimitive().get(id); - return new cElementalDefinitionStack(primitive,amount); - }catch (NumberFormatException e){ - byte clazz = (byte) args.remove(0).charAt(0); - Method constructor = cElementalDefinition.getBindsComplex().get(clazz); - - cElementalDefinitionStackMap stacks =new cElementalDefinitionStackMap(); - while(args.size()>0){ - cElementalDefinitionStack tempStack=getDefinitionStack(args); - if(tempStack==null) { - break; - }else { - stacks.putUnify(tempStack); - } - } - - try { - return ((iElementalDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount); - } catch (Exception e1) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__.getStackForm(amount); - } - } - } - - @Override - public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==2){ - return completionsForClassOrID(); - } - return null; - } - - private List completionsForClassOrID(){ - ArrayList strings=new ArrayList<>(8); - Map binds= cElementalDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())); - } - Map bindsBO = cElementalPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - strings.add(String.valueOf(e.getKey().byteValue())); - } - return strings; - } - - @Override - public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_give Energy Count ClassOrId (Count ClassOrId ... <)"; - } - - @Override - public int compareTo(Object o) { - if(o instanceof ICommand){ - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java deleted file mode 100644 index 20110c0b0d..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class ListEM implements ICommand { - ArrayList aliases=new ArrayList<>(); - - public ListEM(){ - aliases.add("em_list"); - aliases.add("list_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (!sender.getEntityWorld().isRemote) { - if(args.length == 0) { - sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); - Map binds= cElementalDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); - } - }else if(args.length==1){ - sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); - if(args[0].equals(String.valueOf((char)cElementalPrimitive.nbtType))){ - Map bindsBO = cElementalPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getName())); - } - }else{ - sender.addChatMessage(new ChatComponentText("Complex definition - needs contents")); - } - }else{ - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - } - } - } - - @Override - public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==0){ - Map binds= cElementalDefinition.getBindsComplex(); - ArrayList strings=new ArrayList<>(binds.size()); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); - } - return strings; - } - return null; - } - - @Override - public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_list (optional class tag)"; - } - - @Override - public int compareTo(Object o) { - if(o instanceof ICommand){ - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java new file mode 100644 index 0000000000..bed49a5040 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java @@ -0,0 +1,90 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +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.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; + +import static com.github.technus.tectech.util.DoubleCount.mul; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMDecay { + public static final EMDecay[] NO_DECAY = null; + //DECAY IMPOSSIBLE!!! + //Do not use regular NULL java will not make it work with varargs!!! + //Or cast null into ARRAY type but this static is more convenient!!! + public static final EMDecay[] NO_PRODUCT = new EMDecay[0]; + //this in turn can be used to tell that the thing should just vanish + private final EMConstantStackMap outputStacks; + private final double probability; + + public EMDecay(IEMDefinition... outSafe) { + this(1D, outSafe); + } + + public EMDecay(double probability, IEMDefinition... outSafe) { + EMDefinitionStack[] outArr = new EMDefinitionStack[outSafe.length]; + for (int i = 0; i < outArr.length; i++) { + outArr[i] = new EMDefinitionStack(outSafe[i], 1D); + } + outputStacks = new EMConstantStackMap(outArr); + this.probability = probability; + } + + public EMDecay(EMDefinitionStack... outSafe) { + this(1D, outSafe); + } + + public EMDecay(double probability, EMDefinitionStack... out) { + outputStacks = new EMConstantStackMap(out); + this.probability = probability; + } + + public EMDecay(EMConstantStackMap tree) { + this(1D, tree); + } + + public EMDecay(double probability, EMConstantStackMap tree) { + outputStacks = tree; + this.probability = probability; + } + + public EMInstanceStackMap getResults(double lifeMult, double age, long newEnergyLevel, double amountDecaying) { + EMInstanceStackMap decayResult = new EMInstanceStackMap(); + if (getOutputStacks() == null) { + return decayResult;//This is to prevent null pointer exceptions. + } + //Deny decay code is in instance! + boolean empty=true; + for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { + if(stack.getAmount() >0){ + empty=false; + break; + } + } + if (empty) { + return decayResult; + } + //newEnergyLevel /= qtty; + //lifeMult /= (float) qtty; + for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { + decayResult.putUnify(new EMInstanceStack(stack.getDefinition(), + mul(amountDecaying, stack.getAmount()), + lifeMult, + age/*new products*/, + (long)(newEnergyLevel / Math.max(1D, Math.abs(stack.getAmount())))));//get instances from stack + } + return decayResult; + } + + public EMConstantStackMap getOutputStacks() { + return outputStacks; + } + + public double getProbability() { + return probability; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java new file mode 100644 index 0000000000..0a00a519f9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; + +public class EMDecayResult { + private final EMInstanceStackMap output; + private double massAffected; + private double massDiff; + + public EMDecayResult(EMInstanceStackMap output, double massAffected, double massDiff) { + this.output = output; + this.massAffected = massAffected; + this.massDiff = massDiff; + } + + public EMInstanceStackMap getOutput() { + return output; + } + + /** + * How much was lost in the process (decayed or removed) + * + * @return + */ + public double getMassAffected() { + return massAffected; + } + + /** + * Difference of mass of actually decayed elements + * + * @return + */ + public double getMassDiff() { + return massDiff; + } + + public void setMassAffected(double massAffected) { + this.massAffected = massAffected; + } + + public void setMassDiff(double massDiff) { + this.massDiff = massDiff; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java deleted file mode 100644 index 79103f7fa0..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.decay; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -import static com.github.technus.tectech.util.DoubleCount.add; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cElementalDecay { - public static final cElementalDecay[] noDecay = null; - //DECAY IMPOSSIBLE!!! - //Do not use regular NULL java will not make it work with varargs!!! - //Or cast null into ARRAY type but this static is more convenient!!! - public static final cElementalDecay[] noProduct = new cElementalDecay[0]; - //this in turn can be used to tell that the thing should just vanish - public final cElementalConstantStackMap outputStacks; - public final double probability; - - public cElementalDecay(iElementalDefinition... outSafe) { - this(1D, outSafe); - } - - public cElementalDecay(double probability, iElementalDefinition... outSafe) { - cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; - for (int i = 0; i < outArr.length; i++) { - outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D); - } - outputStacks = new cElementalConstantStackMap(outArr); - this.probability = probability; - } - - public cElementalDecay(cElementalDefinitionStack... outSafe) { - this(1D, outSafe); - } - - public cElementalDecay(double probability, cElementalDefinitionStack... out) { - outputStacks = new cElementalConstantStackMap(out); - this.probability = probability; - } - - public cElementalDecay(cElementalConstantStackMap tree) { - this(1D, tree); - } - - public cElementalDecay(double probability, cElementalConstantStackMap tree) { - outputStacks = tree; - this.probability = probability; - } - - public cElementalInstanceStackMap getResults(double lifeMult, double age, long energyTotalForProducts, double amountDecaying) { - cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); - if (outputStacks == null) { - return decayResult;//This is to prevent null pointer exceptions. - } - //Deny decay code is in instance! - double qtty = 0D; - for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { - qtty= add(qtty,stack.amount); - } - if (qtty <= 0D) { - return decayResult; - } - //energyTotalForProducts /= qtty; - //lifeMult /= (float) qtty; - for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { - decayResult.putUnify(new cElementalInstanceStack(stack.definition, - amountDecaying * stack.amount, - lifeMult, age/*new products*/, (long)(energyTotalForProducts / Math.max(1D, Math.abs(stack.amount)))));//get instances from stack - } - return decayResult; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java deleted file mode 100644 index 43f4341720..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.decay; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; - -public class cElementalDecayResult { - private final cElementalInstanceStackMap output; - private double massAffected; - private double massDiff; - - public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) { - this.output = output; - this.massAffected = massAffected; - this.massDiff = massDiff; - } - - public cElementalInstanceStackMap getOutput() { - return output; - } - - /** - * How much was lost in the process (decayed or removed) - * @return - */ - public double getMassAffected() { - return massAffected; - } - - /** - * Difference of mass of actually decayed elements - * @return - */ - public double getMassDiff() { - return massDiff; - } - - public void setMassAffected(double massAffected) { - this.massAffected = massAffected; - } - - public void setMassDiff(double massDiff) { - this.massDiff = massDiff; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java deleted file mode 100644 index 457a37f7b9..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; - -/** - * Created by danie_000 on 25.01.2017. - */ -public interface iElementalContainer { - cElementalInstanceStackMap getContentHandler(); - - void purgeOverflow(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java new file mode 100644 index 0000000000..d9297436a0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java @@ -0,0 +1,58 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Collections; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by Tec on 12.05.2017. + */ +public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap {//Target class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public static final EMConstantStackMap EMPTY = new EMConstantStackMap(); + + private EMConstantStackMap() { + super(Collections.emptyNavigableMap()); + } + + public EMConstantStackMap(EMDefinitionStack... in) { + this(new EMDefinitionStackMap(in).getBackingMap()); + } + + public EMConstantStackMap(NavigableMap in) { + super(Collections.unmodifiableNavigableMap(in)); + } + + @Override + public Class getType() { + return EMDefinitionStack.class; + } + + //IMMUTABLE DON'T NEED IT + @Override + public EMConstantStackMap clone() { + return this; + } + + public EMDefinitionStackMap toMutable() { + return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); + } + + public static EMConstantStackMap fromNBT(NBTTagCompound nbt) throws EMException { + EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + return new EMConstantStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java new file mode 100644 index 0000000000..45ce50d5c7 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class EMDefinitionStackMap extends EMStackMap implements IEMMapWriteExact {//Transient class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public EMDefinitionStackMap() {} + + public EMDefinitionStackMap(EMDefinitionStack... in) { + putUnifyAllExact(in); + } + + public EMDefinitionStackMap(NavigableMap in) { + super(in); + } + + @Override + public Class getType() { + return EMDefinitionStack.class; + } + + @Override + public EMDefinitionStackMap clone() { + return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); + } + + public EMConstantStackMap toImmutable() { + return new EMConstantStackMap(new TreeMap<>(getBackingMap())); + } + + public EMConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { + return new EMConstantStackMap(getBackingMap()); + } + + public static EMDefinitionStackMap fromNBT(NBTTagCompound nbt) throws EMException { + EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + return new EMDefinitionStackMap(defStacks); + } +} 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 new file mode 100644 index 0000000000..c15142787f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java @@ -0,0 +1,242 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +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.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; +import java.util.Map; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class EMInstanceStackMap extends EMStackMap implements IEMMapWrite { + //Constructors + public EMInstanceStackMap() {} + + public EMInstanceStackMap(EMInstanceStack... inSafe) { + this(true, inSafe); + } + + public EMInstanceStackMap(boolean clone, EMInstanceStack... in) { + if (clone) { + EMInstanceStack[] stacks =new EMInstanceStack[in.length]; + for(int i=0;i inSafe) { + this(true, inSafe); + } + + private EMInstanceStackMap(boolean clone, NavigableMap in) { + super(clone?new TreeMap<>():in); + if (clone) { + for(EMInstanceStack stack:in.values()) { + putUnify(stack.clone()); + } + } + } + + @Override + public Class getType() { + return EMInstanceStack.class; + } + + @Override + public EMInstanceStackMap clone() { + return new EMInstanceStackMap(getBackingMap()); + } + + //Remove overflow + public double removeOverflow(int stacksCount, double stackCapacity) { + double massRemoved = 0; + + if (getBackingMap().size() > stacksCount) { + IEMDefinition[] keys = keySetToArray(); + for (int i = stacksCount; i < keys.length; i++) { + massRemoved += getBackingMap().get(keys[i]).getDefinitionStack().getMass(); + getBackingMap().remove(keys[i]); + } + } + + for (EMInstanceStack instance : valuesToArray()) { + if (instance.getAmount() > stackCapacity) { + massRemoved += instance.getDefinition().getMass() * (instance.getAmount() - stackCapacity); + instance.setAmount(stackCapacity); + } + } + return massRemoved; + } + + //Getters + public String[] getElementalInfo() { + String[] info = new String[getBackingMap().size()]; + int i = 0; + for (EMInstanceStack instance : getBackingMap().values()) { + info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName()+ + " "+ EnumChatFormatting.AQUA + instance.getDefinition().getSymbol()+ EnumChatFormatting.RESET+ + " #: " + EnumChatFormatting.GREEN + String.format("%.3E", instance.getAmount() / AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ + " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ + " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); + } + return info; + } + + public ArrayList getScanShortSymbols(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e: getBackingMap().entrySet()){ + e.getValue().addScanShortSymbols(list,capabilities); + } + return list; + } + + public ArrayList getScanInfo(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e: getBackingMap().entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + + //Tick Content + public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { + return tickContent(lifeTimeMult,postEnergize,1D); + } + + public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ + cleanUp(); + double diff=0; + for (EMInstanceStack instance : valuesToArray()) { + instance.setAge(instance.getAge() + seconds); + EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize); + if (newInstances == null) { + instance.nextColor(); + } else { + diff=add(diff,newInstances.getMassDiff()); + removeAmount(instance);//todo check maybe this should be removeKey + putUnifyAll(newInstances.getOutput()); + } + } + return diff; + } + + //NBT + public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanShortSymbols(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public NBTTagCompound getScanInfoNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public static EMInstanceStackMap fromNBT(NBTTagCompound nbt) throws EMException { + EMInstanceStack[] instances = new EMInstanceStack[nbt.getInteger("i")]; + for (int i = 0; i < instances.length; i++) { + instances[i] = EMInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (instances[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + 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"); + for(EMInstanceStack stack: getBackingMap().values()){ + build.append(stack.toString()).append('\n'); + } + return build.toString(); + } + + public EMInstanceStackMap takeAll(){ + EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map + this.getBackingMap().clear(); + return newStack; + } + + public EMDefinitionStackMap toDefinitionMapForComparison() { + EMDefinitionStack[] list = new EMDefinitionStack[size()]; + int i = 0; + for (Map.Entry entry : entrySet()) { + EMInstanceStack value = entry.getValue(); + list[i++] = new EMDefinitionStack(value.getDefinition(), value.getAmount()); + } + return new EMDefinitionStackMap(list); + } + + @Override + public EMInstanceStack putUnify(EMInstanceStack stack) { + EMInstanceStack target =get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = add(target.getAmount(), stack.getAmount()); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=target.unifyIntoThis(stack); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + @Override + public EMInstanceStack putUnifyExact(EMInstanceStack stack) { + EMInstanceStack target =get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = target.getAmount()+stack.getAmount(); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=target.unifyIntoThis(stack); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java new file mode 100644 index 0000000000..4c798499b5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; + +import java.util.NavigableMap; +import java.util.TreeMap; + +/** + * Created by Tec on 12.05.2017. + */ +abstract class EMStackMap implements IEMMapRead { + private final NavigableMap backingMap; + + protected EMStackMap() { + this(new TreeMap<>()); + } + + protected EMStackMap(NavigableMap map) { + this.backingMap =map; + } + + @Override + public NavigableMap getBackingMap() { + return backingMap; + } + + @Override + public abstract EMStackMap clone(); + + @Override + public boolean equals(Object obj) { + if (obj instanceof EMInstanceStackMap) { + return compareTo(((EMInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; + } + if (obj instanceof EMStackMap) { + return compareTo((EMStackMap) obj) == 0; + } + return false; + } + + @Override + public int hashCode() {//Hash only definitions to compare contents not amounts or data + int hash = -(getBackingMap().size() << 4); + for (T stack : getBackingMap().values()) { + hash += stack.getDefinition().hashCode(); + } + return hash; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java new file mode 100644 index 0000000000..392d06f5cf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java @@ -0,0 +1,275 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.lang.reflect.Array; +import java.util.*; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; +import static com.github.technus.tectech.util.DoubleCount.ulpSigned; + +public interface IEMMapRead extends Comparable>, Cloneable { + static boolean isValidAmount(double amount){ + return amount>=AVOGADRO_CONSTANT_UNCERTAINTY; + } + + static boolean isInvalidAmount(double amount){ + return amount getBackingMap(); + + IEMMapRead clone(); + + default Set> entrySet(){ + return getBackingMap().entrySet(); + } + + default Set keySet(){ + return getBackingMap().keySet(); + } + + default IEMDefinition[] keySetToArray() { + return keySetToArray(new IEMDefinition[size()]); + } + + default IEMDefinition[] keySetToArray(IEMDefinition[] array) { + return keySet().toArray(array); + } + + default Collection values(){ + return getBackingMap().values(); + } + + @SuppressWarnings("unchecked") + default T[] valuesToArray(){ + return valuesToArray((T[]) Array.newInstance(getType(),size())); + } + + default T[] valuesToArray(T[] array){ + return values().toArray(array); + } + + Class getType(); + + //Getters + default T getFirst(){ + return getBackingMap().firstEntry().getValue(); + } + + default T getLast(){ + return getBackingMap().lastEntry().getValue(); + } + + default T get(IEMStack stack) { + return get(stack.getDefinition()); + } + + default T get(IEMDefinition def) { + return getBackingMap().get(def); + } + + default T getNaturallySorted(int pos) { + if(pos<0 || pos>=size()){ + throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size()); + } + for (Map.Entry entry : entrySet()) { + if(pos==0){ + return entry.getValue(); + } + pos--; + } + return null; + } + + default T getRandom() { + return getNaturallySorted(TecTech.RANDOM.nextInt(size())); + } + + default String[] getShortSymbolsInfo() { + String[] info = new String[size()]; + int i = 0; + for (T instance : values()) { + info[i++] = instance.getDefinition().getShortSymbol(); + } + return info; + } + + default String[] getElementalInfo() { + String[] info = new String[size() * 3]; + int i = 0; + for (T defStack : values()) { + info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getLocalizedName(); + info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); + info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; + i += 3; + } + return info; + } + + //NBT + default NBTTagCompound getShortSymbolsNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getShortSymbolsInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound getInfoNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getElementalInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger("i", size()); + int i = 0; + for (T stack : values()) { + nbt.setTag(Integer.toString(i++), stack.toNBT()); + } + return nbt; + } + + @Override + default int compareTo(IEMMapRead o) {//this actually compares rest + int sizeDiff = size() - o.size(); + if (sizeDiff != 0) { + return sizeDiff; + } + + Iterator iterator = values().iterator(); + Iterator iteratorO = o.values().iterator(); + + while (iterator.hasNext()) { + int result = iterator.next().compareTo(iteratorO.next()); + if (result != 0) { + return result; + } + } + return 0; + } + + default double getMass(){ + double mass=0; + for (Map.Entry entry : entrySet()) { + mass+=entry.getValue().getMass(); + } + return mass; + } + + default long getCharge(){ + long charge=0; + for (Map.Entry entry : entrySet()) { + charge+=entry.getValue().getCharge(); + } + return charge; + } + + //Tests + default boolean containsKey(IEMDefinition def) { + return getBackingMap().containsKey(def); + } + + default boolean containsKey(IEMStack def) { + return containsKey(def.getDefinition()); + } + + default boolean containsAllKeys(IEMDefinition... definitions) { + for (IEMDefinition def : definitions) { + if (!containsKey(def)) { + return false; + } + } + return true; + } + + default boolean containsAllKeys(IEMStack... hasElementalDefinition) { + for (IEMStack has : hasElementalDefinition) { + if (!containsKey(has)) { + return false; + } + } + return true; + } + + default boolean containsAmountExact(IEMDefinition def, double amount) { + T target = getBackingMap().get(def); + return target != null && target.getAmount() >= amount; + } + + default boolean containsAmountExact(IEMStack stack) { + return containsAmountExact(stack.getDefinition(),stack.getAmount()); + } + + default boolean containsAllAmountsExact(IEMStack... stacks) { + for (IEMStack stack : stacks) { + if(!containsAmountExact(stack)){ + return false; + } + } + return true; + } + + default boolean containsAllAmountsExact(IEMMapRead container) { + for (Map.Entry entry : container.entrySet()) { + if(!containsAmountExact(entry.getValue())){ + return false; + } + } + return true; + } + + default boolean containsAmount(IEMDefinition def, double amountToConsume) { + double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + if(amountRequired==amountToConsume){ + amountRequired-=ulpSigned(amountRequired); + } + return containsAmountExact(def,amountRequired); + } + + default boolean containsAmount(IEMStack stack) { + return containsAmount(stack.getDefinition(),stack.getAmount()); + } + + default boolean containsAllAmounts(IEMStack... stacks) { + for (IEMStack stack : stacks) { + if(!containsAmount(stack)){ + return false; + } + } + return true; + } + + default boolean containsAllAmounts(IEMMapRead container) { + for (Map.Entry entry : container.entrySet()) { + if(!containsAmount(entry.getValue())){ + return false; + } + } + return true; + } + + default int size() { + return getBackingMap().size(); + } + + default boolean hasStacks() { + return !isEmpty(); + } + + default boolean isEmpty(){ + return getBackingMap().isEmpty(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java new file mode 100644 index 0000000000..cc22267474 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -0,0 +1,112 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; + +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_EPSILON; +import static com.github.technus.tectech.util.DoubleCount.*; + +public interface IEMMapWrite extends IEMMapWriteExact { + IEMMapWrite clone(); + + /** + * Consumes amount from map + * @param def def to consume + * @param amountToConsume should be comparable to {@link EMTransformationInfo#AVOGADRO_CONSTANT} + * @return consumed successfully + */ + default boolean removeAmount(IEMDefinition def, double amountToConsume){ + double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + if(amountRequired==amountToConsume){ + amountRequired-=ulpSigned(amountRequired); + } + return removeAmount(def,amountToConsume,amountRequired); + } + + default boolean removeAmount(IEMDefinition def, double amountToConsume, double amountRequired){ + T current=getBackingMap().get(def); + if(current!=null){ + if(current.getAmount()>=amountRequired){ + double newAmount=sub(current.getAmount(),amountToConsume); + if(IEMMapRead.isValidAmount(current.getAmount())){ + current=(T)current.mutateAmount(newAmount); + getBackingMap().put(current.getDefinition(),current); + }else { + getBackingMap().remove(current.getDefinition()); + } + return true; + } + } + return false; + } + + default boolean removeAmount(IEMStack stack) { + return removeAmount(stack.getDefinition(),stack.getAmount()); + } + + default boolean removeAllAmounts(IEMStack... stacks) { + boolean test = true; + for (IEMStack stack : stacks) { + test &= containsAmount(stack); + } + if (!test) { + return test; + } + for (IEMStack stack : stacks) { + removeAmount(stack); + } + return true; + } + + default boolean removeAllAmounts(IEMMapRead map) { + boolean test=true; + for (Map.Entry entry : map.entrySet()) { + test &= containsAmount(entry.getValue()); + } + if (!test) { + return test; + } + for (Map.Entry entry : map.entrySet()) { + removeAmount(entry.getValue()); + } + return true; + } + + //Put unify + /** + * + * @param stack thing to put + * @return new mapping or null if merging actually removed stuff + */ + default T putUnify(T stack) { + T target=getBackingMap().get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = add(target.getAmount(), stack.getAmount()); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=(T) target.mutateAmount(newAmount); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + default void putUnifyAll(T... defs) { + for (T def : defs) { + putUnify(def); + } + } + + default void putUnifyAll(IEMMapRead inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnify(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java new file mode 100644 index 0000000000..7b8853a2f4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -0,0 +1,166 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; + +import java.util.Map; + +public interface IEMMapWriteExact extends IEMMapRead { + default void cleanUp(){ + entrySet().removeIf(entry -> IEMMapRead.isInvalidAmount(entry.getValue().getAmount())); + } + + default void clear() { + getBackingMap().clear(); + } + + IEMMapWriteExact clone(); + + //Remove + default T removeKey(IEMDefinition def) { + return getBackingMap().remove(def); + } + + default T removeKey(IEMStack has) { + return removeKey(has.getDefinition()); + } + + default boolean removeKeys(IEMDefinition... definitions) { + boolean hadAll=true; + for (IEMDefinition def : definitions) { + hadAll&=removeKey(def)!=null; + } + return hadAll; + } + + default boolean removeKeys(IEMStack... hasElementalDefinition) { + boolean hadAll=true; + for (IEMStack has : hasElementalDefinition) { + hadAll&=removeKey(has)!=null; + } + return hadAll; + } + + default boolean removeAllKeys(IEMDefinition... definitions) { + boolean hadAll=containsAllKeys(definitions); + if(hadAll){ + for (IEMDefinition def : definitions) { + removeKey(def); + } + } + return hadAll; + } + + default boolean removeAllKeys(IEMStack... hasElementalDefinition) { + boolean hadAll=containsAllKeys(hasElementalDefinition); + if(hadAll){ + for (IEMStack stack : hasElementalDefinition) { + removeKey(stack); + } + } + return hadAll; + } + + default void putReplace(T defStackUnsafe) { + getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); + } + + default void putReplaceAll(T... defStacksUnsafe) { + for (T defStack : defStacksUnsafe) { + putReplace(defStack); + } + } + + default void putReplaceAll(IEMMapRead inContainerUnsafe) { + getBackingMap().putAll(inContainerUnsafe.getBackingMap()); + } + + /** + * Should only be used when modifying definitions to alter the integer count correctly + * @param def + * @return + */ + default boolean removeAmountExact(IEMStack def){ + return removeAmountExact(def.getDefinition(),def.getAmount()); + } + + /** + * Should only be used when modifying definitions to alter the integer count correctly + * @param def + * @param amountToConsume + * @return + */ + default boolean removeAmountExact(IEMDefinition def, double amountToConsume){ + T current=getBackingMap().get(def); + if(current!=null){ + double newAmount=current.getAmount()-amountToConsume; + if(newAmount>=0){ + if(IEMMapRead.isValidAmount(current.getAmount())){ + current=(T)current.mutateAmount(newAmount); + getBackingMap().put(current.getDefinition(),current); + } else { + getBackingMap().remove(current.getDefinition()); + } + return true; + } + } + return false; + } + + default boolean removeAllAmountsExact(IEMStack... stacks) { + boolean test = true; + for (IEMStack stack : stacks) { + test &= containsAmountExact(stack); + } + if (!test) { + return test; + } + for (IEMStack stack : stacks) { + removeAmountExact(stack); + } + return true; + } + + default boolean removeAllAmountsExact(IEMMapRead map) { + boolean test=true; + for (Map.Entry entry : map.entrySet()) { + test &= containsAmountExact(entry.getValue()); + } + if (!test) { + return test; + } + for (Map.Entry entry : map.entrySet()) { + removeAmountExact(entry.getValue()); + } + return true; + } + + default T putUnifyExact(T stack) { + T target=getBackingMap().get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = target.getAmount()+stack.getAmount(); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=(T) target.mutateAmount(newAmount); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + default void putUnifyAllExact(T... defs) { + for (T def : defs) { + putUnifyExact(def); + } + } + + default void putUnifyAllExact(IEMMapRead inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnifyExact(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java deleted file mode 100644 index cde1d55561..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.Collections; -import java.util.NavigableMap; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by Tec on 12.05.2017. - */ -public final class cElementalConstantStackMap/*IMMUTABLE*/ extends cElementalStackMap {//Target class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public static final cElementalConstantStackMap EMPTY = new cElementalConstantStackMap(); - - private cElementalConstantStackMap() { - super(Collections.emptyNavigableMap()); - } - - public cElementalConstantStackMap(cElementalDefinitionStack... in) { - this(new cElementalDefinitionStackMap(in).map); - } - - public cElementalConstantStackMap(NavigableMap in) { - super(Collections.unmodifiableNavigableMap(in)); - } - - @Override - public Class getType() { - return cElementalDefinitionStack.class; - } - - //IMMUTABLE DON'T NEED IT - @Override - public cElementalConstantStackMap clone() { - return this; - } - - public cElementalDefinitionStackMap toMutable() { - return new cElementalDefinitionStackMap(new TreeMap<>(map)); - } - - public static cElementalConstantStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalConstantStackMap(defStacks); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java deleted file mode 100644 index 1273119bb3..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.NavigableMap; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalDefinitionStackMap extends cElementalStackMap implements iElementalMapRW {//Transient class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public cElementalDefinitionStackMap() {} - - public cElementalDefinitionStackMap(cElementalDefinitionStack... in) { - putUnifyAll(in); - } - - public cElementalDefinitionStackMap(NavigableMap in) { - super(in); - } - - @Override - public Class getType() { - return cElementalDefinitionStack.class; - } - - @Override - public cElementalDefinitionStackMap clone() { - return new cElementalDefinitionStackMap(new TreeMap<>(map)); - } - - public cElementalConstantStackMap toImmutable() { - return new cElementalConstantStackMap(new TreeMap<>(map)); - } - - public cElementalConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { - return new cElementalConstantStackMap(map); - } - - public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalDefinitionStackMap(defStacks); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java deleted file mode 100644 index aab1f93990..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.ArrayList; -import java.util.Map; -import java.util.NavigableMap; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.util.DoubleCount.add; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalInstanceStackMap extends cElementalStackMap implements iElementalMapRW { - //Constructors - public cElementalInstanceStackMap() {} - - public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) { - this(true, inSafe); - } - - public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) { - if (clone) { - cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length]; - for(int i=0;i inSafe) { - this(true, inSafe); - } - - private cElementalInstanceStackMap(boolean clone, NavigableMap in) { - if (clone) { - map = new TreeMap<>(); - for(cElementalInstanceStack stack:in.values()) { - putUnify(stack.clone()); - } - } else { - map = in; - } - } - - @Override - public Class getType() { - return cElementalInstanceStack.class; - } - - @Override - public cElementalInstanceStackMap clone() { - return new cElementalInstanceStackMap(map); - } - - //Remove overflow - public double removeOverflow(int stacksCount, double stackCapacity) { - double massRemoved = 0; - - if (map.size() > stacksCount) { - iElementalDefinition[] keys = keySetToArray(); - for (int i = stacksCount; i < keys.length; i++) { - massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); - map.remove(keys[i]); - } - } - - for (cElementalInstanceStack instance : valuesToArray()) { - if (instance.amount > stackCapacity) { - massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); - instance.amount = stackCapacity; - } - } - return massRemoved; - } - - //Getters - public String[] getElementalInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ - " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ - " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ - " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ - " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); - } - return info; - } - - public ArrayList getScanShortSymbols(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanShortSymbols(list,capabilities); - } - return list; - } - - public ArrayList getScanInfo(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanResults(list,capabilities); - } - return list; - } - - //Tick Content - public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { - return tickContent(lifeTimeMult,postEnergize,1D); - } - - public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ - cleanUp(); - double diff=0; - for (cElementalInstanceStack instance : valuesToArray()) { - cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); - if (newInstances == null) { - instance.nextColor(); - } else { - diff=add(diff,newInstances.getMassDiff()); - removeAmount(false,instance); - putUnifyAll(newInstances.getOutput()); - } - } - return diff; - } - - //NBT - public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanShortSymbols(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound getScanInfoNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanInfo(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; - for (int i = 0; i < instances.length; i++) { - instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (instances[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalInstanceStackMap(false, instances); - } - - //stackUp - public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { - cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); - inTree.putUnifyAll(in); - return inTree.valuesToArray(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalInstanceStackMap) { - return compareTo((cElementalInstanceStackMap) obj) == 0; - } - if (obj instanceof cElementalStackMap) { - return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0; - } - return false; - } - - @Override - public String toString() { - StringBuilder build=new StringBuilder("Instance Stack Map\n"); - for(cElementalInstanceStack stack:map.values()){ - build.append(stack.toString()).append('\n'); - } - return build.toString(); - } - - public cElementalInstanceStackMap takeAll(){ - cElementalInstanceStackMap newStack=new cElementalInstanceStackMap(false,new TreeMap<>(this.map));//just in case to uncouple The map - this.map.clear(); - return newStack; - } - - public cElementalDefinitionStackMap toDefinitionMapForComparison() { - cElementalDefinitionStack[] list = new cElementalDefinitionStack[size()]; - int i = 0; - for (Map.Entry entry : entrySet()) { - cElementalInstanceStack value = entry.getValue(); - list[i++] = new cElementalDefinitionStack(value.getDefinition(), value.getAmount()); - } - return new cElementalDefinitionStackMap(list); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java deleted file mode 100644 index 2b144df128..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -import java.util.NavigableMap; -import java.util.TreeMap; - -/** - * Created by Tec on 12.05.2017. - */ -abstract class cElementalStackMap implements iElementalMapR { - protected NavigableMap map; - - protected cElementalStackMap() { - this(new TreeMap<>()); - } - - protected cElementalStackMap(NavigableMap map) { - this.map = map; - } - - @Override - public NavigableMap getBackingMap() { - return map; - } - - @Override - public abstract cElementalStackMap clone(); - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalInstanceStackMap) { - return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; - } - if (obj instanceof cElementalStackMap) { - return compareTo((cElementalStackMap) obj) == 0; - } - return false; - } - - @Override - public int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (T stack : map.values()) { - hash += stack.getDefinition().hashCode(); - } - return hash; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java deleted file mode 100644 index 0491c43ebc..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.lang.reflect.Array; -import java.util.*; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; - -public interface iElementalMapR extends Comparable>, Cloneable { - NavigableMap getBackingMap(); - - iElementalMapR clone(); - - default Set> entrySet(){ - return getBackingMap().entrySet(); - } - - default Set keySet(){ - return getBackingMap().keySet(); - } - - default iElementalDefinition[] keySetToArray() { - return keySetToArray(new iElementalDefinition[size()]); - } - - default iElementalDefinition[] keySetToArray(iElementalDefinition[] array) { - return getBackingMap().keySet().toArray(array); - } - - default Collection values(){ - return getBackingMap().values(); - } - - @SuppressWarnings("unchecked") - default T[] valuesToArray(){ - return valuesToArray((T[]) Array.newInstance(getType(),size())); - } - - default T[] valuesToArray(T[] array){ - return getBackingMap().values().toArray(array); - } - - Class getType(); - - //Getters - default T getFirst(){ - return getBackingMap().firstEntry().getValue(); - } - - default T getLast(){ - return getBackingMap().lastEntry().getValue(); - } - - default T get(iElementalDefinition def) { - return getBackingMap().get(def); - } - - default T getNaturallySorted(int pos) { - if(pos<0 || pos>=size()){ - throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size()); - } - for (Map.Entry entry : entrySet()) { - if(pos==0){ - return entry.getValue(); - } - pos--; - } - return null; - } - - default T getRandom() { - return getNaturallySorted(TecTech.RANDOM.nextInt(size())); - } - - default String[] getShortSymbolsInfo() { - String[] info = new String[size()]; - int i = 0; - for (T instance : values()) { - info[i++] = instance.getDefinition().getShortSymbol(); - } - return info; - } - - default String[] getElementalInfo() { - String[] info = new String[size() * 3]; - int i = 0; - for (T defStack : values()) { - info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getName(); - info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; - i += 3; - } - return info; - } - - //NBT - default NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - default NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - default NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", size()); - int i = 0; - for (T stack : values()) { - nbt.setTag(Integer.toString(i++), stack.toNBT()); - } - return nbt; - } - - @Override - default int compareTo(iElementalMapR o) {//this actually compares rest - int sizeDiff = size() - o.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - - Iterator iterator = values().iterator(); - Iterator iteratorO = o.values().iterator(); - - while (iterator.hasNext()) { - int result = iterator.next().compareTo(iteratorO.next()); - if (result != 0) { - return result; - } - } - return 0; - } - - default double getMass(){ - double mass=0; - for (Map.Entry entry : getBackingMap().entrySet()) { - mass+=entry.getValue().getMass(); - } - return mass; - } - - default long getCharge(){ - long charge=0; - for (Map.Entry entry : getBackingMap().entrySet()) { - charge+=entry.getValue().getCharge(); - } - return charge; - } - - //Tests - default boolean containsKey(iElementalDefinition def) { - return getBackingMap().containsKey(def); - } - - default boolean containsKey(iElementalStack def) { - return containsKey(def.getDefinition()); - } - - default int size() { - return getBackingMap().size(); - } - - default boolean hasStacks() { - return !isEmpty(); - } - - default boolean isEmpty(){ - return getBackingMap().isEmpty(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java deleted file mode 100644 index 7f8d314858..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -import java.util.Map; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; -import static com.github.technus.tectech.util.DoubleCount.sub; - -public interface iElementalMapRW extends iElementalMapR { - iElementalMapRW clone(); - - default void cleanUp(){ - getBackingMap().entrySet().removeIf(entry -> entry.getValue().getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY); - } - - default void clear() { - getBackingMap().clear(); - } - - //Remove - default T remove(iElementalDefinition def) { - return getBackingMap().remove(def); - } - - default T remove(iElementalStack has) { - return remove(has.getDefinition()); - } - - default void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - getBackingMap().remove(def); - } - } - - default void removeAll(iElementalStack... hasElementalDefinition) { - for (iElementalStack has : hasElementalDefinition) { - getBackingMap().remove(has.getDefinition()); - } - } - - default boolean removeAmount(boolean testOnly, iElementalStack stack) { - return removeAmount(testOnly,stack.getDefinition(),stack.getAmount()); - } - - default boolean removeAmount(boolean testOnly, iElementalDefinition def,double amount) { - T target = getBackingMap().get(def); - if (target == null) { - return false; - } - if (testOnly) { - return target.getAmount() >= amount; - } else { - double newAmount = sub(target.getAmount(),amount); - if (newAmount > 0) { - getBackingMap().put(target.getDefinition(), (T)target.mutateAmount(newAmount)); - return true; - } else if (newAmount == 0) { - getBackingMap().remove(def); - return true; - } - } - return false; - } - - default boolean removeAllAmounts(boolean testOnly, iElementalStack... stacks) { - boolean test = true; - for (iElementalStack stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iElementalStack stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - default boolean removeAllAmounts(boolean testOnly, iElementalMapR container) { - boolean test=true; - for (Map.Entry entry : container.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - //Put replace - default T putReplace(T defStackUnsafe) { - return getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); - } - - default void putReplaceAll(T... defStacks) { - for (T defStack : defStacks) { - getBackingMap().put(defStack.getDefinition(), defStack); - } - } - - default void putReplaceAll(iElementalMapR inContainerUnsafe) { - getBackingMap().putAll(inContainerUnsafe.getBackingMap()); - } - - //Put unify - default T putUnify(T def) { - T stack=getBackingMap().get(def.getDefinition()); - if(stack==null) { - return getBackingMap().put(def.getDefinition(), def); - } - return getBackingMap().put(def.getDefinition(), (T)stack.mutateAmount(def.getAmount()+stack.getAmount())); - } - - default void putUnifyAll(T... defs) { - for (T def : defs) { - putUnify(def); - } - } - - default void putUnifyAll(iElementalMapR inTreeUnsafe) { - for (T in : inTreeUnsafe.values()) { - putUnify(in); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java new file mode 100644 index 0000000000..4b0792eac9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java @@ -0,0 +1,87 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 02.03.2017. + */ +public class EMRecipe implements Comparable> { + private final int ID; + private final EMConstantStackMap inEM; + private final IEMMapRead outEM; + private final ItemStack[] outItems; + private final FluidStack[] outFluids; + private T extension; + + public EMRecipe( + EMConstantStackMap inEM,//not null plz + int id, + IEMMapRead outEM, + ItemStack[] outItems, + FluidStack[] outFluids) { + this.inEM = inEM; + this.outEM = outEM; + this.outItems = outItems; + this.outFluids = outFluids; + ID = id;//allows multiple recipes with the same input EM,so u can actually extend... + } + + public EMRecipe extend(T data) { + setExtension(data); + return this; + } + + @Override + public int compareTo(EMRecipe o) { + int compare = getInEM().compareTo(o.getInEM()); + if(compare!=0) { + return compare; + } + return Integer.compare(getID(), o.getID()); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof EMRecipe) { + return compareTo((EMRecipe) obj) == 0; + } + return false; + } + + @Override + public int hashCode() { + return getInEM().hashCode(); + } + + public int getID() { + return ID; + } + + public EMConstantStackMap getInEM() { + return inEM; + } + + public IEMMapRead getOutEM() { + return outEM; + } + + public ItemStack[] getOutItems() { + return outItems; + } + + public FluidStack[] getOutFluids() { + return outFluids; + } + + public T getExtension() { + return extension; + } + + public void setExtension(T extension) { + this.extension = extension; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java new file mode 100644 index 0000000000..811a9bc370 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java @@ -0,0 +1,65 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Tec on 02.03.2017. + */ +public class EMRecipeMap {//TODO FIX + //Multimap for multiple recipes from the same thing - you know parameters might differ the output + private final Map>> recipes; + + public EMRecipeMap() { + recipes = new HashMap<>(); + } + + public EMRecipe put(EMRecipe in) { + Map> r = getRecipes().computeIfAbsent(in.getInEM(), k -> new HashMap<>()); + return r.put(in.getID(), in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) + //It is either bad, or unimportant if you use different id's + } + + public void putAll(EMRecipe... contents) { + for (EMRecipe recipe : contents) { + put(recipe); + } + } + + public EMRecipe remove(IEMMapRead map, int id) { + Map> recipesMap = getRecipes().get(map); + return recipesMap != null ? recipesMap.remove(id) : null;//todo check, suspicious but ok, equals and hashcode methods are adjusted for that + } + + public Map> remove(IEMMapRead map) { + return getRecipes().remove(map);//todo check, suspicious but ok, equals and hashcode methods are adjusted for that + } + + //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! + //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) + @Deprecated + public Map> findExact(IEMMapRead in) { + return getRecipes().get(in);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + //this does check if the map contains all the requirements for any recipe, and the required amounts + //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! + public Map> findMatch(IEMMapRead in) { + for (Map.Entry>> cElementalDefinitionStackMapHashMapEntry : getRecipes().entrySet()) { + if (in.containsAllAmounts(cElementalDefinitionStackMapHashMapEntry.getKey())) { + return cElementalDefinitionStackMapHashMapEntry.getValue(); + } + } + return null; + } + + public Map>> getRecipes() { + return recipes; + } + + //To check for instance data and other things use recipe extensions! +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java deleted file mode 100644 index 8c0fb40a4b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipe implements Comparable { - public final short ID; - public final cElementalConstantStackMap inEM; - public final cElementalConstantStackMap outEM; - public final ItemStack[] outItems; - public final FluidStack[] outFluids; - public Object[] extension; - - public rElementalRecipe( - cElementalConstantStackMap inEM,//not null plz - short id, - cElementalConstantStackMap outEM, - ItemStack[] outItems, - FluidStack[] outFluids) { - this.inEM = inEM; - this.outEM = outEM; - this.outItems = outItems; - this.outFluids = outFluids; - ID = id;//allows multiple recipes with the same input EM,so u can actually extend... - } - - public rElementalRecipe extend(Object... data) { - extension = data; - return this; - } - - @Override - public int compareTo(rElementalRecipe o) { - int compare = inEM.compareTo(o.inEM); - if(compare!=0) { - return compare; - } - return Short.compare(ID, o.ID); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof rElementalRecipe) { - return compareTo((rElementalRecipe) obj) == 0; - } - return false; - } - - @Override - public int hashCode() { - return inEM.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java deleted file mode 100644 index 56a9030354..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipeMap {//TODO FIX - //Multimap for multiple recipes from the same thing - you know parameters might differ the output - private final HashMap> recipes; - - public rElementalRecipeMap() { - recipes = new HashMap<>(); - } - - public rElementalRecipe put(rElementalRecipe in) { - HashMap r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>()); - return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) - //It is either bad, or unimportant if you use different id's - } - - public void putAll(rElementalRecipe... contents) { - for (rElementalRecipe recipe : contents) { - put(recipe); - } - } - - public rElementalRecipe remove(iElementalMapR map, short id) { - return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap remove(iElementalMapR map) { - return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap findExact(cElementalInstanceStackMap in) { - return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! - //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) - @Deprecated - public HashMap findExact(iElementalMapR in) { - return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //this does check if the map contains all the requirements for any recipe, and the required amounts - //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! - @Deprecated - public HashMap findMatch(cElementalDefinitionStackMap in, boolean testOnlyTruePreferred) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - public HashMap findMatch(cElementalInstanceStackMap in, boolean testOnly) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - //To check for instance data and other things use recipe extensions! -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java new file mode 100644 index 0000000000..fe0c73e795 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +/** + * Created by danie_000 on 20.11.2016. + */ +public final class EMDefinitionStack implements IEMStack { + private final IEMDefinition definition; + private final double amount; + + public EMDefinitionStack(IEMDefinition def, double amount) { + definition = def == null ? null__ : def; + this.amount = amount; + } + + @Override + public EMDefinitionStack clone() { + return this;//IMMUTABLE + } + + @Override + public EMDefinitionStack mutateAmount(double newAmount) { + if(getAmount() == newAmount){ + return this; + } + return new EMDefinitionStack(getDefinition(), newAmount);//IMMUTABLE + } + + @Override + public IEMDefinition getDefinition() { + return definition;//IMMUTABLE + } + + @Override + public double getAmount() { + return amount; + } + + public NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("d", getDefinition().toNBT()); + nbt.setDouble("Q", getAmount()); + return nbt; + } + + public static EMDefinitionStack fromNBT(NBTTagCompound nbt) { + return new EMDefinitionStack( + EMComplex.fromNBT(nbt.getCompoundTag("d")), + nbt.getLong("q")+nbt.getDouble("Q")); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof IEMDefinition) { + return getDefinition().compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + //Amount shouldn't be hashed if this is just indicating amount and not structure + @Override + public int hashCode() { + return getDefinition().hashCode(); + } +} 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 new file mode 100644 index 0000000000..b73bd21f02 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java @@ -0,0 +1,605 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +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.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.util.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.DoubleCount.*; +import static java.lang.Math.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMInstanceStack implements IEMStack { + public static int MIN_MULTIPLE_DECAY_CALLS = 4, MAX_MULTIPLE_DECAY_CALLS = 16; + public static double DECAY_CALL_PER = AVOGADRO_CONSTANT;//todo + + private final IEMDefinition definition; + private double amount; + + private double age; + //energy - if positive then particle should try to decay + private long energy; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private byte color; + private double lifeTime; + private double lifeTimeMult; + + public EMInstanceStack(IEMStack stackSafe) { + this(stackSafe.getDefinition(), stackSafe.getAmount(), 1D, 0D, 0); + } + + public EMInstanceStack(IEMStack stackSafe, double lifeTimeMult, double age, long energy) { + this(stackSafe.getDefinition(), stackSafe.getAmount(), lifeTimeMult, age, energy); + } + + public EMInstanceStack(IEMDefinition defSafe, double amount) { + this(defSafe, amount, 1D, 0D, 0); + } + + public EMInstanceStack(IEMDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { + definition = defSafe == null ? null__ : defSafe; + byte bColor = getDefinition().getColor(); + if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color + this.color = bColor; + } else { + this.color = (byte) TecTech.RANDOM.nextInt(3); + } + this.lifeTimeMult = lifeTimeMult; + lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult; + setEnergy(energy); + this.setAge(age); + this.setAmount(amount); + } + + //Clone proxy + private EMInstanceStack(EMInstanceStack stack) { + definition = stack.getDefinition(); + color = stack.color; + setAge(stack.getAge()); + setAmount(stack.getAmount()); + lifeTime = stack.lifeTime; + lifeTimeMult = stack.lifeTimeMult; + energy = stack.energy; + } + + @Override + public EMInstanceStack clone() { + return new EMInstanceStack(this); + } + + @Override + public EMInstanceStack mutateAmount(double newAmount) { + this.setAmount(newAmount); + return this; + } + + @Override + public double getAmount() { + return amount; + } + + public long getEnergy() { + return energy; + } + + public void setEnergy(long newEnergyLevel) { + energy = newEnergyLevel; + setLifeTimeMultiplier(getLifeTimeMultiplier()); + } + + public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel) { + return getDefinition().getEnergyDiffBetweenStates(currentEnergyLevel, newEnergyLevel) * getAmount(); + } + + public double getEnergySettingCost(long newEnergyLevel) { + return getEnergySettingCost(energy, newEnergyLevel) * getAmount(); + } + + public EMDefinitionStack getDefinitionStack() { + return new EMDefinitionStack(getDefinition(), getAmount()); + } + + @Override + public IEMDefinition getDefinition() { + return definition; + } + + public byte getColor() { + return color; + } + + public void setColor(byte color) {//does not allow changing magic element + if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { + return; + } + this.color = color; + } + + public void nextColor() {//does not allow changing magic element + if (color < 0 || color > 2) { + return; + } + color = (byte) TecTech.RANDOM.nextInt(3); + } + + public double getLifeTime() { + return lifeTime; + } + + public void setLifeTimeMultiplier(double mult) { + if (mult <= 0) //since infinity*0=nan + { + throw new IllegalArgumentException("multiplier must be >0"); + } + lifeTimeMult = mult; + if (getDefinition().getRawTimeSpan(energy) <= 0) { + return; + } + lifeTime = getDefinition().getRawTimeSpan(energy) * lifeTimeMult; + } + + public double getLifeTimeMultiplier() { + return lifeTimeMult; + } + + public EMDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize) { + return tickStack(lifeTimeMult, postEnergize, 1D); + } + + public EMDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds) { + setAge(getAge() + seconds); + EMDecayResult newInstances = decay(lifeTimeMult, getAge(), postEnergize); + if (newInstances == null) { + nextColor(); + } else { + for (EMInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { + newInstance.nextColor(); + } + } + return newInstances; + } + + public EMDecayResult decay() { + return decay(1D, getAge(), 0);//try to decay without changes + } + + public EMDecayResult decay(double apparentAge, long postEnergize) { + return decay(1D, apparentAge, postEnergize); + } + + public EMDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) { + long newEnergyLevel = postEnergize + energy; + if (newEnergyLevel > 0) { + newEnergyLevel -= 1; + } else if (newEnergyLevel < 0) { + newEnergyLevel += 1; + } + EMDecayResult output; + if (getDefinition().usesMultipleDecayCalls(energy)) { + double amountTemp = getAmount(); + int decayCnt = (int) min(MAX_MULTIPLE_DECAY_CALLS, max(getAmount() / DECAY_CALL_PER, MIN_MULTIPLE_DECAY_CALLS)); + setAmount(div(getAmount(), decayCnt)); + decayCnt--; + + output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + if (output == null) { + setAmount(amountTemp); + return null; + } + + for (int i = 0; i < decayCnt; i++) { + EMDecayResult map = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + if (map != null) { + output.getOutput().putUnifyAll(map.getOutput()); + output.setMassDiff(add(output.getMassDiff(), map.getMassDiff())); + output.setMassAffected(output.getMassDiff() + map.getMassDiff()); + } + } + setAmount(amountTemp); + } else { + output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + } + if (output != null) { + output.getOutput().cleanUp(); + } + return output; + } + + private EMDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) { + if (energy > 0 && !getDefinition().usesSpecialEnergeticDecayHandling()) { + setLifeTimeMultiplier(getLifeTimeMultiplier()); + return decayCompute(getDefinition().getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); + } else if (getDefinition().getRawTimeSpan(energy) < 0) { + return null;//return null, decay cannot be achieved + } else if (getDefinition().isTimeSpanHalfLife()) { + return exponentialDecayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, -1D, newEnergyLevel); + } else { + if (1 > lifeTime) { + return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel); + } else if (apparentAge > lifeTime) { + return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, 0D, newEnergyLevel); + } + } + return null;//return null since decay cannot be achieved + } + + //Use to get direct decay output providing correct decay array + private EMDecayResult exponentialDecayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + double newAmount = div(getAmount(), Math.pow(2D, 1D/* 1 second */ / lifeTime)); + + //if(definition.getSymbol().startsWith("U ")) { + // System.out.println("newAmount = " + newAmount); + // System.out.println("amountRemaining = " + amountRemaining); + // for(cElementalDecay decay:decays){ + // System.out.println("prob = "+decay.probability); + // for(cElementalDefinitionStack stack:decay.outputStacks.values()){ + // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount); + // } + // } + //} + if (newAmount == getAmount()) { + newAmount -= ulpSigned(newAmount); + } else if (newAmount < 1) { + return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + } + + //split to non decaying and decaying part + double amount = this.getAmount(); + this.setAmount(this.getAmount() - newAmount); + EMDecayResult products = decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + this.setAmount(newAmount); + if (products != null) { + products.getOutput().putUnify(clone()); + } + this.setAmount(amount); + return products; + } + + //Use to get direct decay output providing correct decay array + private EMDecayResult decayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + if (decays == null) { + return null;//Can not decay so it won't + } + boolean makesEnergy = getDefinition().decayMakesEnergy(energy); + double mass = getMass(); + if (decays.length == 0) { + return makesEnergy ? null : new EMDecayResult(new EMInstanceStackMap(), mass, 0); + //provide non null 0 length array for annihilation + } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end + if (decays[0] == deadEnd) { + return makesEnergy ? null : new EMDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()), mass, 0); + } + EMInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()); + if (newProductsAge < 0) { + if (output.size() == 1) { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } + } else { + for (EMInstanceStack stack : output.valuesToArray()) { + if (stack.getDefinition().equals(getDefinition())) { + stack.setAge(getAge()); + } + } + } + } else { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + } + } + if (energy <= 0 && output.getMass() > mass) { + return null;//no energy usage to decay + } + return new EMDecayResult(new EMInstanceStackMap(), mass, makesEnergy ? output.getMass() - mass : 0); + } else { + EMDecayResult totalOutput = new EMDecayResult(new EMInstanceStackMap(), getMass(), 0); + EMInstanceStackMap output = totalOutput.getOutput(), results; + int differentDecays = decays.length; + double[] probabilities = new double[differentDecays]; + for (int i = 0; i < probabilities.length; i++) { + probabilities[i] = decays[i].getProbability(); + } + double[] qttyOfDecay; + try { + qttyOfDecay = distribute(getAmount(), probabilities); + } catch (ArithmeticException e) { + Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: " + this, e)); + return null; + } + //long amountRemaining = this.amount, amount = this.amount; + //float remainingProbability = 1D; +// + //for (int i = 0; i < differentDecays; i++) { + // if (decays[i].probability >= 1D) { + // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); + // if (thisDecayAmount > 0) { + // if (thisDecayAmount <= amountRemaining) { + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // }else {//in case too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // } + // } + // break; + // } + // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); + // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // } else if (thisDecayAmount > amountRemaining) {//too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // break; + // } + // remainingProbability -= decays[i].probability; + // if(remainingProbability<=0) { + // break; + // } + //} + + //for (int i = 0; i < amountRemaining; i++) { + // double rand = TecTech.RANDOM.nextDouble(); + // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into + // rand -= decays[j].probability; + // if (rand <= 0D) { + // qttyOfDecay[j]++; + // break; + // } + // } + //} + + if (getDefinition().decayMakesEnergy(energy)) { + for (int i = differentDecays - 1; i >= 0; i--) { + if (decays[i] == deadEnd) { + EMInstanceStack clone = clone(); + clone.setAmount(qttyOfDecay[i]); + output.putUnify(clone); + } else { + results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + totalOutput.setMassDiff(add(totalOutput.getMassDiff(), results.getMass() - mass)); + } + } + } else { + for (int i = differentDecays - 1; i >= 0; i--) { + results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + } + } + + if (newProductsAge < 0) { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } else { + for (EMInstanceStack stack : output.valuesToArray()) { + if (stack.getDefinition().equals(getDefinition())) { + stack.setAge(getAge()); + } + } + } + } else { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } + } + if (energy <= 0 && output.getMass() > getMass()) { + return null;//no energy usage to decay + } + return totalOutput; + } + } + + public EMInstanceStack unifyIntoThis(EMInstanceStack... instances) { + if (instances == null) { + return this; + } + //returns with the definition from the first object passed + double energyTotal = getEnergySettingCost(0, energy); + long maxEnergy = energy; + long minEnergy = energy; + + for (EMInstanceStack instance : instances) { + //if (instance != null && compareTo(instance) == 0) { + setAmount(add(getAmount(), instance.getAmount())); + energyTotal += instance.getEnergySettingCost(0, instance.energy); + maxEnergy = max(instance.energy, maxEnergy); + minEnergy = min(instance.energy, maxEnergy); + lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); + setAge(max(getAge(), instance.getAge())); + //} + } + + if (energyTotal >= 0) { + for (; maxEnergy > 0; maxEnergy--) { + if (getEnergySettingCost(0, maxEnergy) < energyTotal) { + break; + } + } + setEnergy(maxEnergy); + } else { + for (; minEnergy < 0; minEnergy++) { + if (getEnergySettingCost(minEnergy, 0) < energyTotal) { + break; + } + } + setEnergy(minEnergy); + } + return this; + } + + public EMInstanceStack unifyIntoThisExact(EMInstanceStack... instances) { + if (instances == null) { + return this; + } + //returns with the definition from the first object passed + double energyTotal = getEnergySettingCost(0, energy); + long maxEnergy = energy; + long minEnergy = energy; + + for (EMInstanceStack instance : instances) { + //if (instance != null && compareTo(instance) == 0) { + setAmount(getAmount() + instance.getAmount()); + energyTotal += instance.getEnergySettingCost(0, instance.energy); + maxEnergy = max(instance.energy, maxEnergy); + minEnergy = min(instance.energy, maxEnergy); + lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); + setAge(max(getAge(), instance.getAge())); + //} + } + + if (energyTotal >= 0) { + for (; maxEnergy > 0; maxEnergy--) { + if (getEnergySettingCost(0, maxEnergy) < energyTotal) { + break; + } + } + setEnergy(maxEnergy); + } else { + for (; minEnergy < 0; minEnergy++) { + if (getEnergySettingCost(minEnergy, 0) < energyTotal) { + break; + } + } + setEnergy(minEnergy); + } + return this; + } + + public void addScanShortSymbols(ArrayList lines, int[] detailsOnDepthLevels) { + int capabilities = detailsOnDepthLevels[0]; + getDefinition().addScanShortSymbols(lines, capabilities, energy); + //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); + } + + //private void scanShortSymbolsContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + // if(definitions!=null && depth lines, int[] detailsOnDepthLevels) { + int capabilities = detailsOnDepthLevels[0]; + if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { + lines.add("DEPTH = " + 0); + } + getDefinition().addScanResults(lines, capabilities, energy); + if (Util.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { + lines.add("TIME MULT = " + lifeTimeMult); + if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("TIME SPAN = " + lifeTime + " s"); + } + } + if (Util.areBitsSet(SCAN_GET_AGE, capabilities)) { + lines.add("AGE = " + getAge() + " s"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add("COLOR = " + color + " RGB or CMY"); + } + if (Util.areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { + lines.add("ENERGY = " + energy); + } + if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { + lines.add("AMOUNT = " + getAmount() / AVOGADRO_CONSTANT + " mol"); + } + scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); + } + + private void scanContents(ArrayList lines, EMConstantStackMap definitions, int depth, int[] detailsOnDepthLevels) { + if (definitions != null && depth < detailsOnDepthLevels.length) { + int deeper = depth + 1; + for (EMDefinitionStack definitionStack : definitions.valuesToArray()) { + lines.add("");//def separator + if (Util.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])) { + lines.add("AMOUNT = " + definitionStack.getAmount()); + } + scanContents(lines, definitionStack.getDefinition().getSubParticles(), deeper, detailsOnDepthLevels); + } + } + } + + public NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("d", getDefinition().toNBT()); + nbt.setDouble("Q", getAmount()); + nbt.setLong("e", energy); + nbt.setByte("c", color); + nbt.setDouble("A", getAge()); + nbt.setDouble("M", lifeTimeMult); + return nbt; + } + + public static EMInstanceStack fromNBT(NBTTagCompound nbt) { + NBTTagCompound definition = nbt.getCompoundTag("d"); + EMInstanceStack instance = new EMInstanceStack( + EMComplex.fromNBT(definition), + nbt.getLong("q") + nbt.getDouble("Q"), + nbt.getFloat("m") + nbt.getDouble("M"), + nbt.getLong("a") + nbt.getDouble("A"), + nbt.getLong("e")); + instance.setColor(nbt.getByte("c")); + return instance; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof IEMDefinition) { + return getDefinition().compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + //Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT creativeTabTecTech INFO + @Override + public int hashCode() { + return getDefinition().hashCode(); + } + + @Override + public String toString() { + return getDefinition().toString() + '\n' + getAmount() / AVOGADRO_CONSTANT + " mol\n" + getMass(); + } + + public void setAmount(double amount) { + this.amount = amount; + } + + public double getAge() { + return age; + } + + public void setAge(double age) { + this.age = age; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java new file mode 100644 index 0000000000..94c76634d9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Created by danie_000 on 30.01.2017. + */ +public interface IEMStack extends Comparable,Cloneable { + IEMDefinition getDefinition(); + + double getAmount(); + + default double getCharge(){ + return getDefinition().getCharge()*getAmount(); + } + + default double getMass(){ + return getDefinition().getMass()*getAmount(); + } + + IEMStack clone(); + + /** + * Will return stack with mutated amount, it might be a new object! + * @param newAmount new amount + * @return new stack (or previous one if was mutable) + */ + IEMStack mutateAmount(double newAmount); + + NBTTagCompound toNBT(); + + @Override + default int compareTo(IEMStack o){ + return getDefinition().compareTo(o.getDefinition()); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java deleted file mode 100644 index 1e03c8130f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; - -/** - * Created by danie_000 on 20.11.2016. - */ -public final class cElementalDefinitionStack implements iElementalStack { - public final iElementalDefinition definition; - public final double amount; - - public cElementalDefinitionStack(iElementalDefinition def, double amount) { - definition = def == null ? null__ : def; - this.amount = amount; - } - - @Override - public cElementalDefinitionStack clone() { - return this;//IMMUTABLE - } - - @Override - public cElementalDefinitionStack mutateAmount(double amount) { - if(this.amount==amount){ - return this; - } - return new cElementalDefinitionStack(definition,amount);//IMMUTABLE - } - - @Override - public iElementalDefinition getDefinition() { - return definition;//IMMUTABLE - } - - @Override - public double getAmount() { - return amount; - } - - @Override - public double getCharge() { - return definition.getCharge() * amount; - } - - @Override - public double getMass() { - return definition.getMass() * amount; - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", definition.toNBT()); - nbt.setDouble("Q", amount); - return nbt; - } - - public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) { - return new cElementalDefinitionStack( - cElementalDefinition.fromNBT(nbt.getCompoundTag("d")), - nbt.getLong("q")+nbt.getDouble("Q")); - } - - @Override - public int compareTo(iElementalStack o) { - return definition.compareTo(o.getDefinition()); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof iElementalDefinition) { - return definition.compareTo((iElementalDefinition) obj) == 0; - } - if (obj instanceof iElementalStack) { - return definition.compareTo(((iElementalStack) obj).getDefinition()) == 0; - } - return false; - } - - //Amount shouldn't be hashed if this is just indicating amount and not structure - @Override - public int hashCode() { - return definition.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java deleted file mode 100644 index 1c06e560db..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ /dev/null @@ -1,566 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.crash.CrashReport; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static com.github.technus.tectech.util.DoubleCount.*; -import static java.lang.Math.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cElementalInstanceStack implements iElementalStack { - public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16; - public static double DECAY_CALL_PER=AVOGADRO_CONSTANT;//todo - - public final iElementalDefinition definition; - //energy - if positive then particle should try to decay - private long energy; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private byte color; - public double age; - public double amount; - private double lifeTime; - private double lifeTimeMult; - - public cElementalInstanceStack(cElementalDefinitionStack stackSafe) { - this(stackSafe.definition, stackSafe.amount, 1D, 0D, 0); - } - - public cElementalInstanceStack(cElementalDefinitionStack stackSafe, double lifeTimeMult, double age, long energy) { - this(stackSafe.definition, stackSafe.amount, lifeTimeMult, age, energy); - } - - public cElementalInstanceStack(iElementalDefinition defSafe, double amount) { - this(defSafe, amount, 1D, 0D, 0); - } - - public cElementalInstanceStack(iElementalDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { - definition = defSafe == null ? null__ : defSafe; - byte bColor = definition.getColor(); - if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color - this.color = bColor; - } else { - this.color = (byte) TecTech.RANDOM.nextInt(3); - } - this.lifeTimeMult = lifeTimeMult; - lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; - setEnergy(energy); - this.age = age; - this.amount = amount; - } - - //Clone proxy - private cElementalInstanceStack(cElementalInstanceStack stack) { - definition = stack.definition; - color = stack.color; - age = stack.age; - amount = stack.amount; - lifeTime = stack.lifeTime; - lifeTimeMult = stack.lifeTimeMult; - energy = stack.energy; - } - - @Override - public cElementalInstanceStack clone() { - return new cElementalInstanceStack(this); - } - - @Override - public cElementalInstanceStack mutateAmount(double amount) { - this.amount = amount; - return this; - } - - @Override - public double getAmount() { - return amount; - } - - @Override - public double getCharge() { - return definition.getCharge() * amount; - } - - @Override - public double getMass() { - return definition.getMass() * amount; - } - - public long getEnergy() { - return energy; - } - - public void setEnergy(long newEnergyLevel){ - energy=newEnergyLevel; - setLifeTimeMultiplier(getLifeTimeMultiplier()); - } - - public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ - return definition.getEnergyDiffBetweenStates(currentEnergyLevel,newEnergyLevel)*amount; - } - - public double getEnergySettingCost(long newEnergyLevel){ - return definition.getEnergyDiffBetweenStates(energy,newEnergyLevel)*amount; - } - - public cElementalDefinitionStack getDefinitionStack() { - return new cElementalDefinitionStack(definition, amount); - } - - @Override - public iElementalDefinition getDefinition() { - return definition; - } - - public byte getColor() { - return color; - } - - public byte setColor(byte color) {//does not allow changing magic element - if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { - return this.color; - } - return this.color = color; - } - - public byte nextColor() {//does not allow changing magic element - if (color < 0 || color > 2) { - return color; - } - return color = (byte) TecTech.RANDOM.nextInt(3); - } - - public double getLifeTime() { - return lifeTime; - } - - public double setLifeTimeMultiplier(double mult) { - if(mult<=0) //since infinity*0=nan - { - throw new IllegalArgumentException("multiplier must be >0"); - } - lifeTimeMult = mult; - if (definition.getRawTimeSpan(energy) <= 0) { - return lifeTime; - } - lifeTime = definition.getRawTimeSpan(energy) * lifeTimeMult; - return lifeTime; - } - - public double getLifeTimeMultiplier() { - return lifeTimeMult; - } - - public cElementalDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize){ - return tickStack(lifeTimeMult,postEnergize,1D); - } - - public cElementalDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds){ - cElementalDecayResult newInstances = decay(lifeTimeMult, age += seconds, postEnergize); - if (newInstances == null) { - nextColor(); - } else { - for (cElementalInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { - newInstance.nextColor(); - } - } - return newInstances; - } - - public cElementalDecayResult decay() { - return decay(1D, age, 0);//try to decay without changes - } - - public cElementalDecayResult decay(double apparentAge, long postEnergize) { - return decay(1D,apparentAge,postEnergize); - } - - public cElementalDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) { - long newEnergyLevel = postEnergize + energy; - if (newEnergyLevel > 0) { - newEnergyLevel -= 1; - } else if (newEnergyLevel < 0) { - newEnergyLevel += 1; - } - cElementalDecayResult output; - if(definition.usesMultipleDecayCalls(energy)){ - double amountTemp=amount; - int decayCnt=(int) min(MAX_MULTIPLE_DECAY_CALLS,max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS)); - amount= div(amount,decayCnt); - decayCnt--; - - output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); - if(output==null){ - amount=amountTemp; - return null; - } - - for(int i=0;i 0 && !definition.usesSpecialEnergeticDecayHandling()) { - setLifeTimeMultiplier(getLifeTimeMultiplier()); - return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); - } else if (definition.getRawTimeSpan(energy) < 0) { - return null;//return null, decay cannot be achieved - } else if (definition.isTimeSpanHalfLife()) { - return exponentialDecayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, -1D, newEnergyLevel); - } else { - if (1 > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel); - } else if (apparentAge > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, 0D, newEnergyLevel); - } - } - return null;//return null since decay cannot be achieved - } - - //Use to get direct decay output providing correct decay array - private cElementalDecayResult exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { - double newAmount= div(amount,Math.pow(2D,1D/* 1 second *//lifeTime)); - - //if(definition.getSymbol().startsWith("U ")) { - // System.out.println("newAmount = " + newAmount); - // System.out.println("amountRemaining = " + amountRemaining); - // for(cElementalDecay decay:decays){ - // System.out.println("prob = "+decay.probability); - // for(cElementalDefinitionStack stack:decay.outputStacks.values()){ - // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount); - // } - // } - //} - if(newAmount==amount) { - newAmount-=ulp(newAmount); - } else if(newAmount<1) { - return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); - } - - //split to non decaying and decaying part - double amount=this.amount; - this.amount-=newAmount; - cElementalDecayResult products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); - this.amount=newAmount; - if(products!=null){ - products.getOutput().putUnify(clone()); - } - this.amount=amount; - return products; - } - - //Use to get direct decay output providing correct decay array - private cElementalDecayResult decayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { - if (decays == null) { - return null;//Can not decay so it wont - } - boolean makesEnergy=definition.decayMakesEnergy(energy); - double mass=getMass(); - if (decays.length == 0) { - return makesEnergy ? null : new cElementalDecayResult(new cElementalInstanceStackMap(), mass, 0); - //provide non null 0 length array for annihilation - } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end - if(decays[0]==deadEnd) { - return makesEnergy ? null : new cElementalDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount), mass, 0); - } - cElementalInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); - if(newProductsAge<0){ - if(output.size()==1) { - if(output.size()==1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - output.getFirst().age=age; - } - }else { - for (cElementalInstanceStack stack : output.valuesToArray()) { - if (stack.definition.equals(definition)) { - stack.age = age; - } - } - } - }else{ - if(output.size()==1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - } - } - if(energy <= 0 && output.getMass() > mass){ - return null;//no energy usage to decay - } - return new cElementalDecayResult(new cElementalInstanceStackMap(), mass, makesEnergy ? output.getMass()-mass:0); - } else { - cElementalDecayResult totalOutput = new cElementalDecayResult(new cElementalInstanceStackMap(),getMass(),0); - cElementalInstanceStackMap output=totalOutput.getOutput(),results; - int differentDecays = decays.length; - double[] probabilities=new double[differentDecays]; - for (int i = 0; i < probabilities.length; i++) { - probabilities[i]=decays[i].probability; - } - double[] qttyOfDecay; - try{ - qttyOfDecay = distribute(amount, probabilities); - }catch (ArithmeticException e){ - Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: "+this.toString(),e)); - return null; - } - //long amountRemaining = this.amount, amount = this.amount; - //float remainingProbability = 1D; -// - //for (int i = 0; i < differentDecays; i++) { - // if (decays[i].probability >= 1D) { - // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); - // if (thisDecayAmount > 0) { - // if (thisDecayAmount <= amountRemaining) { - // amountRemaining -= thisDecayAmount; - // qttyOfDecay[i] += thisDecayAmount; - // }else {//in case too much was made - // qttyOfDecay[i] += amountRemaining; - // amountRemaining = 0; - // //remainingProbability=0; - // } - // } - // break; - // } - // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); - // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made - // amountRemaining -= thisDecayAmount; - // qttyOfDecay[i] += thisDecayAmount; - // } else if (thisDecayAmount > amountRemaining) {//too much was made - // qttyOfDecay[i] += amountRemaining; - // amountRemaining = 0; - // //remainingProbability=0; - // break; - // } - // remainingProbability -= decays[i].probability; - // if(remainingProbability<=0) { - // break; - // } - //} - - //for (int i = 0; i < amountRemaining; i++) { - // double rand = TecTech.RANDOM.nextDouble(); - // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into - // rand -= decays[j].probability; - // if (rand <= 0D) { - // qttyOfDecay[j]++; - // break; - // } - // } - //} - - if(definition.decayMakesEnergy(energy)){ - for (int i = differentDecays - 1; i >= 0; i--) { - if(decays[i]==deadEnd){ - cElementalInstanceStack clone=clone(); - clone.amount=qttyOfDecay[i]; - output.putUnify(clone); - }else { - results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); - output.putUnifyAll(results); - totalOutput.setMassDiff(add(totalOutput.getMassDiff(),results.getMass()-mass)); - } - } - }else{ - for (int i = differentDecays - 1; i >= 0; i--) { - results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); - output.putUnifyAll(results); - } - } - - if(newProductsAge<0) { - if (output.size() == 1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - output.getFirst().age = age; - } else { - for (cElementalInstanceStack stack : output.valuesToArray()) { - if (stack.definition.equals(definition)) { - stack.age = age; - } - } - } - }else{ - if(output.size()==1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - output.getFirst().age=age; - } - } - if(energy <= 0 && output.getMass() > getMass()){ - return null;//no energy usage to decay - } - return totalOutput; - } - } - - public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) { - if (instances == null) { - return this; - } - //returns with the definition from the first object passed - double energyTotal = this.energy * amount; - long maxEnergy=this.energy; - double lifeTimeMul = lifeTimeMult; - - for (cElementalInstanceStack instance : instances) { - if (instance != null && compareTo(instance) == 0) { - amount= add(amount,instance.amount); - energyTotal += instance.energy * instance.amount; - if(instance.energy>maxEnergy){ - maxEnergy=instance.energy; - } - lifeTimeMul = min(lifeTimeMul, instance.lifeTimeMult); - age = max(age, instance.age); - } - } - - if (amount != 0) { - energyTotal /= Math.abs(amount); - } - - double wholeParts=Math.floor(energyTotal); - energyTotal= min(energyTotal-wholeParts,1D)+(wholeParts>=0?-0.11709966304863834D:0.11709966304863834D); - long energy=(long) wholeParts + ((energyTotal > TecTech.RANDOM.nextDouble()) ? 1 : 0); - if(energy*energyTotal<0){ - energy=0; - } - setEnergy(min(maxEnergy,energy)); - return this; - } - - public void addScanShortSymbols(ArrayList lines, int[] detailsOnDepthLevels){ - int capabilities=detailsOnDepthLevels[0]; - definition.addScanShortSymbols(lines,capabilities,energy); - //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); - } - - //private void scanShortSymbolsContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ - // if(definitions!=null && depth lines, int[] detailsOnDepthLevels){ - int capabilities=detailsOnDepthLevels[0]; - if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)) { - lines.add("DEPTH = " + 0); - } - definition.addScanResults(lines,capabilities,energy); - if(Util.areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)) { - lines.add("TIME MULT = " + lifeTimeMult); - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)) { - lines.add("TIME SPAN = " + lifeTime + " s"); - } - } - if(Util.areBitsSet(SCAN_GET_AGE,capabilities)) { - lines.add("AGE = " + age + " s"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add("COLOR = " + color + " RGB or CMY"); - } - if(Util.areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)) { - lines.add("ENERGY = " + energy); - } - if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) { - lines.add("AMOUNT = " + amount/ AVOGADRO_CONSTANT +" mol"); - } - scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); - } - - private void scanContents(ArrayList lines, cElementalConstantStackMap definitions, int depth, int[] detailsOnDepthLevels){ - if(definitions!=null && depth,Cloneable { - iElementalDefinition getDefinition(); - - double getAmount(); - - double getCharge(); - - double getMass(); - - iElementalStack clone(); - - iElementalStack mutateAmount(double amount); - - NBTTagCompound toNBT(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java deleted file mode 100644 index 2adadfd062..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -/** - * Created by danie_000 on 19.11.2016. - */ -public final class tElementalException extends Exception { - public tElementalException(String message) { - super(message); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java new file mode 100644 index 0000000000..7fc074bded --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java @@ -0,0 +1,135 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.templates; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 23.01.2017. + */ +public abstract class EMComplex implements IEMDefinition { + //Nothing array + public static final IEMDefinition[] nothing = new EMPrimitive[0]; + + //add text based creators for recipe formula input? + private static final Map nbtCreationBind = new HashMap<>();//creator methods in subclasses + private static final HashSet classSet = new HashSet<>(); + + protected static void addCreatorFromNBT(byte shortcutNBT, Method constructorFromNBT,byte classID) { + if(nbtCreationBind.put(shortcutNBT, constructorFromNBT)!=null) { + throw new Error("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); + } + if(!classSet.add(classID)) { + throw new Error("Duplicate Class ID! " + classID + " used for class comparison"); + } + } + + public static Map getBindsComplex(){ + return nbtCreationBind; + } + + @Override + public final EMComplex clone() { + return this;//IMMUTABLE + } + + public static IEMDefinition fromNBT(NBTTagCompound nbt) { + try { + return (IEMDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return nbtE__; + } + } + + @Override + public int compareTo(IEMDefinition o) { + int classCompare = compareClassID(o); + if (classCompare != 0) { + return classCompare; + } + + //only of the internal def stacks!!! + //that allows neat check if the same thing and + //top hierarchy amount can be used to store amount info + return compareInnerContentsWithAmounts(getSubParticles().valuesToArray(), o.getSubParticles().valuesToArray()); + } + + //use only for nested operations! + private static int compareInnerContentsWithAmounts(EMDefinitionStack[] tc, EMDefinitionStack[] sc) { + if (tc == null) { + if (sc == null) { + return 0; + } else { + return -1; + } + } + if (sc == null) { + return 1; + } + + int lenDiff = tc.length - sc.length; + if (lenDiff != 0) { + return lenDiff; + } + + for (int i = 0; i < tc.length; i++) { + int cn = tc[i].getDefinition().compareTo(sc[i].getDefinition()); + if (cn != 0) { + return cn; + } + + if (tc[i].getAmount() > sc[i].getAmount()) { + return 1; + } + if (tc[i].getAmount() < sc[i].getAmount()) { + return -1; + } + } + return 0; + } + + @Override + public final EMDefinitionStack getStackForm(double amount) { + return new EMDefinitionStack(this, amount); + } + + @Override + public final boolean equals(Object obj) { + if(this==obj) { + return true; + } + if (obj instanceof IEMDefinition) { + return compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + @Override + public int hashCode() {//Internal amounts should be also hashed + int hash = -(getSubParticles().size() << 4); + for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { + int amount=(int) stack.getAmount(); + hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); + } + return hash; + } + + @Override + public String toString() { + return getLocalizedName()+ '\n' + getSymbol(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java new file mode 100644 index 0000000000..587affd0f1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java @@ -0,0 +1,283 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.templates; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.util.Util.areBitsSet; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; + +/** + * Created by danie_000 on 22.10.2016. + * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) + */ +public abstract class EMPrimitive extends EMComplex { + public static final byte nbtType = (byte) 'p'; + + private static final Map bindsBO = new HashMap<>(); + + public static Map getBindsPrimitive() { + return bindsBO; + } + + private final String name; + private final String symbol; + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private final byte color; + //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti + private final byte type; + + private EMPrimitive anti;//IMMUTABLE + private EMDecay[] elementalDecays; + private byte naturalDecayInstant; + private byte energeticDecayInstant; + private double rawLifeTime; + + private final int ID; + + //no _ at end - normal particle + // _ at end - anti particle + // __ at end - self is antiparticle + + protected EMPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { + this.name = name; + this.symbol = symbol; + this.type = (byte) type; + this.mass = mass; + this.charge = charge; + this.color = (byte) color; + this.ID = ID; + if (bindsBO.put(ID, this) != null) { + Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new EMException("Duplicate ID"))); + } + STACKS_REGISTERED.add(this); + } + + // + protected void init(EMPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { + anti = antiParticle; + this.rawLifeTime = rawLifeTime; + naturalDecayInstant = (byte) naturalInstant; + energeticDecayInstant = (byte) energeticInstant; + elementalDecays =elementalDecaysArray; + } + + @Override + public String getLocalizedName() { + return "Undefined: " + getName(); + } + + @Override + public String getSymbol() { + return symbol; + } + + @Override + public String getShortSymbol() { + return getSymbol(); + } + + @Override + public IEMDefinition getAnti() { + return anti;//no need for copy + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public byte getColor() { + return color; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + if (naturalDecayInstant < 0) { + return elementalDecays; + }else if (naturalDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[naturalDecayInstant]}; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (energeticDecayInstant < 0) { + return elementalDecays; + }else if (energeticDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[energeticDecayInstant]}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + return elementalDecays; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return rawLifeTime; + } + + @Override + public final EMConstantStackMap getSubParticles() { + return null; + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public byte getType() { + return type; + } + + @Override + public final NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setByte("t", nbtType); + nbt.setInteger("c", getID()); + return nbt; + } + + public static EMPrimitive fromNBT(NBTTagCompound content) { + EMPrimitive primitive = bindsBO.get(content.getInteger("c")); + return primitive == null ? null__ : primitive; + } + + @Override + public final byte getClassType() { + return -128; + } + + public static byte getClassTypeStatic(){ + return -128; + } + + @Override + public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + nbtType + ' ' + getClassType()); + } + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+ getLocalizedName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + + public static void run() { + try { + EMComplex.addCreatorFromNBT(nbtType, EMPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Primitive " + nbtType + ' ' + -128); + } + } + + @Override + public final int compareTo(IEMDefinition o) { + if (getClassType() == o.getClassType()) { + int oID = ((EMPrimitive) o).getID(); + return Integer.compare(getID(), oID); + } + return compareClassID(o); + } + + @Override + public final int hashCode() { + return getID(); + } + + public String getName() { + return name; + } + + public int getID() { + return ID; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java new file mode 100644 index 0000000000..7ae6d0395c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java @@ -0,0 +1,84 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.templates; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +/** + * Created by danie_000 on 11.11.2016. + */ +public interface IEMDefinition extends Comparable,Cloneable {//IMMUTABLE + double STABLE_RAW_LIFE_TIME =1.5e36D; + double NO_DECAY_RAW_LIFE_TIME=-1D; + long DEFAULT_ENERGY_LEVEL=0; + double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels + + //Nomenclature + String getLocalizedName(); + + String getSymbol(); + + String getShortSymbol(); + + void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); + + void addScanResults(ArrayList lines, int capabilities, long energyLevel); + + byte getType(); + + byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + + //Not dynamically changing stuff + IEMDefinition getAnti();//gives new anti particle def + + EMDecay[] getDecayArray();//possible decays + + EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick + + EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay + + boolean usesSpecialEnergeticDecayHandling(); + + boolean usesMultipleDecayCalls(long energyLevel); + + boolean decayMakesEnergy(long energyLevel); + + boolean fusionMakesEnergy(long energyLevel); + + double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative + + double getMass();//mass... MeV/c^2 + + int getCharge();//charge 1/3 electron charge + + //dynamically changing stuff + byte getColor();//-1 nope cannot 0 it can but undefined + + double getRawTimeSpan(long currentEnergy);//defined in static fields or generated + + boolean isTimeSpanHalfLife(); + + EMConstantStackMap getSubParticles();//contents... null if none + + EMFluidDequantizationInfo someAmountIntoFluidStack(); + + EMItemDequantizationInfo someAmountIntoItemsStack(); + + EMOredictDequantizationInfo someAmountIntoOredictStack(); + + NBTTagCompound toNBT(); + + EMDefinitionStack getStackForm(double amount); + + IEMDefinition clone(); + + default int compareClassID(IEMDefinition obj) { + return (int) getClassType() - obj.getClassType(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java deleted file mode 100644 index 43e42df988..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 23.01.2017. - */ -public abstract class cElementalDefinition extends iElementalDefinition { - //Nothing array - public static final iElementalDefinition[] nothing = new cElementalPrimitive[0]; - - //add text based creators for recipe formula input? - private static final Map nbtCreationBind = new HashMap<>();//creator methods in subclasses - private static final HashSet classSet = new HashSet<>(); - - protected static void addCreatorFromNBT(byte shortcutNBT, Method constructorFromNBT,byte classID) { - if(nbtCreationBind.put(shortcutNBT, constructorFromNBT)!=null) { - throw new Error("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); - } - if(!classSet.add(classID)) { - throw new Error("Duplicate Class ID! " + classID + " used for class comparison"); - } - } - - public static Map getBindsComplex(){ - return nbtCreationBind; - } - - @Override - public final cElementalDefinition clone() { - return this;//IMMUTABLE - } - - public static iElementalDefinition fromNBT(NBTTagCompound nbt) { - try { - return (iElementalDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__; - } - } - - @Override - public int compareTo(iElementalDefinition o) { - int classCompare = compareClassID(o); - if (classCompare != 0) { - return classCompare; - } - - //only of the internal def stacks!!! - //that allows neat check if the same thing and - //top hierarchy amount can be used to store amount info - return compareInnerContentsWithAmounts(getSubParticles().valuesToArray(), o.getSubParticles().valuesToArray()); - } - - //use only for nested operations! - private static int compareInnerContentsWithAmounts(cElementalDefinitionStack[] tc, cElementalDefinitionStack[] sc) { - if (tc == null) { - if (sc == null) { - return 0; - } else { - return -1; - } - } - if (sc == null) { - return 1; - } - - int lenDiff = tc.length - sc.length; - if (lenDiff != 0) { - return lenDiff; - } - - for (int i = 0; i < tc.length; i++) { - int cn = tc[i].definition.compareTo(sc[i].definition); - if (cn != 0) { - return cn; - } - - if (tc[i].amount > sc[i].amount) { - return 1; - } - if (tc[i].amount < sc[i].amount) { - return -1; - } - } - return 0; - } - - @Override - public final cElementalDefinitionStack getStackForm(double amount) { - return new cElementalDefinitionStack(this, amount); - } - - @Override - public final boolean equals(Object obj) { - if(this==obj) { - return true; - } - if (obj instanceof iElementalDefinition) { - return compareTo((iElementalDefinition) obj) == 0; - } - if (obj instanceof iElementalStack) { - return compareTo(((iElementalStack) obj).getDefinition()) == 0; - } - return false; - } - - @Override - public int hashCode() {//Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 4); - for (cElementalDefinitionStack stack : getSubParticles().valuesToArray()) { - int amount=(int)stack.amount; - hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.definition.hashCode(); - } - return hash; - } - - @Override - public String toString() { - return getName()+ '\n' + getSymbol(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java deleted file mode 100644 index 70af6445c9..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import net.minecraft.client.Minecraft; -import net.minecraft.crash.CrashReport; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; - -import static com.github.technus.tectech.util.Util.areBitsSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; - -/** - * Created by danie_000 on 22.10.2016. - * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) - */ -public abstract class cElementalPrimitive extends cElementalDefinition { - public static final byte nbtType = (byte) 'p'; - - private static final Map bindsBO = new HashMap<>(); - - public static Map getBindsPrimitive() { - return bindsBO; - } - - public final String name; - public final String symbol; - //float-mass in eV/c^2 - public final double mass; - //int -electric charge in 1/3rds of electron charge for optimization - public final byte charge; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - public final byte color; - //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - public final byte type; - - private cElementalPrimitive anti;//IMMUTABLE - private cElementalDecay[] elementalDecays; - private byte naturalDecayInstant; - private byte energeticDecayInstant; - private double rawLifeTime; - - public final int ID; - - //no _ at end - normal particle - // _ at end - anti particle - // __ at end - self is antiparticle - - protected cElementalPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { - this.name = name; - this.symbol = symbol; - this.type = (byte) type; - this.mass = mass; - this.charge = (byte) charge; - this.color = (byte) color; - this.ID = ID; - if (bindsBO.put(ID, this) != null) { - Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new tElementalException("Duplicate ID"))); - } - STACKS_REGISTERED.add(this); - } - - // - protected void init(cElementalPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { - anti = antiParticle; - this.rawLifeTime = rawLifeTime; - naturalDecayInstant = (byte) naturalInstant; - energeticDecayInstant = (byte) energeticInstant; - elementalDecays =elementalDecaysArray; - } - - @Override - public String getName() { - return "Undefined: " + name; - } - - @Override - public String getSymbol() { - return symbol; - } - - @Override - public String getShortSymbol() { - return symbol; - } - - @Override - public iElementalDefinition getAnti() { - return anti;//no need for copy - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public byte getColor() { - return color; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - if (naturalDecayInstant < 0) { - return elementalDecays; - }else if (naturalDecayInstant>=elementalDecays.length){ - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{elementalDecays[naturalDecayInstant]}; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - if (energeticDecayInstant < 0) { - return elementalDecays; - }else if (energeticDecayInstant>=elementalDecays.length){ - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{elementalDecays[energeticDecayInstant]}; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getDecayArray() { - return elementalDecays; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public final cElementalConstantStackMap getSubParticles() { - return null; - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public byte getType() { - return type; - } - - @Override - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - nbt.setInteger("c", ID); - return nbt; - } - - public static cElementalPrimitive fromNBT(NBTTagCompound content) { - cElementalPrimitive primitive = bindsBO.get(content.getInteger("c")); - return primitive == null ? null__ : primitive; - } - - @Override - public final byte getClassType() { - return -128; - } - - public static byte getClassTypeStatic(){ - return -128; - } - - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" "+"At current energy level"); - } - } - - public static void run() { - try { - cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Primitive " + nbtType + ' ' + -128); - } - } - - @Override - public final int compareTo(iElementalDefinition o) { - if (getClassType() == o.getClassType()) { - int oID = ((cElementalPrimitive) o).ID; - return Integer.compare(ID, oID); - } - return compareClassID(o); - } - - @Override - public final int hashCode() { - return ID; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java deleted file mode 100644 index 8065e9c170..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -/** - * Created by danie_000 on 11.11.2016. - */ -public abstract class iElementalDefinition implements Comparable,Cloneable {//IMMUTABLE - public static final double STABLE_RAW_LIFE_TIME =1.5e36D; - public static final double NO_DECAY_RAW_LIFE_TIME=-1D; - public static final long DEFAULT_ENERGY_LEVEL=0; - public static final double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels - - //Nomenclature - public abstract String getName(); - - public abstract String getSymbol(); - - public abstract String getShortSymbol(); - - public abstract void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); - - public abstract void addScanResults(ArrayList lines, int capabilities, long energyLevel); - - public abstract byte getType(); - - public abstract byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - - //Not dynamically changing stuff - public abstract iElementalDefinition getAnti();//gives new anti particle def - - public abstract cElementalDecay[] getDecayArray();//possible decays - - public abstract cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick - - public abstract cElementalDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay - - public abstract boolean usesSpecialEnergeticDecayHandling(); - - public abstract boolean usesMultipleDecayCalls(long energyLevel); - - public abstract boolean decayMakesEnergy(long energyLevel); - - public abstract boolean fusionMakesEnergy(long energyLevel); - - public abstract double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative - - public abstract double getMass();//mass... MeV/c^2 - - public abstract int getCharge();//charge 1/3 electron charge - - //dynamically changing stuff - public abstract byte getColor();//-1 nope cannot 0 it can but undefined - - public abstract double getRawTimeSpan(long currentEnergy);//defined in static fields or generated - - public abstract boolean isTimeSpanHalfLife(); - - public abstract cElementalConstantStackMap getSubParticles();//contents... null if none - - public abstract aFluidDequantizationInfo someAmountIntoFluidStack(); - - public abstract aItemDequantizationInfo someAmountIntoItemsStack(); - - public abstract aOredictDequantizationInfo someAmountIntoOredictStack(); - - public abstract NBTTagCompound toNBT(); - - public abstract cElementalDefinitionStack getStackForm(double amount); - - @Override - public abstract iElementalDefinition clone(); - - final int compareClassID(iElementalDefinition obj) { - return (int) getClassType() - obj.getClassType(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java new file mode 100644 index 0000000000..d74c36170e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMFluidDequantizationInfo implements IEMExchangeInfo { + private final IEMStack in; + private final FluidStack out; + + public EMFluidDequantizationInfo(IEMStack emIn, FluidStack fluidStackOut){ + in=emIn; + out=fluidStackOut; + } + + public EMFluidDequantizationInfo(IEMStack emIn, Fluid fluid, int fluidAmount){ + in=emIn; + out=new FluidStack(fluid,fluidAmount); + } + + @Override + public IEMStack input() { + return in.clone();//MEH! + } + + @Override + public FluidStack output() { + return out.copy(); + } + + @Override + public int hashCode() { + return in.getDefinition().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMFluidDequantizationInfo && hashCode() == obj.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java new file mode 100644 index 0000000000..43fb5550aa --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMFluidQuantizationInfo implements IEMExchangeInfo { + private final FluidStack in; + private final IEMStack out; + + public EMFluidQuantizationInfo(FluidStack fluidStackIn, IEMStack emOut){ + in=fluidStackIn; + out=emOut; + } + + public EMFluidQuantizationInfo(Fluid fluid, int fluidAmount, IEMStack emOut){ + in=new FluidStack(fluid,fluidAmount); + out=emOut; + } + + @Override + public FluidStack input() { + return in.copy(); + } + + @Override + public IEMStack output() { + return out.clone(); + } + + @Override + public int hashCode() { + return in.getFluidID(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMFluidQuantizationInfo && hashCode() == obj.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java new file mode 100644 index 0000000000..af741c703d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMItemDequantizationInfo implements IEMExchangeInfo { + private final IEMStack in; + private final ItemStack out; + + public EMItemDequantizationInfo(IEMStack emIn, ItemStack itemStackOut){ + in=emIn; + out=itemStackOut; + } + + public EMItemDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int amount) { + in = emIn; + out = GT_OreDictUnificator.get(prefix, material, amount); + } + + @Override + public IEMStack input() { + return in.clone(); + } + + @Override + public ItemStack output() { + return out.copy(); + } + + @Override + public int hashCode() { + return in.getDefinition().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMItemDequantizationInfo && hashCode() == obj.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java new file mode 100644 index 0000000000..553e806d38 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java @@ -0,0 +1,69 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMItemQuantizationInfo implements IEMExchangeInfo { + private final ItemStack in; + private final boolean skipNBT; + private final IEMStack out; + + public EMItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, IEMStack emOut) { + in = itemStackIn; + out = emOut; + this.skipNBT = skipNBT; + } + + public EMItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, IEMStack emOut) { + in = GT_OreDictUnificator.get(prefix, material, amount); + out = emOut; + this.skipNBT = skipNBT; + } + + @Override + public ItemStack input() { + return in.copy(); + } + + @Override + public IEMStack output() { + return out.clone(); + } + + @Override + public int hashCode() { + return (GameRegistry.findUniqueIdentifierFor(in.getItem())+":"+in.getUnlocalizedName()+ ':' +in.getItemDamage()).hashCode(); + } + + @Override + public boolean equals(Object obj) { + if(obj instanceof EMItemQuantizationInfo){ + //alias + ItemStack stack=((EMItemQuantizationInfo) obj).in; + if(!in.getUnlocalizedName().equals(((EMItemQuantizationInfo) obj).in.getUnlocalizedName())) { + return false; + } + + if(!GameRegistry.findUniqueIdentifierFor(in.getItem()).equals( + GameRegistry.findUniqueIdentifierFor(((EMItemQuantizationInfo) obj).in.getItem()))) { + return false; + } + + if(in.getItemDamage() != OreDictionary.WILDCARD_VALUE && stack.getItemDamage() != OreDictionary.WILDCARD_VALUE) { + if (in.getItemDamage() != stack.getItemDamage()) { + return false; + } + } + return skipNBT || ItemStack.areItemStackTagsEqual(in, stack); + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java new file mode 100644 index 0000000000..c8e337c7fd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java @@ -0,0 +1,60 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMOredictDequantizationInfo implements IEMExchangeInfo { + private final IEMStack in; + private final String out; + private final int amount; + + public EMOredictDequantizationInfo(IEMStack emIn, String name, int qty) { + in = emIn; + out =name; + amount = qty; + } + + public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int qty) { + in = emIn; + out = prefix.name() + material.mName; + amount = qty; + } + + public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, String materialName, int qty) { + in = emIn; + out = prefix.name() + materialName; + amount = qty; + } + + @Override + public IEMStack input() { + return in.clone();//MEH! + } + + @Override + public String output() { + return getOut(); + } + + @Override + public int hashCode() { + return in.getDefinition().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMOredictDequantizationInfo && hashCode() == obj.hashCode(); + } + + public String getOut() { + return out; + } + + public int getAmount() { + return amount; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java new file mode 100644 index 0000000000..0ca0415b0d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java @@ -0,0 +1,60 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMOredictQuantizationInfo implements IEMExchangeInfo { + private final String in; + private final int amount; + private final IEMStack out; + + public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut){ + in=name; + amount=qty; + out=emOut; + } + + public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut){ + in=prefix.name() + material.mName; + amount=qty; + out=emOut; + } + + public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut){ + in=prefix.name() + materialName; + amount=qty; + out=emOut; + } + + @Override + public String input() { + return getIn(); + } + + @Override + public IEMStack output() { + return out.clone(); + } + + @Override + public int hashCode() { + return getIn().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMOredictQuantizationInfo && hashCode() == obj.hashCode(); + } + + public String getIn() { + return in; + } + + public int getAmount() { + return amount; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java new file mode 100644 index 0000000000..fca79b0b6f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java @@ -0,0 +1,172 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static java.lang.Math.pow; + +/** + * Created by Tec on 26.05.2017. + */ +public class EMTransformationInfo { + /** + * Atom count per Mol + */ + public static final double AVOGADRO_CONSTANT =6.02214076e23D; + /** + * Min. chance of existing + */ + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48); + public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON; + public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; + public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON; + public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D; + public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON; + + public static EMTransformationInfo TRANSFORMATION_INFO = new EMTransformationInfo(); + + private Map fluidQuantization; + private Map itemQuantization; + private Map oredictQuantization; + + private Map fluidDequantization; + private Map itemDequantization; + private Map oredictDequantization; + + private EMTransformationInfo() { + this( + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) + ); + } + + public EMTransformationInfo( + Map fluidQuantization, + Map itemQuantization, + Map oredictQuantization, + Map fluidDequantization, + Map itemDequantization, + Map oredictDequantization) { + this.setFluidQuantization(fluidQuantization); + this.setItemQuantization(itemQuantization); + this.setOredictQuantization(oredictQuantization); + this.setFluidDequantization(fluidDequantization); + this.setItemDequantization(itemDequantization); + this.setOredictDequantization(oredictDequantization); + } + + public void addFluid(IEMStack em, FluidStack fluidStack){ + getFluidQuantization().put(fluidStack.getFluidID(),new EMFluidQuantizationInfo(fluidStack,em)); + getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluidStack)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addFluid(IEMStack em, Fluid fluid, int fluidAmount){ + getFluidQuantization().put(fluid.getID(),new EMFluidQuantizationInfo(fluid,fluidAmount,em)); + getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluid,fluidAmount)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + private void addItemQuantization(EMItemQuantizationInfo aIQI){ + getItemQuantization().put(aIQI,aIQI); + } + + public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT){ + addItemQuantization(new EMItemQuantizationInfo(itemStack,skipNBT,em)); + getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,itemStack)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ + addItemQuantization(new EMItemQuantizationInfo(prefix,material,amount,skipNBT,em)); + getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,prefix,material,amount)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addOredict(IEMStack em, String name, int qty){ + getOredictQuantization().put(OreDictionary.getOreID(name),new EMOredictQuantizationInfo(name,qty,em)); + getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,name,qty)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty){ + getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + material.mName),new EMOredictQuantizationInfo(prefix,material,qty,em)); + getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,material,qty)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty){ + getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + materialName),new EMOredictQuantizationInfo(prefix,materialName,qty,em)); + getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,materialName,qty)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public Map getFluidQuantization() { + return fluidQuantization; + } + + public void setFluidQuantization(Map fluidQuantization) { + this.fluidQuantization = fluidQuantization; + } + + public Map getItemQuantization() { + return itemQuantization; + } + + public void setItemQuantization(Map itemQuantization) { + this.itemQuantization = itemQuantization; + } + + public Map getOredictQuantization() { + return oredictQuantization; + } + + public void setOredictQuantization(Map oredictQuantization) { + this.oredictQuantization = oredictQuantization; + } + + public Map getFluidDequantization() { + return fluidDequantization; + } + + public void setFluidDequantization(Map fluidDequantization) { + this.fluidDequantization = fluidDequantization; + } + + public Map getItemDequantization() { + return itemDequantization; + } + + public void setItemDequantization(Map itemDequantization) { + this.itemDequantization = itemDequantization; + } + + public Map getOredictDequantization() { + return oredictDequantization; + } + + public void setOredictDequantization(Map oredictDequantization) { + this.oredictDequantization = oredictDequantization; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java new file mode 100644 index 0000000000..e20b0af3b5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java @@ -0,0 +1,11 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +/** + * Created by Tec on 23.05.2017. + */ +public interface IEMExchangeInfo { + OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. + //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) + + IN input();//same as above but for input +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java deleted file mode 100644 index 0d91b57ed5..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aFluidDequantizationInfo implements iExchangeInfo { - private final iElementalStack in; - private final FluidStack out; - - public aFluidDequantizationInfo(iElementalStack emIn, FluidStack fluidStackOut){ - in=emIn; - out=fluidStackOut; - } - - public aFluidDequantizationInfo(iElementalStack emIn, Fluid fluid, int fluidAmount){ - in=emIn; - out=new FluidStack(fluid,fluidAmount); - } - - @Override - public iElementalStack input() { - return in.clone();//MEH! - } - - @Override - public FluidStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aFluidDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java deleted file mode 100644 index 39e4ec4671..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aFluidQuantizationInfo implements iExchangeInfo { - private final FluidStack in; - private final iElementalStack out; - - public aFluidQuantizationInfo(FluidStack fluidStackIn, iElementalStack emOut){ - in=fluidStackIn; - out=emOut; - } - - public aFluidQuantizationInfo(Fluid fluid, int fluidAmount, iElementalStack emOut){ - in=new FluidStack(fluid,fluidAmount); - out=emOut; - } - - @Override - public FluidStack input() { - return in.copy(); - } - - @Override - public iElementalStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return in.getFluidID(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aFluidQuantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java deleted file mode 100644 index fb71275276..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import net.minecraft.item.ItemStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aItemDequantizationInfo implements iExchangeInfo { - private final iElementalStack in; - private final ItemStack out; - - public aItemDequantizationInfo(iElementalStack emIn, ItemStack itemStackOut){ - in=emIn; - out=itemStackOut; - } - - public aItemDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int amount) { - in = emIn; - out = GT_OreDictUnificator.get(prefix, material, amount); - } - - @Override - public iElementalStack input() { - return in.clone(); - } - - @Override - public ItemStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aItemDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java deleted file mode 100644 index da9950a186..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * Created by Tec on 23.05.2017. - */ -public class aItemQuantizationInfo implements iExchangeInfo { - private final ItemStack in; - private final boolean skipNBT; - private final iElementalStack out; - - public aItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, iElementalStack emOut) { - in = itemStackIn; - out = emOut; - this.skipNBT = skipNBT; - } - - public aItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, iElementalStack emOut) { - in = GT_OreDictUnificator.get(prefix, material, amount); - out = emOut; - this.skipNBT = skipNBT; - } - - @Override - public ItemStack input() { - return in.copy(); - } - - @Override - public iElementalStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return (GameRegistry.findUniqueIdentifierFor(in.getItem())+":"+in.getUnlocalizedName()+ ':' +in.getItemDamage()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if(obj instanceof aItemQuantizationInfo){ - //alias - ItemStack stack=((aItemQuantizationInfo) obj).in; - if(!in.getUnlocalizedName().equals(((aItemQuantizationInfo) obj).in.getUnlocalizedName())) { - return false; - } - - if(!GameRegistry.findUniqueIdentifierFor(in.getItem()).equals( - GameRegistry.findUniqueIdentifierFor(((aItemQuantizationInfo) obj).in.getItem()))) { - return false; - } - - if(in.getItemDamage() != OreDictionary.WILDCARD_VALUE && stack.getItemDamage() != OreDictionary.WILDCARD_VALUE) { - if (in.getItemDamage() != stack.getItemDamage()) { - return false; - } - } - return skipNBT || ItemStack.areItemStackTagsEqual(in, stack); - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java deleted file mode 100644 index 20f2252bd8..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; - -/** - * Created by Tec on 23.05.2017. - */ -public class aOredictDequantizationInfo implements iExchangeInfo { - private final iElementalStack in; - public final String out; - public final int amount; - - public aOredictDequantizationInfo(iElementalStack emIn, String name, int qty) { - in = emIn; - out =name; - amount = qty; - } - - public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int qty) { - in = emIn; - out = prefix.name() + material.mName; - amount = qty; - } - - public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, String materialName, int qty) { - in = emIn; - out = prefix.name() + materialName; - amount = qty; - } - - @Override - public iElementalStack input() { - return in.clone();//MEH! - } - - @Override - public String output() { - return out; - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aOredictDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java deleted file mode 100644 index 252b524185..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; - -/** - * Created by Tec on 23.05.2017. - */ -public class aOredictQuantizationInfo implements iExchangeInfo { - public final String in; - public final int amount; - private final iElementalStack out; - - public aOredictQuantizationInfo(String name, int qty, iElementalStack emOut){ - in=name; - amount=qty; - out=emOut; - } - - public aOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, iElementalStack emOut){ - in=prefix.name() + material.mName; - amount=qty; - out=emOut; - } - - public aOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, iElementalStack emOut){ - in=prefix.name() + materialName; - amount=qty; - out=emOut; - } - - @Override - public String input() { - return in; - } - - @Override - public iElementalStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return in.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aOredictQuantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java deleted file mode 100644 index 39f946c54a..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.HashMap; -import java.util.Map; - -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; -import static java.lang.Math.pow; - -/** - * Created by Tec on 26.05.2017. - */ -public class bTransformationInfo { - /** - * Atom count per Mol - */ - public static final double AVOGADRO_CONSTANT =6.02214076e23D; - /** - * Min. chance of existing - */ - public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT; - /** - * Quantity considered to be indifferent when computing stuff - */ - public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48); - public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON; - public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; - public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON*144D; - public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D; - public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON*1000D; - - public static bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(); - - public Map fluidQuantization; - public Map itemQuantization; - public Map oredictQuantization; - - public Map fluidDequantization; - public Map itemDequantization; - public Map oredictDequantization; - - private bTransformationInfo() { - this( - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) - ); - } - - public bTransformationInfo( - Map fluidQuantization, - Map itemQuantization, - Map oredictQuantization, - Map fluidDequantization, - Map itemDequantization, - Map oredictDequantization) { - this.fluidQuantization = fluidQuantization; - this.itemQuantization = itemQuantization; - this.oredictQuantization = oredictQuantization; - this.fluidDequantization = fluidDequantization; - this.itemDequantization = itemDequantization; - this.oredictDequantization = oredictDequantization; - } - - public void addFluid(iElementalStack em, FluidStack fluidStack){ - fluidQuantization.put(fluidStack.getFluidID(),new aFluidQuantizationInfo(fluidStack,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addFluid(iElementalStack em, Fluid fluid, int fluidAmount){ - fluidQuantization.put(fluid.getID(),new aFluidQuantizationInfo(fluid,fluidAmount,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluid,fluidAmount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - private void addItemQuantization(aItemQuantizationInfo aIQI){ - itemQuantization.put(aIQI,aIQI); - } - - public void addItem(iElementalStack em, ItemStack itemStack, boolean skipNBT){ - addItemQuantization(new aItemQuantizationInfo(itemStack,skipNBT,em)); - itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,itemStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addItem(iElementalStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ - addItemQuantization(new aItemQuantizationInfo(prefix,material,amount,skipNBT,em)); - itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,prefix,material,amount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iElementalStack em, String name, int qty){ - oredictQuantization.put(OreDictionary.getOreID(name),new aOredictQuantizationInfo(name,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,name,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iElementalStack em, OrePrefixes prefix, Materials material, int qty){ - oredictQuantization.put(OreDictionary.getOreID(prefix.name() + material.mName),new aOredictQuantizationInfo(prefix,material,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,material,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iElementalStack em, OrePrefixes prefix, String materialName, int qty){ - oredictQuantization.put(OreDictionary.getOreID(prefix.name() + materialName),new aOredictQuantizationInfo(prefix,materialName,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,materialName,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java deleted file mode 100644 index 2e8ef92073..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -/** - * Created by Tec on 23.05.2017. - */ -public interface iExchangeInfo { - OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. - //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) - - IN input();//same as above but for input -} 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 new file mode 100644 index 0000000000..77ac6c46c4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -0,0 +1,1694 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import com.github.technus.tectech.Reference; +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +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.XSTR; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.Materials; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; +import static gregtech.api.enums.OrePrefixes.dust; + +/** + * Created by danie_000 on 18.11.2016. + */ +public final class EMAtomDefinition extends EMComplex { + public static final long ATOM_COMPLEXITY_LIMIT=65536L; + private static final byte BYTE_OFFSET=32; + + private final int hash; + public static double refMass, refUnstableMass; + + private static final byte nbtType = (byte) 'a'; + private static final Random xstr = new XSTR();//NEEDS SEPARATE! + private static Map> stableIsotopes = new HashMap<>(); + private static final Map stableAtoms = new HashMap<>(); + private static Map> mostStableUnstableIsotopes = new HashMap<>(); + private static final Map unstableAtoms = new HashMap<>(); + private static EMDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; + private static final HashMap lifetimeOverrides = new HashMap<>(); + + private final EMNuclideIAEA iaea; + + private static EMAtomDefinition somethingHeavy; + public static EMAtomDefinition getSomethingHeavy() { + return somethingHeavy; + } + + private static final ArrayList overrides = new ArrayList<>(); + public static void addOverride(EMAtomDefinition atom, double rawLifeTime){ + lifetimeOverrides.put(atom,rawLifeTime); + } + + //float-mass in eV/c^2 + private final double mass; + //public final int charge; + private final int charge; + //int -electric charge in 1/3rds of electron charge for optimization + private final int chargeLeptons; + private double rawLifeTime; + //generation max present inside - minus if contains any anti quark + private final byte type; + + private final byte decayMode;//t neutron to proton+,0,f proton to neutron + //public final boolean stable; + + private final int neutralCount; + private final int element; + + private final boolean iaeaDefinitionExistsAndHasEnergyLevels; + + private final EMConstantStackMap elementalStacks; + + //stable is rawLifeTime>=10^9 + + public EMAtomDefinition(EMDefinitionStack... things) throws EMException { + this(true, new EMConstantStackMap(things)); + } + + private EMAtomDefinition(boolean check, EMDefinitionStack... things) throws EMException { + this(check, new EMConstantStackMap(things)); + } + + public EMAtomDefinition(EMConstantStackMap things) throws EMException { + this(true, things); + } + + private EMAtomDefinition(boolean check, EMConstantStackMap things) throws EMException { + if (check && !canTheyBeTogether(things)) { + throw new EMException("Atom Definition error"); + } + elementalStacks = things; + + double mass = 0; + int cLeptons = 0; + int cNucleus = 0; + int neutralCount = 0, element = 0; + int type = 0; + boolean containsAnti = false; + for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { + IEMDefinition def = stack.getDefinition(); + int amount = (int) stack.getAmount(); + if((int) stack.getAmount() != stack.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + mass += stack.getMass(); + if (def.getType() < 0) { + containsAnti = true; + } + type = Math.max(type, Math.abs(def.getType())); + + if (def instanceof EMLeptonDefinition) { + cLeptons += stack.getCharge(); + } else { + cNucleus += stack.getCharge(); + if (def.getCharge() == 3) { + element += amount; + } else if (def.getCharge() == -3) { + element -= amount; + } else if (def.getCharge() == 0) { + neutralCount += amount; + } + } + } + this.type = containsAnti ? (byte) -type : (byte) type; + //this.mass = mass; + chargeLeptons = cLeptons; + charge = cNucleus + cLeptons; + this.neutralCount = neutralCount; + this.element = element; + + element = Math.abs(element); + + //stability curve + int StableIsotope = stableIzoCurve(element); + int izoDiff = neutralCount - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + + xstr.setSeed((element + 1L) * (neutralCount + 100L)); + iaea = EMNuclideIAEA.get(element,neutralCount); + if(getIaea() !=null){ + if(Double.isNaN(getIaea().getMass())) { + this.mass = mass; + } else { + this.mass = getIaea().getMass(); + } + + if(Double.isNaN(getIaea().getHalfTime())) { + Double overriddenLifeTime= lifetimeOverrides.get(this); + double rawLifeTimeTemp; + if(overriddenLifeTime!=null) { + rawLifeTimeTemp = overriddenLifeTime; + } else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); + }else { + rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : getIaea().getHalfTime(); + } + iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length>1; + }else{ + this.mass=mass; + + Double overriddenLifeTime= lifetimeOverrides.get(this); + double rawLifeTimeTemp; + if(overriddenLifeTime!=null) { + rawLifeTimeTemp = overriddenLifeTime; + } else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); + + iaeaDefinitionExistsAndHasEnergyLevels =false; + } + + if(getIaea() ==null || getIaea().getEnergeticStatesArray()[0].energy!=0) { + if (izoDiff == 0) { + decayMode = 0; + } else { + decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); + } + }else{ + decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); + } + //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; + hash=super.hashCode(); + } + + private static int stableIzoCurve(int element) { + return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) + + 1.60885E-04D * Math.pow(element, 3D) + + 3.76604E-04D * Math.pow(element, 2D) + + 1.08418E+00D * (double) element); + } + + private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { + double rawLifeTime; + + if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { + rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); + } else { + //Y = (X-A)/(B-A) * (D-C) + C + double unstabilityEXP; + if (element == 0) { + return 1e-35D; + } else if (element == 1) { + unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; + } else if (element == 2) { + switch (isotope) { + case 4: + unstabilityEXP = 1.61D; + break; + case 5: + unstabilityEXP = -7.523D; + break; + case 6: + unstabilityEXP = -1.51D; + break; + default: + unstabilityEXP = -(izoDiffAbs * 6.165D); + break; + } + } else if (element <= 83 || isotope <= 127 && element <= 120) { + double elementPow4 = Math.pow(element, 4); + + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); + } else if (element < 180) { + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); + } else { + return -1; + } + if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { + unstabilityEXP -= 1.8D; + } + if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { + unstabilityEXP += 6; + } + if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) { + unstabilityEXP += 6; + } + rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); + } + + if (rawLifeTime < 8e-15D) { + return 1e-35D; + } + if (rawLifeTime > 8e28D) { + return 8e30D; + } + return rawLifeTime; + } + + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + boolean nuclei = false; + long qty=0; + for (EMDefinitionStack stack : stacks.valuesToArray()) { + if (stack.getDefinition() instanceof EMHadronDefinition) { + if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) { + return false; + } + nuclei = true; + } else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) { + return false; + } + if((int) stack.getAmount() != stack.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + qty+= stack.getAmount(); + } + return nuclei && qty= getIaea().getEnergeticStatesArray().length){ + return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].Thalf/(currentEnergy- getIaea().getEnergeticStatesArray().length+1); + } + return getIaea().getEnergeticStatesArray()[(int)currentEnergy].Thalf; + } + return rawLifeTime/(currentEnergy+1); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } + + @Override + public byte getColor() { + return -10; + } + + @Override + public String getLocalizedName() { + int element = Math.abs(this.getElement()); + boolean negative = this.getElement() < 0; + try { + if (Math.abs(getType()) != 1) { + return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; + } + return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return (negative ? "Element: ~" : "Element: ") + element; + } + } + + @Override + public String getSymbol() { + int element = Math.abs(this.getElement()); + boolean negative = this.getElement() < 0; + try { + return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + try { + int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + } catch (Exception E) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + } + } + } + + @Override + public String getShortSymbol() { + int element = Math.abs(this.getElement()); + boolean negative = this.getElement() < 0; + try { + return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + try { + int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; + } catch (Exception E) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return (negative ? "~" : "") + "?"; + } + } + } + + @Override + public EMConstantStackMap getSubParticles() { + return elementalStacks.clone(); + } + + @Override + public EMDecay[] getDecayArray() { + ArrayList decaysList =new ArrayList<>(4); + return getDecayArray(decaysList, getDecayMode(),true); + } + + private EMDecay[] getDecayArray(ArrayList decaysList, int decayMode, boolean tryAnti) {//todo? + if (getType() == 1) { + switch (decayMode) { + case -2: + if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } else if(PbetaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case -1: + if(Emmision(decaysList, EMHadronDefinition.hadron_p1)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 0: + if(alphaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 1: + if(Emmision(decaysList, EMHadronDefinition.hadron_n1)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 2: + if(MbetaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + default: + if(decayMode>8){ + if(iaeaDecay(decaysList,0)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); + } + } + return EMDecay.NO_DECAY; + }else if(getType() ==-1){ + EMAtomDefinition anti =getAnti(); + if(anti!=null) { + return anti.getDecayArray(decaysList, decayMode, false); + } + } + return getNaturalDecayInstant(); + } + + private boolean iaeaDecay(ArrayList decaysList, long energy){ + EMNuclideIAEA.energeticState state; + if(energy> getIaea().getEnergeticStatesArray().length) { + state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; + } else if(energy<=0) { + state = getIaea().getEnergeticStatesArray()[0]; + } else { + state = getIaea().getEnergeticStatesArray()[(int) energy]; + } + for (int i=0;i decaysList, EMNuclideIAEA.iaeaDecay decay, long energy){ + EMDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new EMDefinitionStackMap(); + switch (decay.decayName){ + case "D": { + if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())){ + withThis.putReplace(deuterium); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "3H": { + if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())){ + withThis.putReplace(tritium); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "3HE": { + if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())){ + withThis.putReplace(helium_3); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "8BE": { + if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())){ + withThis.putReplace(beryllium_8); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "14C": { + if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())){ + newStuff.putReplace(carbon_14); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "24NE": { + if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())){ + newStuff.putReplace(neon_24); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "34SI": { + if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())){ + newStuff.putReplace(silicon_34); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "A": case "A?": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)){ + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2B-": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p2); + newStuff.putReplace(EMLeptonDefinition.lepton_e2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "EC": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2EC": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B++EC": case "EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+A": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+2P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-A": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_n1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-2N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_n2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECA": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECP": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "EC2P": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECP+EC2P": {//todo look at branching ratios + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(EMHadronDefinition.hadron_p3); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + newStuff.putReplace(EMHadronDefinition.hadron_n1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + newStuff.putReplace(EMHadronDefinition.hadron_n2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "SF": { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { + return true; + } + } break; + case "B-F": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECF": case "ECSF": case "EC(+SF)": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "SF(+EC+B+)": case "SF+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "SF+EC+B-": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "IT": case "IT?": case "G": { + if(energy>0){ + decaysList.add(new EMDecay(decay.chance, this, boson_Y__)); + }else{ + if(DEBUG_MODE) { + TecTech.LOGGER.info("Tried to emit Gamma from ground state"); + } + decaysList.add(new EMDecay(decay.chance, this)); + } + return true; + } //break; + case "IT+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(EMBosonDefinition.boson_Y__1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "DEAD_END": + decaysList.add(deadEnd); + return true; + default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName); + } + return false; + } + + private boolean Emmision(ArrayList decaysList, EMDefinitionStack emit) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(emit)) { + try { + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean alphaDecay(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmountsExact(alpha.getDefinition().getSubParticles())) { + try { + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean MbetaDecay(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(EMHadronDefinition.hadron_n1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_p1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e1, EMNeutrinoDefinition.lepton_Ve_1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean PbetaDecay(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(EMHadronDefinition.hadron_p1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_n1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e_1, EMNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean ElectronCapture(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_n1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { + EMDefinitionStackMap heavy = new EMDefinitionStackMap(); + double[] liquidDrop = liquidDropFunction(Math.abs(getElement())<=97); + + for(EMDefinitionStack stack: fissile.valuesToArray()){ + if(spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && + (stack.getAmount() <=80 || stack.getAmount() <90 && XSTR_INSTANCE.nextInt(10)< stack.getAmount() -80)) { + return false; + } + if(stack.getDefinition().getCharge()==0){ + //if(stack.definition instanceof dHadronDefinition){ + double neutrals= stack.getAmount() *liquidDrop[2]; + int neutrals_cnt=(int)Math.floor(neutrals); + neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0; + particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); + + int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[1]); + while(heavy_cnt+neutrals_cnt> stack.getAmount()) { + heavy_cnt--; + } + fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(),heavy_cnt+neutrals_cnt)); + heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); + //}else{ + // particles.add(stack); + // light.remove(stack.definition); + //} + }else{ + int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[0]); + if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { + heavy_cnt--; + } + EMDefinitionStack new_stack =new EMDefinitionStack(stack.getDefinition(), heavy_cnt); + fissile.removeAmountExact(new_stack); + heavy.putReplace(new_stack); + } + } + + try { + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); + decaysList.add(new EMDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + return false; + } + + private static double[] liquidDropFunction(boolean asymmetric) { + double[] out = new double[3]; + + out[0] = XSTR_INSTANCE.nextGaussian(); + + if (out[0] < 1 && out[0] >= -1) { + if (XSTR_INSTANCE.nextBoolean()) { + out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; + } + } + + if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) { + out[0] = -out[0]; + } + + //scale to splitting ratio + out[0] = out[0] * 0.05d + .6d; + + if (out[0] < 0 || out[0] > 1) { + return liquidDropFunction(asymmetric); + } + if (out[0] < .5d) { + out[0] = 1d - out[0]; + } + + //extra neutrals + out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; + + if (asymmetric) { + out[1] = out[0]; + } else { + out[1] = out[0] - out[2] * .5d; + } + + return out; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (iaeaDefinitionExistsAndHasEnergyLevels) { + ArrayList decays =new ArrayList<>(4); + if(iaeaDecay(decays,energyLevel)){ + return decays.toArray(EMDecay.NO_PRODUCT); + } + } + if(energyLevel< Math.abs(getCharge())/3+ getNeutralCount()) { + return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; + } + return getNaturalDecayInstant(); + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { + if(iaeaDefinitionExistsAndHasEnergyLevels){ + double result=0; + boolean backwards=newEnergyLevel= getIaea().getEnergeticStatesArray().length){ + if(currentEnergyLevel>= getIaea().getEnergeticStatesArray().length) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } else { + result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - getIaea().getEnergeticStatesArray().length + 1); + } + result+= getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].energy; + }else { + result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy; + } + + return backwards?-result:result; + } + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + if(!iaeaDefinitionExistsAndHasEnergyLevels) return false; + EMNuclideIAEA.energeticState state; + if(energyLevel> getIaea().getEnergeticStatesArray().length) { + state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; + } else if(energyLevel<=0) { + state = getIaea().getEnergeticStatesArray()[0]; + } else { + state = getIaea().getEnergeticStatesArray()[(int) energyLevel]; + } + for (EMNuclideIAEA.iaeaDecay decay:state.decaymodes){ + if(decay.decayName.contains("F")) return true;//if is fissile + } + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return getIaea() !=null || iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + //disembody + ArrayList decaysInto = new ArrayList<>(); + for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { + if (elementalStack.getDefinition().getType() == 1 || elementalStack.getDefinition().getType() == -1) { + //covers both quarks and antiquarks + decaysInto.add(elementalStack); + } else { + //covers both quarks and antiquarks + decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); + } + } + return new EMDecay[]{new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), deadEnd}; + } + + //@Override + //public iElementalDefinition getAnti() { + // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); + // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // for (int i = 0; i < antiElements.length; i++) { + // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // } + // try { + // return new dAtomDefinition(false, antiElements); + // } catch (tElementalException e) { + // if (DEBUG_MODE) e.printStackTrace(); + // return null; + // } + //} + + @Override + public EMAtomDefinition getAnti() { + EMDefinitionStackMap anti = new EMDefinitionStackMap(); + for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { + anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); + } + try { + return new EMAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return EMTransformationInfo.TRANSFORMATION_INFO.getFluidDequantization().get(this); + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return EMTransformationInfo.TRANSFORMATION_INFO.getItemDequantization().get(this); + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return EMTransformationInfo.TRANSFORMATION_INFO.getOredictDequantization().get(this); + } + + public EMNuclideIAEA getIaea() { + return iaea; + } + + public byte getDecayMode() { + return decayMode; + } + + public int getNeutralCount() { + return neutralCount; + } + + public int getElement() { + return element; + } + + private static final class Nomenclature { + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + } + + @Override + public NBTTagCompound toNBT() { + return getNbtTagCompound(nbtType, elementalStacks); + } + + public static EMAtomDefinition fromNBT(NBTTagCompound nbt) { + EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < stacks.length; i++) { + stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + } + try { + return new EMAtomDefinition(stacks); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + public static void run() { + for (Runnable r : overrides) { + r.run(); + } + + for(Map.Entry entry:lifetimeOverrides.entrySet()){ + try { + lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); + }catch (EMException e){ + e.printStackTrace(); //Impossible + } + } + + //populate stable isotopes + for (int element = 1; element < 83; element++)//Up to Bismuth exclusive + { + for (int isotope = 0; isotope < 130; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + int StableIsotope = stableIzoCurve(element); + int izoDiff = isotope - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); + if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { + TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); + isotopes.add(isotope); + } + } + } + + //populate unstable isotopes + for (int element = 83; element < 150; element++) { + for (int isotope = 100; isotope < 180; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + int Isotope = stableIzoCurve(element); + int izoDiff = isotope - Isotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); + isotopes.put(rawLifeTime, isotope); + } + } + + try { + for (Map.Entry> integerTreeSetEntry : stableIsotopes.entrySet()) { + stableAtoms.put(integerTreeSetEntry.getKey(), new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeSetEntry.getKey()), + new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeSetEntry.getKey()))); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); + } + } + for (Map.Entry> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { + unstableAtoms.put(integerTreeMapEntry.getKey(), new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), + new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeMapEntry.getKey()))); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); + } + } + deuterium=new EMAtomDefinition( + EMHadronDefinition.hadron_p1, + EMHadronDefinition.hadron_n1, + EMLeptonDefinition.lepton_e1).getStackForm(1); + tritium=new EMAtomDefinition( + EMHadronDefinition.hadron_p1, + EMHadronDefinition.hadron_n2, + EMLeptonDefinition.lepton_e1).getStackForm(1); + helium_3=new EMAtomDefinition( + EMHadronDefinition.hadron_p2, + EMHadronDefinition.hadron_n1, + EMLeptonDefinition.lepton_e2).getStackForm(1); + alpha = new EMAtomDefinition( + EMHadronDefinition.hadron_p2, + EMHadronDefinition.hadron_n2).getStackForm(1); + beryllium_8=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 4), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 4), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 4)).getStackForm(1); + carbon_14=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 6), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 8), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 6)).getStackForm(1); + neon_24=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 10), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 14), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 10)).getStackForm(1); + silicon_34=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 14), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 20), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 14)).getStackForm(1); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + + try { + EMComplex.addCreatorFromNBT(nbtType, EMAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64); + } + } + + public static void setTransformation(){ + /*----STABLE ATOMS----**/ + refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; + + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); + + /*----UNSTABLE ATOMS----**/ + refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; + + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); + //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); + + try { + EMAtomDefinition temp; + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(deuterium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); + + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(tritium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); + + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(helium_3.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); + + temp=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 146) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); + + double tempMass=temp.getMass(); + + temp=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 143) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); + + TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); + + temp=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 145) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); + + somethingHeavy=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 147) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); + + TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); + + TecTech.LOGGER.info("Neutron Mass: "+ EMHadronDefinition.hadron_n.getMass()); + + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + + if(Loader.isModLoaded(Reference.GTPLUSPLUS)) { + new GtppAtomLoader().run(); + } + } + + public static EMAtomDefinition getFirstStableIsotope(int element) { + return stableAtoms.get(element); + } + + public static EMAtomDefinition getBestUnstableIsotope(int element) { + return unstableAtoms.get(element); + } + + @Override + public byte getClassType() { + return 64; + } + + public static byte getClassTypeStatic(){ + return 64; + } + + @Override + public int hashCode() { + return hash; + } + + @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)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + nbtType + ' ' + getClassType()); + } + if(Util.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)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(iaeaDefinitionExistsAndHasEnergyLevels && Util.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)){ + 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 new file mode 100644 index 0000000000..384087770f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java @@ -0,0 +1,520 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.*; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import com.github.technus.tectech.util.Util; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static gregtech.api.enums.OrePrefixes.dust; + +/** + * Created by danie_000 on 17.11.2016. + */ +public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o + private final int hash; + + private static final byte nbtType = (byte) 'h'; + //Helpers + public static final Map SYMBOL_MAP =new HashMap<>(); + public static final Map NAME_MAP =new HashMap<>(); + public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; + public static EMDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; + private static double protonMass = 0D; + private static double neutronMass = 0D; + private static final double actualProtonMass=938272081.3D; + private static final double actualNeutronMass=939565413.3D; + + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + private final double rawLifeTime; + private final int amount; + //generation max present inside - minus if contains any antiquark + private final byte type; + //private final FluidStack fluidThing; + //private final ItemStack itemThing; + + private final EMConstantStackMap quarkStacks; + + public EMHadronDefinition(EMDefinitionStack... quarks) throws EMException { + this(true, new EMConstantStackMap(quarks)); + } + + private EMHadronDefinition(boolean check, EMDefinitionStack... quarks) throws EMException { + this(check, new EMConstantStackMap(quarks)); + } + + public EMHadronDefinition(EMConstantStackMap quarks) throws EMException { + this(true, quarks); + } + + private EMHadronDefinition(boolean check, EMConstantStackMap quarks) throws EMException { + if (check && !canTheyBeTogether(quarks)) { + throw new EMException("Hadron Definition error"); + } + quarkStacks = quarks; + + int amount = 0; + int charge = 0; + int type = 0; + boolean containsAnti = false; + double mass = 0; + for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) { + amount += quarkStack.getAmount(); + if((int) quarkStack.getAmount() != quarkStack.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + mass += quarkStack.getMass(); + charge += quarkStack.getCharge(); + type = Math.max(Math.abs(quarkStack.getDefinition().getType()), type); + if (quarkStack.getDefinition().getType() < 0) { + containsAnti = true; + } + } + this.amount = amount; + this.charge = charge; + this.type = containsAnti ? (byte) -type : (byte) type; + long mult = this.getAmount() * this.getAmount() * (this.getAmount() - 1); + mass = mass * 5.543D * mult;//yes it becomes heavier + + if (mass == protonMass && this.getAmount() == 3) { + rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME; + mass=actualProtonMass; + } else if (mass == neutronMass && this.getAmount() == 3) { + rawLifeTime = 882D; + mass=actualNeutronMass; + } else { + if (this.getAmount() == 3) { + rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); + } else if (this.getAmount() == 2) { + rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); + } else { + rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); + } + } + this.mass=mass; + hash=super.hashCode(); + } + + //public but u can just try{}catch(){} the constructor it still calls this method + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + long amount = 0; + for (EMDefinitionStack quarks : stacks.valuesToArray()) { + if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) { + return false; + } + if((int) quarks.getAmount() != quarks.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + amount += quarks.getAmount(); + } + return amount >= 2 && amount <= 12; + } + + @Override + public String getLocalizedName() { + StringBuilder name= new StringBuilder(getSimpleName()); + name.append(':'); + String sym= NAME_MAP.get(this); + if(sym!=null){ + name.append(' ').append(sym); + }else { + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount()); + } + } + return name.toString(); + } + + private String getSimpleName() { + switch (getAmount()) { + case 2: + return "Meson"; + case 3: + return "Baryon"; + case 4: + return "Tetraquark"; + case 5: + return "Pentaquark"; + case 6: + return "Hexaquark"; + default: + return "Hadron"; + } + } + + @Override + public String getSymbol() { + String sym=SYMBOL_MAP.get(this); + if(sym!=null){ + return sym; + }else { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + for (int i = 0; i < quark.getAmount(); i++) { + symbol.append(quark.getDefinition().getSymbol()); + } + } + return symbol.toString(); + } + } + + @Override + public String getShortSymbol() { + String sym=SYMBOL_MAP.get(this); + if(sym!=null){ + return sym; + }else { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + for (int i = 0; i < quark.getAmount(); i++) { + symbol.append(quark.getDefinition().getShortSymbol()); + } + } + return symbol.toString(); + } + } + + @Override + public byte getColor() { + return -7; + } + + @Override + public EMConstantStackMap getSubParticles() { + return quarkStacks; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + return EMDecay.NO_PRODUCT; + } + ArrayList decaysInto = new ArrayList<>(); + for (EMDefinitionStack quarks : quarkStacks) { + if (quarks.getDefinition().getType() == 1 || quarks.getDefinition().getType() == -1) { + //covers both quarks and antiquarks + decaysInto.add(quarks); + } else { + //covers both quarks and antiquarks + decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); + } + } + return new EMDecay[]{ + new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), + EMBosonDefinition.deadEnd + }; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && + quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && + quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + return EMDecay.NO_PRODUCT; + } else if (getAmount() != 3) { + return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + } else { + ArrayList newBaryon = new ArrayList<>(); + IEMDefinition[] Particles = new IEMDefinition[2]; + for (EMDefinitionStack quarks : quarkStacks) { + for (int i = 0; i < quarks.getAmount(); i++) { + newBaryon.add((EMQuarkDefinition) quarks.getDefinition()); + } + } + //remove last + EMQuarkDefinition lastQuark = newBaryon.remove(2); + + EMDefinitionStack[] decay; + if (Math.abs(lastQuark.getType()) > 1) { + decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); + } else { + decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); + } + newBaryon.add((EMQuarkDefinition) decay[0].getDefinition()); + Particles[0] = decay[1].getDefinition(); + Particles[1] = decay[2].getDefinition(); + + EMDefinitionStack[] contentOfBaryon = newBaryon.stream() + .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition,1)) + .toArray(EMDefinitionStack[]::new); + + try { + return new EMDecay[]{ + new EMDecay(0.001D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), + new EMDecay(0.99D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), + EMBosonDefinition.deadEnd}; + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return new EMDecay[]{EMBosonDefinition.deadEnd}; + } + } + } + + @Override + public double getMass() { + return mass; + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return getRawLifeTime(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } + + @Override + public byte getType() { + return type; + } + + //@Override + //public iElementalDefinition getAnti() { + // cElementalDefinitionStack[] stacks = this.quarkStacks.values(); + // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // for (int i = 0; i < antiElements.length; i++) { + // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // } + // try { + // return new dHadronDefinition(false, antiElements); + // } catch (tElementalException e) { + // if (DEBUG_MODE) e.printStackTrace(); + // return null; + // } + //} + + @Override + public IEMDefinition getAnti() { + EMDefinitionStackMap anti = new EMDefinitionStackMap(); + for (EMDefinitionStack stack : quarkStacks.valuesToArray()) { + anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); + } + try { + return new EMHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public NBTTagCompound toNBT() { + return getNbtTagCompound(nbtType, quarkStacks); + } + + public static EMHadronDefinition fromNBT(NBTTagCompound nbt) { + EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < stacks.length; i++) { + stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + } + try { + return new EMHadronDefinition(stacks); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + public static void run() { + try { + hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); + protonMass = hadron_p.getMass(); + //redefine the proton with proper lifetime (the lifetime is based on mass comparison) + hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); + SYMBOL_MAP.put(hadron_p,"p"); + NAME_MAP.put(hadron_p,"Proton"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); + hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); + SYMBOL_MAP.put(hadron_p_,"~p"); + NAME_MAP.put(hadron_p_,"Anti Proton"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); + neutronMass = hadron_n.getMass(); + //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); + SYMBOL_MAP.put(hadron_n, "n"); + NAME_MAP.put(hadron_n, "Neutron"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); + hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); + SYMBOL_MAP.put(hadron_n_,"~n"); + NAME_MAP.put(hadron_n_,"Anti Neutron"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + protonMass = -1; + neutronMass = -1; + } + hadron_p1 = new EMDefinitionStack(hadron_p, 1D); + hadron_n1 = new EMDefinitionStack(hadron_n, 1D); + hadron_p2 = new EMDefinitionStack(hadron_p, 2D); + hadron_n2 = new EMDefinitionStack(hadron_n, 2D); + hadron_p3 = new EMDefinitionStack(hadron_p, 3D); + hadron_n3 = new EMDefinitionStack(hadron_n, 3D); + hadron_p5 = new EMDefinitionStack(hadron_p, 5D); + + try { + EMComplex.addCreatorFromNBT(nbtType, EMHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + -64); + } + } + + public static void setTransformations(){ + //Added to atom map, but should be in its own + EMDefinitionStack neutrons =new EMDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); + TRANSFORMATION_INFO.getOredictDequantization().put(neutrons.getDefinition(),new EMOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); + TRANSFORMATION_INFO.getOredictQuantization().put( + OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), + new EMOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) + ); + } + + @Override + public byte getClassType() { + return -64; + } + + public static byte getClassTypeStatic(){ + return -64; + } + + @Override + public int hashCode() { + return hash; + } + + @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)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + nbtType + ' ' + getClassType()); + } + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+getSimpleName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + + public double getRawLifeTime() { + return rawLifeTime; + } + + public int getAmount() { + return amount; + } +} 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 new file mode 100644 index 0000000000..9a22f54941 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java @@ -0,0 +1,336 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.util.Util.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; + + //Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery + //Abund. [mole fract.] BR [%] [?N] [barn] [keV] [keV] [keV] [keV] [keV] [keV] [keV] [? AMU] [keV] + + //Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc, + //Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc, + private static final HashMap NUCLIDES =new HashMap<>(); + + public static void run(){ + String line=""; + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclides.csv"))); + ArrayList blockOfData=new ArrayList<>(4); + while((line=reader.readLine())!=null) { + String[] split= splitButDifferent(line,","); + if(split.length!=19) { + throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); + } + if(!split[1].isEmpty() && !blockOfData.isEmpty()) { + new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); + blockOfData.clear(); + } + blockOfData.add(split); + } + if(!blockOfData.isEmpty()) { + new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); + blockOfData.clear(); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclidesTable.csv"))); + while((line=reader.readLine())!=null) { + String[] split= splitButDifferent(line,","); + if(split.length!=47) { + throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclidesTable database " + line); + } + get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("energyLevels.csv"))); + while((line=reader.readLine())!=null) { + String[] split= splitButDifferent(line,","); + if(split.length!=27) { + throw new Error("Invalid count (" + split.length + ") of separators in IAEA energyLevels database " + line); + } + new energeticState(split); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + for(EMNuclideIAEA nuclide:NUCLIDES.values()) { + nuclide.makeArrayOfEnergyStates(); + } + } + + public static EMNuclideIAEA get(int protons, int neutrons){ + return NUCLIDES.get((protons<<16)+neutrons); + } + + private final short N; + private final short Z; + private final double halfTime;//sec + private final double mass;//eV/c^2 + private final short discovery;//year + private TreeMap energeticStates; + private energeticState[] energeticStatesArray; + + + private EMNuclideIAEA(String[][] rows){ + N=Short.parseShort(rows[1][2]); + Z=Short.parseShort(rows[1][0]); + NUCLIDES.put(((int) getZ() <<16)+ getN(),this); + + String[] parts = splitButDifferent(rows[0][16], "|"); + double Mass=doubleOrNaN(parts[0],"mass"); + if(!Double.isNaN(Mass)) { + //System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); + mass = Mass* MICRO_AMU_TO_EV_DIV_C_C; + } + else { + mass = Double.NaN; + } + + discovery=(short)doubleOrNaN(rows[0][18],"discovery"); + + if(rows[0][3].contains("STABLE")){ + halfTime = STABLE_RAW_LIFE_TIME; + }else{ + parts = splitButDifferent(rows[0][4], "|"); + halfTime = doubleOrNaN(parts[0],"half life"); + } + } + + private void getMoreData(String[] cells){ + //if(DEBUG_MODE) { + // if (add(cells[14])) System.out.println(N + " " + Z); + // if (add(cells[17])) System.out.println(N + " " + Z); + // if (add(cells[20])) System.out.println(N + " " + Z); + //} + new energeticState(this, getHalfTime(), getDecaysFixed( + cells[14], + doubleOrNaN(cells[15],"chance1"), + cells[17], + doubleOrNaN(cells[18],"chance1"), + cells[20], + doubleOrNaN(cells[21],"chance1"))); + } + + private static final energeticState[] empty=new energeticState[0]; + private void makeArrayOfEnergyStates(){ + if(energeticStates==null || energeticStates.isEmpty()) { + setEnergeticStatesArray(empty); + } else { + setEnergeticStatesArray(energeticStates.values().toArray(new energeticState[0])); + double life= getHalfTime(); + for (energeticState energeticState : getEnergeticStatesArray()) { + if(Double.isNaN(energeticState.Thalf)){ + energeticState.Thalf=life; + }else { + life=energeticState.Thalf; + } + } + } + } + + private double doubleOrNaN(String s, String name){ + s=s.replaceAll("#",""); + if(!s.isEmpty()) { + try { + double value=Double.parseDouble(s); + if(Double.isNaN(value)) { + return Double.NaN; + } + return value != 0 ?value:Double.NaN; + } catch (Exception e) { + System.out.println("Invalid Value " + name + ' ' + getN() + ' ' + getZ() + ' ' + s); + e.printStackTrace(); + } + } + return Double.NaN; + } + + public short getN() { + return N; + } + + public short getZ() { + return Z; + } + + public double getHalfTime() { + return halfTime; + } + + public double getMass() { + return mass; + } + + public short getDiscovery() { + return discovery; + } + + public energeticState[] getEnergeticStatesArray() { + return energeticStatesArray; + } + + public void setEnergeticStatesArray(energeticState[] energeticStatesArray) { + this.energeticStatesArray = energeticStatesArray; + } + + public static final class energeticState{ + public final double energy; + public double Thalf; + public final iaeaDecay[] decaymodes; + + private energeticState(EMNuclideIAEA nuclide, double Thalf, iaeaDecay[] decaymodes){ + energy=0; + this.Thalf=Thalf; + this.decaymodes=decaymodes; + if(nuclide.energeticStates==null) { + nuclide.energeticStates = new TreeMap<>(); + } + nuclide.energeticStates.put(energy,this); + } + + private energeticState(String[] cells){ + EMNuclideIAEA nuclide = get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); + if(nuclide==null) { + throw new Error("Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") + ' ' + (int) doubleOrNaN(cells[1], "neutrons")); + } + energy =doubleOrNaN(cells[3],"energy level",nuclide)*1000D;//to eV + if(energy<0) { + throw new Error("Invalid energy " + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + cells[3]); + } + Thalf =doubleOrNaN(cells[10],"half life",nuclide); + if(nuclide.energeticStates==null) { + new Exception("Should be initialized before doing this... "+ nuclide.getN() + ' ' + nuclide.getZ()).printStackTrace(); + nuclide.energeticStates = new TreeMap<>(); + } + nuclide.energeticStates.put(energy,this); + //if(DEBUG_MODE) { + // if (add(cells[12])) System.out.println(nuclide.N + " " + nuclide.Z); + // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); + // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); + //} + decaymodes = getDecaysFixed( + cells[12], + doubleOrNaN(cells[13],"chance 1",nuclide), + cells[15], + doubleOrNaN(cells[16],"chance 2",nuclide), + cells[18], + doubleOrNaN(cells[19],"chance 3",nuclide)); + } + + private double doubleOrNaN(String s, String name){ + return doubleOrNaN(s,name,null); + } + + private double doubleOrNaN(String s, String name, EMNuclideIAEA nuclide){ + s = s.replaceAll("#", ""); + if (!s.isEmpty()) { + try { + return Double.parseDouble(s); + } catch (Exception e) { + if(nuclide==null){ + System.out.println("Invalid Value " + name + ' ' + s); + }else { + System.out.println("Invalid Value " + name + ' ' + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + s); + } + e.printStackTrace(); + } + } + return Double.NaN; + } + } + + private static HashSet decays=new HashSet<>(); + private static boolean add(String s){ + if(decays.add(s)){ + System.out.println(s); + return true; + } + return false; + } + + private static iaeaDecay[] getDecaysFixed(String decay1, double chance1,String decay2, double chance2,String decay3, double chance3){ + boolean do1,do2,do3; + do1= !decay1.isEmpty() && !Double.isNaN(chance1); + do2= !decay2.isEmpty() && !Double.isNaN(chance2); + do3= !decay3.isEmpty() && !Double.isNaN(chance3); + TreeMap decays=new TreeMap<>(); + if(do1 && do2 && chance1==100 && chance2==100 && chance3!=100){ + decays.put(1D, new iaeaDecay(1D, decay1)); + if(do3) { + chance3/=100d; + decays.put(chance3, new iaeaDecay(chance3, decay2)); + chance2=1d-chance3; + } + chance2/=2d; + decays.put(chance2, new iaeaDecay(chance2, decay2)); + }else if(do1 && chance1==100){ + decays.put(1D, new iaeaDecay(1D, decay1)); + if(do2) { + chance2/=100d; + decays.put(chance2, new iaeaDecay(chance2, decay2)); + } + if(do3) { + chance3 /= 100d; + if(do2) { + chance3 *= chance2; + } + decays.put(chance3, new iaeaDecay(chance3, decay3)); + } + }else{ + double normalization= (do1?chance1:0) + (do2?chance2:0) + (do3?chance3:0); + if(do1) { + chance1/=normalization; + decays.put(chance1, new iaeaDecay(chance1, decay1)); + } + if(do2) { + chance2/=normalization; + decays.put(chance2, new iaeaDecay(chance2, decay2)); + } + if(do3) { + chance3/=normalization; + decays.put(chance3, new iaeaDecay(chance3, decay3)); + } + if(do1||do2||do3) { + decays.put(1D, iaeaDecay.DEAD_END); + } + } + //if(DEBUG_MODE){ + // System.out.println("INVALID SUM?\t"+normalization+"\t"+decay1+"\t"+chance1+"\t"+decay2+"\t"+chance2+"\t"+decay3+"\t"+chance3); + //} + return decays.values().toArray(new iaeaDecay[0]); + } + + public static final class iaeaDecay{ + public final double chance; + public final String decayName; + public static final iaeaDecay DEAD_END=new iaeaDecay(1D,"DEAD_END"); + private iaeaDecay(double chance,String decayName){ + this.chance=chance; + this.decayName=decayName; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java deleted file mode 100644 index 291ec8fe6b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ /dev/null @@ -1,1678 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.util.XSTR; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Materials; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; -import static gregtech.api.enums.OrePrefixes.dust; - -/** - * Created by danie_000 on 18.11.2016. - */ -public final class dAtomDefinition extends cElementalDefinition { - public static final long ATOM_COMPLEXITY_LIMIT=65536L; - private static final byte BYTE_OFFSET=32; - - private final int hash; - public static double refMass, refUnstableMass; - - private static final byte nbtType = (byte) 'a'; - private static final Random xstr = new XSTR();//NEEDS SEPARATE! - private static Map> stableIsotopes = new HashMap<>(); - private static final Map stableAtoms = new HashMap<>(); - private static Map> mostStableUnstableIsotopes = new HashMap<>(); - private static final Map unstableAtoms = new HashMap<>(); - private static cElementalDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; - private static final HashMap lifetimeOverrides = new HashMap<>(); - - public final iaeaNuclide iaea; - - private static dAtomDefinition somethingHeavy; - public static dAtomDefinition getSomethingHeavy() { - return somethingHeavy; - } - - private static final ArrayList overrides = new ArrayList<>(); - public static void addOverride(dAtomDefinition atom, double rawLifeTime){ - lifetimeOverrides.put(atom,rawLifeTime); - } - - //float-mass in eV/c^2 - public final double mass; - //public final int charge; - public final int charge; - //int -electric charge in 1/3rds of electron charge for optimization - public final int chargeLeptons; - private double rawLifeTime; - //generation max present inside - minus if contains any anti quark - public final byte type; - - public final byte decayMode;//t neutron to proton+,0,f proton to neutron - //public final boolean stable; - - public final int neutralCount; - public final int element; - - private final boolean iaeaDefinitionExistsAndHasEnergyLevels; - - private final cElementalConstantStackMap elementalStacks; - - //stable is rawLifeTime>=10^9 - - public dAtomDefinition(cElementalDefinitionStack... things) throws tElementalException { - this(true, new cElementalConstantStackMap(things)); - } - - private dAtomDefinition(boolean check, cElementalDefinitionStack... things) throws tElementalException { - this(check, new cElementalConstantStackMap(things)); - } - - public dAtomDefinition(cElementalConstantStackMap things) throws tElementalException { - this(true, things); - } - - private dAtomDefinition(boolean check, cElementalConstantStackMap things) throws tElementalException { - if (check && !canTheyBeTogether(things)) { - throw new tElementalException("Atom Definition error"); - } - elementalStacks = things; - - double mass = 0; - int cLeptons = 0; - int cNucleus = 0; - int neutralCount = 0, element = 0; - int type = 0; - boolean containsAnti = false; - for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) { - iElementalDefinition def = stack.definition; - int amount = (int)stack.amount; - if((int)stack.amount!=stack.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - mass += stack.getMass(); - if (def.getType() < 0) { - containsAnti = true; - } - type = Math.max(type, Math.abs(def.getType())); - - if (def instanceof eLeptonDefinition) { - cLeptons += stack.getCharge(); - } else { - cNucleus += stack.getCharge(); - if (def.getCharge() == 3) { - element += amount; - } else if (def.getCharge() == -3) { - element -= amount; - } else if (def.getCharge() == 0) { - neutralCount += amount; - } - } - } - this.type = containsAnti ? (byte) -type : (byte) type; - //this.mass = mass; - chargeLeptons = cLeptons; - charge = cNucleus + cLeptons; - this.neutralCount = neutralCount; - this.element = element; - - element = Math.abs(element); - - //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - - xstr.setSeed((element + 1L) * (neutralCount + 100L)); - iaea =iaeaNuclide.get(element,neutralCount); - if(iaea!=null){ - if(Double.isNaN(iaea.mass)) { - this.mass = mass; - } else { - this.mass = iaea.mass; - } - - if(Double.isNaN(iaea.halfTime)) { - Double overriddenLifeTime= lifetimeOverrides.get(this); - double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { - rawLifeTimeTemp = overriddenLifeTime; - } else { - rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); - } - rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - }else { - rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : iaea.halfTime; - } - iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1; - }else{ - this.mass=mass; - - Double overriddenLifeTime= lifetimeOverrides.get(this); - double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { - rawLifeTimeTemp = overriddenLifeTime; - } else { - rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); - } - rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - - iaeaDefinitionExistsAndHasEnergyLevels =false; - } - - if(iaea==null || iaea.energeticStatesArray[0].energy!=0) { - if (izoDiff == 0) { - decayMode = 0; - } else { - decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); - } - }else{ - decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); - } - //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - hash=super.hashCode(); - } - - private static int stableIzoCurve(int element) { - return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) + - 1.60885E-04D * Math.pow(element, 3D) + - 3.76604E-04D * Math.pow(element, 2D) + - 1.08418E+00D * (double) element); - } - - private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { - double rawLifeTime; - - if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { - rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); - } else { - //Y = (X-A)/(B-A) * (D-C) + C - double unstabilityEXP; - if (element == 0) { - return 1e-35D; - } else if (element == 1) { - unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; - } else if (element == 2) { - switch (isotope) { - case 4: - unstabilityEXP = 1.61D; - break; - case 5: - unstabilityEXP = -7.523D; - break; - case 6: - unstabilityEXP = -1.51D; - break; - default: - unstabilityEXP = -(izoDiffAbs * 6.165D); - break; - } - } else if (element <= 83 || isotope <= 127 && element <= 120) { - double elementPow4 = Math.pow(element, 4); - - unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); - } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); - } else { - return -1; - } - if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { - unstabilityEXP -= 1.8D; - } - if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { - unstabilityEXP += 6; - } - if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) { - unstabilityEXP += 6; - } - rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); - } - - if (rawLifeTime < 8e-15D) { - return 1e-35D; - } - if (rawLifeTime > 8e28D) { - return 8e30D; - } - return rawLifeTime; - } - - private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { - boolean nuclei = false; - long qty=0; - for (cElementalDefinitionStack stack : stacks.valuesToArray()) { - if (stack.definition instanceof dHadronDefinition) { - if (((dHadronDefinition) stack.definition).amount != 3) { - return false; - } - nuclei = true; - } else if (!(stack.definition instanceof eLeptonDefinition)) { - return false; - } - if((int)stack.amount!=stack.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - qty+=stack.amount; - } - return nuclei && qty=iaea.energeticStatesArray.length){ - return iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].Thalf/(currentEnergy-iaea.energeticStatesArray.length+1); - } - return iaea.energeticStatesArray[(int)currentEnergy].Thalf; - } - return rawLifeTime/(currentEnergy+1); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } - - @Override - public byte getColor() { - return -10; - } - - @Override - public String getName() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - if (Math.abs(type) != 1) { - return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; - } - return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "Element: ~" : "Element: ") + element; - } - } - - @Override - public String getSymbol() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "? N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); - } - } - } - - @Override - public String getShortSymbol() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "?"; - } - } - } - - @Override - public cElementalConstantStackMap getSubParticles() { - return elementalStacks.clone(); - } - - @Override - public cElementalDecay[] getDecayArray() { - ArrayList decaysList=new ArrayList<>(4); - return getDecayArray(decaysList,decayMode,true); - } - - private cElementalDecay[] getDecayArray(ArrayList decaysList,int decayMode,boolean tryAnti) {//todo? - if (type == 1) { - switch (decayMode) { - case -2: - if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } else if(PbetaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case -1: - if(Emmision(decaysList, dHadronDefinition.hadron_p1)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 0: - if(alphaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 1: - if(Emmision(decaysList, dHadronDefinition.hadron_n1)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 2: - if(MbetaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - default: - if(decayMode>8){ - if(iaeaDecay(decaysList,0)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); - } - } - return cElementalDecay.noDecay; - }else if(type ==-1){ - dAtomDefinition anti=getAnti(); - if(anti!=null) { - return anti.getDecayArray(decaysList, decayMode, false); - } - } - return getNaturalDecayInstant(); - } - - private boolean iaeaDecay(ArrayList decaysList,long energy){ - iaeaNuclide.energeticState state; - if(energy>iaea.energeticStatesArray.length) { - state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1]; - } else if(energy<=0) { - state = iaea.energeticStatesArray[0]; - } else { - state = iaea.energeticStatesArray[(int) energy]; - } - for (int i=0;i decaysList, iaeaNuclide.iaeaDecay decay, long energy){ - cElementalDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new cElementalDefinitionStackMap(); - switch (decay.decayName){ - case "D": { - if (withThis.removeAllAmounts(false, deuterium.definition.getSubParticles())){ - withThis.putReplace(deuterium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "3H": { - if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){ - withThis.putReplace(tritium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "3HE": { - if (withThis.removeAllAmounts(false, helium_3.definition.getSubParticles())){ - withThis.putReplace(helium_3); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "8BE": { - if (withThis.removeAllAmounts(false, beryllium_8.definition.getSubParticles())){ - withThis.putReplace(beryllium_8); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "14C": { - if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){ - newStuff.putReplace(carbon_14); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "24NE": { - if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){ - newStuff.putReplace(neon_24); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "34SI": { - if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){ - newStuff.putReplace(silicon_34); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "A": case "A?": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2B-": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - withThis.putUnify(dHadronDefinition.hadron_p2); - newStuff.putReplace(eLeptonDefinition.lepton_e2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "EC": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2EC": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e2)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B++EC": case "EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+A": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+2P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-A": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3, dHadronDefinition.hadron_p1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_n1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-2N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_n2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECA": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1,eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECP": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "EC2P": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECP+EC2P": {//todo look at branching ratios - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e2,dHadronDefinition.hadron_p5)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(dHadronDefinition.hadron_p3); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(dHadronDefinition.hadron_n1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - newStuff.putReplace(dHadronDefinition.hadron_n2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF": { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } break; - case "B-F": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECF": case "ECSF": case "EC(+SF)": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF(+EC+B+)": case "SF+EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF+EC+B-": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "IT": case "IT?": case "G": { - if(energy>0){ - decaysList.add(new cElementalDecay(decay.chance, this, boson_Y__)); - }else{ - if(DEBUG_MODE) { - TecTech.LOGGER.info("Tried to emit Gamma from ground state"); - } - decaysList.add(new cElementalDecay(decay.chance, this)); - } - return true; - } //break; - case "IT+EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(eBosonDefinition.boson_Y__1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "DEAD_END": - decaysList.add(deadEnd); - return true; - default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + neutralCount+ ' ' +element); - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Failed to decay " + element + ' ' + neutralCount + ' ' + decay.decayName); - } - return false; - } - - private boolean Emmision(ArrayList decaysList, cElementalDefinitionStack emit) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmount(false, emit)) { - try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean alphaDecay(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { - try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean MbetaDecay(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { - try { - tree.putUnify(dHadronDefinition.hadron_p1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean PbetaDecay(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { - try { - tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean ElectronCapture(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { - try { - tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean Fission(ArrayList decaysList, cElementalDefinitionStackMap fissile, cElementalDefinitionStackMap particles, double probability, boolean spontaneousCheck) { - cElementalDefinitionStackMap heavy = new cElementalDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(Math.abs(element)<=97); - - for(cElementalDefinitionStack stack: fissile.valuesToArray()){ - if(spontaneousCheck && stack.definition instanceof dHadronDefinition && - (stack.amount<=80 || stack.amount<90 && XSTR_INSTANCE.nextInt(10)XSTR_INSTANCE.nextDouble()?1:0; - particles.putUnify(new cElementalDefinitionStack(stack.definition, neutrals_cnt)); - - int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[1]); - while(heavy_cnt+neutrals_cnt>stack.amount) { - heavy_cnt--; - } - fissile.removeAmount(false,new cElementalDefinitionStack(stack.definition,heavy_cnt+neutrals_cnt)); - heavy.putReplace(new cElementalDefinitionStack(stack.definition, heavy_cnt)); - //}else{ - // particles.add(stack); - // light.remove(stack.definition); - //} - }else{ - int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[0]); - if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { - heavy_cnt--; - } - cElementalDefinitionStack new_stack=new cElementalDefinitionStack(stack.definition, heavy_cnt); - fissile.removeAmount(false,new_stack); - heavy.putReplace(new_stack); - } - } - - try { - particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); - particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); - decaysList.add(new cElementalDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - return false; - } - - private static double[] liquidDropFunction(boolean asymmetric) { - double[] out = new double[3]; - - out[0] = XSTR_INSTANCE.nextGaussian(); - - if (out[0] < 1 && out[0] >= -1) { - if (XSTR_INSTANCE.nextBoolean()) { - out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; - } - } - - if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) { - out[0] = -out[0]; - } - - //scale to splitting ratio - out[0] = out[0] * 0.05d + .6d; - - if (out[0] < 0 || out[0] > 1) { - return liquidDropFunction(asymmetric); - } - if (out[0] < .5d) { - out[0] = 1d - out[0]; - } - - //extra neutrals - out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; - - if (asymmetric) { - out[1] = out[0]; - } else { - out[1] = out[0] - out[2] * .5d; - } - - return out; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - if (iaeaDefinitionExistsAndHasEnergyLevels) { - ArrayList decays=new ArrayList<>(4); - if(iaeaDecay(decays,energyLevel)){ - return decays.toArray(cElementalDecay.noProduct); - } - } - if(energyLevel< Math.abs(charge)/3+neutralCount) { - return new cElementalDecay[]{new cElementalDecay(1, this, boson_Y__)}; - } - return getNaturalDecayInstant(); - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { - if(iaeaDefinitionExistsAndHasEnergyLevels){ - double result=0; - boolean backwards=newEnergyLevel=iaea.energeticStatesArray.length){ - if(currentEnergyLevel>=iaea.energeticStatesArray.length) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } else { - result += iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - iaea.energeticStatesArray.length + 1); - } - result+=iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].energy; - }else { - result += iaea.energeticStatesArray[(int) Math.max(0, newEnergyLevel)].energy; - } - - return backwards?-result:result; - } - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - if(!iaeaDefinitionExistsAndHasEnergyLevels) return false; - iaeaNuclide.energeticState state; - if(energyLevel>iaea.energeticStatesArray.length) { - state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1]; - } else if(energyLevel<=0) { - state = iaea.energeticStatesArray[0]; - } else { - state = iaea.energeticStatesArray[(int) energyLevel]; - } - for (iaeaNuclide.iaeaDecay decay:state.decaymodes){ - if(decay.decayName.contains("F")) return true;//if is fissile - } - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return iaea!=null || iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - //disembody - ArrayList decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack elementalStack : elementalStacks.valuesToArray()) { - if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { - //covers both quarks and antiquarks - decaysInto.add(elementalStack); - } else { - //covers both quarks and antiquarks - decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); - } - } - return new cElementalDecay[]{new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), deadEnd}; - } - - //@Override - //public iElementalDefinition getAnti() { - // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); - // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; - // for (int i = 0; i < antiElements.length; i++) { - // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); - // } - // try { - // return new dAtomDefinition(false, antiElements); - // } catch (tElementalException e) { - // if (DEBUG_MODE) e.printStackTrace(); - // return null; - // } - //} - - @Override - public dAtomDefinition getAnti() { - cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); - for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) { - anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); - } - try { - return new dAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return bTransformationInfo.TRANSFORMATION_INFO.fluidDequantization.get(this); - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return bTransformationInfo.TRANSFORMATION_INFO.itemDequantization.get(this); - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return bTransformationInfo.TRANSFORMATION_INFO.oredictDequantization.get(this); - } - - private static final class Nomenclature { - private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, elementalStacks); - } - - public static dAtomDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new dAtomDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { - for (Runnable r : overrides) { - r.run(); - } - - for(Map.Entry entry:lifetimeOverrides.entrySet()){ - try { - lifetimeOverrides.put(new dAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); - }catch (tElementalException e){ - e.printStackTrace(); //Impossible - } - } - - //populate stable isotopes - for (int element = 1; element < 83; element++)//Up to Bismuth exclusive - { - for (int isotope = 0; isotope < 130; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - iaeaNuclide nuclide = iaeaNuclide.get(element, isotope); - if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.halfTime >= STABLE_RAW_LIFE_TIME) { - TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); - isotopes.add(isotope); - } - } - } - - //populate unstable isotopes - for (int element = 83; element < 150; element++) { - for (int isotope = 100; isotope < 180; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - //stability curve - int Isotope = stableIzoCurve(element); - int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); - isotopes.put(rawLifeTime, isotope); - } - } - - try { - for (Map.Entry> integerTreeSetEntry : stableIsotopes.entrySet()) { - stableAtoms.put(integerTreeSetEntry.getKey(), new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeSetEntry.getKey()), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeSetEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); - } - } - for (Map.Entry> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { - unstableAtoms.put(integerTreeMapEntry.getKey(), new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeMapEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); - } - } - deuterium=new dAtomDefinition( - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n1, - eLeptonDefinition.lepton_e1).getStackForm(1); - tritium=new dAtomDefinition( - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n2, - eLeptonDefinition.lepton_e1).getStackForm(1); - helium_3=new dAtomDefinition( - dHadronDefinition.hadron_p2, - dHadronDefinition.hadron_n1, - eLeptonDefinition.lepton_e2).getStackForm(1); - alpha = new dAtomDefinition( - dHadronDefinition.hadron_p2, - dHadronDefinition.hadron_n2).getStackForm(1); - beryllium_8=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 4), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 4), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 4)).getStackForm(1); - carbon_14=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 6), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 8), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 6)).getStackForm(1); - neon_24=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 10), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 14), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 10)).getStackForm(1); - silicon_34=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 14), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 20), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 14)).getStackForm(1); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64); - } - } - - public static void setTransformation(){ - /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; - - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); - - /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; - - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); - //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); - - try { - dAtomDefinition temp; - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); - - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); - - double tempMass=temp.getMass(); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); - - TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); - - somethingHeavy=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); - - TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); - - TecTech.LOGGER.info("Neutron Mass: "+dHadronDefinition.hadron_n.getMass()); - - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - if(Loader.isModLoaded(Reference.GTPLUSPLUS)) { - new GtppAtomLoader().run(); - } - } - - public static dAtomDefinition getFirstStableIsotope(int element) { - return stableAtoms.get(element); - } - - public static dAtomDefinition getBestUnstableIsotope(int element) { - return unstableAtoms.get(element); - } - - @Override - public byte getClassType() { - return 64; - } - - public static byte getClassTypeStatic(){ - return 64; - } - - @Override - public int hashCode() { - return hash; - } - - @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)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(iaeaDefinitionExistsAndHasEnergyLevels && Util.areBitsSet(SCAN_GET_ENERGY_STATES,capabilities)){ - for(int i=1;i SYMBOL_MAP =new HashMap<>(); - public static final Map NAME_MAP =new HashMap<>(); - public static dHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; - public static cElementalDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; - private static double protonMass = 0D; - private static double neutronMass = 0D; - private static final double actualProtonMass=938272081.3D; - private static final double actualNeutronMass=939565413.3D; - - //float-mass in eV/c^2 - public final double mass; - //int -electric charge in 1/3rds of electron charge for optimization - public final int charge; - public final double rawLifeTime; - public final int amount; - //generation max present inside - minus if contains any antiquark - public final byte type; - //private final FluidStack fluidThing; - //private final ItemStack itemThing; - - private final cElementalConstantStackMap quarkStacks; - - public dHadronDefinition(cElementalDefinitionStack... quarks) throws tElementalException { - this(true, new cElementalConstantStackMap(quarks)); - } - - private dHadronDefinition(boolean check, cElementalDefinitionStack... quarks) throws tElementalException { - this(check, new cElementalConstantStackMap(quarks)); - } - - public dHadronDefinition(cElementalConstantStackMap quarks) throws tElementalException { - this(true, quarks); - } - - private dHadronDefinition(boolean check, cElementalConstantStackMap quarks) throws tElementalException { - if (check && !canTheyBeTogether(quarks)) { - throw new tElementalException("Hadron Definition error"); - } - quarkStacks = quarks; - - int amount = 0; - int charge = 0; - int type = 0; - boolean containsAnti = false; - double mass = 0; - for (cElementalDefinitionStack quarkStack : quarkStacks.valuesToArray()) { - amount += quarkStack.amount; - if((int)quarkStack.amount!=quarkStack.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - mass += quarkStack.getMass(); - charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.definition.getType()), type); - if (quarkStack.definition.getType() < 0) { - containsAnti = true; - } - } - this.amount = amount; - this.charge = charge; - this.type = containsAnti ? (byte) -type : (byte) type; - long mult = this.amount * this.amount * (this.amount - 1); - mass = mass * 5.543D * mult;//yes it becomes heavier - - if (mass == protonMass && this.amount == 3) { - rawLifeTime = iElementalDefinition.STABLE_RAW_LIFE_TIME; - mass=actualProtonMass; - } else if (mass == neutronMass && this.amount == 3) { - rawLifeTime = 882D; - mass=actualNeutronMass; - } else { - if (this.amount == 3) { - rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); - } else if (this.amount == 2) { - rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); - } else { - rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); - } - } - this.mass=mass; - hash=super.hashCode(); - } - - //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { - long amount = 0; - for (cElementalDefinitionStack quarks : stacks.valuesToArray()) { - if (!(quarks.definition instanceof eQuarkDefinition)) { - return false; - } - if((int)quarks.amount!=quarks.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - amount += quarks.amount; - } - return amount >= 2 && amount <= 12; - } - - @Override - public String getName() { - StringBuilder name= new StringBuilder(getSimpleName()); - name.append(':'); - String sym= NAME_MAP.get(this); - if(sym!=null){ - name.append(' ').append(sym); - }else { - for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { - name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount); - } - } - return name.toString(); - } - - private String getSimpleName() { - switch (amount) { - case 2: - return "Meson"; - case 3: - return "Baryon"; - case 4: - return "Tetraquark"; - case 5: - return "Pentaquark"; - case 6: - return "Hexaquark"; - default: - return "Hadron"; - } - } - - @Override - public String getSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ - return sym; - }else { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { - for (int i = 0; i < quark.amount; i++) { - symbol.append(quark.definition.getSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public String getShortSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ - return sym; - }else { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { - for (int i = 0; i < quark.amount; i++) { - symbol.append(quark.definition.getShortSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public byte getColor() { - return -7; - } - - @Override - public cElementalConstantStackMap getSubParticles() { - return quarkStacks; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { - return cElementalDecay.noProduct; - } - ArrayList decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack quarks : quarkStacks) { - if (quarks.definition.getType() == 1 || quarks.definition.getType() == -1) { - //covers both quarks and antiquarks - decaysInto.add(quarks); - } else { - //covers both quarks and antiquarks - decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); - } - } - return new cElementalDecay[]{ - new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), - eBosonDefinition.deadEnd - }; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{new cElementalDecay(0.75D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getDecayArray() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (amount == 2 && quarkStacks.length == 2 && - quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && - quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { - return cElementalDecay.noProduct; - } else if (amount != 3) { - return new cElementalDecay[]{new cElementalDecay(0.95D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks - } else { - ArrayList newBaryon = new ArrayList<>(); - iElementalDefinition[] Particles = new iElementalDefinition[2]; - for (cElementalDefinitionStack quarks : quarkStacks) { - for (int i = 0; i < quarks.amount; i++) { - newBaryon.add((eQuarkDefinition) quarks.definition); - } - } - //remove last - eQuarkDefinition lastQuark = newBaryon.remove(2); - - cElementalDefinitionStack[] decay; - if (Math.abs(lastQuark.getType()) > 1) { - decay = lastQuark.getDecayArray()[1].outputStacks.valuesToArray(); - } else { - decay = lastQuark.getDecayArray()[2].outputStacks.valuesToArray(); - } - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; - - cElementalDefinitionStack[] contentOfBaryon = newBaryon.stream() - .map(eQuarkDefinition -> new cElementalDefinitionStack(eQuarkDefinition,1)) - .toArray(cElementalDefinitionStack[]::new); - - try { - return new cElementalDecay[]{ - new cElementalDecay(0.001D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), - new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), - eBosonDefinition.deadEnd}; - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return new cElementalDecay[]{eBosonDefinition.deadEnd}; - } - } - } - - @Override - public double getMass() { - return mass; - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } - - @Override - public byte getType() { - return type; - } - - //@Override - //public iElementalDefinition getAnti() { - // cElementalDefinitionStack[] stacks = this.quarkStacks.values(); - // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; - // for (int i = 0; i < antiElements.length; i++) { - // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); - // } - // try { - // return new dHadronDefinition(false, antiElements); - // } catch (tElementalException e) { - // if (DEBUG_MODE) e.printStackTrace(); - // return null; - // } - //} - - @Override - public iElementalDefinition getAnti() { - cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); - for (cElementalDefinitionStack stack : quarkStacks.valuesToArray()) { - anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); - } - try { - return new dHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, quarkStacks); - } - - public static dHadronDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new dHadronDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { - try { - hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); - protonMass = hadron_p.mass; - //redefine the proton with proper lifetime (the lifetime is based on mass comparison) - hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); - SYMBOL_MAP.put(hadron_p,"p"); - NAME_MAP.put(hadron_p,"Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); - hadron_p_ = (dHadronDefinition) hadron_p.getAnti(); - SYMBOL_MAP.put(hadron_p_,"~p"); - NAME_MAP.put(hadron_p_,"Anti Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); - hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); - neutronMass = hadron_n.mass; - //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) - hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); - SYMBOL_MAP.put(hadron_n, "n"); - NAME_MAP.put(hadron_n, "Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); - hadron_n_ = (dHadronDefinition) hadron_n.getAnti(); - SYMBOL_MAP.put(hadron_n_,"~n"); - NAME_MAP.put(hadron_n_,"Anti Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - protonMass = -1; - neutronMass = -1; - } - hadron_p1 = new cElementalDefinitionStack(hadron_p, 1D); - hadron_n1 = new cElementalDefinitionStack(hadron_n, 1D); - hadron_p2 = new cElementalDefinitionStack(hadron_p, 2D); - hadron_n2 = new cElementalDefinitionStack(hadron_n, 2D); - hadron_p3 = new cElementalDefinitionStack(hadron_p, 3D); - hadron_n3 = new cElementalDefinitionStack(hadron_n, 3D); - hadron_p5 = new cElementalDefinitionStack(hadron_p, 5D); - - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + -64); - } - } - - public static void setTransformations(){ - //Added to atom map, but should be in its own - cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); - TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); - TRANSFORMATION_INFO.oredictQuantization.put( - OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), - new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) - ); - } - - @Override - public byte getClassType() { - return -64; - } - - public static byte getClassTypeStatic(){ - return -64; - } - - @Override - public int hashCode() { - return hash; - } - - @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)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getSimpleName()); - //lines.add("SYMBOL = "+getSymbol()); - } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(Util.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/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java deleted file mode 100644 index 8b09bfd2e0..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.util.Util.splitButDifferent; - -public final class iaeaNuclide { - public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D; - - //Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery - //Abund. [mole fract.] BR [%] [?N] [barn] [keV] [keV] [keV] [keV] [keV] [keV] [keV] [? AMU] [keV] - - //Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc, - //Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc, - private static final HashMap NUCLIDES=new HashMap<>(); - - public static void run(){ - String line=""; - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclides.csv"))); - ArrayList blockOfData=new ArrayList<>(4); - while((line=reader.readLine())!=null) { - String[] split= splitButDifferent(line,","); - if(split.length!=19) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); - } - if(!split[1].isEmpty() && !blockOfData.isEmpty()) { - new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][])); - blockOfData.clear(); - } - blockOfData.add(split); - } - if(!blockOfData.isEmpty()) { - new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][])); - blockOfData.clear(); - } - reader.close(); - }catch (Exception e){ - System.out.println(line); - e.printStackTrace(); - } - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclidesTable.csv"))); - while((line=reader.readLine())!=null) { - String[] split= splitButDifferent(line,","); - if(split.length!=47) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclidesTable database " + line); - } - get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); - } - reader.close(); - }catch (Exception e){ - System.out.println(line); - e.printStackTrace(); - } - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("energyLevels.csv"))); - while((line=reader.readLine())!=null) { - String[] split= splitButDifferent(line,","); - if(split.length!=27) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA energyLevels database " + line); - } - new energeticState(split); - } - reader.close(); - }catch (Exception e){ - System.out.println(line); - e.printStackTrace(); - } - - for(iaeaNuclide nuclide:NUCLIDES.values()) { - nuclide.makeArrayOfEnergyStates(); - } - } - - public static iaeaNuclide get(int protons, int neutrons){ - return NUCLIDES.get((protons<<16)+neutrons); - } - - public final short N,Z; - public final double halfTime;//sec - public final double mass;//eV/c^2 - public final short discovery;//year - private TreeMap energeticStates; - public energeticState[] energeticStatesArray; - - - private iaeaNuclide(String[][] rows){ - N=Short.parseShort(rows[1][2]); - Z=Short.parseShort(rows[1][0]); - NUCLIDES.put(((int)Z <<16)+N,this); - - String[] parts = splitButDifferent(rows[0][16], "|"); - double Mass=doubleOrNaN(parts[0],"mass"); - if(!Double.isNaN(Mass)) { - //System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); - mass = Mass* MICRO_AMU_TO_EV_DIV_C_C; - } - else { - mass = Double.NaN; - } - - discovery=(short)doubleOrNaN(rows[0][18],"discovery"); - - if(rows[0][3].contains("STABLE")){ - halfTime = STABLE_RAW_LIFE_TIME; - }else{ - parts = splitButDifferent(rows[0][4], "|"); - halfTime = doubleOrNaN(parts[0],"half life"); - } - } - - private void getMoreData(String[] cells){ - //if(DEBUG_MODE) { - // if (add(cells[14])) System.out.println(N + " " + Z); - // if (add(cells[17])) System.out.println(N + " " + Z); - // if (add(cells[20])) System.out.println(N + " " + Z); - //} - new energeticState(this, halfTime, getDecaysFixed( - cells[14], - doubleOrNaN(cells[15],"chance1"), - cells[17], - doubleOrNaN(cells[18],"chance1"), - cells[20], - doubleOrNaN(cells[21],"chance1"))); - } - - private static final energeticState[] empty=new energeticState[0]; - private void makeArrayOfEnergyStates(){ - if(energeticStates==null || energeticStates.isEmpty()) { - energeticStatesArray = empty; - } else { - energeticStatesArray = energeticStates.values().toArray(new energeticState[0]); - double life=halfTime; - for (energeticState energeticState : energeticStatesArray) { - if(Double.isNaN(energeticState.Thalf)){ - energeticState.Thalf=life; - }else { - life=energeticState.Thalf; - } - } - } - } - - private double doubleOrNaN(String s, String name){ - s=s.replaceAll("#",""); - if(!s.isEmpty()) { - try { - double value=Double.parseDouble(s); - if(Double.isNaN(value)) { - return Double.NaN; - } - return value != 0 ?value:Double.NaN; - } catch (Exception e) { - System.out.println("Invalid Value " + name + ' ' + N + ' ' + Z + ' ' + s); - e.printStackTrace(); - } - } - return Double.NaN; - } - - public static final class energeticState{ - public final double energy; - public double Thalf; - public final iaeaDecay[] decaymodes; - - private energeticState(iaeaNuclide nuclide,double Thalf,iaeaDecay[] decaymodes){ - energy=0; - this.Thalf=Thalf; - this.decaymodes=decaymodes; - if(nuclide.energeticStates==null) { - nuclide.energeticStates = new TreeMap<>(); - } - nuclide.energeticStates.put(energy,this); - } - - private energeticState(String[] cells){ - iaeaNuclide nuclide= get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); - if(nuclide==null) { - throw new Error("Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") + ' ' + (int) doubleOrNaN(cells[1], "neutrons")); - } - energy =doubleOrNaN(cells[3],"energy level",nuclide)*1000D;//to eV - if(energy<0) { - throw new Error("Invalid energy " + nuclide.N + ' ' + nuclide.Z + ' ' + cells[3]); - } - Thalf =doubleOrNaN(cells[10],"half life",nuclide); - if(nuclide.energeticStates==null) { - new Exception("Should be initialized before doing this... "+ nuclide.N + ' ' +nuclide.Z).printStackTrace(); - nuclide.energeticStates = new TreeMap<>(); - } - nuclide.energeticStates.put(energy,this); - //if(DEBUG_MODE) { - // if (add(cells[12])) System.out.println(nuclide.N + " " + nuclide.Z); - // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); - // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); - //} - decaymodes = getDecaysFixed( - cells[12], - doubleOrNaN(cells[13],"chance 1",nuclide), - cells[15], - doubleOrNaN(cells[16],"chance 2",nuclide), - cells[18], - doubleOrNaN(cells[19],"chance 3",nuclide)); - } - - private double doubleOrNaN(String s, String name){ - return doubleOrNaN(s,name,null); - } - - private double doubleOrNaN(String s, String name, iaeaNuclide nuclide){ - s = s.replaceAll("#", ""); - if (!s.isEmpty()) { - try { - return Double.parseDouble(s); - } catch (Exception e) { - if(nuclide==null){ - System.out.println("Invalid Value " + name + ' ' + s); - }else { - System.out.println("Invalid Value " + name + ' ' + nuclide.N + ' ' + nuclide.Z + ' ' + s); - } - e.printStackTrace(); - } - } - return Double.NaN; - } - } - - private static HashSet decays=new HashSet<>(); - private static boolean add(String s){ - if(decays.add(s)){ - System.out.println(s); - return true; - } - return false; - } - - private static iaeaDecay[] getDecaysFixed(String decay1, double chance1,String decay2, double chance2,String decay3, double chance3){ - boolean do1,do2,do3; - do1= !decay1.isEmpty() && !Double.isNaN(chance1); - do2= !decay2.isEmpty() && !Double.isNaN(chance2); - do3= !decay3.isEmpty() && !Double.isNaN(chance3); - TreeMap decays=new TreeMap<>(); - if(do1 && do2 && chance1==100 && chance2==100 && chance3!=100){ - decays.put(1D, new iaeaDecay(1D, decay1)); - if(do3) { - chance3/=100d; - decays.put(chance3, new iaeaDecay(chance3, decay2)); - chance2=1d-chance3; - } - chance2/=2d; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - }else if(do1 && chance1==100){ - decays.put(1D, new iaeaDecay(1D, decay1)); - if(do2) { - chance2/=100d; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - } - if(do3) { - chance3 /= 100d; - if(do2) { - chance3 *= chance2; - } - decays.put(chance3, new iaeaDecay(chance3, decay3)); - } - }else{ - double normalization= (do1?chance1:0) + (do2?chance2:0) + (do3?chance3:0); - if(do1) { - chance1/=normalization; - decays.put(chance1, new iaeaDecay(chance1, decay1)); - } - if(do2) { - chance2/=normalization; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - } - if(do3) { - chance3/=normalization; - decays.put(chance3, new iaeaDecay(chance3, decay3)); - } - if(do1||do2||do3) { - decays.put(1D, iaeaDecay.DEAD_END); - } - } - //if(DEBUG_MODE){ - // System.out.println("INVALID SUM?\t"+normalization+"\t"+decay1+"\t"+chance1+"\t"+decay2+"\t"+chance2+"\t"+decay3+"\t"+chance3); - //} - return decays.values().toArray(new iaeaDecay[0]); - } - - public static final class iaeaDecay{ - public final double chance; - public final String decayName; - public static final iaeaDecay DEAD_END=new iaeaDecay(1D,"DEAD_END"); - private iaeaDecay(double chance,String decayName){ - this.chance=chance; - this.decayName=decayName; - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java new file mode 100644 index 0000000000..e3efa3b7e6 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMBosonDefinition extends EMPrimitive { + public static final EMBosonDefinition + boson_Y__ = new EMBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), + boson_H__ = new EMBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); + //deadEnd + public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); + public static final EMDecay deadEndHalf = new EMDecay(boson_Y__); + public static final EMDefinitionStack boson_Y__1 =new EMDefinitionStack(boson_Y__,1); + + private EMBosonDefinition(String name, String symbol, double mass, int color, int ID) { + super(name, symbol, 0, mass, 0, color, ID); + } + + public static void run() { + boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + boson_H__.init(null, 1.56e-22D, 2, 2, + new EMDecay(0.01D, quark_b, quark_b_), + new EMDecay(0.02D, lepton_t, lepton_t_), + new EMDecay(0.96D, new EMDefinitionStack(boson_Y__, 4)), + deadEnd); + } + + @Override + public String getLocalizedName() { + return "Boson: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return this==boson_H__; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java new file mode 100644 index 0000000000..98bdf7ca5c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -0,0 +1,69 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMLeptonDefinition extends EMPrimitive { + public static final EMLeptonDefinition + lepton_e = new EMLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), + lepton_m = new EMLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), + lepton_t = new EMLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), + lepton_e_ = new EMLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), + lepton_m_ = new EMLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), + lepton_t_ = new EMLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); + + public static final EMDefinitionStack lepton_e1 = new EMDefinitionStack(lepton_e, 1); + public static final EMDefinitionStack lepton_e2 = new EMDefinitionStack(lepton_e, 2); + public static final EMDefinitionStack lepton_e_1 = new EMDefinitionStack(lepton_e_, 1); + public static final EMDefinitionStack lepton_e_2 = new EMDefinitionStack(lepton_e_, 2); + + private EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { + super(name, symbol, type, mass, charge, -1, ID); + //this.itemThing=null; + //this.fluidThing=null; + } + + public static void run() { + lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, + deadEnd, + new EMDecay(lepton_e,boson_Y__)); + lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, + new EMDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), + deadEnd);//makes photons and don't care + lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, + new EMDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), + new EMDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), + new EMDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), + deadEnd);//makes photons and don't care + + lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, + deadEnd, + new EMDecay(lepton_e,boson_Y__)); + lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, + new EMDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), + deadEnd);//makes photons and don't care + lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, + new EMDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), + new EMDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), + new EMDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), + deadEnd);//makes photons and don't care + } + + @Override + public String getLocalizedName() { + return "Lepton: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java new file mode 100644 index 0000000000..e77c74ed89 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -0,0 +1,59 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMNeutrinoDefinition extends EMPrimitive { + public static final EMNeutrinoDefinition + lepton_Ve = new EMNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), + lepton_Vm = new EMNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), + lepton_Vt = new EMNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), + lepton_Ve_ = new EMNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), + lepton_Vm_ = new EMNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), + lepton_Vt_ = new EMNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); + + public static final EMDefinitionStack lepton_Ve1 = new EMDefinitionStack(lepton_Ve, 1); + public static final EMDefinitionStack lepton_Ve2 = new EMDefinitionStack(lepton_Ve, 2); + public static final EMDefinitionStack lepton_Ve_1 = new EMDefinitionStack(lepton_Ve_, 1); + public static final EMDefinitionStack lepton_Ve_2 = new EMDefinitionStack(lepton_Ve_, 2); + + private EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { + super(name, symbol, type, mass, 0, -1, ID); + } + + public static void run() { + lepton_Ve.init(lepton_Ve_, 1D, -1, -1, + EMDecay.NO_PRODUCT); + lepton_Vm.init(lepton_Vm_, 1D, 1, 0, + new EMDecay(0.825D, nothing), + deadEndHalf); + lepton_Vt.init(lepton_Vt_, 1, 1, 0, + new EMDecay(0.75F, nothing), + deadEnd); + + lepton_Ve_.init(lepton_Ve, 1, -1, -1, + EMDecay.NO_PRODUCT); + lepton_Vm_.init(lepton_Vm, 1, 1, 0, + new EMDecay(0.825F, nothing), + deadEndHalf); + lepton_Vt_.init(lepton_Vt, 1, 1, 0, + new EMDecay(0.75F, nothing), + deadEnd); + } + + @Override + public String getLocalizedName() { + return "Lepton: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java new file mode 100644 index 0000000000..68591cc4e6 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -0,0 +1,39 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMPrimitiveDefinition extends EMPrimitive { + public static final EMPrimitiveDefinition + nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), + null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), + space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), + magic = new EMPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), + magic_ = new EMPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); + + private EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { + super(name, symbol, type, mass, 0, color, ID); + } + + public static void run() { + nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + } + + @Override + public String getLocalizedName() { + return "Primitive: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java new file mode 100644 index 0000000000..b0a5c419e1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -0,0 +1,106 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMQuarkDefinition extends EMPrimitive { + public static final EMQuarkDefinition + quark_u = new EMQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), + quark_c = new EMQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), + quark_t = new EMQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), + quark_d = new EMQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), + quark_s = new EMQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), + quark_b = new EMQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), + quark_u_ = new EMQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), + quark_c_ = new EMQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), + quark_t_ = new EMQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), + quark_d_ = new EMQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), + quark_s_ = new EMQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), + quark_b_ = new EMQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); + + private EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { + super(name, symbol, type, mass, charge, 0, ID); + } + + public static void run() { + quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), + new EMDecay(0.9D, quark_d, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_c.init(quark_c_, 0.5e-13D, 1, -1, + new EMDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), + new EMDecay(0.9D, quark_s, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_t.init(quark_t_, 2.5e-26D, 0, -1, + new EMDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), + new EMDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), + new EMDecay(0.9D, quark_b, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + + quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), + new EMDecay(0.9D, quark_u, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_s.init(quark_s_, 0.6e-9D, 1, -1, + new EMDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), + new EMDecay(0.9D, quark_c, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_b.init(quark_b_, 0.7e-13D, 0, -1, + new EMDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), + new EMDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), + new EMDecay(0.9D, quark_t, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + + quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), + new EMDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_c_.init(quark_c, 0.5e-13D, 1, -1, + new EMDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), + new EMDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_t_.init(quark_t, 2.5e-26F, 0, -1, + new EMDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), + new EMDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), + new EMDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + + quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), + new EMDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_s_.init(quark_s, 0.6e-9F, 1, -1, + new EMDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), + new EMDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_b_.init(quark_b, 0.7e-13F, 0, -1, + new EMDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), + new EMDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), + new EMDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + } + + @Override + public String getLocalizedName() { + return "Quark: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java deleted file mode 100644 index 8096743b78..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cPrimitiveDefinition extends cElementalPrimitive { - public static final cPrimitiveDefinition - nbtE__ = new cPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), - null__ = new cPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), - space__ = new cPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), - magic = new cPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), - magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); - - private cPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { - super(name, symbol, type, mass, 0, color, ID); - } - - public static void run() { - nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - } - - @Override - public String getName() { - return "Primitive: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java deleted file mode 100644 index e87df806d3..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eBosonDefinition extends cElementalPrimitive { - public static final eBosonDefinition - boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), - boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); - //deadEnd - public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__, boson_Y__); - public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__); - public static final cElementalDefinitionStack boson_Y__1=new cElementalDefinitionStack(boson_Y__,1); - - private eBosonDefinition(String name, String symbol, double mass, int color, int ID) { - super(name, symbol, 0, mass, 0, color, ID); - } - - public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - boson_H__.init(null, 1.56e-22D, 2, 2, - new cElementalDecay(0.01D, quark_b, quark_b_), - new cElementalDecay(0.02D, lepton_t, lepton_t_), - new cElementalDecay(0.96D, new cElementalDefinitionStack(boson_Y__, 4)), - deadEnd); - } - - @Override - public String getName() { - return "Boson: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return this==boson_H__; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java deleted file mode 100644 index c8e3b07f02..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eLeptonDefinition extends cElementalPrimitive { - public static final eLeptonDefinition - lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), - lepton_m = new eLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), - lepton_t = new eLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), - lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), - lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), - lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); - - public static final cElementalDefinitionStack lepton_e1 = new cElementalDefinitionStack(lepton_e, 1); - public static final cElementalDefinitionStack lepton_e2 = new cElementalDefinitionStack(lepton_e, 2); - public static final cElementalDefinitionStack lepton_e_1 = new cElementalDefinitionStack(lepton_e_, 1); - public static final cElementalDefinitionStack lepton_e_2 = new cElementalDefinitionStack(lepton_e_, 2); - - private eLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, -1, ID); - //this.itemThing=null; - //this.fluidThing=null; - } - - public static void run() { - lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, - deadEnd, - new cElementalDecay(lepton_e,boson_Y__)); - lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, - new cElementalDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), - deadEnd);//makes photons and don't care - lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, - new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), - new cElementalDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), - new cElementalDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), - deadEnd);//makes photons and don't care - - lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, - deadEnd, - new cElementalDecay(lepton_e,boson_Y__)); - lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, - new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), - deadEnd);//makes photons and don't care - lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, - new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), - new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), - new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), - deadEnd);//makes photons and don't care - } - - @Override - public String getName() { - return "Lepton: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java deleted file mode 100644 index 0f0725d208..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eNeutrinoDefinition extends cElementalPrimitive { - public static final eNeutrinoDefinition - lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), - lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), - lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), - lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), - lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), - lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); - - public static final cElementalDefinitionStack lepton_Ve1 = new cElementalDefinitionStack(lepton_Ve, 1); - public static final cElementalDefinitionStack lepton_Ve2 = new cElementalDefinitionStack(lepton_Ve, 2); - public static final cElementalDefinitionStack lepton_Ve_1 = new cElementalDefinitionStack(lepton_Ve_, 1); - public static final cElementalDefinitionStack lepton_Ve_2 = new cElementalDefinitionStack(lepton_Ve_, 2); - - private eNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { - super(name, symbol, type, mass, 0, -1, ID); - } - - public static void run() { - lepton_Ve.init(lepton_Ve_, 1D, -1, -1, - cElementalDecay.noProduct); - lepton_Vm.init(lepton_Vm_, 1D, 1, 0, - new cElementalDecay(0.825D, nothing), - deadEndHalf); - lepton_Vt.init(lepton_Vt_, 1, 1, 0, - new cElementalDecay(0.75F, nothing), - deadEnd); - - lepton_Ve_.init(lepton_Ve, 1, -1, -1, - cElementalDecay.noProduct); - lepton_Vm_.init(lepton_Vm, 1, 1, 0, - new cElementalDecay(0.825F, nothing), - deadEndHalf); - lepton_Vt_.init(lepton_Vt, 1, 1, 0, - new cElementalDecay(0.75F, nothing), - deadEnd); - } - - @Override - public String getName() { - return "Lepton: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java deleted file mode 100644 index 798066466b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eQuarkDefinition extends cElementalPrimitive { - public static final eQuarkDefinition - quark_u = new eQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), - quark_c = new eQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), - quark_t = new eQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), - quark_d = new eQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), - quark_s = new eQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), - quark_b = new eQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), - quark_u_ = new eQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), - quark_c_ = new eQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), - quark_t_ = new eQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), - quark_d_ = new eQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), - quark_s_ = new eQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), - quark_b_ = new eQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); - - private eQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, 0, ID); - } - - public static void run() { - quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), - new cElementalDecay(0.9D, quark_d, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_c.init(quark_c_, 0.5e-13D, 1, -1, - new cElementalDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), - new cElementalDecay(0.9D, quark_s, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26D, 0, -1, - new cElementalDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), - new cElementalDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), - new cElementalDecay(0.9D, quark_b, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - - quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), - new cElementalDecay(0.9D, quark_u, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_s.init(quark_s_, 0.6e-9D, 1, -1, - new cElementalDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), - new cElementalDecay(0.9D, quark_c, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13D, 0, -1, - new cElementalDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), - new cElementalDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), - new cElementalDecay(0.9D, quark_t, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - - quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), - new cElementalDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_c_.init(quark_c, 0.5e-13D, 1, -1, - new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), - new cElementalDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 0, -1, - new cElementalDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), - new cElementalDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), - new cElementalDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - - quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), - new cElementalDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_s_.init(quark_s, 0.6e-9F, 1, -1, - new cElementalDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), - new cElementalDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 0, -1, - new cElementalDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), - new cElementalDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), - new cElementalDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - } - - @Override - public String getName() { - return "Quark: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index 05f251924e..f5cfad22f3 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,9 +1,11 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +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.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; @@ -17,16 +19,16 @@ import java.util.HashSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; public class TT_recipe extends GT_Recipe { - public static final String E_RECIPE_ID = "eRecipeID"; - public final cElementalConstantStackMap[] input; - public final cElementalConstantStackMap[] output; - public final cElementalConstantStackMap[] eCatalyst; - public final IAdditionalCheck additionalCheck; + public static final String E_RECIPE_ID = "eRecipeID"; + public final EMConstantStackMap[] input; + public final IEMMapRead[] output; + public final EMConstantStackMap[] eCatalyst; + public final IAdditionalCheck additionalCheck; public TT_recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check){ + EMConstantStackMap[] in, IEMMapRead[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check){ super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue); input=in; output=out; @@ -38,11 +40,11 @@ public class TT_recipe extends GT_Recipe { return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,null,null); } - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in){ + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in){ return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); } - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] catalyst) { + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) { return false; } @@ -51,7 +53,7 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < eCatalyst.length; i++) { if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) { + if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { return false; } } else { @@ -68,8 +70,14 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < input.length; i++) { if (input[i] != null && input[i].hasStacks()) { if (in[i] != null && in[i].hasStacks()) { - if (!in[i].removeAllAmounts(consume, input[i])) { - return false; + if(consume){ + if (!in[i].removeAllAmounts(input[i])) { + return false; + } + }else { + if (!in[i].containsAllAmounts(input[i])) { + return false; + } } } else { return false; @@ -83,11 +91,13 @@ public class TT_recipe extends GT_Recipe { return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks); } - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in){ + @Deprecated + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in){ return EMisRecipeInputEqualConsumeFromOne(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); } - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] catalyst) { + @Deprecated + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) { return false; } @@ -96,7 +106,7 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < eCatalyst.length; i++) { if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) { + if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { return false; } } else { @@ -110,11 +120,17 @@ public class TT_recipe extends GT_Recipe { } if (input != null) { if (in != null) { - for (cElementalConstantStackMap anInput : input) { + for (EMConstantStackMap anInput : input) { if (anInput != null && anInput.hasStacks()) { if (in.hasStacks()) { - if (!in.removeAllAmounts(consume, anInput)) { - return false; + if(consume){ + if (!in.removeAllAmounts(anInput)) { + return false; + } + }else { + if (!in.containsAllAmounts(anInput)) { + return false; + } } } else { return false; @@ -129,8 +145,8 @@ public class TT_recipe extends GT_Recipe { } public interface IAdditionalCheck { - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] e); - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] e); + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] e); + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] e); } public static class TT_Recipe_Map { @@ -166,12 +182,20 @@ public class TT_recipe extends GT_Recipe { } public static class GT_Recipe_MapTT extends GT_Recipe.GT_Recipe_Map { - public static GT_Recipe_MapTT sResearchableFakeRecipes =new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1,1,0,1,"", 1, "", true, false);//nei to false - using custom handler - public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32),"gt.recipe.em_scanner","EM Scanner Research", null,"gregtech:textures/gui/multimachines/ResearchFake",1,1,1,0,1,"",1,"",true,false); - public static ArrayList sAssemblylineRecipes=new ArrayList<>(); + public static GT_Recipe_MapTT sResearchableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false);//nei to false - using custom handler + public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.em_scanner", "EM Scanner Research", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false); + public static ArrayList sAssemblylineRecipes = new ArrayList<>(); - public GT_Recipe_MapTT(Collection aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_MapTT(Collection aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, + int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { + super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, + aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, + aShowVoltageAmperageInNEI, aNEIAllowed); } } @@ -181,7 +205,7 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { + EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchItem=researchItem; } @@ -189,28 +213,28 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in) { + EMConstantStackMap[] in) { this(aOptimize, researchItem, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } public static class TT_EMRecipe extends TT_recipe{ - public final iElementalDefinition mResearchEM; - public final GT_Recipe scannerRecipe; + public final IEMDefinition mResearchEM; + public final GT_Recipe scannerRecipe; - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, + public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { + EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchEM=researchEM; this.scannerRecipe=scannerRecipe; } - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, + public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in) { + EMConstantStackMap[] in) { this(aOptimize, scannerRecipe, researchEM, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } @@ -219,8 +243,8 @@ public class TT_recipe extends GT_Recipe { public static TT_Recipe_Map_EM sCrafterRecipesEM = new TT_Recipe_Map_EM<>("EM Crafter Recipes","gt.recipe.em_crafter",null); public static TT_Recipe_Map_EM sMachineRecipesEM = new TT_Recipe_Map_EM<>("EM Machinert Recipe","gt.recipe.em_machinery",null); - private final HashMap mRecipeMap; - public final String mNEIName,mUnlocalizedName,mNEIGUIPath; + private final HashMap mRecipeMap; + public final String mNEIName,mUnlocalizedName,mNEIGUIPath; public TT_Recipe_Map_EM(String mNEIName,String mUnlocalizedName,String mNEIGUIPath){ mRecipeMap =new HashMap<>(16); @@ -229,7 +253,7 @@ public class TT_recipe extends GT_Recipe { this.mNEIGUIPath=mNEIGUIPath; } - public T findRecipe(iElementalDefinition stack){ + public T findRecipe(IEMDefinition stack){ return mRecipeMap.get(stack); } @@ -238,7 +262,7 @@ public class TT_recipe extends GT_Recipe { return null; } try { - return mRecipeMap.get(cElementalDefinition.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); + return mRecipeMap.get(EMComplex.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); }catch (Exception e){ if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 93d6f4ea2b..bb18c16727 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +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.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; @@ -131,7 +131,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMmachineRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, + ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -165,7 +165,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMcrafterRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -187,8 +187,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { } public static boolean addScannableEMmachineRecipe( - iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, + IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -215,7 +215,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); @@ -223,8 +223,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { } public static boolean addScannableEMcrafterRecipe( - iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -240,7 +240,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); 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 b1f6d8887b..107cb97103 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 @@ -3,11 +3,11 @@ 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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; @@ -31,7 +31,7 @@ import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -39,7 +39,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by Tec on 15.03.2017. */ public final class DebugElementalInstanceContainer_EM extends Item implements IElementalItem { - public static final TreeSet STACKS_REGISTERED =new TreeSet<>(); + public static final TreeSet STACKS_REGISTERED =new TreeSet<>(); public static DebugElementalInstanceContainer_EM INSTANCE; @@ -58,23 +58,23 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE aStack.stackSize = 1; if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof iElementalContainer) { - cElementalInstanceStackMap content = ((iElementalContainer) metaTE).getContentHandler(); + if (metaTE instanceof IEMContainer) { + EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { - content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { + content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } return true; } - ((iElementalContainer) metaTE).purgeOverflow(); + ((IEMContainer) metaTE).purgeOverflow(); tNBT.removeTag("content"); tNBT.removeTag("symbols"); tNBT.removeTag("info"); } else if (content.hasStacks()) { - ((iElementalContainer) metaTE).purgeOverflow(); + ((IEMContainer) metaTE).purgeOverflow(); tNBT.setTag("info", content.getInfoNBT()); tNBT.setTag("content", content.toNBT()); tNBT.setTag("symbols", content.getShortSymbolsNBT()); @@ -87,7 +87,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE return aPlayer instanceof EntityPlayerMP; } - public ItemStack setContent(ItemStack aStack,cElementalInstanceStackMap content){ + public ItemStack setContent(ItemStack aStack, EMInstanceStackMap content){ NBTTagCompound tNBT = aStack.getTagCompound(); if(tNBT==null){ tNBT=new NBTTagCompound(); @@ -95,8 +95,8 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } if (tNBT.hasKey("content")) { try { - content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { + content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -141,10 +141,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(iElementalDefinition definition: STACKS_REGISTERED){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 144 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); + for(IEMDefinition definition: STACKS_REGISTERED){ + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 144 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_144)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1000 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); } } 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 2513bdf8bf..2cca6474f4 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 @@ -3,8 +3,8 @@ 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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; @@ -38,18 +38,18 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem } //return previous thing - public static cElementalConstantStackMap setContent(ItemStack containerItem, cElementalConstantStackMap definitions){ + public static EMConstantStackMap setContent(ItemStack containerItem, EMConstantStackMap definitions){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { tNBT = containerItem.stackTagCompound = new NBTTagCompound(); } - cElementalConstantStackMap oldMap =null; + EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -63,7 +63,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalConstantStackMap getContent(ItemStack containerItem){ + public static EMConstantStackMap getContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; @@ -71,8 +71,8 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } try { - return cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + return EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -81,18 +81,18 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalConstantStackMap clearContent(ItemStack containerItem){ + public static EMConstantStackMap clearContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { return null; } - cElementalConstantStackMap oldMap =null; + EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } 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 e43feb2351..e517fe5f2a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; @@ -44,7 +44,7 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl } //return previous thing - public static void setContent(ItemStack containerItem, cElementalInstanceStackMap definitions, int[] detailsOnDepthLevels){ + public static void setContent(ItemStack containerItem, EMInstanceStackMap definitions, int[] detailsOnDepthLevels){ if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) { if (containerItem.stackTagCompound == null) { containerItem.stackTagCompound = new NBTTagCompound(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index d25a0c62ed..0950a173ab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; @@ -24,7 +24,7 @@ import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; @@ -34,16 +34,16 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 11.12.2016. */ -public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalContainer, IConnectsToElementalPipe { +public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements IEMContainer, IConnectsToElementalPipe { private static Textures.BlockIcons.CustomIcon EM_T_SIDES; private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; private static Textures.BlockIcons.CustomIcon EM_T_CONN; private String clientLocale = "en_US"; - protected cElementalInstanceStackMap content = new cElementalInstanceStackMap(); + protected EMInstanceStackMap content = new EMInstanceStackMap(); //float lifeTimeMult=1f; - public int postEnergize = 0; + public int postEnergize = 0; public double overflowMatter = 0f; public short id = -1; private byte deathDelay = 2; @@ -95,13 +95,13 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); id = aNBT.getShort("eID"); try { - content = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); - } catch (tElementalException e) { + content = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } if (content == null) { - content = new cElementalInstanceStackMap(); + content = new EMInstanceStackMap(); } } } @@ -165,7 +165,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } @Override - public cElementalInstanceStackMap getContentHandler() { + public EMInstanceStackMap getContentHandler() { return content; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index a61bf27fe3..4a0bb55784 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -38,7 +38,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -61,9 +61,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static double MASS_TO_EU_INSTANT; private static int STARTUP_COST, KEEPUP_COST; - protected byte eTier = 0; - protected cElementalInstanceStack stack; - private long plasmaEnergy; + protected byte eTier = 0; + protected EMInstanceStack stack; + private long plasmaEnergy; protected boolean started = false; //endregion @@ -73,7 +73,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); public interface IPrimitiveColliderHandler { - void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out); + void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); } public interface IColliderHandler extends IPrimitiveColliderHandler { @@ -81,23 +81,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } static { - FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnifyAll(in2.definition.getSubParticles()); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -106,27 +106,27 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 1; } }); - registerSimpleAtomFuse(dHadronDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(dComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(cElementalPrimitive.getClassTypeStatic()); + registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMPrimitive.getClassTypeStatic()); - FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | dHadronDefinition.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnifyAll(in2.definition.getSubParticles()); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -135,23 +135,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 2; } }); - FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -161,13 +161,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } }); - registerSimpleAspectFuse(dComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(cElementalPrimitive.getClassTypeStatic()); + registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAspectFuse(EMPrimitive.getClassTypeStatic()); - FUSE_HANDLERS.put((cElementalPrimitive.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMPrimitive.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName() + '\0' + in2.definition.getClass().getName()); + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); if (collisionHandler != null) { collisionHandler.collide(in2, in1, out); } else { @@ -181,40 +181,40 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } }); - PRIMITIVE_FUSE_HANDLERS.put(eQuarkDefinition.class.getName() + '\0' + eQuarkDefinition.class.getName(), (in1, in2, out) -> { + PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnify(in1.definition.getStackForm(1)); - defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } }); - PRIMITIVE_FUSE_HANDLERS.put(ePrimalAspectDefinition.class.getName() + '\0' + ePrimalAspectDefinition.class.getName(), (in1, in2, out) -> { + PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> { if (fuseAspects(in1, in2, out)) return; - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } }); } - private static boolean fuseAspects(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnify(in1.definition.getStackForm(1)); - defs.putUnify(in2.definition.getStackForm(1)); - dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(aspect, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return true; @@ -223,14 +223,14 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } private static void registerSimpleAspectFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((dComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + FUSE_HANDLERS.put((EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { if (fuseAspects(in1, in2, out)) return; - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -242,23 +242,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } private static void registerSimpleAtomFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnify(in2.definition.getStackForm(1)); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -378,27 +378,27 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU if (partner.stack != null && stack != null) {//todo add single event mode as an option - boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && - partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); + boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) && + partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); - cElementalInstanceStack stack2 = partner.stack; - double preMass = add(stack2.getMass(),stack.getMass()); + EMInstanceStack stack2 = partner.stack; + double preMass = add(stack2.getMass(),stack.getMass()); //System.out.println("preMass = " + preMass); - cElementalInstanceStackMap map = new cElementalInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } else { - colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } - for (cElementalInstanceStack newStack : map.valuesToArray()) { - check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); + for (EMInstanceStack newStack : map.valuesToArray()) { + check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); } //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new cElementalInstanceStackMap[]{map}; + outputEM = new EMInstanceStackMap[]{map}; partner.stack = stack = null; //System.out.println("check = " + check); @@ -410,21 +410,21 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! if (partner.stack != null && stack != null) {//todo add single event mode as an option - cElementalInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); + EMInstanceStack stack2 = partner.stack; + double preMass = stack2.getMass() + stack.getMass(); //System.out.println("preMass = " + preMass); - cElementalInstanceStackMap map = new cElementalInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } else { - colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new cElementalInstanceStackMap[]{map}; + outputEM = new EMInstanceStackMap[]{map}; partner.stack = stack = null; //System.out.println("check = " + check); @@ -434,12 +434,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 0; } - private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) { + private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { colliderHandler.collide(stack2, stack, map); } else { map.putUnifyAll(stack, stack2); - outputEM = new cElementalInstanceStackMap[]{map}; + outputEM = new EMInstanceStackMap[]{map}; return true; } return false; @@ -472,16 +472,17 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } } - private cElementalInstanceStackMap tickStack() { + private EMInstanceStackMap tickStack() { if (stack == null) { return null; } - cElementalDecayResult newInstances = stack.decay(1, stack.age += 1, 0); + stack.setAge(stack.getAge() + 1); + EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); if (newInstances == null) { stack.nextColor(); return null; } else { - stack = newInstances.getOutput().remove(newInstances.getOutput().getLast().definition); + stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); return newInstances.getOutput(); } } @@ -525,12 +526,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB if (started) { if (stack == null) { for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - cElementalInstanceStackMap container = inputElemental.getContentHandler(); + EMInstanceStackMap container = inputElemental.getContentHandler(); if (container.isEmpty()) { continue; } - stack = container.remove(container.getFirst().definition); - long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / dAtomDefinition.getSomethingHeavy().getMass())) / 2; + stack = container.removeKey(container.getFirst().getDefinition()); + long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; if (eut < Integer.MIN_VALUE + 7) { return false; } @@ -575,12 +576,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB collide(partner);//todo break; default: { - outputEM = new cElementalInstanceStackMap[2]; + outputEM = new EMInstanceStackMap[2]; outputEM[1] = tickStack(); if (outputEM[1] == null) { outputEM[1] = partner.tickStack(); } else { - cElementalInstanceStackMap map = partner.tickStack(); + EMInstanceStackMap map = partner.tickStack(); if (map != null) { outputEM[1].putUnifyAll(map); } @@ -659,7 +660,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB eTier = aNBT.getByte("eTier");//collider tier started = aNBT.getBoolean("eStarted"); if (aNBT.hasKey("eStack")) { - stack = cElementalInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); + stack = EMInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); } plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index ed245b0e97..84dafb8db2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; @@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -115,7 +115,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean checkRecipe_EM(ItemStack itemStack) { - cElementalInstanceStackMap map = getInputsClone_EM(); + EMInstanceStackMap map = getInputsClone_EM(); if (map != null && map.hasStacks()) { for (GT_MetaTileEntity_Hatch_InputElemental i : eInputHatches) { i.getContentHandler().clear(); @@ -125,20 +125,20 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return false; } - private boolean startRecipe(cElementalInstanceStackMap input) { + private boolean startRecipe(EMInstanceStackMap input) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - outputEM = new cElementalInstanceStackMap[2]; + outputEM = new EMInstanceStackMap[2]; outputEM[0] = input; - outputEM[1] = new cElementalInstanceStackMap(); + outputEM[1] = new EMInstanceStackMap(); - for (cElementalInstanceStack stack : outputEM[0].valuesToArray()) { - if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && + for (EMInstanceStack stack : outputEM[0].valuesToArray()) { + if (stack.getEnergy() == 0 && stack.getDefinition().decayMakesEnergy(1) && getBaseMetaTileEntity().decreaseStoredEnergyUnits( (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { stack.setEnergy(1); - } else if (!stack.definition.decayMakesEnergy(stack.getEnergy())) { - outputEM[0].remove(stack.definition); + } else if (!stack.getDefinition().decayMakesEnergy(stack.getEnergy())) { + outputEM[0].removeKey(stack.getDefinition()); outputEM[1].putReplace(stack); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 208219cd59..466f82071b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -26,9 +26,9 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -72,7 +72,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo super(aName); } - private void startRecipe(iElementalStack from, long energy) { + private void startRecipe(IEMStack from, long energy) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = from.getMass(); @@ -98,12 +98,12 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - cElementalInstanceStackMap map = in.getContentHandler(); - for (cElementalInstanceStack stack : map.valuesToArray()) { + EMInstanceStackMap map = in.getContentHandler(); + for (EMInstanceStack stack : map.valuesToArray()) { { - aFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); + EMFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); if (info != null) { - if (map.removeAllAmounts(false, info.input())) { + if (map.removeAllAmounts(info.input())) { mOutputFluids = new FluidStack[]{info.output()}; startRecipe(info.input(), stack.getEnergy()); return true; @@ -111,9 +111,9 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } } { - aItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); + EMItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); if (info != null) { - if (map.removeAllAmounts(false, info.input())) { + if (map.removeAllAmounts(info.input())) { mOutputItems = new ItemStack[]{info.output()}; startRecipe(info.input(), stack.getEnergy()); return true; @@ -121,10 +121,10 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } } { - aOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); + EMOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); if (info != null) { - if (map.removeAllAmounts(false, info.input())) { - ArrayList items = OreDictionary.getOres(info.out); + if (map.removeAllAmounts(info.input())) { + ArrayList items = OreDictionary.getOres(info.getOut()); if (items != null && !items.isEmpty()) { mOutputItems = new ItemStack[]{items.get(0)}; startRecipe(info.input(), stack.getEnergy()); 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 f5504eadc7..630569a25d 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 @@ -3,12 +3,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.mechanics.elementalMatter.core.transformations.EMFluidQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -29,11 +29,11 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.DEFAULT_ENERGY_LEVEL; +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; @@ -98,9 +98,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - aItemQuantizationInfo aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); + EMItemQuantizationInfo aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -109,12 +109,12 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - aOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.oredictQuantization.get(ID); + EMOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.getOredictQuantization().get(ID); if (aOQI == null) { continue; } - iElementalStack into = aOQI.output(); - if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) { + IEMStack into = aOQI.output(); + if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage())}, null, inI)) { startRecipe(into); return true; } @@ -124,7 +124,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage()); } - iElementalStack into = aIQI.output(); + IEMStack into = aIQI.output(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -136,11 +136,11 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - aFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.fluidQuantization.get(fs.getFluid().getID()); + EMFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.getFluidQuantization().get(fs.getFluid().getID()); if (aFQI == null) { continue; } - iElementalStack into = aFQI.output(); + IEMStack into = aFQI.output(); if (into != null && fs.amount >= aFQI.input().amount && isInputEqual(true, false, new FluidStack[]{aFQI.input()}, nullItem, inF, (ItemStack[]) null)) { startRecipe(into); @@ -152,7 +152,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock return false; } - private void startRecipe(iElementalStack into) { + private void startRecipe(IEMStack into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = into.getMass(); @@ -163,10 +163,10 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } else { mEUt = (int) -V[6]; } - outputEM = new cElementalInstanceStackMap[]{ - into instanceof cElementalInstanceStack ? - new cElementalInstanceStackMap((cElementalInstanceStack) into) : - new cElementalInstanceStackMap(new cElementalInstanceStack(into.getDefinition(), into.getAmount())) + outputEM = new EMInstanceStackMap[]{ + into instanceof EMInstanceStack ? + new EMInstanceStackMap((EMInstanceStack) into) : + new EMInstanceStackMap(new EMInstanceStack(into.getDefinition(), into.getAmount())) }; } 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 d02088e805..74bb817142 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 @@ -2,10 +2,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.EMException; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; @@ -35,7 +35,7 @@ import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; @@ -59,9 +59,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; - private cElementalDefinitionStack objectResearched; - private cElementalInstanceStackMap objectsScanned; - private String machineType; + private EMDefinitionStack objectResearched; + private EMInstanceStackMap objectsScanned; + private String machineType; private long computationRemaining, computationRequired; private int[] scanComplexity; @@ -219,31 +219,31 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa public boolean checkRecipe_EM(ItemStack itemStack) { eRecipe = null; if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContentHandler().hasStacks() && !eOutputHatches.isEmpty()) { - cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); + EMInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { GT_Recipe scannerRecipe = null; - for (cElementalInstanceStack stackEM : researchEM.valuesToArray()) { + for (EMInstanceStack stackEM : researchEM.valuesToArray()) { objectsScanned = null; - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.getDefinition()); if (eRecipe != null) { scannerRecipe = eRecipe.scannerRecipe; machineType = machine; - objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); + objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); //cleanMassEM_EM(objectResearched.getMass()); - researchEM.remove(objectResearched.definition); + researchEM.removeKey(objectResearched.getDefinition()); break; } - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.getDefinition()); if (eRecipe != null) { scannerRecipe = eRecipe.scannerRecipe; machineType = crafter; - objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); + objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); //cleanMassEM_EM(objectResearched.getMass()); - researchEM.remove(objectResearched.definition); + researchEM.removeKey(objectResearched.getDefinition()); break; } cleanStackEM_EM(stackEM); - researchEM.remove(stackEM.definition); + researchEM.removeKey(stackEM.getDefinition()); } if (eRecipe != null && scannerRecipe != null) {//todo make sure it werks computationRequired = computationRemaining = scannerRecipe.mDuration * 20L; @@ -409,8 +409,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa computationRemaining = aNBT.getLong("eComputationRemaining"); computationRequired = aNBT.getLong("eComputationRequired"); if (aNBT.hasKey("eObject")) { - objectResearched = cElementalDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); - if (objectResearched.definition == nbtE__) { + objectResearched = EMDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); + if (objectResearched.getDefinition() == nbtE__) { objectResearched = null; } } else { @@ -423,10 +423,10 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } try { if (aNBT.hasKey("eScanObjects")) { - objectsScanned = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); + objectsScanned = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); } - } catch (tElementalException e) { - objectsScanned = new cElementalInstanceStackMap(); + } catch (EMException e) { + objectsScanned = new EMInstanceStackMap(); } } @@ -445,11 +445,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (computationRemaining > 0 && objectResearched != null) { eRecipe = null; if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.getDefinition()); if (eRecipe != null) { machineType = machine; } else { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.getDefinition()); if (eRecipe != null) { machineType = crafter; } 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 ba6ae223f6..9a6f99bed8 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 @@ -10,10 +10,10 @@ import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.EMException; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; @@ -109,7 +109,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //storage for output EM that will be auto handled in case of failure to finish recipe //if you succed to use a recipe - be sure to output EM from outputEM to hatches in the output method - protected cElementalInstanceStackMap[] outputEM; + protected EMInstanceStackMap[] outputEM; //are parameters correct - change in check recipe/output/update params etc. (maintenance status boolean) protected boolean eParameters = true; @@ -842,13 +842,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt int outputLen = aNBT.getInteger("eOutputStackCount"); if (outputLen > 0) { - outputEM = new cElementalInstanceStackMap[outputLen]; + outputEM = new EMInstanceStackMap[outputLen]; NBTTagCompound compound = aNBT.getCompoundTag("outputEM"); for (int i = 0; i < outputEM.length; i++) { if (compound.hasKey(Integer.toString(i))) { try { - outputEM[i] = cElementalInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i))); - } catch (tElementalException e) { + outputEM[i] = EMInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -966,7 +966,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private void cleanOrExplode() { if (outputEM != null) { float mass = 0; - for (cElementalInstanceStackMap tree : outputEM) { + for (EMInstanceStackMap tree : outputEM) { if (tree != null) { mass += tree.getMass(); } @@ -1155,7 +1155,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt explodeMultiblock(); } if (outputEM != null) { - for (cElementalInstanceStackMap tree : outputEM) { + for (EMInstanceStackMap tree : outputEM) { if (tree != null && tree.hasStacks()) { explodeMultiblock(); } @@ -1297,26 +1297,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } double remaining = voider.overflowMax - voider.getOverflowMatter(); for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContentHandler().valuesToArray()) { - double qty = div(remaining,instance.definition.getMass()); + for (EMInstanceStack instance : in.getContentHandler().valuesToArray()) { + double qty = div(remaining, instance.getDefinition().getMass()); if (qty > 0) { - qty = min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { + qty = min(qty, instance.getAmount()); + if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - in.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + in.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); } } } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContentHandler().valuesToArray()) { - double qty = div(remaining,instance.definition.getMass()); + for (EMInstanceStack instance : out.getContentHandler().valuesToArray()) { + double qty = div(remaining, instance.getDefinition().getMass()); if (qty > 0) { - qty = min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { + qty = min(qty, instance.getAmount()); + if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - out.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + out.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); } } } @@ -1929,8 +1929,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region convenience copies input and output EM //new Method - public final cElementalInstanceStackMap getInputsClone_EM() { - cElementalInstanceStackMap in = new cElementalInstanceStackMap(); + public final EMInstanceStackMap getInputsClone_EM() { + EMInstanceStackMap in = new EMInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) { in.putUnifyAll(hatch.getContentHandler()); } @@ -1938,8 +1938,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //new Method - public final cElementalInstanceStackMap getOutputsClone_EM() { - cElementalInstanceStackMap out = new cElementalInstanceStackMap(); + public final EMInstanceStackMap getOutputsClone_EM() { + EMInstanceStackMap out = new EMInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) { out.putUnifyAll(hatch.getContentHandler()); } @@ -1974,7 +1974,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt cleanMassEM_EM(target.getContentHandler().getMass()); } - public void cleanStackEM_EM(cElementalInstanceStack target) { + public void cleanStackEM_EM(EMInstanceStack target) { if (target == null) { return; } @@ -2006,7 +2006,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return; } float mass = 0; - for (cElementalInstanceStackMap map : outputEM) { + for (EMInstanceStackMap map : outputEM) { if (map != null) { mass += map.getMass(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 093a418056..d1eafa22fc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; @@ -12,7 +12,8 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.DoubleCount.*; @@ -74,7 +75,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav radius = 0.5D - (12D - tier) / 64D; maxRCF = Math.pow(Math.E, tier) * 12D; maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); - double maxSafeMass = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); + double maxSafeMass = EMAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g maxCapacity = maxSafeMass * AVOGADRO_CONSTANT_144 * radius;// eV/c^2 } @@ -83,12 +84,12 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav return RPM * RPM * radius * 0.001118; } - private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - double amountPerFraction = div(me.amount,fractionCount); - cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; + private void addRandomly(EMInstanceStack me, EMInstanceStackMap[] toThis, int fractionCount) { + double amountPerFraction = div(me.getAmount(),fractionCount); + EMInstanceStack[] stacks = new EMInstanceStack[fractionCount]; for (int i = 0; i < fractionCount; i++) { stacks[i] = me.clone(); - stacks[i].amount = amountPerFraction; + stacks[i].setAmount(amountPerFraction); toThis[i].putReplace(stacks[i]); } //int remainingAmount = (int) (me.amount % fractionCount); @@ -112,23 +113,23 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - cElementalInstanceStackMap input = inputs[0]; + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + EMInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.valuesToArray(); + EMInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { inputMass += Math.abs(stack.getMass()); } double excessMass = 0; while (inputMass > maxCapacity) { - cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); - randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap - if (randomStack.amount <= 0) { - input.remove(randomStack.definition); + EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap + if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) { + input.removeKey(randomStack.getDefinition()); stacks = input.valuesToArray(); } double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; @@ -142,10 +143,10 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav if (inputMass * RCF > maxForce) return new MultiblockControl<>(excessMass);//AND THEN IT EXPLODES // how many output hatches to use - int fractionCount = (int) settingFraction.get(); - cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[fractionCount]; + int fractionCount = (int) settingFraction.get(); + EMInstanceStackMap[] outputs = new EMInstanceStackMap[fractionCount]; for (int i = 0; i < fractionCount; i++) { - outputs[i] = new cElementalInstanceStackMap(); + outputs[i] = new EMInstanceStackMap(); } //mixing factor... @@ -165,21 +166,21 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav stacks = input.takeAll().valuesToArray();//cleanup stacks if (stacks.length > 1) { Arrays.sort(stacks, (o1, o2) -> { - double m1 = o1.definition.getMass(); - double m2 = o2.definition.getMass(); + double m1 = o1.getDefinition().getMass(); + double m2 = o2.getDefinition().getMass(); if (m1 < m2) return -1; if (m1 > m2) return 1; return o1.compareTo(o2); }); double absMassPerOutput = 0;//"volume" - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { double tempMass=Math.abs(stack.getMass()); if(tempMass!=0) { - double amount = stack.amount; - stack.amount = mul(stack.amount,mixingFactor); + double amount = stack.getAmount(); + stack.setAmount(mul(stack.getAmount(),mixingFactor)); addRandomly(stack, outputs, fractionCount); - stack.amount = sub(amount,stack.amount); + stack.setAmount(sub(amount, stack.getAmount())); absMassPerOutput += tempMass; } } @@ -197,7 +198,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (int stackNo = 0; stackNo < stacks.length; stackNo++) { if (stacks[stackNo] != null) { double stackMass = Math.abs(stacks[stackNo].getMass()); - double amount = div(remaining,Math.abs(stacks[stackNo].definition.getMass())); + double amount = div(remaining,Math.abs(stacks[stackNo].getDefinition().getMass())); //if(DEBUG_MODE){ // TecTech.LOGGER.info("stackMass "+stackMass); // TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass()); @@ -207,16 +208,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav if (stackMass == 0) { addRandomly(stacks[stackNo], outputs, fractionCount); stacks[stackNo] = null; - } else if (amount >= stacks[stackNo].amount) { + } else if (amount >= stacks[stackNo].getAmount()) { remaining= sub(remaining,stackMass); outputs[fraction].putUnify(stacks[stackNo]); stacks[stackNo] = null; } else if (amount > 0) { - remaining= sub(remaining, mul(amount,stacks[stackNo].definition.getMass())); - cElementalInstanceStack clone = stacks[stackNo].clone(); - clone.amount = amount; + remaining= sub(remaining, mul(amount, stacks[stackNo].getDefinition().getMass())); + EMInstanceStack clone = stacks[stackNo].clone(); + clone.setAmount(amount); outputs[fraction].putUnify(clone); - stacks[stackNo].amount= sub(stacks[stackNo].amount,amount); + stacks[stackNo].setAmount(sub(stacks[stackNo].getAmount(),amount)); //if(DEBUG_MODE){ // TecTech.LOGGER.info("remainingAfter "+remaining); // TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount); @@ -228,7 +229,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } } //add remaining - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { if (stack != null) { outputs[fractionCount - 1].putUnify(stack); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java index d335bac7ab..4c95c2acd7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.IBeh } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 6ac6ac74c4..70d93b36ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -1,15 +1,16 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.DoubleCount.mul; @@ -88,7 +89,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; ticks =Math.max(20,(1<<(12-desiredTier))*20); - maxCapacity= dAtomDefinition.getSomethingHeavy().getMass()*(2< process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - cElementalInstanceStackMap input = inputs[0]; + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + EMInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.valuesToArray(); + EMInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { inputMass += Math.abs(stack.getMass()); } float excessMass = 0; while (inputMass > maxCapacity) { - cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); - randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap - if (randomStack.amount <= 0) { - input.remove(randomStack.definition); + EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap + if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) { + input.removeKey(randomStack.getDefinition()); } double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; @@ -174,9 +175,9 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ int mTicks=(int)(ticks*(inputMass/maxCapacity)); mTicks=Math.max(mTicks,20); - cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[3]; + EMInstanceStackMap[] outputs = new EMInstanceStackMap[3]; for (int i = 0; i < 3; i++) { - outputs[i] = new cElementalInstanceStackMap(); + outputs[i] = new EMInstanceStackMap(); } double offsetIn=offsetSetting.get(); @@ -186,8 +187,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ //take all from hatch handler and put into new map - this takes from hatch to inner data storage stacks = input.takeAll().valuesToArray();//cleanup stacks - for(cElementalInstanceStack stack:stacks){ - double charge=stack.definition.getCharge()-offsetIn; + for(EMInstanceStack stack:stacks){ + double charge= stack.getDefinition().getCharge()-offsetIn; if(charge-precisionMinimalIn){ outputs[1].putReplace(stack); }else if(charge>=precisionFullIn){ @@ -195,13 +196,13 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ }else if(charge<=-precisionFullIn){ outputs[0].putReplace(stack); }else{ - double amount=mul(stack.amount,(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check - if (amount < stack.amount) { - cElementalInstanceStack clone = stack.clone(); - clone.amount = sub(clone.amount, amount); + double amount=mul(stack.getAmount(),(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check + if (amount < stack.getAmount()) { + EMInstanceStack clone = stack.clone(); + clone.setAmount(sub(clone.getAmount(), amount)); outputs[1].putReplace(clone); - stack.amount = amount; + stack.setAmount(amount); } if(charge>0){ outputs[2].putReplace(stack); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java index 97ece16fb1..7d472de847 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.IB } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index f7aa945d69..05050a3c66 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -26,9 +26,9 @@ public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehavio } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { double mass=0; - for (cElementalInstanceStackMap input : inputs) { + for (EMInstanceStackMap input : inputs) { if (input != null) { mass += input.getMass(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java index 2dc9067e22..fa517c73d4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.IBehaviou } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } 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 d9217171d3..e653c1a357 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 @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -161,7 +161,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa * @param parameters array passed from previous method! * @return null if recipe should not start, control object to set machine state and start recipe */ - MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); + MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); } private void quantumStuff(boolean shouldIExist) { @@ -254,7 +254,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return false; } - cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; + EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; for (int i = 0; i < 6; i++) { int pointer = (int) inputMux[i].get(); if (pointer >= 0 && pointer < eInputHatches.size()) { @@ -272,7 +272,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } } - MultiblockControl control = currentBehaviour.process(handles, this, parametrization); + MultiblockControl control = currentBehaviour.process(handles, this, parametrization); if (control == null) { return false; } @@ -311,7 +311,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return; } - cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; + EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; for (int i = 0; i < 6; i++) { int pointer = (int) outputMux[i].get(); if (pointer >= 0 && pointer < eOutputHatches.size()) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo index 7059fdf6fd..a195157a17 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo @@ -23,16 +23,16 @@ BlockFakeLight.java for turrets: floodlightb +mega - projects + fix eu/t checks if needs maintenance!!! make microwave grinder cap autosmelting based on power - iterative halflife formula: =prev qty* 2^(-t diff / t half) - actual ion cannons diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java index b37c0987ae..576123079c 100644 --- a/src/main/java/com/github/technus/tectech/util/DoubleCount.java +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -3,26 +3,40 @@ package com.github.technus.tectech.util; import java.util.Arrays; import static java.lang.Math.*; -import static java.lang.Math.max; -import static java.lang.Math.ulp; public class DoubleCount { - public static double[] distribute(double count,double... probabilities) throws ArithmeticException { - if (probabilities == null) { + /** + * Distributes count across probabilities + * + * @param count the count to divide + * @param probabilities probability ratios to divide by, descending + * @return divided count + * @throws ArithmeticException + */ + public static double[] distribute(double count, double... probabilities) throws ArithmeticException { + if (probabilities == null || Double.isNaN(count)) { return null; } else if (count == 0) { return new double[probabilities.length]; + } else if (Double.isInfinite(count)) { + double[] doubles = new double[probabilities.length]; + Arrays.fill(doubles, count); + return doubles; } else { switch (probabilities.length) { default: { - int size = probabilities.length; + int size = probabilities.length; double[] output = new double[size]; size--; - double remaining = count, previous = probabilities[size], probability, out, sum = 0; + double remaining = count, previous = probabilities[size], probability, out; for (int i = size - 1; i >= 0; i--) { probability = probabilities[i]; - remaining -= out = count * probability - ulp(probability); - sum += output[i] = out; + out = count * probability; + out -= ulpSigned(out); + + remaining -= out; + output[i] = out; + if (previous < probability) { throw new ArithmeticException("Malformed probability order: " + Arrays.toString(probabilities)); } @@ -31,14 +45,10 @@ public class DoubleCount { break; } } - if (remaining * count < 0) { + if (remaining * count < 0) {//overshoot finishIt(size, output, remaining); } else { - sum += output[size] = remaining - ulp(remaining) * size; - if (sum > count) { - remaining = sum - count; - finishIt(size, output, remaining); - } + output[size] = remaining; } return output; } @@ -50,84 +60,58 @@ public class DoubleCount { } } + public static double ulpSigned(double number) { + if (number == 0) { + return 0; + } + return number > 0 ? ulp(number) : -ulp(number); + } + private static void finishIt(int size, double[] output, double remaining) { for (int i = size - 1; i >= 0; i--) { if (abs(output[i]) >= abs(remaining)) { output[i] -= remaining; break; } else { - remaining+=output[i]; - output[i]=0; + remaining += output[i]; + output[i] = 0; } } } - public static double div(double count,double divisor){ - if (divisor == 0) { - throw new ArithmeticException("Divide by 0"); - }else if(count==0 || divisor==1){ - return count; - }else if(divisor==-1){ - return -count; + public static double div(double count, double divisor) { + if (count == 0 || abs(divisor) == 1 || abs(count)==abs(divisor)) { + return count/divisor; } else { double result = count / divisor; - if(result*count<0){ - return 0; - } - return result-ulp(result); + return result - ulpSigned(result); } } - public static double mul(double count,double multiplier){ - if(count==0 || multiplier==1){ - return count; - }else if(multiplier==-1){ - return -count; + public static double mul(double count, double multiplier) { + if (count == 0 || multiplier == 0 || abs(multiplier)==1 || abs(count)==1) { + return count*multiplier; } else { double result = count * multiplier; - if(result*count<0){ - return 0; - } - return result-ulp(result); + return result - ulpSigned(result); } } - public static double sub(double count,double value){ - if(value==0){ - return count; - } - if(count==0){ - return -value; - } - if(value==count){ - return 0; - } - return value < 0 ? addInternal(count, -value) : subInternal(count, value); - } - - public static double add(double count,double value){ - if(value==0){ - return count; - } - if(count==0){ - return value; - } - return value < 0 ? subInternal(count, -value) : addInternal(count, value); - } - - private static double subInternal(double count,double value){ - double result = count - max(value,ulp(count)); - if (result+value>count || value>count-result){ - result-=ulp(result); + public static double sub(double count, double value) { + if (count == 0 || value == 0 || count == value) { + return count - value; + } else { + double result = count - value; + return result - ulpSigned(result); } - return result; } - private static double addInternal(double count,double value){ - double result = count + value; - if (result-value>count || result-count>value){ - result-=ulp(result); + public static double add(double count, double value) { + if (count == 0 || value == 0 || count == -value) { + return count + value; + } else { + double result = count + value; + return result - ulpSigned(result); } - return result; } } -- cgit From 44c86af58ecb24de8ba66fa6cf8fa81324a32a28 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 18 Jan 2022 21:57:53 +0100 Subject: Cleanup serialization of EM --- .../entity/projectiles/projectileEM.java | 4 +- .../definitions/EMComplexAspectDefinition.java | 30 +-- .../definitions/EMPrimalAspectDefinition.java | 4 +- .../transformations/AspectDefinitionCompat.java | 2 +- .../AspectDefinitionCompatEnabled.java | 4 +- .../thing/metaTileEntity/multi/EssentiaCompat.java | 2 +- .../multi/EssentiaCompatEnabled.java | 2 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../technus/tectech/loader/ElementalLoader.java | 3 - .../elementalMatter/core/EMException.java | 17 +- .../elementalMatter/core/commands/EMGive.java | 15 +- .../elementalMatter/core/commands/EMList.java | 14 +- .../elementalMatter/core/decay/EMDecay.java | 2 +- .../core/definitions/EMComplexTemplate.java | 73 ++++++ .../core/definitions/EMDefinitionsRegistry.java | 110 ++++++++ .../core/definitions/EMPrimitiveTemplate.java | 243 ++++++++++++++++++ .../core/definitions/IEMDefinition.java | 85 +++++++ .../core/maps/EMConstantStackMap.java | 2 +- .../core/maps/EMDefinitionStackMap.java | 2 +- .../core/maps/EMInstanceStackMap.java | 2 +- .../elementalMatter/core/maps/EMStackMap.java | 2 +- .../elementalMatter/core/maps/IEMMapRead.java | 39 ++- .../elementalMatter/core/maps/IEMMapWrite.java | 2 +- .../core/maps/IEMMapWriteExact.java | 2 +- .../core/stacks/EMDefinitionStack.java | 6 +- .../core/stacks/EMInstanceStack.java | 7 +- .../elementalMatter/core/stacks/IEMStack.java | 2 +- .../elementalMatter/core/templates/EMComplex.java | 135 ---------- .../core/templates/EMPrimitive.java | 283 --------------------- .../core/templates/IEMDefinition.java | 84 ------ .../core/transformations/EMTransformationInfo.java | 25 +- .../definitions/complex/EMAtomDefinition.java | 34 +-- .../definitions/complex/EMHadronDefinition.java | 50 ++-- .../definitions/complex/EMNuclideIAEA.java | 2 +- .../definitions/primitive/EMBosonDefinition.java | 4 +- .../definitions/primitive/EMLeptonDefinition.java | 4 +- .../primitive/EMNeutrinoDefinition.java | 4 +- .../primitive/EMPrimitiveDefinition.java | 10 +- .../definitions/primitive/EMQuarkDefinition.java | 4 +- .../github/technus/tectech/recipe/TT_recipe.java | 6 +- .../technus/tectech/recipe/TT_recipeAdder.java | 2 +- .../item/DebugElementalInstanceContainer_EM.java | 7 +- .../multi/GT_MetaTileEntity_EM_collider.java | 10 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 4 +- 45 files changed, 692 insertions(+), 656 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index d594a826bc..785b59f093 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -52,10 +52,10 @@ public class projectileEM extends LaserProjectile { charge=projectileContent.getCharge(); massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass()); - if(projectileContent.getDefinition().getType()>1 || projectileContent.getDefinition().getType()<-1) { + if(projectileContent.getDefinition().getMatterType()>1 || projectileContent.getDefinition().getMatterType()<-1) { strange = true; } - if(projectileContent.getDefinition().getType()<0) { + if(projectileContent.getDefinition().getMatterType()<0) { antiMatter = true; } 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 432d151b80..e56e31f166 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 @@ -2,13 +2,14 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defi import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; 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.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; @@ -25,7 +26,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class EMComplexAspectDefinition extends EMComplex { +public final class EMComplexAspectDefinition extends EMComplexTemplate { private final int hash; private final double mass; @@ -123,19 +124,8 @@ public final class EMComplexAspectDefinition extends EMComplex { } @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, aspectStacks); - } - - public static NBTTagCompound getNbtTagCompound(byte nbtType, EMConstantStackMap aspectStacks) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - EMDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray(); - nbt.setInteger("i", quarkStacksValues.length); - for (int i = 0; i < quarkStacksValues.length; i++) { - nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); - } - return nbt; + protected int getIndirectTagValue() { + return nbtType; } public static EMComplexAspectDefinition fromNBT(NBTTagCompound nbt) { @@ -169,7 +159,7 @@ public final class EMComplexAspectDefinition extends EMComplex { } @Override - public byte getType() { + public byte getMatterType() { return 0; } @@ -250,20 +240,20 @@ public final class EMComplexAspectDefinition extends EMComplex { public static void run() { try { - EMComplex.addCreatorFromNBT(nbtType, EMComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96); + EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMComplexAspectDefinition::fromNBT,EMComplexAspectDefinition.class, getClassTypeStatic()); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } if (DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + -96); + TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + getClassTypeStatic()); } } @Override public byte getClassType() { - return -96; + return getClassTypeStatic(); } public static byte getClassTypeStatic() { diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java index bf9703d6d7..e62c2e5278 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; import static net.minecraft.util.StatCollector.translateToLocal; @@ -8,7 +8,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class EMPrimalAspectDefinition extends EMPrimitive { +public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { public static final EMPrimalAspectDefinition magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java index c7f38eb21d..a4328d2e03 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import java.util.HashMap; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java index c9ca5d7b9f..ead8a5fdef 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -2,13 +2,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry.STACKS_REGISTERED; /** * Created by Tec on 21.05.2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index d51bc8dc2d..35d3a1b91f 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index ab682ba1a5..37df2c48cc 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 5606442c37..5fe8c973fe 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defin import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index 7ce371e57e..61989e7b13 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMNuclideIAEA; @@ -18,8 +17,6 @@ public class ElementalLoader implements Runnable { // Definition init // =================================================================================================== - EMPrimitive.run(); - EMPrimitiveDefinition.run(); EMQuarkDefinition.run(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java index 23ca5d77d9..e00e72446d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java @@ -3,8 +3,23 @@ package com.github.technus.tectech.mechanics.elementalMatter.core; /** * Created by danie_000 on 19.11.2016. */ -public final class EMException extends Exception { +public final class EMException extends RuntimeException { public EMException(String message) { super(message); } + + public EMException(String message, Throwable cause) { + super(message, cause); + } + + public EMException(Throwable cause) { + super(cause); + } + + public EMException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + + public EMException() { + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java index 64e9bcea1e..af4caf854b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -5,9 +5,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstance import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; 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.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; @@ -77,11 +76,11 @@ public class EMGive implements ICommand { try{ int id=Integer.parseInt(args.get(0)); args.remove(0); - IEMDefinition primitive = EMPrimitive.getBindsPrimitive().get(id); + IEMDefinition primitive = IEMDefinition.getBindsPrimitive().get(id); return new EMDefinitionStack(primitive,amount); }catch (NumberFormatException e){ byte clazz = (byte) args.remove(0).charAt(0); - Method constructor = EMComplex.getBindsComplex().get(clazz); + Method constructor = IEMDefinition.getBindsComplex().get(clazz); EMDefinitionStackMap stacks =new EMDefinitionStackMap(); while(args.size()>0){ @@ -129,12 +128,12 @@ public class EMGive implements ICommand { private List completionsForClassOrID(){ ArrayList strings=new ArrayList<>(8); - Map binds= EMComplex.getBindsComplex(); + Map binds= IEMDefinition.getBindsComplex(); for (Map.Entry e:binds.entrySet()) { strings.add(String.valueOf((char)e.getKey().byteValue())); } - Map bindsBO = EMPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { + Map bindsBO = IEMDefinition.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { strings.add(String.valueOf(e.getKey().byteValue())); } return strings; 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 395592036f..13531dbf85 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; @@ -27,15 +27,15 @@ public class EMList implements ICommand { if (!sender.getEntityWorld().isRemote) { if(args.length == 0) { sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); - Map binds= EMComplex.getBindsComplex(); + Map binds= IEMDefinition.getBindsComplex(); for (Map.Entry e:binds.entrySet()) { sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); } }else if(args.length==1){ sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); - if(args[0].equals(String.valueOf((char) EMPrimitive.nbtType))){ - Map bindsBO = EMPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { + if(args[0].equals(String.valueOf((char) EMPrimitiveTemplate.nbtType))){ + Map bindsBO = IEMDefinition.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName())); } }else{ @@ -65,7 +65,7 @@ public class EMList implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { if(args.length==0){ - Map binds= EMComplex.getBindsComplex(); + Map binds= IEMDefinition.getBindsComplex(); ArrayList strings=new ArrayList<>(binds.size()); for (Map.Entry e:binds.entrySet()) { strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java index bed49a5040..a6bd623414 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java @@ -4,7 +4,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstant import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import static com.github.technus.tectech.util.DoubleCount.mul; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java new file mode 100644 index 0000000000..94a50ce322 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Created by danie_000 on 23.01.2017. + */ +public abstract class EMComplexTemplate implements IEMDefinition { + /** + * Just empty array? + */ + public static final IEMDefinition[] nothing = new EMPrimitiveTemplate[0]; + + @Override + public final EMComplexTemplate clone() { + return this;//IMMUTABLE + } + + @Override + public int compareTo(IEMDefinition o) { + int classCompare = compareClassID(o); + if (classCompare != 0) { + return classCompare; + } + //that allows neat check if the same thing and + //top hierarchy amount can be used to store amount info + return getSubParticles().compareWithAmountsInternal(o.getSubParticles()); + } + + @Override + public final EMDefinitionStack getStackForm(double amount) { + return new EMDefinitionStack(this, amount); + } + + @Override + public final boolean equals(Object obj) { + if(this==obj) { + return true; + } + if (obj instanceof IEMDefinition) { + return compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + @Override + public int hashCode() {//Internal amounts should be also hashed + int hash = -(getSubParticles().size() << 4); + for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { + int amount=(int) stack.getAmount(); + hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); + } + return hash; + } + + @Override + public String toString() { + return getLocalizedName()+ '\n' + getSymbol(); + } + + public NBTTagCompound toNBT() { + NBTTagCompound nbtTagCompound = getSubParticles().toNBT(); + nbtTagCompound.setInteger(EMDefinitionsRegistry.getIndirectTagName(), getIndirectTagValue()); + return nbtTagCompound; + } + + protected abstract int getIndirectTagValue(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java new file mode 100644 index 0000000000..c0f9df32f2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java @@ -0,0 +1,110 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; +import java.util.function.Function; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +public class EMDefinitionsRegistry { + private static final NavigableSet STACKS_REGISTERED = new TreeSet<>(); + private static final Map DIRECT_BINDS = new HashMap<>(); + private static final Map> CLASS_BINDS = new HashMap<>();//creator methods in subclasses + private static final Map> CLASSES = new HashMap<>(); + private static final Map, Integer> CLASS_TYPES = new HashMap<>(); + private static final String INDIRECT_TAG = "t"; + private static final String DIRECT_TAG = "c"; + + private EMDefinitionsRegistry() { + } + + static { + CLASS_BINDS.put(0, EMDefinitionsRegistry::getDefinitionDirect); + CLASS_BINDS.put((int) 'p', EMDefinitionsRegistry::getDefinitionDirect); + } + + private static IEMDefinition getDefinitionDirect(NBTTagCompound nbt) { + return DIRECT_BINDS.get(nbt.getInteger(getDirectTagName())); + } + + public static IEMDefinition fromNBT(NBTTagCompound nbt) { + IEMDefinition apply; + try { + apply = CLASS_BINDS.get(nbt.getInteger(getIndirectTagName())).apply(nbt); + } catch (Exception e) { + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + if (!DEBUG_MODE) { + if (apply == nbtE__) { + throw new EMException("Deserialized to NBT ERROR!"); + } else if (apply == null__ || apply == null) { + throw new EMException("Deserialized to NULL POINTER!"); + } + } + if (apply == null) { + return null__; + } + return apply; + } + + public static void registerDefinitionClass(int shortcutNBT, Function creator, Class clazz, int classID) { + if (CLASS_BINDS.put(shortcutNBT, creator) != null) { + EMException e = new EMException("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + if (CLASSES.put(classID, clazz) != null) { + EMException e = new EMException("Duplicate Class ID! " + classID + " used for class comparison"); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + CLASS_TYPES.put(clazz, classID); + } + + public static void registerDirectDefinition(IEMDefinition definition, int id) { + IEMDefinition old = DIRECT_BINDS.put(id, definition); + if (old != null) { + EMException e = new EMException("Duplicate primitive EM ID: " + id + + " for " + definition.getLocalizedName() + + " and " + old.getLocalizedName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public static NavigableSet getStacksRegisteredForDisplay() { + return STACKS_REGISTERED; + } + + public static void registerForDisplay(IEMDefinition definition){ + STACKS_REGISTERED.add(definition); + STACKS_REGISTERED.add(definition.getAnti()); + } + + public static String getIndirectTagName() { + return INDIRECT_TAG; + } + + public static String getDirectTagName() { + return DIRECT_TAG; + } +} 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 new file mode 100644 index 0000000000..f3ce34dd1d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java @@ -0,0 +1,243 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +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; + +/** + * Created by danie_000 on 22.10.2016. + * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! + */ +public abstract class EMPrimitiveTemplate extends EMComplexTemplate { + private final String name; + private final String symbol; + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private final byte color; + //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti + private final byte type; + + private EMPrimitiveTemplate anti;//IMMUTABLE + private EMDecay[] elementalDecays; + private byte naturalDecayInstant; + private byte energeticDecayInstant; + private double rawLifeTime; + + private final int ID; + + //no _ at end - normal particle + // _ at end - anti particle + // __ at end - self is antiparticle + + protected EMPrimitiveTemplate(String name, String symbol, int type, double mass, int charge, int color, int ID) { + this.name = name; + this.symbol = symbol; + this.type = (byte) type; + this.mass = mass; + this.charge = charge; + this.color = (byte) color; + this.ID = ID; + EMDefinitionsRegistry.registerDirectDefinition(this,ID); + } + + // + protected void init(EMPrimitiveTemplate antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { + anti = antiParticle; + this.rawLifeTime = rawLifeTime; + naturalDecayInstant = (byte) naturalInstant; + energeticDecayInstant = (byte) energeticInstant; + elementalDecays =elementalDecaysArray; + EMDefinitionsRegistry.registerForDisplay(this); + } + + @Override + public String getLocalizedName() { + return "Undefined: " + getName(); + } + + @Override + public String getSymbol() { + return symbol; + } + + @Override + public String getShortSymbol() { + return getSymbol(); + } + + @Override + public IEMDefinition getAnti() { + return anti;//no need for copy + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public byte getColor() { + return color; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + if (naturalDecayInstant < 0) { + return elementalDecays; + }else if (naturalDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[naturalDecayInstant]}; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (energeticDecayInstant < 0) { + return elementalDecays; + }else if (energeticDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[energeticDecayInstant]}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + return elementalDecays; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return rawLifeTime; + } + + @Override + public final EMConstantStackMap getSubParticles() { + return null; + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public byte getMatterType() { + return type; + } + + @Override + public final NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger(EMDefinitionsRegistry.getDirectTagName(), ID); + return nbt; + } + + @Override + public final byte getClassType() { + return getClassTypeStatic(); + } + + public static byte getClassTypeStatic(){ + return -128; + } + + @Override + public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + EMDefinitionsRegistry.getDirectTagName() + ' ' + getClassType()); + } + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+ getLocalizedName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + + @Override + public final int compareTo(IEMDefinition o) { + if (getClassType() == o.getClassType()) { + int oID = ((EMPrimitiveTemplate) o).ID; + return Integer.compare(ID, oID); + } + return compareClassID(o); + } + + @Override + public final int hashCode() { + return ID; + } + + public String getName() { + return name; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java new file mode 100644 index 0000000000..06bfc61737 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java @@ -0,0 +1,85 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +/** + * Created by danie_000 on 11.11.2016. + */ +public interface IEMDefinition extends Comparable,Cloneable {//IMMUTABLE + double STABLE_RAW_LIFE_TIME =1.5e36D; + double NO_DECAY_RAW_LIFE_TIME =-1D; + long DEFAULT_ENERGY_LEVEL =0; + double DEFAULT_ENERGY_REQUIREMENT =25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels + //add text based creators for recipe formula input? + + //Nomenclature + String getLocalizedName(); + + String getSymbol(); + + String getShortSymbol(); + + void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); + + void addScanResults(ArrayList lines, int capabilities, long energyLevel); + + byte getMatterType(); + + byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + + //Not dynamically changing stuff + IEMDefinition getAnti();//gives new anti particle def + + EMDecay[] getDecayArray();//possible decays + + EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick + + EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay + + boolean usesSpecialEnergeticDecayHandling(); + + boolean usesMultipleDecayCalls(long energyLevel); + + boolean decayMakesEnergy(long energyLevel); + + boolean fusionMakesEnergy(long energyLevel); + + double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative + + double getMass();//mass... MeV/c^2 + + int getCharge();//charge 1/3 electron charge + + //dynamically changing stuff + byte getColor();//-1 nope cannot 0 it can but undefined + + double getRawTimeSpan(long currentEnergy);//defined in static fields or generated + + boolean isTimeSpanHalfLife(); + + EMConstantStackMap getSubParticles();//contents... null if none + + EMFluidDequantizationInfo someAmountIntoFluidStack(); + + EMItemDequantizationInfo someAmountIntoItemsStack(); + + EMOredictDequantizationInfo someAmountIntoOredictStack(); + + NBTTagCompound toNBT(); + + EMDefinitionStack getStackForm(double amount); + + IEMDefinition clone(); + + default int compareClassID(IEMDefinition obj) { + return (int) getClassType() - obj.getClassType(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java index d9297436a0..e6cfa7d03e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import java.util.Collections; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java index 45ce50d5c7..78bb8d740a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import java.util.NavigableMap; 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 c15142787f..69dc53f83d 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 @@ -4,7 +4,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayRe 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.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; 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 4c798499b5..795ac3d3bf 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import java.util.NavigableMap; import java.util.TreeMap; 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 392d06f5cf..1322566914 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 @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -136,8 +136,8 @@ public interface IEMMapRead extends Comparable NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", size()); int i = 0; - for (T stack : values()) { - nbt.setTag(Integer.toString(i++), stack.toNBT()); + for (Map.Entry entry : entrySet()) { + nbt.setTag(Integer.toString(i++), entry.getValue().toNBT()); } return nbt; } @@ -161,6 +161,39 @@ public interface IEMMapRead extends Comparable return 0; } + /** + * use only for nested operations! + * @param o + * @return + */ + default int compareWithAmountsInternal(IEMMapRead o) { + if (o == null) { + return 1; + } + + int lenDiff = size() - o.size(); + if (lenDiff != 0) { + return lenDiff; + } + + Iterator> iterator = entrySet().iterator(); + Iterator> iteratorO = o.entrySet().iterator(); + + while (iterator.hasNext()) { + T first = iterator.next().getValue(); + IEMStack second = iteratorO.next().getValue(); + int result = first.compareTo(second); + if (result != 0) { + return result; + } + result=Double.compare(first.getAmount(),second.getAmount()); + if (result != 0) { + return result; + } + } + return 0; + } + default double getMass(){ double mass=0; for (Map.Entry entry : entrySet()) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java index cc22267474..f13e82fb26 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; import java.util.Map; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java index 7b8853a2f4..167ec8451d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import java.util.Map; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java index fe0c73e795..f868dbe0ad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; @@ -50,7 +50,7 @@ public final class EMDefinitionStack implements IEMStack { public static EMDefinitionStack fromNBT(NBTTagCompound nbt) { return new EMDefinitionStack( - EMComplex.fromNBT(nbt.getCompoundTag("d")), + EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), nbt.getLong("q")+nbt.getDouble("Q")); } 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 b73bd21f02..6347cd2144 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 @@ -1,12 +1,12 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; 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.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; @@ -558,9 +558,8 @@ public final class EMInstanceStack implements IEMStack { } public static EMInstanceStack fromNBT(NBTTagCompound nbt) { - NBTTagCompound definition = nbt.getCompoundTag("d"); EMInstanceStack instance = new EMInstanceStack( - EMComplex.fromNBT(definition), + EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), nbt.getLong("q") + nbt.getDouble("Q"), nbt.getFloat("m") + nbt.getDouble("M"), nbt.getLong("a") + nbt.getDouble("A"), diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java index 94c76634d9..5672b31c04 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; /** diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java deleted file mode 100644 index 7fc074bded..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 23.01.2017. - */ -public abstract class EMComplex implements IEMDefinition { - //Nothing array - public static final IEMDefinition[] nothing = new EMPrimitive[0]; - - //add text based creators for recipe formula input? - private static final Map nbtCreationBind = new HashMap<>();//creator methods in subclasses - private static final HashSet classSet = new HashSet<>(); - - protected static void addCreatorFromNBT(byte shortcutNBT, Method constructorFromNBT,byte classID) { - if(nbtCreationBind.put(shortcutNBT, constructorFromNBT)!=null) { - throw new Error("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); - } - if(!classSet.add(classID)) { - throw new Error("Duplicate Class ID! " + classID + " used for class comparison"); - } - } - - public static Map getBindsComplex(){ - return nbtCreationBind; - } - - @Override - public final EMComplex clone() { - return this;//IMMUTABLE - } - - public static IEMDefinition fromNBT(NBTTagCompound nbt) { - try { - return (IEMDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__; - } - } - - @Override - public int compareTo(IEMDefinition o) { - int classCompare = compareClassID(o); - if (classCompare != 0) { - return classCompare; - } - - //only of the internal def stacks!!! - //that allows neat check if the same thing and - //top hierarchy amount can be used to store amount info - return compareInnerContentsWithAmounts(getSubParticles().valuesToArray(), o.getSubParticles().valuesToArray()); - } - - //use only for nested operations! - private static int compareInnerContentsWithAmounts(EMDefinitionStack[] tc, EMDefinitionStack[] sc) { - if (tc == null) { - if (sc == null) { - return 0; - } else { - return -1; - } - } - if (sc == null) { - return 1; - } - - int lenDiff = tc.length - sc.length; - if (lenDiff != 0) { - return lenDiff; - } - - for (int i = 0; i < tc.length; i++) { - int cn = tc[i].getDefinition().compareTo(sc[i].getDefinition()); - if (cn != 0) { - return cn; - } - - if (tc[i].getAmount() > sc[i].getAmount()) { - return 1; - } - if (tc[i].getAmount() < sc[i].getAmount()) { - return -1; - } - } - return 0; - } - - @Override - public final EMDefinitionStack getStackForm(double amount) { - return new EMDefinitionStack(this, amount); - } - - @Override - public final boolean equals(Object obj) { - if(this==obj) { - return true; - } - if (obj instanceof IEMDefinition) { - return compareTo((IEMDefinition) obj) == 0; - } - if (obj instanceof IEMStack) { - return compareTo(((IEMStack) obj).getDefinition()) == 0; - } - return false; - } - - @Override - public int hashCode() {//Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 4); - for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { - int amount=(int) stack.getAmount(); - hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); - } - return hash; - } - - @Override - public String toString() { - return getLocalizedName()+ '\n' + getSymbol(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java deleted file mode 100644 index 587affd0f1..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java +++ /dev/null @@ -1,283 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import net.minecraft.client.Minecraft; -import net.minecraft.crash.CrashReport; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; - -import static com.github.technus.tectech.util.Util.areBitsSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; - -/** - * Created by danie_000 on 22.10.2016. - * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) - */ -public abstract class EMPrimitive extends EMComplex { - public static final byte nbtType = (byte) 'p'; - - private static final Map bindsBO = new HashMap<>(); - - public static Map getBindsPrimitive() { - return bindsBO; - } - - private final String name; - private final String symbol; - //float-mass in eV/c^2 - private final double mass; - //int -electric charge in 1/3rds of electron charge for optimization - private final int charge; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private final byte color; - //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - private final byte type; - - private EMPrimitive anti;//IMMUTABLE - private EMDecay[] elementalDecays; - private byte naturalDecayInstant; - private byte energeticDecayInstant; - private double rawLifeTime; - - private final int ID; - - //no _ at end - normal particle - // _ at end - anti particle - // __ at end - self is antiparticle - - protected EMPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { - this.name = name; - this.symbol = symbol; - this.type = (byte) type; - this.mass = mass; - this.charge = charge; - this.color = (byte) color; - this.ID = ID; - if (bindsBO.put(ID, this) != null) { - Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new EMException("Duplicate ID"))); - } - STACKS_REGISTERED.add(this); - } - - // - protected void init(EMPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { - anti = antiParticle; - this.rawLifeTime = rawLifeTime; - naturalDecayInstant = (byte) naturalInstant; - energeticDecayInstant = (byte) energeticInstant; - elementalDecays =elementalDecaysArray; - } - - @Override - public String getLocalizedName() { - return "Undefined: " + getName(); - } - - @Override - public String getSymbol() { - return symbol; - } - - @Override - public String getShortSymbol() { - return getSymbol(); - } - - @Override - public IEMDefinition getAnti() { - return anti;//no need for copy - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public byte getColor() { - return color; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public EMDecay[] getNaturalDecayInstant() { - if (naturalDecayInstant < 0) { - return elementalDecays; - }else if (naturalDecayInstant>=elementalDecays.length){ - return EMDecay.NO_PRODUCT; - } - return new EMDecay[]{elementalDecays[naturalDecayInstant]}; - } - - @Override - public EMDecay[] getEnergyInducedDecay(long energyLevel) { - if (energeticDecayInstant < 0) { - return elementalDecays; - }else if (energeticDecayInstant>=elementalDecays.length){ - return EMDecay.NO_PRODUCT; - } - return new EMDecay[]{elementalDecays[energeticDecayInstant]}; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public EMDecay[] getDecayArray() { - return elementalDecays; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public final EMConstantStackMap getSubParticles() { - return null; - } - - @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public byte getType() { - return type; - } - - @Override - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - nbt.setInteger("c", getID()); - return nbt; - } - - public static EMPrimitive fromNBT(NBTTagCompound content) { - EMPrimitive primitive = bindsBO.get(content.getInteger("c")); - return primitive == null ? null__ : primitive; - } - - @Override - public final byte getClassType() { - return -128; - } - - public static byte getClassTypeStatic(){ - return -128; - } - - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+ getLocalizedName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" "+"At current energy level"); - } - } - - public static void run() { - try { - EMComplex.addCreatorFromNBT(nbtType, EMPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Primitive " + nbtType + ' ' + -128); - } - } - - @Override - public final int compareTo(IEMDefinition o) { - if (getClassType() == o.getClassType()) { - int oID = ((EMPrimitive) o).getID(); - return Integer.compare(getID(), oID); - } - return compareClassID(o); - } - - @Override - public final int hashCode() { - return getID(); - } - - public String getName() { - return name; - } - - public int getID() { - return ID; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java deleted file mode 100644 index 7ae6d0395c..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -/** - * Created by danie_000 on 11.11.2016. - */ -public interface IEMDefinition extends Comparable,Cloneable {//IMMUTABLE - double STABLE_RAW_LIFE_TIME =1.5e36D; - double NO_DECAY_RAW_LIFE_TIME=-1D; - long DEFAULT_ENERGY_LEVEL=0; - double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels - - //Nomenclature - String getLocalizedName(); - - String getSymbol(); - - String getShortSymbol(); - - void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); - - void addScanResults(ArrayList lines, int capabilities, long energyLevel); - - byte getType(); - - byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - - //Not dynamically changing stuff - IEMDefinition getAnti();//gives new anti particle def - - EMDecay[] getDecayArray();//possible decays - - EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick - - EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay - - boolean usesSpecialEnergeticDecayHandling(); - - boolean usesMultipleDecayCalls(long energyLevel); - - boolean decayMakesEnergy(long energyLevel); - - boolean fusionMakesEnergy(long energyLevel); - - double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative - - double getMass();//mass... MeV/c^2 - - int getCharge();//charge 1/3 electron charge - - //dynamically changing stuff - byte getColor();//-1 nope cannot 0 it can but undefined - - double getRawTimeSpan(long currentEnergy);//defined in static fields or generated - - boolean isTimeSpanHalfLife(); - - EMConstantStackMap getSubParticles();//contents... null if none - - EMFluidDequantizationInfo someAmountIntoFluidStack(); - - EMItemDequantizationInfo someAmountIntoItemsStack(); - - EMOredictDequantizationInfo someAmountIntoOredictStack(); - - NBTTagCompound toNBT(); - - EMDefinitionStack getStackForm(double amount); - - IEMDefinition clone(); - - default int compareClassID(IEMDefinition obj) { - return (int) getClassType() - obj.getClassType(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java index fca79b0b6f..d6f6731aec 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java @@ -1,7 +1,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.item.ItemStack; @@ -12,7 +13,6 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; import static java.lang.Math.pow; /** @@ -72,15 +72,13 @@ public class EMTransformationInfo { public void addFluid(IEMStack em, FluidStack fluidStack){ getFluidQuantization().put(fluidStack.getFluidID(),new EMFluidQuantizationInfo(fluidStack,em)); getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluidStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addFluid(IEMStack em, Fluid fluid, int fluidAmount){ getFluidQuantization().put(fluid.getID(),new EMFluidQuantizationInfo(fluid,fluidAmount,em)); getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluid,fluidAmount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } private void addItemQuantization(EMItemQuantizationInfo aIQI){ @@ -90,36 +88,31 @@ public class EMTransformationInfo { public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT){ addItemQuantization(new EMItemQuantizationInfo(itemStack,skipNBT,em)); getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,itemStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ addItemQuantization(new EMItemQuantizationInfo(prefix,material,amount,skipNBT,em)); getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,prefix,material,amount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addOredict(IEMStack em, String name, int qty){ getOredictQuantization().put(OreDictionary.getOreID(name),new EMOredictQuantizationInfo(name,qty,em)); getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,name,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty){ getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + material.mName),new EMOredictQuantizationInfo(prefix,material,qty,em)); getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,material,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty){ getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + materialName),new EMOredictQuantizationInfo(prefix,materialName,qty,em)); getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,materialName,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public Map getFluidQuantization() { 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 77ac6c46c4..666249f408 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 @@ -3,13 +3,14 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; @@ -25,7 +26,6 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.*; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; @@ -37,7 +37,7 @@ import static gregtech.api.enums.OrePrefixes.dust; /** * Created by danie_000 on 18.11.2016. */ -public final class EMAtomDefinition extends EMComplex { +public final class EMAtomDefinition extends EMComplexTemplate { public static final long ATOM_COMPLEXITY_LIMIT=65536L; private static final byte BYTE_OFFSET=32; @@ -118,10 +118,10 @@ public final class EMAtomDefinition extends EMComplex { throw new ArithmeticException("Amount cannot be safely converted to int!"); } mass += stack.getMass(); - if (def.getType() < 0) { + if (def.getMatterType() < 0) { containsAnti = true; } - type = Math.max(type, Math.abs(def.getType())); + type = Math.max(type, Math.abs(def.getMatterType())); if (def instanceof EMLeptonDefinition) { cLeptons += stack.getCharge(); @@ -307,7 +307,7 @@ public final class EMAtomDefinition extends EMComplex { } @Override - public byte getType() { + public byte getMatterType() { return type; } @@ -340,7 +340,7 @@ public final class EMAtomDefinition extends EMComplex { int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { - if (Math.abs(getType()) != 1) { + if (Math.abs(getMatterType()) != 1) { return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; } return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; @@ -408,7 +408,7 @@ public final class EMAtomDefinition extends EMComplex { } private EMDecay[] getDecayArray(ArrayList decaysList, int decayMode, boolean tryAnti) {//todo? - if (getType() == 1) { + if (getMatterType() == 1) { switch (decayMode) { case -2: if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { @@ -446,7 +446,7 @@ public final class EMAtomDefinition extends EMComplex { } } return EMDecay.NO_DECAY; - }else if(getType() ==-1){ + }else if(getMatterType() ==-1){ EMAtomDefinition anti =getAnti(); if(anti!=null) { return anti.getDecayArray(decaysList, decayMode, false); @@ -1264,7 +1264,7 @@ public final class EMAtomDefinition extends EMComplex { //disembody ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { - if (elementalStack.getDefinition().getType() == 1 || elementalStack.getDefinition().getType() == -1) { + if (elementalStack.getDefinition().getMatterType() == 1 || elementalStack.getDefinition().getMatterType() == -1) { //covers both quarks and antiquarks decaysInto.add(elementalStack); } else { @@ -1344,8 +1344,8 @@ public final class EMAtomDefinition extends EMComplex { } @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, elementalStacks); + protected int getIndirectTagValue() { + return nbtType; } public static EMAtomDefinition fromNBT(NBTTagCompound nbt) { @@ -1465,14 +1465,14 @@ public final class EMAtomDefinition extends EMComplex { } try { - EMComplex.addCreatorFromNBT(nbtType, EMAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); + EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMAtomDefinition::fromNBT,EMAtomDefinition.class,getClassTypeStatic()); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64); + TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); } } @@ -1644,7 +1644,7 @@ public final class EMAtomDefinition extends EMComplex { @Override public byte getClassType() { - return 64; + return getClassTypeStatic(); } public static byte getClassTypeStatic(){ 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 384087770f..a901f5c8fc 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 @@ -1,17 +1,20 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.*; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import com.github.technus.tectech.util.Util; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -22,7 +25,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; @@ -33,7 +35,7 @@ import static gregtech.api.enums.OrePrefixes.dust; /** * Created by danie_000 on 17.11.2016. */ -public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o +public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o private final int hash; private static final byte nbtType = (byte) 'h'; @@ -90,8 +92,8 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o } mass += quarkStack.getMass(); charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.getDefinition().getType()), type); - if (quarkStack.getDefinition().getType() < 0) { + type = Math.max(Math.abs(quarkStack.getDefinition().getMatterType()), type); + if (quarkStack.getDefinition().getMatterType() < 0) { containsAnti = true; } } @@ -212,12 +214,12 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o @Override public EMDecay[] getNaturalDecayInstant() { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { return EMDecay.NO_PRODUCT; } ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack quarks : quarkStacks) { - if (quarks.getDefinition().getType() == 1 || quarks.getDefinition().getType() == -1) { + if (quarks.getDefinition().getMatterType() == 1 || quarks.getDefinition().getMatterType() == -1) { //covers both quarks and antiquarks decaysInto.add(quarks); } else { @@ -234,7 +236,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { return EMDecay.NO_PRODUCT; } return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks @@ -270,7 +272,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && - quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { return EMDecay.NO_PRODUCT; } else if (getAmount() != 3) { return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks @@ -286,7 +288,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o EMQuarkDefinition lastQuark = newBaryon.remove(2); EMDefinitionStack[] decay; - if (Math.abs(lastQuark.getType()) > 1) { + if (Math.abs(lastQuark.getMatterType()) > 1) { decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); } else { decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); @@ -334,7 +336,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o } @Override - public byte getType() { + public byte getMatterType() { return type; } @@ -385,8 +387,8 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o } @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, quarkStacks); + protected int getIndirectTagValue() { + return nbtType; } public static EMHadronDefinition fromNBT(NBTTagCompound nbt) { @@ -412,22 +414,22 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); SYMBOL_MAP.put(hadron_p,"p"); NAME_MAP.put(hadron_p,"Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p); hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); SYMBOL_MAP.put(hadron_p_,"~p"); NAME_MAP.put(hadron_p_,"Anti Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p_); hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.getMass(); //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); NAME_MAP.put(hadron_n, "Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n); hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); SYMBOL_MAP.put(hadron_n_,"~n"); NAME_MAP.put(hadron_n_,"Anti Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n_); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -444,14 +446,14 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o hadron_p5 = new EMDefinitionStack(hadron_p, 5D); try { - EMComplex.addCreatorFromNBT(nbtType, EMHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); + EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMHadronDefinition::fromNBT,EMHadronDefinition.class,getClassTypeStatic()); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + -64); + TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + getClassTypeStatic()); } } @@ -467,7 +469,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o @Override public byte getClassType() { - return -64; + return getClassTypeStatic(); } public static byte getClassTypeStatic(){ 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 9a22f54941..bd34733cb6 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 @@ -7,7 +7,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.TreeMap; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.util.Util.splitButDifferent; public final class EMNuclideIAEA { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index e3efa3b7e6..5f14eefcdb 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; @@ -11,7 +11,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p /** * Created by danie_000 on 22.10.2016. */ -public final class EMBosonDefinition extends EMPrimitive { +public final class EMBosonDefinition extends EMPrimitiveTemplate { public static final EMBosonDefinition boson_Y__ = new EMBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), boson_H__ = new EMBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index 98bdf7ca5c..0f9898775f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; @@ -11,7 +11,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p /** * Created by danie_000 on 22.10.2016. */ -public final class EMLeptonDefinition extends EMPrimitive { +public final class EMLeptonDefinition extends EMPrimitiveTemplate { public static final EMLeptonDefinition lepton_e = new EMLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), lepton_m = new EMLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index e77c74ed89..ac06a80728 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -2,14 +2,14 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; /** * Created by danie_000 on 22.10.2016. */ -public final class EMNeutrinoDefinition extends EMPrimitive { +public final class EMNeutrinoDefinition extends EMPrimitiveTemplate { public static final EMNeutrinoDefinition lepton_Ve = new EMNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), lepton_Vm = new EMNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index 68591cc4e6..e4a92fbae1 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; /** * Created by danie_000 on 22.10.2016. */ -public final class EMPrimitiveDefinition extends EMPrimitive { +public final class EMPrimitiveDefinition extends EMPrimitiveTemplate { public static final EMPrimitiveDefinition - nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), - null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), - space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), + nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, 0), + null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MIN_VALUE), + space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, Integer.MIN_VALUE+1), magic = new EMPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), magic_ = new EMPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index b0a5c419e1..9afa04d243 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; @@ -9,7 +9,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p /** * Created by danie_000 on 22.10.2016. */ -public final class EMQuarkDefinition extends EMPrimitive { +public final class EMQuarkDefinition extends EMPrimitiveTemplate { public static final EMQuarkDefinition quark_u = new EMQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), quark_c = new EMQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index f5cfad22f3..b7310485a2 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.recipe; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.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.mechanics.elementalMatter.core.maps.IEMMapRead; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; @@ -262,7 +262,7 @@ public class TT_recipe extends GT_Recipe { return null; } try { - return mRecipeMap.get(EMComplex.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); + return mRecipeMap.get(EMDefinitionsRegistry.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); }catch (Exception e){ if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index bb18c16727..599d3e1c2c 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; 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.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; 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 107cb97103..2062173cfd 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 @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.item; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstance import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; @@ -26,7 +27,6 @@ import net.minecraft.world.World; import java.util.Collections; import java.util.List; -import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @@ -39,7 +39,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by Tec on 15.03.2017. */ public final class DebugElementalInstanceContainer_EM extends Item implements IElementalItem { - public static final TreeSet STACKS_REGISTERED =new TreeSet<>(); public static DebugElementalInstanceContainer_EM INSTANCE; @@ -141,7 +140,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(IEMDefinition definition: STACKS_REGISTERED){ + for(IEMDefinition definition: EMDefinitionsRegistry.getStacksRegisteredForDisplay()){ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT)))); list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 144 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_144)))); list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1000 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 4a0bb55784..3015d024c7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -8,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayRe import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; @@ -108,7 +108,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }); registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMPrimitive.getClassTypeStatic()); + registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { @Override @@ -135,7 +135,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 2; } }); - FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { @Override public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { @@ -162,9 +162,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }); registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(EMPrimitive.getClassTypeStatic()); + registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); - FUSE_HANDLERS.put((EMPrimitive.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { @Override public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 466f82071b..e769d3e480 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -26,7 +26,7 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 630569a25d..64949fe402 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 @@ -29,8 +29,8 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.DEFAULT_ENERGY_LEVEL; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.DEFAULT_ENERGY_LEVEL; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; -- cgit From 975bf105794ac48b1415d4e78946449fbb68bcaf Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 18 Jan 2022 22:25:23 +0100 Subject: Cleanup some Locale --- .../tectech/loader/recipe/RecipeLoader.java | 2 +- .../core/definitions/EMPrimitiveTemplate.java | 11 +++++----- .../definitions/complex/EMAtomDefinition.java | 7 +++--- .../definitions/complex/EMHadronDefinition.java | 25 +++++++++++----------- .../definitions/primitive/EMBosonDefinition.java | 3 ++- .../definitions/primitive/EMLeptonDefinition.java | 3 ++- .../primitive/EMNeutrinoDefinition.java | 3 ++- .../primitive/EMPrimitiveDefinition.java | 3 ++- .../definitions/primitive/EMQuarkDefinition.java | 3 ++- 9 files changed, 34 insertions(+), 26 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java index 3572e601e4..b5333c8e0d 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java @@ -35,7 +35,7 @@ public class RecipeLoader implements Runnable { @Override public void run() { - EMAtomDefinition.setTransformation(); + EMAtomDefinition.setTransformations(); EMHadronDefinition.setTransformations(); // =================================================================================================== 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 f3ce34dd1d..b529b79cc0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; @@ -61,11 +62,6 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { EMDefinitionsRegistry.registerForDisplay(this); } - @Override - public String getLocalizedName() { - return "Undefined: " + getName(); - } - @Override public String getSymbol() { return symbol; @@ -183,6 +179,11 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { return nbt; } + @Override + protected final int getIndirectTagValue() { + throw new EMException("This class should only be used directly!"); + } + @Override public final byte getClassType() { return getClassTypeStatic(); 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 666249f408..878c2a6627 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 @@ -33,6 +33,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.OrePrefixes.dust; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 18.11.2016. @@ -348,7 +349,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { if (DEBUG_MODE) { e.printStackTrace(); } - return (negative ? "Element: ~" : "Element: ") + element; + return translateToLocal("tt.keyword.Element")+(negative ? ": ~" : ": ") + element; } } @@ -1476,7 +1477,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { } } - public static void setTransformation(){ + public static void setTransformations(){ /*----STABLE ATOMS----**/ refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; @@ -1666,7 +1667,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); + lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); } if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+ getLocalizedName()); 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 a901f5c8fc..70092aa735 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 @@ -31,6 +31,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.core.transfor import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.11.2016. @@ -141,7 +142,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize public String getLocalizedName() { StringBuilder name= new StringBuilder(getSimpleName()); name.append(':'); - String sym= NAME_MAP.get(this); + String sym= translateToLocal(NAME_MAP.get(this)); if(sym!=null){ name.append(' ').append(sym); }else { @@ -155,17 +156,17 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize private String getSimpleName() { switch (getAmount()) { case 2: - return "Meson"; + return translateToLocal("tt.keyword.Meson"); case 3: - return "Baryon"; + return translateToLocal("tt.keyword.Baryon"); case 4: - return "Tetraquark"; + return translateToLocal("tt.keyword.Tetraquark"); case 5: - return "Pentaquark"; + return translateToLocal("tt.keyword.Pentaquark"); case 6: - return "Hexaquark"; + return translateToLocal("tt.keyword.Hexaquark"); default: - return "Hadron"; + return translateToLocal("tt.keyword.Hadron"); } } @@ -413,22 +414,22 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize //redefine the proton with proper lifetime (the lifetime is based on mass comparison) hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); SYMBOL_MAP.put(hadron_p,"p"); - NAME_MAP.put(hadron_p,"Proton"); + NAME_MAP.put(hadron_p,translateToLocal("tt.keyword.Proton")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p); hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); SYMBOL_MAP.put(hadron_p_,"~p"); - NAME_MAP.put(hadron_p_,"Anti Proton"); + NAME_MAP.put(hadron_p_,translateToLocal("tt.keyword.AntiProton")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p_); hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.getMass(); //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); - NAME_MAP.put(hadron_n, "Neutron"); + NAME_MAP.put(hadron_n,translateToLocal("tt.keyword.Neutron")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n); hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); SYMBOL_MAP.put(hadron_n_,"~n"); - NAME_MAP.put(hadron_n_,"Anti Neutron"); + NAME_MAP.put(hadron_n_,translateToLocal("tt.keyword.AntiNeutron")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n_); } catch (EMException e) { if (DEBUG_MODE) { @@ -491,7 +492,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); + lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); } if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+getSimpleName()); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index 5f14eefcdb..f20f872a6e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMP import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -35,7 +36,7 @@ public final class EMBosonDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Boson: " + getName(); + return translateToLocal("tt.keyword.Boson")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index 0f9898775f..38e537ec59 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMP import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -59,7 +60,7 @@ public final class EMLeptonDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Lepton: " + getName(); + return translateToLocal("tt.keyword.Lepton")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index ac06a80728..9af7b97cb4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefini import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -49,7 +50,7 @@ public final class EMNeutrinoDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Lepton: " + getName(); + return translateToLocal("tt.keyword.Neutrino")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index e4a92fbae1..41da06567d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -29,7 +30,7 @@ public final class EMPrimitiveDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Primitive: " + getName(); + return translateToLocal("tt.keyword.Primitive")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index 9afa04d243..3f19205aeb 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMP import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -96,7 +97,7 @@ public final class EMQuarkDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Quark: " + getName(); + return translateToLocal("tt.keyword.Quark")+": " + getName(); } @Override -- cgit From 62021d238a0c38401b50211d59e72e169399f444 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 18 Jan 2022 22:33:13 +0100 Subject: Minor fixes --- .../elementalMatter/definitions/EMComplexAspectDefinition.java | 2 +- .../mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java | 2 +- .../elementalMatter/definitions/complex/EMHadronDefinition.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') 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 e56e31f166..a062fa0dab 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 @@ -48,7 +48,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { private EMComplexAspectDefinition(boolean check, EMConstantStackMap aspects) throws EMException { if (check && !canTheyBeTogether(aspects)) { - throw new EMException("Hadron Definition error"); + throw new EMException("Complex Aspect Definition error"); } aspectStacks = aspects; float mass = 0; 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 878c2a6627..37ecb861f8 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 @@ -72,7 +72,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { private final int charge; //int -electric charge in 1/3rds of electron charge for optimization private final int chargeLeptons; - private double rawLifeTime; + private final double rawLifeTime; //generation max present inside - minus if contains any anti quark private final byte type; 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 70092aa735..c1db8e4460 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 @@ -101,7 +101,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize this.amount = amount; this.charge = charge; this.type = containsAnti ? (byte) -type : (byte) type; - long mult = this.getAmount() * this.getAmount() * (this.getAmount() - 1); + long mult = (long) this.getAmount() * this.getAmount() * (this.getAmount() - 1); mass = mass * 5.543D * mult;//yes it becomes heavier if (mass == protonMass && this.getAmount() == 3) { -- cgit From 48e8812c1b72009f799a25dd0423cc9fbcb112a1 Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Tue, 18 Jan 2022 23:31:53 +0000 Subject: Update DreamCraftRecipeLoader.java --- .../dreamcraft/DreamCraftRecipeLoader.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 646158cc5b..5c2f8529a8 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1274,28 +1274,28 @@ public class DreamCraftRecipeLoader implements Runnable { //Stargate Recipes if (Loader.isModLoaded("eternalsingularity") && Loader.isModLoaded("SGCraft")) { TT_recipeAdder.addResearchableAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Infinity, 1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 32000000, 8192, 128000000, 1, new ItemStack[]{ GT_ModHandler.getModItem("eternalsingularity", "eternal_singularity", 1L), - ItemList.Sensor_UV.get(16L), + ItemList.Sensor_UEV.get(16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.CosmicNeutronium, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), - getItemContainer("NanoCircuit").get(1L).splitStack(16) + getItemContainer("QuantumCircuit").get(1L).splitStack(16) }, new FluidStack[]{ Materials.Neutronium.getMolten(36864L), Materials.Tritanium.getMolten(36864L), - Materials.Tetranaquadahdiindiumhexaplatiumosminid.getMolten(36864L), + Materials.Longasssuperconductornameforuhvwire.getMolten(36864L), Materials.Silver.getPlasma(36864L) }, - getItemContainer("StargateShieldingFoil").get(1L), 72000, 2000000); + getItemContainer("StargateShieldingFoil").get(1L), 72000, 500000000); TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("StargateShieldingFoil").get(1L), - 192000, 512, 2000000, 32, new ItemStack[]{ - ItemList.Electric_Piston_UV.get(16L), - ItemList.Electric_Motor_UV.get(64L), + 32000000, 8192, 128000000, 1, new ItemStack[]{ + ItemList.Electric_Piston_UEV.get(16L), + ItemList.Electric_Motor_UEV.get(64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NetherStar, 64L), @@ -1304,18 +1304,18 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Ardite, 8L), GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Ruby, 16L), GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Jasper, 16L), - getItemContainer("NanoCircuit").get(1L).splitStack(32) + getItemContainer("QuantumCircuit").get(1L).splitStack(32) }, new FluidStack[]{ Materials.Neutronium.getMolten(9216L), Materials.Tritanium.getMolten(9216L), - Materials.Tetranaquadahdiindiumhexaplatiumosminid.getMolten(9216L), + Materials.Longasssuperconductornameforuhvwire.getMolten(9216L), Materials.Silver.getPlasma(9216L) }, - getItemContainer("StargateChevron").get(1L), 72000, 2000000); + getItemContainer("StargateChevron").get(1L), 72000, 500000000); TT_recipeAdder.addResearchableAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 32000000, 8192, 128000000, 1, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Infinity, 64L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.CosmicNeutronium, 64L), @@ -1327,7 +1327,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Tritanium.getMolten(73728L), Materials.Concrete.getMolten(73728L) }, - getItemContainer("StargateFramePart").get(1L), 72000, 2000000); + getItemContainer("StargateFramePart").get(1L), 72000, 500000000); } //endregion -- cgit From dbfb2dbcdfc9715bca3a61481c350687d6bdc4f1 Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Thu, 20 Jan 2022 23:02:16 +0000 Subject: Fix UMV energy hatch/dynamo recipe to use correct circuit --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 5c2f8529a8..2efe5c5c3e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1111,7 +1111,7 @@ public class DreamCraftRecipeLoader implements Runnable { getItemContainer("Hull_UMV").get(1L), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 16L), ItemList.Circuit_Chip_QPIC.get(4L), - getItemContainer("PikoCircuit").get(2), + getItemContainer("QuantumCircuit").get(2), ItemList.UHV_Coil.get(16L), ItemList.Reactor_Coolant_Sp_6.get(1L), ItemList.Reactor_Coolant_Sp_6.get(1L), @@ -1134,7 +1134,7 @@ public class DreamCraftRecipeLoader implements Runnable { getItemContainer("Hull_UMV").get(1L), GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 64L), ItemList.Circuit_Chip_QPIC.get(4L), - getItemContainer("PikoCircuit").get(2), + getItemContainer("QuantumCircuit").get(2), ItemList.UHV_Coil.get(16L), ItemList.Reactor_Coolant_Sp_6.get(1L), ItemList.Reactor_Coolant_Sp_6.get(1L), -- cgit From 223bbd822b8656fe4b5d805db71dab4730dc145d Mon Sep 17 00:00:00 2001 From: Sphyix Date: Fri, 21 Jan 2022 00:29:47 +0100 Subject: fix consistency across circuits --- .../tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index b679d3cff8..c95caf742e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1246,7 +1246,7 @@ public class DreamCraftRecipeLoader implements Runnable { TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("PikoCircuit").get(1L), 720000, 2048, 8000000, 128, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 16), - getItemContainer("PikoCircuit").get(8L), + getItemContainer("PikoCircuit").get(2L), ItemList.Circuit_Parts_CapacitorASMD.get(64L), ItemList.Circuit_Parts_DiodeASMD.get(64L), ItemList.Circuit_Parts_TransistorASMD.get(64L), -- cgit From b5399199a88d7c6c19a2ed494aa9c66b81bf2249 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 22 Jan 2022 23:33:56 +0100 Subject: Rework API, add locale --- .../java/com/github/technus/tectech/TecTech.java | 19 +- .../dreamcraft/DreamCraftRecipeLoader.java | 8 +- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 68 +- .../blocks/turretbases/TurretBaseEM.java | 2 +- .../blocks/turretheads/TurretHeadEM.java | 2 +- .../entity/projectiles/projectileEM.java | 4 +- .../tileentity/turret/TileTurretHeadEM.java | 6 +- .../spartakcore/SpartakCoreRecipeLoader.java | 9 +- .../definitions/EMComplexAspectDefinition.java | 78 +- .../definitions/EMPrimalAspectDefinition.java | 41 +- .../transformations/AspectDefinitionCompat.java | 7 +- .../AspectDefinitionCompatEnabled.java | 11 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 8 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 4 +- .../technus/tectech/loader/ElementalLoader.java | 29 +- .../github/technus/tectech/loader/MainLoader.java | 26 +- .../tectech/loader/gui/CreativeTabTecTech.java | 2 - .../tectech/loader/recipe/BaseRecipeLoader.java | 125 +++ .../tectech/loader/recipe/BloodyRecipeLoader.java | 6 +- .../tectech/loader/recipe/RecipeLoader.java | 121 -- .../tectech/loader/thing/MachineLoader.java | 15 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 14 +- .../elementalMatter/core/EMException.java | 3 - .../elementalMatter/core/commands/EMGive.java | 118 +- .../elementalMatter/core/commands/EMList.java | 56 +- .../core/definitions/EMComplexTemplate.java | 20 +- .../core/definitions/EMDefinitionsRegistry.java | 110 -- .../core/definitions/EMPrimitiveTemplate.java | 67 +- .../core/definitions/IEMDefinition.java | 32 +- .../registry/EMDefinitionsRegistry.java | 189 ++++ .../core/definitions/registry/EMIndirectType.java | 37 + .../core/definitions/registry/EMType.java | 63 ++ .../core/maps/EMConstantStackMap.java | 5 +- .../core/maps/EMDefinitionStackMap.java | 5 +- .../core/maps/EMInstanceStackMap.java | 32 +- .../elementalMatter/core/maps/IEMMapRead.java | 20 +- .../elementalMatter/core/maps/IEMMapWrite.java | 12 +- .../core/maps/IEMMapWriteExact.java | 6 +- .../core/stacks/EMDefinitionStack.java | 10 +- .../core/stacks/EMInstanceStack.java | 61 +- .../elementalMatter/core/stacks/IEMStack.java | 33 +- .../core/transformations/EMDequantizationInfo.java | 56 + .../transformations/EMFluidDequantizationInfo.java | 43 - .../transformations/EMFluidQuantizationInfo.java | 4 +- .../transformations/EMItemDequantizationInfo.java | 45 - .../transformations/EMItemQuantizationInfo.java | 4 +- .../EMOredictDequantizationInfo.java | 60 - .../transformations/EMOredictQuantizationInfo.java | 41 +- .../core/transformations/EMTransformationInfo.java | 165 --- .../transformations/EMTransformationRegistry.java | 134 +++ .../core/transformations/IEMExchangeInfo.java | 11 - .../core/transformations/OreDictionaryStack.java | 19 + .../definitions/complex/EMAtomDefinition.java | 1187 ++++++++++---------- .../definitions/complex/EMHadronDefinition.java | 229 ++-- .../definitions/primitive/EMBosonDefinition.java | 38 +- .../definitions/primitive/EMFermionDefinition.java | 16 + .../primitive/EMGaugeBosonDefinition.java | 83 ++ .../definitions/primitive/EMLeptonDefinition.java | 43 +- .../primitive/EMNeutrinoDefinition.java | 41 +- .../primitive/EMPrimitiveDefinition.java | 50 +- .../definitions/primitive/EMQuarkDefinition.java | 87 +- .../primitive/EMScalarBosonDefinition.java | 46 + .../github/technus/tectech/recipe/TT_recipe.java | 19 +- .../tectech/thing/block/QuantumGlassBlock.java | 2 +- .../tectech/thing/casing/GT_Block_CasingsNH.java | 2 +- .../tectech/thing/casing/GT_Block_CasingsTT.java | 2 +- .../tectech/thing/casing/GT_Block_HintTT.java | 2 +- .../technus/tectech/thing/item/AvrProgrammer.java | 2 +- .../thing/item/ConstructableTriggerItem.java | 2 +- .../item/DebugElementalInstanceContainer_EM.java | 32 +- .../item/ElementalDefinitionContainer_EM.java | 11 +- .../item/ElementalDefinitionScanStorage_EM.java | 2 +- .../technus/tectech/thing/item/EuMeterGT.java | 2 +- .../thing/item/FrontRotationTriggerItem.java | 2 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 2 +- .../tectech/thing/metaTileEntity/Textures.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 8 +- .../multi/GT_MetaTileEntity_EM_collider.java | 717 ------------ .../multi/GT_MetaTileEntity_EM_decay.java | 4 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 49 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 11 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 10 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 +- .../em_collider/GT_MetaTileEntity_EM_collider.java | 709 ++++++++++++ .../multi/em_collider/IColliderHandler.java | 5 + .../em_collider/IPrimitiveColliderHandler.java | 8 + .../multi/em_machine/Behaviour_Centrifuge.java | 7 +- .../Behaviour_ElectromagneticSeparator.java | 9 +- .../github/technus/tectech/util/DoubleCount.java | 6 + .../java/com/github/technus/tectech/util/Util.java | 12 + src/main/resources/assets/tectech/lang/en_US.lang | 103 +- 91 files changed, 2929 insertions(+), 2703 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index ef5e146bfa..d730d64a65 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -2,6 +2,7 @@ package com.github.technus.tectech; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; +import com.github.technus.tectech.loader.gui.CreativeTabTecTech; import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler; import com.github.technus.tectech.mechanics.anomaly.CancerCommand; import com.github.technus.tectech.mechanics.anomaly.ChargeCommand; @@ -11,6 +12,8 @@ import com.github.technus.tectech.mechanics.data.ChunkDataHandler; import com.github.technus.tectech.mechanics.data.PlayerPersistence; import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMGive; import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.proxy.CommonProxy; import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.FMLCommonHandler; @@ -41,7 +44,8 @@ public class TecTech { public static TecTech instance; public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; - public static final LogHelper LOGGER = new LogHelper(Reference.MODID); + public static final LogHelper LOGGER = new LogHelper(Reference.MODID); + public static CreativeTabTecTech creativeTabTecTech; private static IngameErrorLog moduleAdminErrorLogs; public static TecTechConfig configTecTech; @@ -50,6 +54,9 @@ public class TecTech { public static AnomalyHandler anomalyHandler; public static PlayerPersistence playerPersistence; + public static final EMDefinitionsRegistry definitionsRegistry =new EMDefinitionsRegistry(); + public static final EMTransformationRegistry transformationInfo =new EMTransformationRegistry(); + /** * For Loader.isModLoaded checks during the runtime */ @@ -106,7 +113,7 @@ public class TecTech { Field field= GT_Proxy.class.getDeclaredField("mEvents"); field.setAccessible(true); modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL ); - field.set(GT_Mod.gregtechproxy, new Collection() { + field.set(GT_Mod.gregtechproxy, new Collection() { @Override public int size() { return 0; @@ -123,8 +130,8 @@ public class TecTech { } @Override - public Iterator iterator() { - return new Iterator() { + public Iterator iterator() { + return new Iterator() { @Override public boolean hasNext() { return false; @@ -188,13 +195,13 @@ public class TecTech { } - MainLoader.load(); + MainLoader.load(definitionsRegistry); MainLoader.addAfterGregTechPostLoadRunner(); } @Mod.EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { - MainLoader.postLoad(); + MainLoader.postLoad(definitionsRegistry,transformationInfo); chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler=new AnomalyHandler()); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 00b31915c2..4ebe84147f 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.dreamcraft; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -23,12 +24,12 @@ import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault; +import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault; /** * Created by Tec on 06.08.2017. */ -public class DreamCraftRecipeLoader implements Runnable { +public class DreamCraftRecipeLoader { //region reflect a bit @SuppressWarnings("rawtypes") private Class CUSTOM_ITEM_LIST; @@ -48,8 +49,7 @@ public class DreamCraftRecipeLoader implements Runnable { } //endregion - @Override - public void run() { + public void run(EMTransformationRegistry transformationInfo) { //region reflect a bit try { CUSTOM_ITEM_LIST = Class.forName("com.dreammaster.gthandler.CustomItemList"); diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index ee7d293e08..67a363fc6c 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -1,18 +1,19 @@ package com.github.technus.tectech.compatibility.gtpp; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getBestUnstableIsotope; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getFirstStableIsotope; -public class GtppAtomLoader implements Runnable{ +public class GtppAtomLoader { //region reflect a bit - private Class ELEMENT; + private Class ELEMENT; private Object ELEMENT_INSTANCE; private Method getUnlocalizedName,getFluid,generate; @@ -41,14 +42,13 @@ public class GtppAtomLoader implements Runnable{ } //endregion - @Override - public void run() { + public void setTransformations(EMTransformationRegistry transformationInfo) { //region reflect a bit try{ ELEMENT=Class.forName("gtPlusPlus.core.material.ELEMENT"); ELEMENT_INSTANCE=ELEMENT.getMethod("getInstance").invoke(null); - Class clazz=Class.forName("gtPlusPlus.core.material.Material"); + Class clazz=Class.forName("gtPlusPlus.core.material.Material"); getUnlocalizedName=clazz.getMethod("getUnlocalizedName"); getFluid=clazz.getMethod("getFluid", int.class); @@ -59,34 +59,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("NEON",144)); generate("GERMANIUM",true,true); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("BROMINE",144)); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("KRYPTON",144)); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),getFluid("XENON",144)); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java index 9da3b82b40..654b4e37a6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java @@ -10,7 +10,7 @@ import net.minecraft.world.World; import openmodularturrets.blocks.turretbases.BlockAbstractTurretBase; import openmodularturrets.handler.ConfigHandler; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by Tec on 27/07/2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java index 7b7167b915..da212d4853 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java @@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import openmodularturrets.tileentity.turretbase.TurretBase; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by Tec on 27/07/2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index 785b59f093..54bd3aaea5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -52,10 +52,10 @@ public class projectileEM extends LaserProjectile { charge=projectileContent.getCharge(); massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass()); - if(projectileContent.getDefinition().getMatterType()>1 || projectileContent.getDefinition().getMatterType()<-1) { + if(projectileContent.getDefinition().getGeneration()>1 || projectileContent.getDefinition().getGeneration()<-1) { strange = true; } - if(projectileContent.getDefinition().getMatterType()<0) { + if(projectileContent.getDefinition().getGeneration()<0) { antiMatter = true; } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 6dc5c4f60a..742232d8c6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -14,7 +14,7 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; /** * Created by Bass on 27/07/2017. @@ -71,8 +71,8 @@ public class TileTurretHeadEM extends TurretHead{ return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null); } EMInstanceStack stack = hatchContentPointer.getRandom(); - double amount = Math.min(AVOGADRO_CONSTANT, stack.getAmount()); - hatchContentPointer.removeAmount(stack.getDefinition(),AVOGADRO_CONSTANT); + double amount = Math.min(EM_COUNT_PER_MATERIAL_AMOUNT, stack.getAmount()); + hatchContentPointer.removeAmount(stack.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT); stack=stack.clone(); stack.setAmount(amount); return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack); diff --git a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java index 3fabfd67b2..b2050bbac5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.spartakcore; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -19,15 +20,13 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault; +import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault; /** * Created by Spartak1997 on 28.07.2019. */ -public class SpartakCoreRecipeLoader implements Runnable { - - @Override - public void run() { +public class SpartakCoreRecipeLoader { + public void run(EMTransformationRegistry transformationInfo) { //Quantum Glass GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ 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 a062fa0dab..40419604e4 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 @@ -2,24 +2,21 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defi import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -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.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; -import net.minecraft.nbt.NBTTagCompound; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.util.Util; import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static net.minecraft.util.StatCollector.translateToLocal; @@ -30,7 +27,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { private final int hash; private final double mass; - private static final byte nbtType = (byte) 'c'; + private static final String nbtType = "`"; private final EMConstantStackMap aspectStacks; @@ -76,7 +73,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { @Override public String getLocalizedName() { - String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this); + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); if (name != null) { name = name.substring(0, 1).toUpperCase() + name.substring(1); } else { @@ -124,25 +121,10 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { } @Override - protected int getIndirectTagValue() { + protected String getIndirectTagValue() { return nbtType; } - public static EMComplexAspectDefinition fromNBT(NBTTagCompound nbt) { - EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new EMComplexAspectDefinition(stacks); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - @Override public double getRawTimeSpan(long currentEnergy) { return -1; @@ -159,12 +141,12 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { } @Override - public byte getMatterType() { + public int getGeneration() { return 0; } @Override - public byte getColor() { + public int getMaxColors() { return -1; } @@ -175,7 +157,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { - return new EMDecay[]{new EMDecay(0.75F, aspectStacks), EMBosonDefinition.deadEnd}; + return new EMDecay[]{new EMDecay(0.75F, aspectStacks), deadEnd}; } @Override @@ -218,45 +200,25 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { return mass; } - @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - @Override public IEMDefinition getAnti() { return null; } - public static void run() { - try { - EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMComplexAspectDefinition::fromNBT,EMComplexAspectDefinition.class, getClassTypeStatic()); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt)-> + new EMComplexAspectDefinition(EMConstantStackMap.fromNBT(definitionsRegistry,nbt)), EMComplexAspectDefinition.class, "tt.keyword.Aspect")); if (DEBUG_MODE) { TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + getClassTypeStatic()); } } @Override - public byte getClassType() { + public int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic() { + public static int getClassTypeStatic() { return -96; } @@ -275,7 +237,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType()); + lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getMatterMassType()); } if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { lines.add(translateToLocal("tt.keyword.NAME") + " = " + getLocalizedName()); @@ -285,7 +247,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); } if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); + lines.add(hasColor() ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); } if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java index e62c2e5278..885a71ef28 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -1,6 +1,9 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; import static net.minecraft.util.StatCollector.translateToLocal; @@ -10,29 +13,35 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { public static final EMPrimalAspectDefinition - magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), - magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), - magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), - magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), - magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), - magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); + magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 45,"a`"), + magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 44,"e`"), + magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 43,"f`"), + magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 42,"w`"), + magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 40,"o`"), + magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Chaos"), "c`", 1e5D, 41,"c`"); - private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID) { - super(name, symbol, 0, mass, 0, -1, ID); + private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID,String bind) { + super(name, symbol, 0, mass, 0, -1, ID,bind); } - public static void run() { - magic_air.init(null, -1F, -1, -1, NO_DECAY); - magic_earth.init(null, -1F, -1, -1, NO_DECAY); - magic_fire.init(null, -1F, -1, -1, NO_DECAY); - magic_water.init(null, -1F, -1, -1, NO_DECAY); - magic_order.init(null, -1F, -1, -1, NO_DECAY); - magic_entropy.init(null, -1F, -1, -1, NO_DECAY); + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMPrimalAspectDefinition.class,"tt.keyword.Primal")); + magic_air.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_earth.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_fire.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_water.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_order.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_entropy.init(registry,null, -1F, -1, -1, NO_DECAY); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Primal") + ": " + getName(); + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); + if (name != null) { + return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName()+" ("+name+")"; + } else { + return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName(); + } } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java index a4328d2e03..c1c6c6dcb2 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import java.util.HashMap; @@ -13,12 +14,16 @@ public class AspectDefinitionCompat { private final HashMap defToAspect = new HashMap<>(); private final HashMap aspectToDef = new HashMap<>(); - public void run(){} + public void run(EMDefinitionsRegistry registry){} public String getAspectTag(IEMDefinition definition){ return null; } + public String getAspectLocalizedName(IEMDefinition definition){ + return null; + } + public IEMDefinition getDefinition(String aspect){ return null; } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java index ead8a5fdef..ccccff7c3d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -2,20 +2,20 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry.STACKS_REGISTERED; /** * Created by Tec on 21.05.2017. */ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { @Override - public void run(){ + public void run(EMDefinitionsRegistry registry){ getDefToAspect().put(magic_air,"aer"); getDefToAspect().put(magic_earth,"terra"); getDefToAspect().put(magic_fire,"ignis"); @@ -51,6 +51,7 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } getAspectToDef().put(aspect.getTag(),newAspect); getDefToAspect().put(newAspect,aspect.getTag()); + registry.registerForDisplay(newAspect); }catch (EMException e) { /**/ }finally { @@ -60,7 +61,6 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } } } - STACKS_REGISTERED.addAll(getDefToAspect().keySet()); } @Override @@ -68,6 +68,11 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat return getDefToAspect().get(definition); } + public String getAspectLocalizedName(IEMDefinition definition){ + Aspect aspect = Aspect.aspects.get(getAspectTag(definition)); + return aspect != null ? aspect.getName() : null; + } + @Override public IEMDefinition getDefinition(String aspect) { return getAspectToDef().get(aspect); diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index dbcbe7d86b..267af79784 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -26,8 +26,8 @@ import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; +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_ITEM_DIMINISHED; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -100,7 +100,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } EMInstanceStack stack = inputHatchContainer.getRandom(); - if (stack.getAmount() < AVOGADRO_CONSTANT_DIMINISHED) { + if (stack.getAmount() < EM_COUNT_PER_ITEM_DIMINISHED) { cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[6]; } else { @@ -111,7 +111,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[7]; } else { - inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(AVOGADRO_CONSTANT)); + inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(EM_COUNT_PER_MATERIAL_AMOUNT)); if (aspect.isPrimal()) { mEUt = (int) -V[8]; } else { diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 5fe8c973fe..a381a37f89 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -25,7 +25,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -90,7 +90,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu mEfficiencyIncrease = 10000; eAmpereFlow = 1; outputEM = new EMInstanceStackMap[]{ - new EMInstanceStackMap(new EMInstanceStack(definition,AVOGADRO_CONSTANT)) + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)) }; if (definition instanceof EMPrimalAspectDefinition) { mEUt = (int) -V[8]; diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index 61989e7b13..773361bd0f 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -2,36 +2,33 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMNuclideIAEA; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*; /** * Created by danie_000 on 16.11.2016. */ -public class ElementalLoader implements Runnable { - @Override - public void run() { +public class ElementalLoader { + public void run(EMDefinitionsRegistry registry) { // =================================================================================================== // Definition init // =================================================================================================== - EMPrimitiveDefinition.run(); + EMPrimitiveDefinition.run(registry); - EMQuarkDefinition.run(); - EMLeptonDefinition.run(); - EMNeutrinoDefinition.run(); - EMBosonDefinition.run(); + EMQuarkDefinition.run(registry); + EMLeptonDefinition.run(registry); + EMNeutrinoDefinition.run(registry); + EMGaugeBosonDefinition.run(registry); + EMScalarBosonDefinition.run(registry); - EMHadronDefinition.run(); + EMHadronDefinition.run(registry); - EMNuclideIAEA.run(); + EMAtomDefinition.run(registry); - EMAtomDefinition.run(); - - EMPrimalAspectDefinition.run(); - - EMComplexAspectDefinition.run(); + EMPrimalAspectDefinition.run(registry); + EMComplexAspectDefinition.run(registry); } } diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index b3c8d24a7c..e2f1e2882f 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -8,14 +8,16 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.loader.recipe.RecipeLoader; +import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; import com.github.technus.tectech.loader.thing.ComponentLoader; import com.github.technus.tectech.loader.thing.CoverLoader; import com.github.technus.tectech.loader.thing.MachineLoader; import com.github.technus.tectech.loader.thing.ThingsLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.Textures; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_collider; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.common.network.NetworkRegistry; @@ -43,7 +45,7 @@ import static com.github.technus.tectech.TecTech.*; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static gregtech.api.enums.GT_Values.W; public final class MainLoader { @@ -65,17 +67,17 @@ public final class MainLoader { //set expanded texture arrays for tiers try { - new Textures(); + Textures.run(); }catch (Throwable t){ LOGGER.error("Loading textures...",t); } } - public static void load() { + public static void load(EMDefinitionsRegistry registry) { ProgressManager.ProgressBar progressBarLoad = ProgressManager.push("TecTech Loader", 9); progressBarLoad.step("Elemental Things"); - new ElementalLoader().run(); + new ElementalLoader().run(registry); LOGGER.info("Elemental Init Done"); progressBarLoad.step("Thaumcraft Compatibility"); @@ -120,7 +122,7 @@ public final class MainLoader { ProgressManager.pop(progressBarLoad); } - public static void postLoad() { + public static void postLoad(EMDefinitionsRegistry registry, EMTransformationRegistry transformationInfo) { ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 6); progressBarPostLoad.step("Dreamcraft Compatibility"); @@ -138,15 +140,11 @@ public final class MainLoader { } progressBarPostLoad.step("Thaumcraft Compatibility"); - if (Loader.isModLoaded(Reference.THAUMCRAFT)) { - aspectDefinitionCompat = new AspectDefinitionCompatEnabled(); - aspectDefinitionCompat.run(); - } else { - aspectDefinitionCompat = new AspectDefinitionCompat(); - } + aspectDefinitionCompat = Loader.isModLoaded(Reference.THAUMCRAFT) ? new AspectDefinitionCompatEnabled() : new AspectDefinitionCompat(); + aspectDefinitionCompat.run(registry); progressBarPostLoad.step("Recipes"); - new RecipeLoader().run(); + new BaseRecipeLoader().run(transformationInfo); TecTech.LOGGER.info("Recipe Init Done"); progressBarPostLoad.step("Register Extra Hazmat Suits"); diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java index d360162fb6..e5b9fea395 100644 --- a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java @@ -11,8 +11,6 @@ import net.minecraft.item.Item; import java.util.List; public class CreativeTabTecTech extends CreativeTabs { - public static CreativeTabTecTech creativeTabTecTech; - public CreativeTabTecTech(String name) { super(name); } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java new file mode 100644 index 0000000000..d91d0e5900 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java @@ -0,0 +1,125 @@ +package com.github.technus.tectech.loader.recipe; + +import com.github.technus.tectech.Reference; +import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; +import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; +import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.thing.CustomItemList; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.item.ConstructableTriggerItem; +import com.github.technus.tectech.thing.item.EuMeterGT; +import com.github.technus.tectech.thing.item.FrontRotationTriggerItem; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import static gregtech.api.enums.GT_Values.RA; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class BaseRecipeLoader { + public static Materials getOrDefault(String name,Materials def){ + Materials mat=Materials.get(name); + return mat == Materials._NULL || mat == null ? def : mat; + } + + public void run(EMTransformationRegistry transformationInfo) { + EMAtomDefinition.setTransformations(transformationInfo); + EMHadronDefinition.setTransformations(transformationInfo); + if (Loader.isModLoaded(Reference.GTPLUSPLUS)) { + new GtppAtomLoader().setTransformations(transformationInfo); + } + + // =================================================================================================== + // Recipes init - common goes here rest goes into methods below + // =================================================================================================== + + for(int i=0;i<=15;i++) { + RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, Materials.Aluminium.getMolten(864), new ItemStack(TT_Container_Casings.sHintCasingsTT, 1, i), 32, 120); + } + + //Scrench + GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"fPR", " RP", "S h", + 'P', OrePrefixes.plate.get(Materials.Cobalt), + 'R', OrePrefixes.stick.get(Materials.Cobalt), + 'S', OrePrefixes.stick.get(Materials.Wood),}); + + //BLUEprint + GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); + + //GT EU reader + GT_ModHandler.addCraftingRecipe(new ItemStack(EuMeterGT.INSTANCE,1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"PGW", "SCW", "BRN", + 'P', OrePrefixes.plateDouble.get(Materials.Steel), + 'G', OrePrefixes.plate.get(Materials.Glass), + 'W', OrePrefixes.cableGt01.get(Materials.Copper), + 'S', OrePrefixes.stick.get(Materials.Brass), + 'C', ItemList.Casing_Coil_Cupronickel.get(1), + 'B', Dyes.dyeBlue, + 'R', Dyes.dyeRed, + 'N', Dyes.dyeBlack,}); + + //Owner detector + GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_OwnerDetector.get(1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"PPP","GEG","PPP", + 'P', OrePrefixes.plate.get(Materials.IronMagnetic), + 'G', OrePrefixes.plate.get(Materials.Glass), + 'E', OrePrefixes.gem.get(Materials.EnderPearl)}); + + //Data reader + GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_DataReader.get(1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"BdB","GES","PwP", + 'B', OrePrefixes.screw.get(Materials.Iridium), + 'P', OrePrefixes.plate.get(Materials.Iridium), + 'G', ItemList.Cover_Screen, + 'S', OrePrefixes.circuit.get(Materials.Elite), + 'E', ItemList.Hull_IV}); + + //Data Bank + RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new ItemStack[]{ + CustomItemList.Machine_Multi_Switch.get(1), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), + ItemList.Tool_DataOrb.get(1), + ItemList.Cover_Screen.get(1), + }, new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Hydrogen.getGas(1000), + }, CustomItemList.Machine_Multi_DataBank.get(1), 12000, 14000); + //CustomItemList.Machine_Multi_DataBank + + //Bucks + //RA.addAssemblerRecipe(CustomItemList.) + + //recipe for ass line data hatches + RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataIn_Hatch.get(1), CustomItemList.dataInAss_Hatch.get(1), 2048, 12000); + RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataOut_Hatch.get(1), CustomItemList.dataOutAss_Hatch.get(1), 2048, 12000); + + if (Loader.isModLoaded(Reference.DREAMCRAFT)) { + new DreamCraftRecipeLoader().run(transformationInfo);//init recipes for GTNH version + } else if (Loader.isModLoaded(Reference.SPARTAKCORE)) { + new SpartakCoreRecipeLoader().run(transformationInfo);//init recipes for SpartakCore version + } else { + new BloodyRecipeLoader().run(transformationInfo);//init recipes for NON-GTNH version + } + } +} + diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java index 7b8cc14f4d..a57f268d4e 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.loader.recipe; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -22,9 +23,8 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 06.08.2017. */ -public class BloodyRecipeLoader implements Runnable { - @Override - public void run() { +public class BloodyRecipeLoader { + public void run(EMTransformationRegistry transformationInfo) { //Quantum Glass GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.eM_Containment.get(1), diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java deleted file mode 100644 index b5333c8e0d..0000000000 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.github.technus.tectech.loader.recipe; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; -import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.EuMeterGT; -import com.github.technus.tectech.thing.item.FrontRotationTriggerItem; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import static gregtech.api.enums.GT_Values.RA; - -/** - * Created by danie_000 on 16.11.2016. - */ -public class RecipeLoader implements Runnable { - public static Materials getOrDefault(String name,Materials def){ - Materials mat=Materials.get(name); - return mat == Materials._NULL || mat == null ? def : mat; - } - - @Override - public void run() { - EMAtomDefinition.setTransformations(); - EMHadronDefinition.setTransformations(); - - // =================================================================================================== - // Recipes init - common goes here rest goes into methods below - // =================================================================================================== - - for(int i=0;i<=15;i++) { - RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, Materials.Aluminium.getMolten(864), new ItemStack(TT_Container_Casings.sHintCasingsTT, 1, i), 32, 120); - } - - //Scrench - GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"fPR", " RP", "S h", - 'P', OrePrefixes.plate.get(Materials.Cobalt), - 'R', OrePrefixes.stick.get(Materials.Cobalt), - 'S', OrePrefixes.stick.get(Materials.Wood),}); - - //BLUEprint - GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); - - //GT EU reader - GT_ModHandler.addCraftingRecipe(new ItemStack(EuMeterGT.INSTANCE,1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"PGW", "SCW", "BRN", - 'P', OrePrefixes.plateDouble.get(Materials.Steel), - 'G', OrePrefixes.plate.get(Materials.Glass), - 'W', OrePrefixes.cableGt01.get(Materials.Copper), - 'S', OrePrefixes.stick.get(Materials.Brass), - 'C', ItemList.Casing_Coil_Cupronickel.get(1), - 'B', Dyes.dyeBlue, - 'R', Dyes.dyeRed, - 'N', Dyes.dyeBlack,}); - - //Owner detector - GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_OwnerDetector.get(1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"PPP","GEG","PPP", - 'P', OrePrefixes.plate.get(Materials.IronMagnetic), - 'G', OrePrefixes.plate.get(Materials.Glass), - 'E', OrePrefixes.gem.get(Materials.EnderPearl)}); - - //Data reader - GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_DataReader.get(1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"BdB","GES","PwP", - 'B', OrePrefixes.screw.get(Materials.Iridium), - 'P', OrePrefixes.plate.get(Materials.Iridium), - 'G', ItemList.Cover_Screen, - 'S', OrePrefixes.circuit.get(Materials.Elite), - 'E', ItemList.Hull_IV}); - - //Data Bank - RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new ItemStack[]{ - CustomItemList.Machine_Multi_Switch.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), - ItemList.Tool_DataOrb.get(1), - ItemList.Cover_Screen.get(1), - }, new FluidStack[]{ - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), - Materials.Hydrogen.getGas(1000), - }, CustomItemList.Machine_Multi_DataBank.get(1), 12000, 14000); - //CustomItemList.Machine_Multi_DataBank - - //Bucks - //RA.addAssemblerRecipe(CustomItemList.) - - //recipe for ass line data hatches - RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataIn_Hatch.get(1), CustomItemList.dataInAss_Hatch.get(1), 2048, 12000); - RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataOut_Hatch.get(1), CustomItemList.dataOutAss_Hatch.get(1), 2048, 12000); - - if (Loader.isModLoaded(Reference.DREAMCRAFT)) { - new DreamCraftRecipeLoader().run();//init recipes for GTNH version - } else if (Loader.isModLoaded(Reference.SPARTAKCORE)) { - new SpartakCoreRecipeLoader().run();//init recipes for SpartakCore version - } else { - new BloodyRecipeLoader().run();//init recipes for NON-GTNH version - } - } -} - diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index b3df7483f5..4dd9d3422d 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaQuantizer; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; @@ -15,7 +16,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; @@ -74,22 +75,22 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); // =================================================================================================== 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 c6ac34b66d..84f8a5e9d6 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 @@ -31,18 +31,18 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +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; public class AnomalyHandler implements IChunkMetaDataHandler { - private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... + private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;//can be const as it is computed later... private static final int COUNT_DIV=32; private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; private static final int MEAN_DELAY =50; - private static final double CANCER_EFFECTIVENESS = 1/AVOGADRO_CONSTANT; - private static final double CHARGE_EFFECTIVENESS = 10/AVOGADRO_CONSTANT; - private static final double CHARGE_EXPLOSIVENESS = 5/AVOGADRO_CONSTANT; + private static final double CANCER_EFFECTIVENESS = 1/ EM_COUNT_PER_MATERIAL_AMOUNT; + private static final double CHARGE_EFFECTIVENESS = 10/ EM_COUNT_PER_MATERIAL_AMOUNT; + private static final double CHARGE_EXPLOSIVENESS = 5/ EM_COUNT_PER_MATERIAL_AMOUNT; private boolean fixMe=false; private final ArrayList playersWithCharge = new ArrayList<>(); @@ -133,7 +133,7 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } private void swapSomething(Chunk a,Chunk b,double mass) { - float explosionPower=(float) Math.log(mass/AVOGADRO_CONSTANT); + float explosionPower=(float) Math.log(mass/ EM_COUNT_PER_MATERIAL_AMOUNT); for (int i = 0; i < Math.min((int)explosionPower,64); i++) { int x = TecTech.RANDOM.nextInt(16); int y = TecTech.RANDOM.nextInt(a.worldObj.getActualHeight()); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java index e00e72446d..d607dfad73 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java @@ -19,7 +19,4 @@ public final class EMException extends RuntimeException { public EMException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } - - public EMException() { - } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java index af4caf854b..18f2f76498 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -1,36 +1,31 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.definitions.EMPrimitiveTemplate; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; /** * Created by danie_000 on 30.12.2017. */ public class EMGive implements ICommand { - ArrayList aliases=new ArrayList<>(); + ArrayList aliases = new ArrayList<>(); - public EMGive(){ + public EMGive() { aliases.add("em_give"); aliases.add("give_em"); aliases.add("gib_em"); @@ -39,27 +34,24 @@ public class EMGive implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) { if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - if(args.length < 3) { + if (args.length < 3) { sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - }else{ - TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args)); + } else { + TecTech.LOGGER.info("Spawninig EM for " + ((EntityPlayerMP) sender).getDisplayName() + " - " + Arrays.toString(args)); - ArrayList list = new ArrayList<>(Arrays.asList(args)); - String energy=list.remove(0); + ArrayList list = new ArrayList<>(Arrays.asList(args)); + String energy = list.remove(0); - EMDefinitionStack def = getDefinitionStack(list); - if(def!=null) { - EMInstanceStack instanceStack = new EMInstanceStack(def, 1D, 0D, Long.parseLong(energy)); + EMDefinitionStack def = getDefinitionStack(TecTech.definitionsRegistry, list); + if (def != null) { + EMInstanceStack instanceStack = new EMInstanceStack(def, 1, 0, Long.parseLong(energy)); sender.addChatMessage(new ChatComponentText(instanceStack.getDefinition().getSymbol() + " - " + instanceStack.getDefinition().getLocalizedName())); EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack); ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); - NBTTagCompound contents = new NBTTagCompound(); - contents.setTag("info", instanceMap.getInfoNBT()); - contents.setTag("content", instanceMap.toNBT()); - itemStack.setTagCompound(contents); + DebugElementalInstanceContainer_EM.INSTANCE.setContent(itemStack, instanceMap); ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); } @@ -67,40 +59,45 @@ public class EMGive implements ICommand { } } - private EMDefinitionStack getDefinitionStack(ArrayList args){ - if(args.get(0).equals("<")){ - args.remove(0); + private EMDefinitionStack getDefinitionStack(EMDefinitionsRegistry registry, ArrayList args) { + double amount; + if (args.size() == 0) { return null; } - double amount=Double.parseDouble(args.remove(0)); - try{ - int id=Integer.parseInt(args.get(0)); - args.remove(0); - IEMDefinition primitive = IEMDefinition.getBindsPrimitive().get(id); - return new EMDefinitionStack(primitive,amount); - }catch (NumberFormatException e){ - byte clazz = (byte) args.remove(0).charAt(0); - Method constructor = IEMDefinition.getBindsComplex().get(clazz); - - EMDefinitionStackMap stacks =new EMDefinitionStackMap(); - while(args.size()>0){ - EMDefinitionStack tempStack =getDefinitionStack(args); - if(tempStack==null) { - break; - }else { - stacks.putUnifyExact(tempStack); - } + String defTag = args.remove(0); + if ("<".equals(defTag)) { + return null; + } + try { + amount = Double.parseDouble(defTag); + if (args.size() == 0) { + return null; } - - try { - return ((IEMDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount); - } catch (Exception e1) { - if (DEBUG_MODE) { - e.printStackTrace(); + defTag = args.remove(0); + if ("<".equals(defTag)) { + return null; + } + } catch (Exception e) { + amount = 1; + } + IEMDefinition definition = registry.getDirectBinds().get(defTag); + if (definition != null) { + return definition.getStackForm(amount); + } + EMIndirectType emIndirectType = registry.getIndirectBinds().get(defTag); + if (emIndirectType != null) { + EMDefinitionStackMap stacks = new EMDefinitionStackMap(); + while (args.size() > 0) { + EMDefinitionStack definitionStack = getDefinitionStack(registry, args); + if (definitionStack == null) { + break; + } else { + stacks.putUnifyExact(definitionStack); } - return nbtE__.getStackForm(amount); } + return emIndirectType.create(registry, stacks.toNBT(registry)).getStackForm(amount); } + return null; } @Override @@ -120,33 +117,20 @@ public class EMGive implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==2){ - return completionsForClassOrID(); + if (args.length > 1 && args.length % 2 == 0) { + return new ArrayList<>(TecTech.definitionsRegistry.getBinds().keySet()); } return null; } - private List completionsForClassOrID(){ - ArrayList strings=new ArrayList<>(8); - Map binds= IEMDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())); - } - Map bindsBO = IEMDefinition.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - strings.add(String.valueOf(e.getKey().byteValue())); - } - return strings; - } - @Override public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_give Energy Count ClassOrId (Count ClassOrId ... <)"; + return "em_give Energy Count ClassOrId ( (Count ClassOrId ... <) ...<)"; } @Override public int compareTo(Object o) { - if(o instanceof ICommand){ + if (o instanceof ICommand) { return getCommandName().compareTo(((ICommand) o).getCommandName()); } return 0; 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 13531dbf85..90eddf1e23 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 @@ -1,15 +1,15 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +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 net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import java.util.Map; +import java.util.stream.Collectors; /** * Created by danie_000 on 30.12.2017. @@ -26,27 +26,32 @@ public class EMList implements ICommand { public void processCommand(ICommandSender sender, String[] args) { if (!sender.getEntityWorld().isRemote) { if(args.length == 0) { - sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); - Map binds= IEMDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); - } - }else if(args.length==1){ - sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); - if(args[0].equals(String.valueOf((char) EMPrimitiveTemplate.nbtType))){ - Map bindsBO = IEMDefinition.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName())); - } - }else{ - sender.addChatMessage(new ChatComponentText("Complex definition - needs contents")); - } - }else{ - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + listClasses(sender); + }else { + listDefinitions(sender, Util.getConcated(args," ")); } } } + private void listDefinitions(ICommandSender sender, String arg) { + sender.addChatMessage(new ChatComponentText(" Available Direct: tag - name symbol")); + for (EMType directType : TecTech.definitionsRegistry.getDirectTypes().values()) { + if ("*".equals(arg) || arg.equalsIgnoreCase(directType.getLocalizedName())) { + directType.getDefinitions().forEach((bind, definition) -> + sender.addChatMessage(new ChatComponentText(bind + " - " + definition.getLocalizedName() + " " + definition.getSymbol()))); + } + } + } + + private void listClasses(ICommandSender sender) { + sender.addChatMessage(new ChatComponentText(" Available Direct: name (use name as parameter to learn more")); + TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) -> + sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName()))); + sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name")); + TecTech.definitionsRegistry.getIndirectBinds().forEach((bind, emIndirectType) -> + sender.addChatMessage(new ChatComponentText(bind+" - "+emIndirectType.getLocalizedName()))); + } + @Override public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { return false; @@ -65,19 +70,14 @@ public class EMList implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { if(args.length==0){ - Map binds= IEMDefinition.getBindsComplex(); - ArrayList strings=new ArrayList<>(binds.size()); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); - } - return strings; + return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).collect(Collectors.toList()); } return null; } @Override public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_list (optional class tag)"; + return "em_list (optional Direct Name or *)"; } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java index 94a50ce322..13838cf443 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import net.minecraft.nbt.NBTTagCompound; @@ -29,11 +30,6 @@ public abstract class EMComplexTemplate implements IEMDefinition { return getSubParticles().compareWithAmountsInternal(o.getSubParticles()); } - @Override - public final EMDefinitionStack getStackForm(double amount) { - return new EMDefinitionStack(this, amount); - } - @Override public final boolean equals(Object obj) { if(this==obj) { @@ -50,24 +46,22 @@ public abstract class EMComplexTemplate implements IEMDefinition { @Override public int hashCode() {//Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 4); + int hash = -(getSubParticles().size() << 16); for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { int amount=(int) stack.getAmount(); - hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); + hash += ((amount & 0x1) == 0 ? -amount : amount) * (stack.getDefinition().hashCode()<<4); } return hash; } @Override public String toString() { - return getLocalizedName()+ '\n' + getSymbol(); + return getLocalizedName()+ " " + getSymbol(); } - public NBTTagCompound toNBT() { - NBTTagCompound nbtTagCompound = getSubParticles().toNBT(); - nbtTagCompound.setInteger(EMDefinitionsRegistry.getIndirectTagName(), getIndirectTagValue()); - return nbtTagCompound; + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + return registry.indirectToNBT(getIndirectTagValue(),getSubParticles()); } - protected abstract int getIndirectTagValue(); + protected abstract String getIndirectTagValue(); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java deleted file mode 100644 index c0f9df32f2..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; -import java.util.function.Function; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; - -public class EMDefinitionsRegistry { - private static final NavigableSet STACKS_REGISTERED = new TreeSet<>(); - private static final Map DIRECT_BINDS = new HashMap<>(); - private static final Map> CLASS_BINDS = new HashMap<>();//creator methods in subclasses - private static final Map> CLASSES = new HashMap<>(); - private static final Map, Integer> CLASS_TYPES = new HashMap<>(); - private static final String INDIRECT_TAG = "t"; - private static final String DIRECT_TAG = "c"; - - private EMDefinitionsRegistry() { - } - - static { - CLASS_BINDS.put(0, EMDefinitionsRegistry::getDefinitionDirect); - CLASS_BINDS.put((int) 'p', EMDefinitionsRegistry::getDefinitionDirect); - } - - private static IEMDefinition getDefinitionDirect(NBTTagCompound nbt) { - return DIRECT_BINDS.get(nbt.getInteger(getDirectTagName())); - } - - public static IEMDefinition fromNBT(NBTTagCompound nbt) { - IEMDefinition apply; - try { - apply = CLASS_BINDS.get(nbt.getInteger(getIndirectTagName())).apply(nbt); - } catch (Exception e) { - EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); - if (DEBUG_MODE) { - emException.printStackTrace(); - return nbtE__; - } else { - throw emException; - } - } - if (!DEBUG_MODE) { - if (apply == nbtE__) { - throw new EMException("Deserialized to NBT ERROR!"); - } else if (apply == null__ || apply == null) { - throw new EMException("Deserialized to NULL POINTER!"); - } - } - if (apply == null) { - return null__; - } - return apply; - } - - public static void registerDefinitionClass(int shortcutNBT, Function creator, Class clazz, int classID) { - if (CLASS_BINDS.put(shortcutNBT, creator) != null) { - EMException e = new EMException("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - if (CLASSES.put(classID, clazz) != null) { - EMException e = new EMException("Duplicate Class ID! " + classID + " used for class comparison"); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - CLASS_TYPES.put(clazz, classID); - } - - public static void registerDirectDefinition(IEMDefinition definition, int id) { - IEMDefinition old = DIRECT_BINDS.put(id, definition); - if (old != null) { - EMException e = new EMException("Duplicate primitive EM ID: " + id + - " for " + definition.getLocalizedName() + - " and " + old.getLocalizedName()); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - } - - public static NavigableSet getStacksRegisteredForDisplay() { - return STACKS_REGISTERED; - } - - public static void registerForDisplay(IEMDefinition definition){ - STACKS_REGISTERED.add(definition); - STACKS_REGISTERED.add(definition.getAnti()); - } - - public static String getIndirectTagName() { - return INDIRECT_TAG; - } - - public static String getDirectTagName() { - return DIRECT_TAG; - } -} 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 b529b79cc0..0f25d73704 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 @@ -2,10 +2,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; @@ -25,41 +23,43 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { //int -electric charge in 1/3rds of electron charge for optimization private final int charge; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private final byte color; + private final int color; //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - private final byte type; + private final int generation; - private EMPrimitiveTemplate anti;//IMMUTABLE + private IEMDefinition anti;//IMMUTABLE private EMDecay[] elementalDecays; private byte naturalDecayInstant; private byte energeticDecayInstant; private double rawLifeTime; private final int ID; + private final String bind; //no _ at end - normal particle // _ at end - anti particle // __ at end - self is antiparticle - protected EMPrimitiveTemplate(String name, String symbol, int type, double mass, int charge, int color, int ID) { + protected EMPrimitiveTemplate(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { this.name = name; this.symbol = symbol; - this.type = (byte) type; + this.generation = generation; this.mass = mass; this.charge = charge; - this.color = (byte) color; + this.color = color; this.ID = ID; - EMDefinitionsRegistry.registerDirectDefinition(this,ID); + this.bind=bind; } // - protected void init(EMPrimitiveTemplate antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { + protected void init(EMDefinitionsRegistry registry,IEMDefinition antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { anti = antiParticle; this.rawLifeTime = rawLifeTime; naturalDecayInstant = (byte) naturalInstant; energeticDecayInstant = (byte) energeticInstant; elementalDecays =elementalDecaysArray; - EMDefinitionsRegistry.registerForDisplay(this); + registry.registerForDisplay(this); + registry.registerDirectDefinition(bind,this); } @Override @@ -83,7 +83,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { } @Override - public byte getColor() { + public int getMaxColors() { return color; } @@ -153,44 +153,27 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { } @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public byte getMatterType() { - return type; + public int getGeneration() { + return generation; } @Override - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger(EMDefinitionsRegistry.getDirectTagName(), ID); - return nbt; + public final NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + return registry.directToNBT(bind); } @Override - protected final int getIndirectTagValue() { + protected final String getIndirectTagValue() { throw new EMException("This class should only be used directly!"); } @Override - public final byte getClassType() { + public final int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic(){ - return -128; + public static int getClassTypeStatic(){ + return Short.MIN_VALUE; } @Override @@ -203,7 +186,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + EMDefinitionsRegistry.getDirectTagName() + ' ' + getClassType()); + lines.add("DIRECT = " + bind + ' ' + getMatterMassType()); } if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+ getLocalizedName()); @@ -213,7 +196,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } if(areBitsSet(SCAN_GET_MASS,capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); @@ -226,7 +209,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { @Override public final int compareTo(IEMDefinition o) { - if (getClassType() == o.getClassType()) { + if (getMatterMassType() == o.getMatterMassType()) { int oID = ((EMPrimitiveTemplate) o).ID; return Integer.compare(ID, oID); } @@ -238,7 +221,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { return ID; } - public String getName() { + public String getUnlocalizedName() { return name; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java index 06bfc61737..8125812dc6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java @@ -1,11 +1,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; @@ -31,9 +29,9 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM void addScanResults(ArrayList lines, int capabilities, long energyLevel); - byte getMatterType(); + int getMatterMassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + int getGeneration(); //Not dynamically changing stuff IEMDefinition getAnti();//gives new anti particle def @@ -59,7 +57,11 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM int getCharge();//charge 1/3 electron charge //dynamically changing stuff - byte getColor();//-1 nope cannot 0 it can but undefined + int getMaxColors(); + + default boolean hasColor(){ + return getMaxColors()>0; + } double getRawTimeSpan(long currentEnergy);//defined in static fields or generated @@ -67,19 +69,17 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM EMConstantStackMap getSubParticles();//contents... null if none - EMFluidDequantizationInfo someAmountIntoFluidStack(); - - EMItemDequantizationInfo someAmountIntoItemsStack(); - - EMOredictDequantizationInfo someAmountIntoOredictStack(); + NBTTagCompound toNBT(EMDefinitionsRegistry registry); - NBTTagCompound toNBT(); - - EMDefinitionStack getStackForm(double amount); + default EMDefinitionStack getStackForm(double amount){ + return new EMDefinitionStack(this,amount); + } - IEMDefinition clone(); + default IEMDefinition clone(){ + return this; + } default int compareClassID(IEMDefinition obj) { - return (int) getClassType() - obj.getClassType(); + return getMatterMassType() - obj.getMatterMassType(); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java new file mode 100644 index 0000000000..458965da66 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java @@ -0,0 +1,189 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +public class EMDefinitionsRegistry { + private static final String TAG_NAME = "EM"; + + private final NavigableSet stacksRegistered = new TreeSet<>(); + + private final Map hashMap = new HashMap<>(); + private final Map hashMapR = Collections.unmodifiableMap(hashMap); + + private final Map, EMType> types = new HashMap<>(); + private final Map, EMType> typesR = Collections.unmodifiableMap(types); + private final Map, EMType> directTypes = new HashMap<>(); + private final Map, EMType> directTypesR = Collections.unmodifiableMap(directTypes); + private final Map, EMIndirectType> indirectTypes = new HashMap<>(); + private final Map, EMIndirectType> indirectTypesR = Collections.unmodifiableMap(indirectTypes); + + private final Map binds = new HashMap<>(); + private final Map bindsR = Collections.unmodifiableMap(binds); + private final Map directBinds = new HashMap<>(); + private final Map directBindsR = Collections.unmodifiableMap(directBinds); + private final Map indirectBinds = new HashMap<>(); + private final Map indirectBindsR = Collections.unmodifiableMap(indirectBinds); + + public NBTTagCompound directToNBT(String bind) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setString(TAG_NAME, bind); + return nbt; + } + + public NBTTagCompound indirectToNBT(String bind, IEMMapRead content) { + NBTTagCompound nbt = content.toNBT(this); + nbt.setString(TAG_NAME, bind); + return nbt; + } + + public IEMDefinition fromNBT(NBTTagCompound nbt) { + IEMDefinition definition; + try { + String bind = nbt.getString(TAG_NAME); + definition = directBinds.get(bind); + if (definition == null) { + definition = indirectBinds.get(bind).create(this, nbt); + } + } catch (Exception e) { + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + if (!DEBUG_MODE) { + if (definition == nbtE__) { + throw new EMException("Deserialized to NBT ERROR!"); + } else if (definition == null) { + throw new EMException("Deserialized to NULL POINTER!"); + } else if (definition == null__) { + throw new EMException("Deserialized to NULL!"); + } + } + if (definition == null) { + return null__; + } + return definition; + } + + public boolean isOccupied(String bind) { + return binds.containsKey(bind); + } + + protected void addType(EMType emType) { + if (types.put(emType.getClazz(), emType) != null) { + EMException e = new EMException("Class collision! " + emType.getClazz().getName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + protected void bindType(String bind, EMType emType) { + if (binds.put(bind, emType) != null) { + EMException e = new EMException("NBT Bind collision! " + bind); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public void registerDefinitionClass(String bind, EMIndirectType emIndirectType) { + addType(emIndirectType); + indirectTypes.put(emIndirectType.getClazz(), emIndirectType); + bindType(bind, emIndirectType); + indirectBinds.put(bind, emIndirectType); + } + + public void registerDefinitionClass(EMType emDirectType) { + addType(emDirectType); + } + + public void registerDirectDefinition(String bind, IEMDefinition definition) { + if (hashMap.put(definition.hashCode(), definition) != null) { + EMException e = new EMException("Hash collision! " + definition.hashCode()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + EMType emType = directTypes.get(definition.getClass()); + if (emType == null) { + emType = types.get(definition.getClass()); + if (emType != null) { + directTypes.put(definition.getClass(), emType); + } else { + EMException e = new EMException("Direct Type bind missing! " + definition.getClass().getName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + if (emType != null) { + directTypes.put(definition.getClass(), emType); + bindType(bind, emType); + emType.addDefinition(bind, definition); + directBinds.put(bind, definition); + } + } + + public void registerForDisplay(IEMDefinition definition) { + stacksRegistered.add(definition); + IEMDefinition anti = definition.getAnti(); + if (anti != null) { + stacksRegistered.add(anti); + } + } + + @Deprecated + public Map getHashMapping() { + return hashMapR; + } + + public NavigableSet getStacksRegisteredForDisplay() { + return stacksRegistered; + } + + public Map getBinds() { + return bindsR; + } + + public Map getDirectBinds() { + return directBindsR; + } + + public Map getIndirectBinds() { + return indirectBindsR; + } + + public Map, EMType> getTypes() { + return typesR; + } + + public Map, EMType> getDirectTypes() { + return directTypesR; + } + + public Map, EMIndirectType> getIndirectTypes() { + return indirectTypesR; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java new file mode 100644 index 0000000000..680dd029a4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.function.BiFunction; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +public class EMIndirectType extends EMType { + private final BiFunction creator; + + public EMIndirectType(BiFunction creator, Class clazz, String unlocalizedName) { + super(clazz, unlocalizedName); + this.creator = creator; + } + + protected BiFunction getCreator() { + return creator; + } + + public IEMDefinition create(EMDefinitionsRegistry registry,NBTTagCompound nbt){ + try { + return creator.apply(registry, nbt); + }catch (Exception e){ + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java new file mode 100644 index 0000000000..73097db663 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java @@ -0,0 +1,63 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static net.minecraft.util.StatCollector.translateToLocal; + +public class EMType { + private final Map definitions = new HashMap<>(); + private final Map definitionsR = Collections.unmodifiableMap(definitions); + private final Class clazz; + private final String unlocalizedName; + + public EMType(Class clazz, String unlocalizedName) { + this.clazz = clazz; + this.unlocalizedName = unlocalizedName; + } + + public Class getClazz() { + return clazz; + } + + public String getUnlocalizedName() { + return unlocalizedName; + } + + public String getLocalizedName() { + return translateToLocal(getUnlocalizedName()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + return clazz==((EMType) o).clazz; + } + + @Override + public int hashCode() { + return clazz.hashCode(); + } + + public void addDefinition(String bind, IEMDefinition definition) { + if (definitions.put(bind, definition) != null) { + EMException e = new EMException("NBT Bind collision on Direct bind!"); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public Map getDefinitions() { + return definitionsR; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java index e6cfa7d03e..f6bef9910e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; @@ -45,10 +46,10 @@ public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap(getBackingMap())); } - public static EMConstantStackMap fromNBT(NBTTagCompound nbt) throws EMException { + public static EMConstantStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); if (defStacks[i].getDefinition().equals(nbtE__)) { throw new EMException("Something went Wrong"); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java index 78bb8d740a..57b8f7bf1c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; @@ -43,10 +44,10 @@ public final class EMDefinitionStackMap extends EMStackMap im return new EMConstantStackMap(getBackingMap()); } - public static EMDefinitionStackMap fromNBT(NBTTagCompound nbt) throws EMException { + public static EMDefinitionStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); if (defStacks[i].getDefinition().equals(nbtE__)) { throw new EMException("Something went Wrong"); } 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 69dc53f83d..64ff7063e8 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 @@ -1,10 +1,12 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -13,9 +15,10 @@ import java.util.Map; import java.util.NavigableMap; import java.util.TreeMap; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.util.DoubleCount.add; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.01.2017. @@ -91,7 +94,7 @@ 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) +" mol"+ 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())); } @@ -120,16 +123,15 @@ public final class EMInstanceStackMap extends EMStackMap implem } public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ - cleanUp(); + //cleanUp(); double diff=0; - for (EMInstanceStack instance : valuesToArray()) { + for (EMInstanceStack instance : takeAllToArray()) { instance.setAge(instance.getAge() + seconds); EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize); if (newInstances == null) { - instance.nextColor(); + putUnify(instance); } else { diff=add(diff,newInstances.getMassDiff()); - removeAmount(instance);//todo check maybe this should be removeKey putUnifyAll(newInstances.getOutput()); } } @@ -157,10 +159,10 @@ public final class EMInstanceStackMap extends EMStackMap implem return nbt; } - public static EMInstanceStackMap fromNBT(NBTTagCompound nbt) throws EMException { + public static EMInstanceStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { EMInstanceStack[] instances = new EMInstanceStack[nbt.getInteger("i")]; for (int i = 0; i < instances.length; i++) { - instances[i] = EMInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + instances[i] = EMInstanceStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); if (instances[i].getDefinition().equals(nbtE__)) { throw new EMException("Something went Wrong"); } @@ -188,6 +190,12 @@ public final class EMInstanceStackMap extends EMStackMap implem return build.toString(); } + public EMInstanceStack[] takeAllToArray(){ + EMInstanceStack[] newStack = valuesToArray();//just in case to uncouple The map + this.getBackingMap().clear(); + return newStack; + } + public EMInstanceStackMap takeAll(){ EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map this.getBackingMap().clear(); @@ -212,7 +220,7 @@ public final class EMInstanceStackMap extends EMStackMap implem return stack; } double newAmount = add(target.getAmount(), stack.getAmount()); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=target.unifyIntoThis(stack); putReplace(stack); return stack; @@ -230,7 +238,7 @@ public final class EMInstanceStackMap extends EMStackMap implem return stack; } double newAmount = target.getAmount()+stack.getAmount(); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=target.unifyIntoThis(stack); putReplace(stack); return stack; 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 1322566914..c0420fa2b2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; @@ -9,18 +10,11 @@ import net.minecraft.util.EnumChatFormatting; import java.lang.reflect.Array; import java.util.*; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static com.github.technus.tectech.util.DoubleCount.ulpSigned; +import static net.minecraft.util.StatCollector.translateToLocal; public interface IEMMapRead extends Comparable>, Cloneable { - static boolean isValidAmount(double amount){ - return amount>=AVOGADRO_CONSTANT_UNCERTAINTY; - } - - static boolean isInvalidAmount(double amount){ - return amount getBackingMap(); IEMMapRead clone(); @@ -105,7 +99,7 @@ public interface IEMMapRead extends Comparable for (T defStack : values()) { info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getLocalizedName(); info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; + info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT+" "+translateToLocal("tt.keyword.mol"); i += 3; } return info; @@ -132,12 +126,12 @@ public interface IEMMapRead extends Comparable return nbt; } - default NBTTagCompound toNBT() { + default NBTTagCompound toNBT(EMDefinitionsRegistry registry) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", size()); int i = 0; for (Map.Entry entry : entrySet()) { - nbt.setTag(Integer.toString(i++), entry.getValue().toNBT()); + nbt.setTag(Integer.toString(i++), entry.getValue().toNBT(registry)); } return nbt; } @@ -265,7 +259,7 @@ public interface IEMMapRead extends Comparable } default boolean containsAmount(IEMDefinition def, double amountToConsume) { - double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + double amountRequired=amountToConsume- EM_COUNT_EPSILON; if(amountRequired==amountToConsume){ amountRequired-=ulpSigned(amountRequired); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java index f13e82fb26..15815f2ee0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -2,11 +2,11 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import java.util.Map; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_EPSILON; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_EPSILON; import static com.github.technus.tectech.util.DoubleCount.*; public interface IEMMapWrite extends IEMMapWriteExact { @@ -15,11 +15,11 @@ public interface IEMMapWrite extends IEMMapWriteExact { /** * Consumes amount from map * @param def def to consume - * @param amountToConsume should be comparable to {@link EMTransformationInfo#AVOGADRO_CONSTANT} + * @param amountToConsume should be comparable to {@link EMTransformationRegistry#EM_COUNT_PER_MATERIAL_AMOUNT} * @return consumed successfully */ default boolean removeAmount(IEMDefinition def, double amountToConsume){ - double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + double amountRequired=amountToConsume- EM_COUNT_EPSILON; if(amountRequired==amountToConsume){ amountRequired-=ulpSigned(amountRequired); } @@ -31,7 +31,7 @@ public interface IEMMapWrite extends IEMMapWriteExact { if(current!=null){ if(current.getAmount()>=amountRequired){ double newAmount=sub(current.getAmount(),amountToConsume); - if(IEMMapRead.isValidAmount(current.getAmount())){ + if(IEMStack.isValidAmount(newAmount)){ current=(T)current.mutateAmount(newAmount); getBackingMap().put(current.getDefinition(),current); }else { @@ -88,7 +88,7 @@ public interface IEMMapWrite extends IEMMapWriteExact { return stack; } double newAmount = add(target.getAmount(), stack.getAmount()); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=(T) target.mutateAmount(newAmount); putReplace(stack); return stack; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java index 167ec8451d..9da971944c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -7,7 +7,7 @@ import java.util.Map; public interface IEMMapWriteExact extends IEMMapRead { default void cleanUp(){ - entrySet().removeIf(entry -> IEMMapRead.isInvalidAmount(entry.getValue().getAmount())); + entrySet().removeIf(entry -> entry.getValue().isInvalidAmount()); } default void clear() { @@ -95,7 +95,7 @@ public interface IEMMapWriteExact extends IEMMapRead { if(current!=null){ double newAmount=current.getAmount()-amountToConsume; if(newAmount>=0){ - if(IEMMapRead.isValidAmount(current.getAmount())){ + if(current.isValidAmount()){ current=(T)current.mutateAmount(newAmount); getBackingMap().put(current.getDefinition(),current); } else { @@ -142,7 +142,7 @@ public interface IEMMapWriteExact extends IEMMapRead { return stack; } double newAmount = target.getAmount()+stack.getAmount(); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=(T) target.mutateAmount(newAmount); putReplace(stack); return stack; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java index f868dbe0ad..c1e6a729f8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; @@ -41,16 +41,16 @@ public final class EMDefinitionStack implements IEMStack { return amount; } - public NBTTagCompound toNBT() { + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", getDefinition().toNBT()); + nbt.setTag("d", getDefinition().toNBT(registry)); nbt.setDouble("Q", getAmount()); return nbt; } - public static EMDefinitionStack fromNBT(NBTTagCompound nbt) { + public static EMDefinitionStack fromNBT(EMDefinitionsRegistry registry,NBTTagCompound nbt) { return new EMDefinitionStack( - EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), + registry.fromNBT(nbt.getCompoundTag("d")), nbt.getLong("q")+nbt.getDouble("Q")); } 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 6347cd2144..b67d2ce121 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 @@ -1,12 +1,12 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; @@ -14,19 +14,22 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.DoubleCount.*; -import static java.lang.Math.*; +import static java.lang.Math.max; +import static java.lang.Math.min; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ public final class EMInstanceStack implements IEMStack { public static int MIN_MULTIPLE_DECAY_CALLS = 4, MAX_MULTIPLE_DECAY_CALLS = 16; - public static double DECAY_CALL_PER = AVOGADRO_CONSTANT;//todo + public static double DECAY_CALL_PER = EM_COUNT_PER_MATERIAL_AMOUNT;//todo private final IEMDefinition definition; private double amount; @@ -35,7 +38,7 @@ public final class EMInstanceStack implements IEMStack { //energy - if positive then particle should try to decay private long energy; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private byte color; + private int color; private double lifeTime; private double lifeTimeMult; @@ -53,11 +56,10 @@ public final class EMInstanceStack implements IEMStack { public EMInstanceStack(IEMDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { definition = defSafe == null ? null__ : defSafe; - byte bColor = getDefinition().getColor(); - if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color - this.color = bColor; - } else { - this.color = (byte) TecTech.RANDOM.nextInt(3); + if (getDefinition().hasColor()) { + this.color = (byte) TecTech.RANDOM.nextInt(getDefinition().getMaxColors()); + } else {//transforms colorable??? into proper color + this.color = getDefinition().getMaxColors(); } this.lifeTimeMult = lifeTimeMult; lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult; @@ -119,11 +121,11 @@ public final class EMInstanceStack implements IEMStack { return definition; } - public byte getColor() { + public int getColor() { return color; } - public void setColor(byte color) {//does not allow changing magic element + public void setColor(int color) {//does not allow changing magic element if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { return; } @@ -131,10 +133,9 @@ public final class EMInstanceStack implements IEMStack { } public void nextColor() {//does not allow changing magic element - if (color < 0 || color > 2) { - return; + if (definition.hasColor()) { + color = (byte) TecTech.RANDOM.nextInt(definition.getMaxColors()); } - color = (byte) TecTech.RANDOM.nextInt(3); } public double getLifeTime() { @@ -524,7 +525,7 @@ public final class EMInstanceStack implements IEMStack { lines.add("ENERGY = " + energy); } if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { - lines.add("AMOUNT = " + getAmount() / AVOGADRO_CONSTANT + " mol"); + lines.add("AMOUNT = " + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")); } scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); } @@ -546,25 +547,25 @@ public final class EMInstanceStack implements IEMStack { } } - public NBTTagCompound toNBT() { + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", getDefinition().toNBT()); + nbt.setTag("d", getDefinition().toNBT(registry)); nbt.setDouble("Q", getAmount()); - nbt.setLong("e", energy); - nbt.setByte("c", color); - nbt.setDouble("A", getAge()); nbt.setDouble("M", lifeTimeMult); + nbt.setDouble("A", getAge()); + nbt.setLong("e", energy); + nbt.setInteger("c", color); return nbt; } - public static EMInstanceStack fromNBT(NBTTagCompound nbt) { + public static EMInstanceStack fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) { EMInstanceStack instance = new EMInstanceStack( - EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), - nbt.getLong("q") + nbt.getDouble("Q"), - nbt.getFloat("m") + nbt.getDouble("M"), - nbt.getLong("a") + nbt.getDouble("A"), + registry.fromNBT(nbt.getCompoundTag("d")), + nbt.getDouble("Q"), + nbt.getDouble("M"), + nbt.getDouble("A"), nbt.getLong("e")); - instance.setColor(nbt.getByte("c")); + instance.setColor(nbt.getInteger("c")); return instance; } @@ -587,7 +588,7 @@ public final class EMInstanceStack implements IEMStack { @Override public String toString() { - return getDefinition().toString() + '\n' + getAmount() / AVOGADRO_CONSTANT + " mol\n" + getMass(); + return getDefinition().toString() + ' ' + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")+" " + getMass()+" eV/c^2"; } public void setAmount(double amount) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java index 5672b31c04..e5cfab9752 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java @@ -1,37 +1,56 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import net.minecraft.nbt.NBTTagCompound; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_MINIMUM; + /** * Created by danie_000 on 30.01.2017. */ -public interface IEMStack extends Comparable,Cloneable { +public interface IEMStack extends Comparable, Cloneable { + static boolean isValidAmount(double amount) { + return amount >= EM_COUNT_MINIMUM; + } + + static boolean isInvalidAmount(double amount) { + return amount < EM_COUNT_MINIMUM; + } + default boolean isValidAmount() { + return isValidAmount(getAmount()); + } + + default boolean isInvalidAmount() { + return isInvalidAmount(getAmount()); + } + IEMDefinition getDefinition(); double getAmount(); - default double getCharge(){ - return getDefinition().getCharge()*getAmount(); + default double getCharge() { + return getDefinition().getCharge() * getAmount(); } - default double getMass(){ - return getDefinition().getMass()*getAmount(); + default double getMass() { + return getDefinition().getMass() * getAmount(); } IEMStack clone(); /** * Will return stack with mutated amount, it might be a new object! + * * @param newAmount new amount * @return new stack (or previous one if was mutable) */ IEMStack mutateAmount(double newAmount); - NBTTagCompound toNBT(); + NBTTagCompound toNBT(EMDefinitionsRegistry registry); @Override - default int compareTo(IEMStack o){ + default int compareTo(IEMStack o) { return getDefinition().compareTo(o.getDefinition()); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java new file mode 100644 index 0000000000..855be96797 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class EMDequantizationInfo { + private final IEMStack definition; + private Object stack; + + public EMDequantizationInfo(IEMStack definition) { + this.definition = definition; + } + + public IEMStack getInput() { + return definition; + } + + public FluidStack getFluid() { + return ((FluidStack) stack).copy(); + } + + public void setFluid(FluidStack fluid) { + this.stack = fluid; + } + + public ItemStack getItem() { + return ((ItemStack) stack).copy(); + } + + public void setItem(ItemStack item) { + this.stack = item; + } + + public OreDictionaryStack getOre() { + return (OreDictionaryStack) stack; + } + + public void setOre(OreDictionaryStack ore) { + this.stack = ore; + } + + public Object getStack() { + return stack; + } + + @Override + public boolean equals(Object o) { + return o instanceof EMDequantizationInfo && definition.equals(((EMDequantizationInfo) o).definition); + } + + @Override + public int hashCode() { + return definition.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java deleted file mode 100644 index d74c36170e..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class EMFluidDequantizationInfo implements IEMExchangeInfo { - private final IEMStack in; - private final FluidStack out; - - public EMFluidDequantizationInfo(IEMStack emIn, FluidStack fluidStackOut){ - in=emIn; - out=fluidStackOut; - } - - public EMFluidDequantizationInfo(IEMStack emIn, Fluid fluid, int fluidAmount){ - in=emIn; - out=new FluidStack(fluid,fluidAmount); - } - - @Override - public IEMStack input() { - return in.clone();//MEH! - } - - @Override - public FluidStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMFluidDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java index 43fb5550aa..cf0cc6218c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 23.05.2017. */ -public class EMFluidQuantizationInfo implements IEMExchangeInfo { +public class EMFluidQuantizationInfo { private final FluidStack in; private final IEMStack out; @@ -21,12 +21,10 @@ public class EMFluidQuantizationInfo implements IEMExchangeInfo { - private final IEMStack in; - private final ItemStack out; - - public EMItemDequantizationInfo(IEMStack emIn, ItemStack itemStackOut){ - in=emIn; - out=itemStackOut; - } - - public EMItemDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int amount) { - in = emIn; - out = GT_OreDictUnificator.get(prefix, material, amount); - } - - @Override - public IEMStack input() { - return in.clone(); - } - - @Override - public ItemStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMItemDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java index 553e806d38..c5db63b3ad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java @@ -11,7 +11,7 @@ import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class EMItemQuantizationInfo implements IEMExchangeInfo { +public class EMItemQuantizationInfo { private final ItemStack in; private final boolean skipNBT; private final IEMStack out; @@ -28,12 +28,10 @@ public class EMItemQuantizationInfo implements IEMExchangeInfo { - private final IEMStack in; - private final String out; - private final int amount; - - public EMOredictDequantizationInfo(IEMStack emIn, String name, int qty) { - in = emIn; - out =name; - amount = qty; - } - - public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int qty) { - in = emIn; - out = prefix.name() + material.mName; - amount = qty; - } - - public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, String materialName, int qty) { - in = emIn; - out = prefix.name() + materialName; - amount = qty; - } - - @Override - public IEMStack input() { - return in.clone();//MEH! - } - - @Override - public String output() { - return getOut(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMOredictDequantizationInfo && hashCode() == obj.hashCode(); - } - - public String getOut() { - return out; - } - - public int getAmount() { - return amount; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java index 0ca0415b0d..3c54dd86ac 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java @@ -3,46 +3,41 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class EMOredictQuantizationInfo implements IEMExchangeInfo { - private final String in; +public class EMOredictQuantizationInfo { + private final int id; private final int amount; private final IEMStack out; - public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut){ - in=name; - amount=qty; - out=emOut; + public EMOredictQuantizationInfo(int id, int amount, IEMStack out) { + this.id = id; + this.amount = amount; + this.out = out; } - public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut){ - in=prefix.name() + material.mName; - amount=qty; - out=emOut; + public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut) { + this(OreDictionary.getOreID(name),qty,emOut); } - public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut){ - in=prefix.name() + materialName; - amount=qty; - out=emOut; + public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut) { + this(prefix, material.mName, qty,emOut); } - @Override - public String input() { - return getIn(); + public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut) { + this(OreDictionary.getOreID(prefix.name() + materialName),qty,emOut); } - @Override - public IEMStack output() { - return out.clone(); + public IEMStack getOut() { + return out; } @Override public int hashCode() { - return getIn().hashCode(); + return getId(); } @Override @@ -50,8 +45,8 @@ public class EMOredictQuantizationInfo implements IEMExchangeInfo fluidQuantization; - private Map itemQuantization; - private Map oredictQuantization; - - private Map fluidDequantization; - private Map itemDequantization; - private Map oredictDequantization; - - private EMTransformationInfo() { - this( - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) - ); - } - - public EMTransformationInfo( - Map fluidQuantization, - Map itemQuantization, - Map oredictQuantization, - Map fluidDequantization, - Map itemDequantization, - Map oredictDequantization) { - this.setFluidQuantization(fluidQuantization); - this.setItemQuantization(itemQuantization); - this.setOredictQuantization(oredictQuantization); - this.setFluidDequantization(fluidDequantization); - this.setItemDequantization(itemDequantization); - this.setOredictDequantization(oredictDequantization); - } - - public void addFluid(IEMStack em, FluidStack fluidStack){ - getFluidQuantization().put(fluidStack.getFluidID(),new EMFluidQuantizationInfo(fluidStack,em)); - getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluidStack)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addFluid(IEMStack em, Fluid fluid, int fluidAmount){ - getFluidQuantization().put(fluid.getID(),new EMFluidQuantizationInfo(fluid,fluidAmount,em)); - getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluid,fluidAmount)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - private void addItemQuantization(EMItemQuantizationInfo aIQI){ - getItemQuantization().put(aIQI,aIQI); - } - - public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT){ - addItemQuantization(new EMItemQuantizationInfo(itemStack,skipNBT,em)); - getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,itemStack)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ - addItemQuantization(new EMItemQuantizationInfo(prefix,material,amount,skipNBT,em)); - getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,prefix,material,amount)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addOredict(IEMStack em, String name, int qty){ - getOredictQuantization().put(OreDictionary.getOreID(name),new EMOredictQuantizationInfo(name,qty,em)); - getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,name,qty)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty){ - getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + material.mName),new EMOredictQuantizationInfo(prefix,material,qty,em)); - getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,material,qty)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty){ - getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + materialName),new EMOredictQuantizationInfo(prefix,materialName,qty,em)); - getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,materialName,qty)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public Map getFluidQuantization() { - return fluidQuantization; - } - - public void setFluidQuantization(Map fluidQuantization) { - this.fluidQuantization = fluidQuantization; - } - - public Map getItemQuantization() { - return itemQuantization; - } - - public void setItemQuantization(Map itemQuantization) { - this.itemQuantization = itemQuantization; - } - - public Map getOredictQuantization() { - return oredictQuantization; - } - - public void setOredictQuantization(Map oredictQuantization) { - this.oredictQuantization = oredictQuantization; - } - - public Map getFluidDequantization() { - return fluidDequantization; - } - - public void setFluidDequantization(Map fluidDequantization) { - this.fluidDequantization = fluidDequantization; - } - - public Map getItemDequantization() { - return itemDequantization; - } - - public void setItemDequantization(Map itemDequantization) { - this.itemDequantization = itemDequantization; - } - - public Map getOredictDequantization() { - return oredictDequantization; - } - - public void setOredictDequantization(Map oredictDequantization) { - this.oredictDequantization = oredictDequantization; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java new file mode 100644 index 0000000000..5e41beb9fd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java @@ -0,0 +1,134 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +import static java.lang.Math.pow; + +/** + * Created by Tec on 26.05.2017. + */ +public class EMTransformationRegistry { + /** + * Atom count per Mol + */ + public static final double AVOGADRO_CONSTANT = 6.02214076e23D; + /** + * Scale to 1m^3 of C-12 + */ + public static final double EM_COUNT_PER_CUBE = AVOGADRO_CONSTANT * 1650_000D / 0.012; + public static final double EM_COUNT_PER_MATERIAL_AMOUNT = EM_COUNT_PER_CUBE / 144 / 9; + public static final double EM_COUNT_PER_ITEM = EM_COUNT_PER_CUBE * 9; + public static final double EM_COUNT_PER_1k = EM_COUNT_PER_MATERIAL_AMOUNT * 1000; + + public static final double EM_COUNT_MINIMUM = 1 / EM_COUNT_PER_CUBE; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double EM_COUNT_EPSILON = EM_COUNT_PER_CUBE / pow(2, 40); + + public static final double EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT - EM_COUNT_EPSILON; + public static final double EM_COUNT_PER_CUBE_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144 * 9; + public static final double EM_COUNT_PER_ITEM_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144; + public static final double EM_COUNT_PER_1k_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 1000; + + private final Map fluidQuantization; + private final Map itemQuantization; + private final Map oredictQuantization; + + private final Map infoMap; + private final Function creator; + + public EMTransformationRegistry() { + this(EMDequantizationInfo::new); + } + + public EMTransformationRegistry(Function creator) { + this(creator, + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(256) + ); + } + + public EMTransformationRegistry(Function creator, + Map fluidQuantization, + Map itemQuantization, + Map oredictQuantization, + Map infoMap) { + this.creator = creator; + this.fluidQuantization = fluidQuantization; + this.itemQuantization = itemQuantization; + this.oredictQuantization = oredictQuantization; + this.infoMap = infoMap; + } + + protected EMDequantizationInfo compute(IEMStack em) { + return infoMap.computeIfAbsent(em.getDefinition(), stack -> creator.apply(em)); + } + + public void addFluid(IEMStack em, FluidStack fluidStack) { + getFluidQuantization().put(fluidStack.getFluidID(), new EMFluidQuantizationInfo(fluidStack, em)); + compute(em).setFluid(fluidStack); + } + + public void addFluid(IEMStack em, Fluid fluid, int fluidAmount) { + addFluid(em, new FluidStack(fluid, fluidAmount)); + } + + protected void addItemQuantization(EMItemQuantizationInfo aIQI) { + getItemQuantization().put(aIQI, aIQI); + } + + public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT) { + addItemQuantization(new EMItemQuantizationInfo(itemStack, skipNBT, em)); + compute(em).setItem(itemStack); + } + + public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT) { + addItem(em, GT_OreDictUnificator.get(prefix, material, amount), skipNBT); + } + + public void addOredict(IEMStack em, int id, int qty) { + getOredictQuantization().put(id, new EMOredictQuantizationInfo(id, qty, em)); + compute(em).setOre(new OreDictionaryStack(qty, id)); + } + + public void addOredict(IEMStack em, String name, int qty) { + addOredict(em, OreDictionary.getOreID(name), qty); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty) { + addOredict(em, prefix, material.mName, qty); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty) { + addOredict(em, OreDictionary.getOreID(prefix.name() + materialName), qty); + } + + public Map getFluidQuantization() { + return fluidQuantization; + } + + public Map getItemQuantization() { + return itemQuantization; + } + + public Map getOredictQuantization() { + return oredictQuantization; + } + + public Map getInfoMap() { + return infoMap; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java deleted file mode 100644 index e20b0af3b5..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -/** - * Created by Tec on 23.05.2017. - */ -public interface IEMExchangeInfo { - OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. - //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) - - IN input();//same as above but for input -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java new file mode 100644 index 0000000000..f5d8d42061 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +public class OreDictionaryStack { + private final int amount; + private final int id; + + public OreDictionaryStack(int amount, int id) { + this.amount = amount; + this.id = id; + } + + public int getAmount() { + return amount; + } + + public int getOreId() { + return id; + } +} 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 37ecb861f8..76f4457e94 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 @@ -1,69 +1,65 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; -import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; +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.XSTR; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Materials; -import net.minecraft.nbt.NBTTagCompound; import java.util.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; +import static gregtech.api.enums.Materials.*; import static gregtech.api.enums.OrePrefixes.dust; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 18.11.2016. */ -public final class EMAtomDefinition extends EMComplexTemplate { - public static final long ATOM_COMPLEXITY_LIMIT=65536L; - private static final byte BYTE_OFFSET=32; +public class EMAtomDefinition extends EMComplexTemplate { + public static final long ATOM_COMPLEXITY_LIMIT = 65536L; + private static final byte BYTE_OFFSET = 32; - private final int hash; + private final int hash; public static double refMass, refUnstableMass; - private static final byte nbtType = (byte) 'a'; + private static final String nbtType = "a"; private static final Random xstr = new XSTR();//NEEDS SEPARATE! private static Map> stableIsotopes = new HashMap<>(); private static final Map stableAtoms = new HashMap<>(); private static Map> mostStableUnstableIsotopes = new HashMap<>(); private static final Map unstableAtoms = new HashMap<>(); - private static EMDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; - private static final HashMap lifetimeOverrides = new HashMap<>(); + private static EMDefinitionStack alpha, deuterium, tritium, helium_3, beryllium_8, carbon_14, neon_24, silicon_34, uranium_238, uranium_235, plutonium_239, plutonium_241; + private static final HashMap lifetimeOverrides = new HashMap<>(); private final EMNuclideIAEA iaea; private static EMAtomDefinition somethingHeavy; + public static EMAtomDefinition getSomethingHeavy() { return somethingHeavy; } private static final ArrayList overrides = new ArrayList<>(); - public static void addOverride(EMAtomDefinition atom, double rawLifeTime){ - lifetimeOverrides.put(atom,rawLifeTime); + + public static void addOverride(EMAtomDefinition atom, double rawLifeTime) { + lifetimeOverrides.put(atom, rawLifeTime); } //float-mass in eV/c^2 @@ -106,23 +102,23 @@ public final class EMAtomDefinition extends EMComplexTemplate { } elementalStacks = things; - double mass = 0; - int cLeptons = 0; - int cNucleus = 0; - int neutralCount = 0, element = 0; - int type = 0; + double mass = 0; + int cLeptons = 0; + int cNucleus = 0; + int neutralCount = 0, element = 0; + int type = 0; boolean containsAnti = false; for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { IEMDefinition def = stack.getDefinition(); int amount = (int) stack.getAmount(); - if((int) stack.getAmount() != stack.getAmount()){ + if ((int) stack.getAmount() != stack.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } mass += stack.getMass(); - if (def.getMatterType() < 0) { + if (def.getGeneration() < 0) { containsAnti = true; } - type = Math.max(type, Math.abs(def.getMatterType())); + type = Math.max(type, Math.abs(def.getGeneration())); if (def instanceof EMLeptonDefinition) { cLeptons += stack.getCharge(); @@ -148,57 +144,57 @@ public final class EMAtomDefinition extends EMComplexTemplate { //stability curve int StableIsotope = stableIzoCurve(element); - int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiff = neutralCount - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); xstr.setSeed((element + 1L) * (neutralCount + 100L)); - iaea = EMNuclideIAEA.get(element,neutralCount); - if(getIaea() !=null){ - if(Double.isNaN(getIaea().getMass())) { + iaea = EMNuclideIAEA.get(element, neutralCount); + if (getIaea() != null) { + if (Double.isNaN(getIaea().getMass())) { this.mass = mass; } else { this.mass = getIaea().getMass(); } - if(Double.isNaN(getIaea().getHalfTime())) { - Double overriddenLifeTime= lifetimeOverrides.get(this); + if (Double.isNaN(getIaea().getHalfTime())) { + Double overriddenLifeTime = lifetimeOverrides.get(this); double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { + if (overriddenLifeTime != null) { rawLifeTimeTemp = overriddenLifeTime; } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - }else { + } else { rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : getIaea().getHalfTime(); } - iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length>1; - }else{ - this.mass=mass; + iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length > 1; + } else { + this.mass = mass; - Double overriddenLifeTime= lifetimeOverrides.get(this); + Double overriddenLifeTime = lifetimeOverrides.get(this); double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { + if (overriddenLifeTime != null) { rawLifeTimeTemp = overriddenLifeTime; } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - iaeaDefinitionExistsAndHasEnergyLevels =false; + iaeaDefinitionExistsAndHasEnergyLevels = false; } - if(getIaea() ==null || getIaea().getEnergeticStatesArray()[0].energy!=0) { + if (getIaea() == null || getIaea().getEnergeticStatesArray()[0].energy != 0) { if (izoDiff == 0) { decayMode = 0; } else { decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); } - }else{ - decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); + } else { + decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); } //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - hash=super.hashCode(); + hash = super.hashCode(); } private static int stableIzoCurve(int element) { @@ -267,7 +263,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { private static boolean canTheyBeTogether(EMConstantStackMap stacks) { boolean nuclei = false; - long qty=0; + long qty = 0; for (EMDefinitionStack stack : stacks.valuesToArray()) { if (stack.getDefinition() instanceof EMHadronDefinition) { if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) { @@ -277,12 +273,12 @@ public final class EMAtomDefinition extends EMComplexTemplate { } else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) { return false; } - if((int) stack.getAmount() != stack.getAmount()){ + if ((int) stack.getAmount() != stack.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } - qty+= stack.getAmount(); + qty += stack.getAmount(); } - return nuclei && qty= getIaea().getEnergeticStatesArray().length){ - return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].Thalf/(currentEnergy- getIaea().getEnergeticStatesArray().length+1); + if (iaeaDefinitionExistsAndHasEnergyLevels) { + if (currentEnergy >= getIaea().getEnergeticStatesArray().length) { + return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].Thalf / (currentEnergy - getIaea().getEnergeticStatesArray().length + 1); } - return getIaea().getEnergeticStatesArray()[(int)currentEnergy].Thalf; + return getIaea().getEnergeticStatesArray()[(int) currentEnergy].Thalf; } - return rawLifeTime/(currentEnergy+1); + return rawLifeTime / (currentEnergy + 1); } @Override @@ -332,16 +328,16 @@ public final class EMAtomDefinition extends EMComplexTemplate { } @Override - public byte getColor() { + public int getMaxColors() { return -10; } @Override public String getLocalizedName() { - int element = Math.abs(this.getElement()); + int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { - if (Math.abs(getMatterType()) != 1) { + if (Math.abs(getGeneration()) != 1) { return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; } return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; @@ -349,35 +345,35 @@ public final class EMAtomDefinition extends EMComplexTemplate { if (DEBUG_MODE) { e.printStackTrace(); } - return translateToLocal("tt.keyword.Element")+(negative ? ": ~" : ": ") + element; + return translateToLocal("tt.keyword.Element") + (negative ? ": ~" : ": ") + element; } } @Override public String getSymbol() { - int element = Math.abs(this.getElement()); + int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } try { int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } catch (Exception E) { if (DEBUG_MODE) { e.printStackTrace(); } - return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } } } @Override public String getShortSymbol() { - int element = Math.abs(this.getElement()); + int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; @@ -404,69 +400,69 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public EMDecay[] getDecayArray() { - ArrayList decaysList =new ArrayList<>(4); - return getDecayArray(decaysList, getDecayMode(),true); + ArrayList decaysList = new ArrayList<>(4); + return getDecayArray(decaysList, getDecayMode(), true); } private EMDecay[] getDecayArray(ArrayList decaysList, int decayMode, boolean tryAnti) {//todo? - if (getMatterType() == 1) { + if (getGeneration() == 1) { switch (decayMode) { case -2: - if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { + if (TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); - } else if(PbetaDecay(decaysList)) { + } else if (PbetaDecay(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case -1: - if(Emmision(decaysList, EMHadronDefinition.hadron_p1)) { + if (Emmision(decaysList, EMHadronDefinition.hadron_p1)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case 0: - if(alphaDecay(decaysList)) { + if (alphaDecay(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case 1: - if(Emmision(decaysList, EMHadronDefinition.hadron_n1)) { + if (Emmision(decaysList, EMHadronDefinition.hadron_n1)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case 2: - if(MbetaDecay(decaysList)) { + if (MbetaDecay(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; default: - if(decayMode>8){ - if(iaeaDecay(decaysList,0)) { + if (decayMode > 8) { + if (iaeaDecay(decaysList, 0)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } - return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); + return getDecayArray(decaysList, decayMode - BYTE_OFFSET, false); } } return EMDecay.NO_DECAY; - }else if(getMatterType() ==-1){ - EMAtomDefinition anti =getAnti(); - if(anti!=null) { + } else if (getGeneration() == -1) { + EMAtomDefinition anti = getAnti(); + if (anti != null) { return anti.getDecayArray(decaysList, decayMode, false); } } return getNaturalDecayInstant(); } - private boolean iaeaDecay(ArrayList decaysList, long energy){ + private boolean iaeaDecay(ArrayList decaysList, long energy) { EMNuclideIAEA.energeticState state; - if(energy> getIaea().getEnergeticStatesArray().length) { + if (energy > getIaea().getEnergeticStatesArray().length) { state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; - } else if(energy<=0) { + } else if (energy <= 0) { state = getIaea().getEnergeticStatesArray()[0]; } else { state = getIaea().getEnergeticStatesArray()[(int) energy]; } - for (int i=0;i decaysList, EMNuclideIAEA.iaeaDecay decay, long energy){ - EMDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new EMDefinitionStackMap(); - switch (decay.decayName){ + private boolean getDecayFromIaea(ArrayList decaysList, EMNuclideIAEA.iaeaDecay decay, long energy) { + EMDefinitionStackMap withThis = elementalStacks.toMutable(), newStuff = new EMDefinitionStackMap(); + switch (decay.decayName) { case "D": { - if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())) { withThis.putReplace(deuterium); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "3H": { - if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())) { withThis.putReplace(tritium); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "3HE": { - if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())) { withThis.putReplace(helium_3); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "8BE": { - if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())) { withThis.putReplace(beryllium_8); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "14C": { - if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())) { newStuff.putReplace(carbon_14); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "24NE": { - if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())) { newStuff.putReplace(neon_24); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "34SI": { - if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())) { newStuff.putReplace(silicon_34); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "A": case "A?": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)){ + } + break; + case "A": + case "A?": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)) { newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_2); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2B-": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p2); newStuff.putReplace(EMLeptonDefinition.lepton_e2); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "EC": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2EC": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "B++EC": case "EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + } + break; + case "B++EC": + case "EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+A": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+2P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-A": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(EMHadronDefinition.hadron_n1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-2N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(EMHadronDefinition.hadron_n2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "ECA": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) { newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "ECP": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "EC2P": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "ECP+EC2P": {//todo look at branching ratios - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(EMHadronDefinition.hadron_p3); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { newStuff.putReplace(EMHadronDefinition.hadron_n1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { newStuff.putReplace(EMHadronDefinition.hadron_n2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { newStuff.putReplace(EMHadronDefinition.hadron_p2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "SF": { if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - } break; + } + break; case "B-F": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "ECF": case "ECSF": case "EC(+SF)": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + } + break; + case "ECF": + case "ECSF": + case "EC(+SF)": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "SF(+EC+B+)": case "SF+EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + } + break; + case "SF(+EC+B+)": + case "SF+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "SF+EC+B-": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "IT": case "IT?": case "G": { - if(energy>0){ + } + break; + case "IT": + case "IT?": + case "G": { + if (energy > 0) { decaysList.add(new EMDecay(decay.chance, this, boson_Y__)); - }else{ - if(DEBUG_MODE) { + } else { + if (DEBUG_MODE) { TecTech.LOGGER.info("Tried to emit Gamma from ground state"); } decaysList.add(new EMDecay(decay.chance, this)); @@ -986,28 +1024,30 @@ public final class EMAtomDefinition extends EMComplexTemplate { return true; } //break; case "IT+EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(EMBosonDefinition.boson_Y__1); - try{ + newStuff.putReplace(EMGaugeBosonDefinition.boson_Y__1); + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "DEAD_END": decaysList.add(deadEnd); return true; - default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); + default: + throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); } - if(DEBUG_MODE) { + if (DEBUG_MODE) { TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName); } return false; @@ -1093,48 +1133,48 @@ public final class EMAtomDefinition extends EMComplexTemplate { private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { EMDefinitionStackMap heavy = new EMDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(Math.abs(getElement())<=97); + double[] liquidDrop = liquidDropFunction(Math.abs(getElement()) <= 97); - for(EMDefinitionStack stack: fissile.valuesToArray()){ - if(spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && - (stack.getAmount() <=80 || stack.getAmount() <90 && XSTR_INSTANCE.nextInt(10)< stack.getAmount() -80)) { + for (EMDefinitionStack stack : fissile.valuesToArray()) { + if (spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && + (stack.getAmount() <= 80 || stack.getAmount() < 90 && XSTR_INSTANCE.nextInt(10) < stack.getAmount() - 80)) { return false; } - if(stack.getDefinition().getCharge()==0){ + if (stack.getDefinition().getCharge() == 0) { //if(stack.definition instanceof dHadronDefinition){ - double neutrals= stack.getAmount() *liquidDrop[2]; - int neutrals_cnt=(int)Math.floor(neutrals); - neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0; - particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); - - int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[1]); - while(heavy_cnt+neutrals_cnt> stack.getAmount()) { - heavy_cnt--; - } - fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(),heavy_cnt+neutrals_cnt)); - heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); + double neutrals = stack.getAmount() * liquidDrop[2]; + int neutrals_cnt = (int) Math.floor(neutrals); + neutrals_cnt += neutrals - neutrals_cnt > XSTR_INSTANCE.nextDouble() ? 1 : 0; + particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); + + int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[1]); + while (heavy_cnt + neutrals_cnt > stack.getAmount()) { + heavy_cnt--; + } + fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(), heavy_cnt + neutrals_cnt)); + heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); //}else{ // particles.add(stack); // light.remove(stack.definition); //} - }else{ - int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[0]); - if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { + } else { + int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[0]); + if (heavy_cnt % 2 == 1 && XSTR_INSTANCE.nextDouble() > 0.05D) { heavy_cnt--; } - EMDefinitionStack new_stack =new EMDefinitionStack(stack.getDefinition(), heavy_cnt); + EMDefinitionStack new_stack = new EMDefinitionStack(stack.getDefinition(), heavy_cnt); fissile.removeAmountExact(new_stack); heavy.putReplace(new_stack); } } try { - particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); - particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1)); + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1)); decaysList.add(new EMDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } catch (Exception e) { - if(DEBUG_MODE) { + if (DEBUG_MODE) { e.printStackTrace(); } } @@ -1181,51 +1221,51 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { if (iaeaDefinitionExistsAndHasEnergyLevels) { - ArrayList decays =new ArrayList<>(4); - if(iaeaDecay(decays,energyLevel)){ + ArrayList decays = new ArrayList<>(4); + if (iaeaDecay(decays, energyLevel)) { return decays.toArray(EMDecay.NO_PRODUCT); } } - if(energyLevel< Math.abs(getCharge())/3+ getNeutralCount()) { + if (energyLevel < Math.abs(getCharge()) / 3 + getNeutralCount()) { return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; } return getNaturalDecayInstant(); } @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { - if(iaeaDefinitionExistsAndHasEnergyLevels){ - double result=0; - boolean backwards=newEnergyLevel= getIaea().getEnergeticStatesArray().length){ - if(currentEnergyLevel>= getIaea().getEnergeticStatesArray().length) { + if (newEnergyLevel >= getIaea().getEnergeticStatesArray().length) { + if (currentEnergyLevel >= getIaea().getEnergeticStatesArray().length) { return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } else { result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - getIaea().getEnergeticStatesArray().length + 1); } - result+= getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].energy; - }else { + result += getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].energy; + } else { result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy; } - return backwards?-result:result; + return backwards ? -result : result; } - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } @Override @@ -1235,17 +1275,17 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public boolean usesMultipleDecayCalls(long energyLevel) { - if(!iaeaDefinitionExistsAndHasEnergyLevels) return false; + if (!iaeaDefinitionExistsAndHasEnergyLevels) return false; EMNuclideIAEA.energeticState state; - if(energyLevel> getIaea().getEnergeticStatesArray().length) { + if (energyLevel > getIaea().getEnergeticStatesArray().length) { state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; - } else if(energyLevel<=0) { + } else if (energyLevel <= 0) { state = getIaea().getEnergeticStatesArray()[0]; } else { state = getIaea().getEnergeticStatesArray()[(int) energyLevel]; } - for (EMNuclideIAEA.iaeaDecay decay:state.decaymodes){ - if(decay.decayName.contains("F")) return true;//if is fissile + for (EMNuclideIAEA.iaeaDecay decay : state.decaymodes) { + if (decay.decayName.contains("F")) return true;//if is fissile } return false; } @@ -1257,7 +1297,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public boolean fusionMakesEnergy(long energyLevel) { - return getIaea() !=null || iaeaDefinitionExistsAndHasEnergyLevels; + return getIaea() != null || iaeaDefinitionExistsAndHasEnergyLevels; } @Override @@ -1265,7 +1305,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { //disembody ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { - if (elementalStack.getDefinition().getMatterType() == 1 || elementalStack.getDefinition().getMatterType() == -1) { + if (elementalStack.getDefinition().getGeneration() == 1 || elementalStack.getDefinition().getGeneration() == -1) { //covers both quarks and antiquarks decaysInto.add(elementalStack); } else { @@ -1278,10 +1318,10 @@ public final class EMAtomDefinition extends EMComplexTemplate { //@Override //public iElementalDefinition getAnti() { - // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); - // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // EMDefinitionStack[] stacks = this.elementalStacks.values(); + // EMDefinitionStack[] antiElements = new EMDefinitionStack[stacks.length]; // for (int i = 0; i < antiElements.length; i++) { - // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // antiElements[i] = new EMDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); // } // try { // return new dAtomDefinition(false, antiElements); @@ -1307,21 +1347,6 @@ public final class EMAtomDefinition extends EMComplexTemplate { } } - @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return EMTransformationInfo.TRANSFORMATION_INFO.getFluidDequantization().get(this); - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return EMTransformationInfo.TRANSFORMATION_INFO.getItemDequantization().get(this); - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return EMTransformationInfo.TRANSFORMATION_INFO.getOredictDequantization().get(this); - } - public EMNuclideIAEA getIaea() { return iaea; } @@ -1339,55 +1364,43 @@ public final class EMAtomDefinition extends EMComplexTemplate { } private static final class Nomenclature { - private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; } @Override - protected int getIndirectTagValue() { + protected String getIndirectTagValue() { return nbtType; } - public static EMAtomDefinition fromNBT(NBTTagCompound nbt) { - EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new EMAtomDefinition(stacks); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) -> + new EMAtomDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMAtomDefinition.class, "tt.keyword.Element")); + EMNuclideIAEA.run(); - public static void run() { for (Runnable r : overrides) { r.run(); } - for(Map.Entry entry:lifetimeOverrides.entrySet()){ + for (Map.Entry entry : lifetimeOverrides.entrySet()) { try { lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); - }catch (EMException e){ + } catch (EMException e) { e.printStackTrace(); //Impossible } } //populate stable isotopes - for (int element = 1; element < 83; element++)//Up to Bismuth exclusive - { + for (int element = 1; element < 83; element++) {//Up to Bismuth exclusive for (int isotope = 0; isotope < 130; isotope++) { xstr.setSeed((long) (element + 1) * (isotope + 100)); //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); + int StableIsotope = stableIzoCurve(element); + int izoDiff = isotope - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); isotopes.add(isotope); @@ -1396,16 +1409,16 @@ public final class EMAtomDefinition extends EMComplexTemplate { } //populate unstable isotopes - for (int element = 83; element < 150; element++) { + for (int element = 1; element < 150; element++) { for (int isotope = 100; isotope < 180; isotope++) { xstr.setSeed((long) (element + 1) * (isotope + 100)); //stability curve - int Isotope = stableIzoCurve(element); - int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); - isotopes.put(rawLifeTime, isotope); + int Isotope = stableIzoCurve(element); + int izoDiff = isotope - Isotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); + isotopes.put(rawLifeTime, isotope);//todo dont add stable ones } } @@ -1428,213 +1441,221 @@ public final class EMAtomDefinition extends EMComplexTemplate { TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); } } - deuterium=new EMAtomDefinition( + + deuterium = new EMAtomDefinition( EMHadronDefinition.hadron_p1, EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1).getStackForm(1); - tritium=new EMAtomDefinition( + registry.registerForDisplay(deuterium.getDefinition()); + + tritium = new EMAtomDefinition( EMHadronDefinition.hadron_p1, EMHadronDefinition.hadron_n2, EMLeptonDefinition.lepton_e1).getStackForm(1); - helium_3=new EMAtomDefinition( + registry.registerForDisplay(tritium.getDefinition()); + + helium_3 = new EMAtomDefinition( EMHadronDefinition.hadron_p2, EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e2).getStackForm(1); + registry.registerForDisplay(helium_3.getDefinition()); + alpha = new EMAtomDefinition( EMHadronDefinition.hadron_p2, EMHadronDefinition.hadron_n2).getStackForm(1); - beryllium_8=new EMAtomDefinition( + registry.registerForDisplay(alpha.getDefinition()); + + beryllium_8 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 4), new EMDefinitionStack(EMHadronDefinition.hadron_n, 4), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 4)).getStackForm(1); - carbon_14=new EMAtomDefinition( + registry.registerForDisplay(beryllium_8.getDefinition()); + + carbon_14 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 6), new EMDefinitionStack(EMHadronDefinition.hadron_n, 8), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 6)).getStackForm(1); - neon_24=new EMAtomDefinition( + registry.registerForDisplay(carbon_14.getDefinition()); + + neon_24 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 10), new EMDefinitionStack(EMHadronDefinition.hadron_n, 14), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 10)).getStackForm(1); - silicon_34=new EMAtomDefinition( + registry.registerForDisplay(neon_24.getDefinition()); + + silicon_34 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 14), new EMDefinitionStack(EMHadronDefinition.hadron_n, 20), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 14)).getStackForm(1); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - try { - EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMAtomDefinition::fromNBT,EMAtomDefinition.class,getClassTypeStatic()); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); - } - } - - public static void setTransformations(){ - /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; - - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); - - /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; - - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); - //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); - - try { - EMAtomDefinition temp; - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(deuterium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(tritium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); + registry.registerForDisplay(silicon_34.getDefinition()); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(helium_3.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); - - temp=new EMAtomDefinition( + uranium_238 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 146) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); - - double tempMass=temp.getMass(); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 146)).getStackForm(1); + registry.registerForDisplay(uranium_238.getDefinition()); - temp=new EMAtomDefinition( + uranium_235 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 143) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 143)).getStackForm(1); + registry.registerForDisplay(uranium_235.getDefinition()); - TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); + TecTech.LOGGER.info("Diff Mass U : " + (uranium_238.getDefinition().getMass() - uranium_235.getDefinition().getMass())); - temp=new EMAtomDefinition( + plutonium_239 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 145) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 145)).getStackForm(1); + registry.registerForDisplay(plutonium_239.getDefinition()); - somethingHeavy=new EMAtomDefinition( + plutonium_241 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 147) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 147)).getStackForm(1); + registry.registerForDisplay(plutonium_241.getDefinition()); - TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); + TecTech.LOGGER.info("Diff Mass Pu: " + (plutonium_241.getDefinition().getMass() - plutonium_239.getDefinition().getMass())); - TecTech.LOGGER.info("Neutron Mass: "+ EMHadronDefinition.hadron_n.getMass()); + somethingHeavy=(EMAtomDefinition) plutonium_241.getDefinition(); - } catch (EMException e) { + } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } - if(Loader.isModLoaded(Reference.GTPLUSPLUS)) { - new GtppAtomLoader().run(); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); + } + + for (int i = 1; i <= 118; i++) { + EMAtomDefinition firstStableIsotope = getFirstStableIsotope(i); + if(firstStableIsotope==null){ + firstStableIsotope = getBestUnstableIsotope(i); + if(firstStableIsotope==null){ + continue; + } + } + registry.registerForDisplay(firstStableIsotope); } } + public static void setTransformations(EMTransformationRegistry transformationInfo) { + /*----STABLE ATOMS----**/ + refMass = getFirstStableIsotope(1).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; + + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Hydrogen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium.mGas, 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lithium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Beryllium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Boron, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Carbon, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Nitrogen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Oxygen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Fluorine.mGas, 144); + //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Neon.mGas.getID(), 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sodium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Magnesium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Aluminium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silicon, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Phosphorus, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sulfur, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Argon.mGas, 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Potassium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Calcium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Scandium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Titanium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Vanadium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Chrome, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Manganese, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iron, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cobalt, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Nickel, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Copper, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Zinc, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gallium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),dust, Germanium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Arsenic, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),dust, Selenium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),dust, Bromine,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),dust, Krypton,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Rubidium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Strontium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Yttrium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),dust, Zirconium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Niobium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Molybdenum, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),dust, Technetium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),dust, Ruthenium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),dust, Rhodium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Palladium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silver, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cadmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Indium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tin, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Antimony, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tellurium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),dust, Iodine,1); + //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Xenon.mGas.getID(), 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Caesium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Barium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lanthanum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cerium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Praseodymium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Neodymium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Samarium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Europium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gadolinium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Terbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Dysprosium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Holmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Erbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thulium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Ytterbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lutetium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),dust, Hafnum,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tantalum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tungsten, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),dust, Rhenium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Osmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iridium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Platinum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gold, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Mercury.mFluid, 144); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),dust, Thallium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lead, 1); + + /*----UNSTABLE ATOMS----**/ + refUnstableMass = getFirstStableIsotope(82).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; + + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(61), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Promethium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Bismuth, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),dust, Polonium,1); + //transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Astatine.mPlasma.getID(), 144); + transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Radon.mGas, 144); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),dust, Francium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),dust, Radium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),dust, Actinium,1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thorium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),dust, Protactinium,1); + ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Uranium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),dust, Neptunium,1); + ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Plutonium,1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Americium, 1); + + + transformationInfo.addFluid(new EMDefinitionStack(deuterium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Deuterium.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(tritium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Tritium.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(helium_3.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium_3.mGas, 144); + + transformationInfo.addOredict(new EMDefinitionStack(uranium_238.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium/*238*/, 1); + transformationInfo.addOredict(new EMDefinitionStack(uranium_235.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium235, 1); + + transformationInfo.addOredict(new EMDefinitionStack(plutonium_239.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium/*239*/, 1); + transformationInfo.addOredict(new EMDefinitionStack(plutonium_241.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium241, 1); + } + public static EMAtomDefinition getFirstStableIsotope(int element) { return stableAtoms.get(element); } @@ -1644,11 +1665,11 @@ public final class EMAtomDefinition extends EMComplexTemplate { } @Override - public byte getClassType() { + public int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic(){ + public static int getClassTypeStatic() { return 64; } @@ -1659,36 +1680,36 @@ public final 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 (Util.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)) { - lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); + if (Util.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)) { - lines.add("NAME = "+ getLocalizedName()); - lines.add("SYMBOL = "+getSymbol()); + if (Util.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 (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { lines.add("CHARGE = " + getCharge() / 3D + " e"); } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); } - if(iaeaDefinitionExistsAndHasEnergyLevels && Util.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 (iaeaDefinitionExistsAndHasEnergyLevels && Util.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)){ - lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); + if (Util.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 c1db8e4460..aedb11ac05 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 @@ -4,21 +4,20 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +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 gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; @@ -26,29 +25,28 @@ import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static gregtech.api.enums.OrePrefixes.dust; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.11.2016. */ -public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o +public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o private final int hash; - private static final byte nbtType = (byte) 'h'; + private static final String nbtType = "h"; //Helpers - public static final Map SYMBOL_MAP =new HashMap<>(); - public static final Map NAME_MAP =new HashMap<>(); - public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; + public static final Map SYMBOL_MAP = new HashMap<>(); + public static final Map UNLOCALIZED_NAME_MAP = new HashMap<>(); + public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; public static EMDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; - private static double protonMass = 0D; - private static double neutronMass = 0D; - private static final double actualProtonMass=938272081.3D; - private static final double actualNeutronMass=939565413.3D; + private static double protonMass = 0D; + private static double neutronMass = 0D; + private static final double actualProtonMass = 938272081.3D; + private static final double actualNeutronMass = 939565413.3D; //float-mass in eV/c^2 private final double mass; @@ -81,20 +79,20 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } quarkStacks = quarks; - int amount = 0; - int charge = 0; - int type = 0; + int amount = 0; + int charge = 0; + int type = 0; boolean containsAnti = false; - double mass = 0; + double mass = 0; for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) { amount += quarkStack.getAmount(); - if((int) quarkStack.getAmount() != quarkStack.getAmount()){ + if ((int) quarkStack.getAmount() != quarkStack.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } mass += quarkStack.getMass(); charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.getDefinition().getMatterType()), type); - if (quarkStack.getDefinition().getMatterType() < 0) { + type = Math.max(Math.abs(quarkStack.getDefinition().getGeneration()), type); + if (quarkStack.getDefinition().getGeneration() < 0) { containsAnti = true; } } @@ -106,10 +104,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize if (mass == protonMass && this.getAmount() == 3) { rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME; - mass=actualProtonMass; + mass = actualProtonMass; } else if (mass == neutronMass && this.getAmount() == 3) { rawLifeTime = 882D; - mass=actualNeutronMass; + mass = actualNeutronMass; } else { if (this.getAmount() == 3) { rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); @@ -119,8 +117,8 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); } } - this.mass=mass; - hash=super.hashCode(); + this.mass = mass; + hash = super.hashCode(); } //public but u can just try{}catch(){} the constructor it still calls this method @@ -130,7 +128,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) { return false; } - if((int) quarks.getAmount() != quarks.getAmount()){ + if ((int) quarks.getAmount() != quarks.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } amount += quarks.getAmount(); @@ -140,12 +138,12 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public String getLocalizedName() { - StringBuilder name= new StringBuilder(getSimpleName()); + StringBuilder name = new StringBuilder(getSimpleName()); name.append(':'); - String sym= translateToLocal(NAME_MAP.get(this)); - if(sym!=null){ + String sym = translateToLocal(UNLOCALIZED_NAME_MAP.get(this)); + if (sym != null) { name.append(' ').append(sym); - }else { + } else { for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount()); } @@ -172,10 +170,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public String getSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ + String sym = SYMBOL_MAP.get(this); + if (sym != null) { return sym; - }else { + } else { StringBuilder symbol = new StringBuilder(8); for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.getAmount(); i++) { @@ -188,10 +186,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public String getShortSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ + String sym = SYMBOL_MAP.get(this); + if (sym != null) { return sym; - }else { + } else { StringBuilder symbol = new StringBuilder(8); for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.getAmount(); i++) { @@ -203,7 +201,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } @Override - public byte getColor() { + public int getMaxColors() { return -7; } @@ -215,12 +213,12 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public EMDecay[] getNaturalDecayInstant() { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { return EMDecay.NO_PRODUCT; } ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack quarks : quarkStacks) { - if (quarks.getDefinition().getMatterType() == 1 || quarks.getDefinition().getMatterType() == -1) { + if (quarks.getDefinition().getGeneration() == 1 || quarks.getDefinition().getGeneration() == -1) { //covers both quarks and antiquarks decaysInto.add(quarks); } else { @@ -230,22 +228,22 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } return new EMDecay[]{ new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), - EMBosonDefinition.deadEnd + deadEnd }; } @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { return EMDecay.NO_PRODUCT; } - return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + return new EMDecay[]{new EMDecay(0.75D, quarkStacks), deadEnd}; //decay into quarks } @Override public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } @Override @@ -273,10 +271,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && - quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { + quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { return EMDecay.NO_PRODUCT; } else if (getAmount() != 3) { - return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + return new EMDecay[]{new EMDecay(0.95D, quarkStacks), deadEnd}; //decay into quarks } else { ArrayList newBaryon = new ArrayList<>(); IEMDefinition[] Particles = new IEMDefinition[2]; @@ -289,7 +287,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize EMQuarkDefinition lastQuark = newBaryon.remove(2); EMDefinitionStack[] decay; - if (Math.abs(lastQuark.getMatterType()) > 1) { + if (Math.abs(lastQuark.getGeneration()) > 1) { decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); } else { decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); @@ -299,19 +297,19 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize Particles[1] = decay[2].getDefinition(); EMDefinitionStack[] contentOfBaryon = newBaryon.stream() - .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition,1)) + .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition, 1)) .toArray(EMDefinitionStack[]::new); try { return new EMDecay[]{ new EMDecay(0.001D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), new EMDecay(0.99D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), - EMBosonDefinition.deadEnd}; + deadEnd}; } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } - return new EMDecay[]{EMBosonDefinition.deadEnd}; + return new EMDecay[]{deadEnd}; } } } @@ -337,7 +335,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } @Override - public byte getMatterType() { + public int getGeneration() { return type; } @@ -373,64 +371,48 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - protected int getIndirectTagValue() { + protected String getIndirectTagValue() { return nbtType; } - public static EMHadronDefinition fromNBT(NBTTagCompound nbt) { - EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new EMHadronDefinition(stacks); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) -> + new EMHadronDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMHadronDefinition.class, "tt.keyword.Hadron")); try { hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); protonMass = hadron_p.getMass(); //redefine the proton with proper lifetime (the lifetime is based on mass comparison) hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); - SYMBOL_MAP.put(hadron_p,"p"); - NAME_MAP.put(hadron_p,translateToLocal("tt.keyword.Proton")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p); + SYMBOL_MAP.put(hadron_p, "p"); + UNLOCALIZED_NAME_MAP.put(hadron_p, "tt.keyword.Proton"); + registry.registerForDisplay(hadron_p); + registry.registerDirectDefinition("p",hadron_p); + hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); - SYMBOL_MAP.put(hadron_p_,"~p"); - NAME_MAP.put(hadron_p_,translateToLocal("tt.keyword.AntiProton")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p_); + SYMBOL_MAP.put(hadron_p_, "~p"); + UNLOCALIZED_NAME_MAP.put(hadron_p_, "tt.keyword.AntiProton"); + registry.registerForDisplay(hadron_p_); + registry.registerDirectDefinition("~p",hadron_p_); + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.getMass(); //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); - NAME_MAP.put(hadron_n,translateToLocal("tt.keyword.Neutron")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n); + UNLOCALIZED_NAME_MAP.put(hadron_n, "tt.keyword.Neutron"); + registry.registerForDisplay(hadron_n); + registry.registerDirectDefinition("n",hadron_n); + hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); - SYMBOL_MAP.put(hadron_n_,"~n"); - NAME_MAP.put(hadron_n_,translateToLocal("tt.keyword.AntiNeutron")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n_); + SYMBOL_MAP.put(hadron_n_, "~n"); + UNLOCALIZED_NAME_MAP.put(hadron_n_, "tt.keyword.AntiNeutron"); + registry.registerForDisplay(hadron_n_); + registry.registerDirectDefinition("~n",hadron_n_); + + TecTech.LOGGER.info("Old Neutron Mass: " + neutronMass); + TecTech.LOGGER.info("Old Proton Mass: " + protonMass); + TecTech.LOGGER.info("New Neutron Mass: " + EMHadronDefinition.hadron_n.getMass()); + TecTech.LOGGER.info("New Proton Mass: " + EMHadronDefinition.hadron_p.getMass()); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -446,34 +428,29 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize hadron_n3 = new EMDefinitionStack(hadron_n, 3D); hadron_p5 = new EMDefinitionStack(hadron_p, 5D); - try { - EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMHadronDefinition::fromNBT,EMHadronDefinition.class,getClassTypeStatic()); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { + if (DEBUG_MODE) { TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + getClassTypeStatic()); } } - public static void setTransformations(){ + public static void setTransformations(EMTransformationRegistry transformationInfo) {//Todo use Neutronium atom? //Added to atom map, but should be in its own - EMDefinitionStack neutrons =new EMDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); - TRANSFORMATION_INFO.getOredictDequantization().put(neutrons.getDefinition(),new EMOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); - TRANSFORMATION_INFO.getOredictQuantization().put( - OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), - new EMOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) + EMDefinitionStack neutrons = new EMDefinitionStack(hadron_n, 1000 * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED); + EMDequantizationInfo emDequantizationInfo = new EMDequantizationInfo(neutrons); + emDequantizationInfo.setOre(new OreDictionaryStack(1,OreDictionary.getOreID(OrePrefixes.dust.name() + Materials.Neutronium.mName)));//todo shitty looking, but works... + transformationInfo.getInfoMap().put(neutrons.getDefinition(), emDequantizationInfo); + transformationInfo.getOredictQuantization().put( + OreDictionary.getOreID(OrePrefixes.ingotHot.name() + Materials.Neutronium.mName), + new EMOredictQuantizationInfo(OrePrefixes.ingotHot, Materials.Neutronium, 1, neutrons) ); } @Override - public byte getClassType() { + public int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic(){ + public static int getClassTypeStatic() { return -64; } @@ -484,32 +461,32 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @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 (Util.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)) { - lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); + if (Util.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)) { - lines.add("NAME = "+getSimpleName()); + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = " + getSimpleName()); //lines.add("SYMBOL = "+getSymbol()); } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { + if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { lines.add("CHARGE = " + getCharge() / 3D + " e"); } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); } - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" "+"At current energy level"); + if (Util.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/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index f20f872a6e..9b77a6cab8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -1,46 +1,16 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; import static net.minecraft.util.StatCollector.translateToLocal; -/** - * Created by danie_000 on 22.10.2016. - */ -public final class EMBosonDefinition extends EMPrimitiveTemplate { - public static final EMBosonDefinition - boson_Y__ = new EMBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), - boson_H__ = new EMBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); - //deadEnd - public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); - public static final EMDecay deadEndHalf = new EMDecay(boson_Y__); - public static final EMDefinitionStack boson_Y__1 =new EMDefinitionStack(boson_Y__,1); - - private EMBosonDefinition(String name, String symbol, double mass, int color, int ID) { - super(name, symbol, 0, mass, 0, color, ID); - } - - public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - boson_H__.init(null, 1.56e-22D, 2, 2, - new EMDecay(0.01D, quark_b, quark_b_), - new EMDecay(0.02D, lepton_t, lepton_t_), - new EMDecay(0.96D, new EMDefinitionStack(boson_Y__, 4)), - deadEnd); +public abstract class EMBosonDefinition extends EMPrimitiveTemplate { + protected EMBosonDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, generation, mass, charge, color, ID, bind); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Boson")+": " + getName(); - } - - @Override - public boolean isTimeSpanHalfLife() { - return this==boson_H__; + return translateToLocal("tt.keyword.Boson")+": " + translateToLocal(getUnlocalizedName()); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java new file mode 100644 index 0000000000..f8f05b80ee --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; + +import static net.minecraft.util.StatCollector.translateToLocal; + +public abstract class EMFermionDefinition extends EMPrimitiveTemplate { + protected EMFermionDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, generation, mass, charge, color, ID, bind); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.Fermion")+": " + translateToLocal(getUnlocalizedName()); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java new file mode 100644 index 0000000000..fb8128c3a5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java @@ -0,0 +1,83 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMGaugeBosonDefinition extends EMBosonDefinition { + public static final EMGaugeBosonDefinition + boson_g__ = new EMGaugeBosonDefinition("tt.keyword.Gluon", "g", 0, 0, 8, 27, "g"), + boson_Y__ = new EMGaugeBosonDefinition("tt.keyword.Photon", "\u03b3", 1e-18D, 0, -1, 28, "Y"), + boson_Z = new EMGaugeBosonDefinition("tt.keyword.Weak0", "Z0", 91.1876e9, 0, -1, 29, "Z0"), + boson_W_ = new EMGaugeBosonDefinition("tt.keyword.WeakPlus", "W+", 80.379e9, 3, -1, 30, "W+"), + boson_W = new EMGaugeBosonDefinition("tt.keyword.WeakMinus", "W-", 80.379e9, -3, -1, 31, "W-"); + //deadEnd + public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); + public static final EMDefinitionStack boson_Y__1 = new EMDefinitionStack(boson_Y__, 1); + public static final EMDecay deadEndHalf = new EMDecay(boson_Y__1); + + protected EMGaugeBosonDefinition(String name, String symbol, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, 0, mass, charge, color, ID, bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMGaugeBosonDefinition.class, "tt.keyword.GaugeBoson")); + boson_g__.init(registry, boson_g__, 3e-50, 0, 0, deadEndHalf); + boson_Y__.init(registry, boson_Y__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + boson_Z.init(registry, boson_Z, 3e-25, 11, 11, + new EMDecay(0.03363, lepton_e, lepton_e_), + new EMDecay(0.03366, lepton_m, lepton_m_), + new EMDecay(0.03367, lepton_t, lepton_t_), + new EMDecay(0.068333, lepton_Ve, lepton_Ve_), + new EMDecay(0.068333, lepton_Vm, lepton_Vm_), + new EMDecay(0.068333, lepton_Vt, lepton_Vt_), + new EMDecay(0.118, quark_u, quark_u_), + new EMDecay(0.118, quark_c, quark_c_), + new EMDecay(0.152, quark_d, quark_d_), + new EMDecay(0.152, quark_s, quark_s_), + new EMDecay(0.152, quark_b, quark_b_), + deadEnd); + boson_W.init(registry, boson_W_, 3e-25, 9, 9, + new EMDecay(0.108, lepton_e, lepton_Ve_), + new EMDecay(0.108, lepton_m, lepton_Vm_), + new EMDecay(0.108, lepton_t, lepton_Vt_), + new EMDecay(0.112666, quark_u_, quark_d), + new EMDecay(0.112666, quark_u_, quark_s), + new EMDecay(0.112666, quark_u_, quark_b), + new EMDecay(0.112666, quark_c_, quark_d), + new EMDecay(0.112666, quark_c_, quark_s), + new EMDecay(0.112666, quark_c_, quark_b), + deadEnd); + boson_W_.init(registry, boson_W, 3e-25, 9, 9, + new EMDecay(0.108, lepton_e_, lepton_Ve), + new EMDecay(0.108, lepton_m_, lepton_Vm), + new EMDecay(0.108, lepton_t_, lepton_Vt), + new EMDecay(0.112666, quark_u, quark_d_), + new EMDecay(0.112666, quark_u, quark_s_), + new EMDecay(0.112666, quark_u, quark_b_), + new EMDecay(0.112666, quark_c, quark_d_), + new EMDecay(0.112666, quark_c, quark_s_), + new EMDecay(0.112666, quark_c, quark_b_), + deadEnd); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.GaugeBoson") + ": " + translateToLocal(getUnlocalizedName()); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index 38e537ec59..c665bf23b4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -1,57 +1,60 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMScalarBosonDefinition.boson_H__; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMLeptonDefinition extends EMPrimitiveTemplate { +public class EMLeptonDefinition extends EMFermionDefinition { public static final EMLeptonDefinition - lepton_e = new EMLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), - lepton_m = new EMLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), - lepton_t = new EMLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), - lepton_e_ = new EMLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), - lepton_m_ = new EMLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), - lepton_t_ = new EMLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); + lepton_e = new EMLeptonDefinition("tt.keyword.Electron", "\u03b2-", 1, 0.511e6D, -3, 15,"e-"), + lepton_m = new EMLeptonDefinition("tt.keyword.Muon", "\u03bc-", 2, 105.658e6D, -3, 17,"m-"), + lepton_t = new EMLeptonDefinition("tt.keyword.Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19,"t-"), + lepton_e_ = new EMLeptonDefinition("tt.keyword.Positron", "\u03b2+", -1, 0.511e6D, 3, 16,"e+"), + lepton_m_ = new EMLeptonDefinition("tt.keyword.Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18,"m+"), + lepton_t_ = new EMLeptonDefinition("tt.keyword.Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20,"t+"); public static final EMDefinitionStack lepton_e1 = new EMDefinitionStack(lepton_e, 1); public static final EMDefinitionStack lepton_e2 = new EMDefinitionStack(lepton_e, 2); public static final EMDefinitionStack lepton_e_1 = new EMDefinitionStack(lepton_e_, 1); public static final EMDefinitionStack lepton_e_2 = new EMDefinitionStack(lepton_e_, 2); - private EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, -1, ID); + protected EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) { + super(name, symbol, type, mass, charge, -1, ID,bind); //this.itemThing=null; //this.fluidThing=null; } - public static void run() { - lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMLeptonDefinition.class,"tt.keyword.Lepton")); + lepton_e.init(registry,lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, deadEnd, new EMDecay(lepton_e,boson_Y__)); - lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, + lepton_m.init(registry,lepton_m_, 2.197019e-6D, 0, 1, new EMDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), deadEnd);//makes photons and don't care - lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, + lepton_t.init(registry,lepton_t_, 2.903e-13D, 1, 3, new EMDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), new EMDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), new EMDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), deadEnd);//makes photons and don't care - lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, + lepton_e_.init(registry,lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, deadEnd, new EMDecay(lepton_e,boson_Y__)); - lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, + lepton_m_.init(registry,lepton_m, 2.197019e-6F, 0, 1, new EMDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), deadEnd);//makes photons and don't care - lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, + lepton_t_.init(registry,lepton_t, 2.903e-13F, 1, 3, new EMDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), new EMDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), new EMDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), @@ -60,7 +63,7 @@ public final class EMLeptonDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Lepton")+": " + getName(); + return translateToLocal("tt.keyword.Lepton")+": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index 9af7b97cb4..9ef04e8c7e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -1,56 +1,59 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEndHalf; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMNeutrinoDefinition extends EMPrimitiveTemplate { +public class EMNeutrinoDefinition extends EMLeptonDefinition { public static final EMNeutrinoDefinition - lepton_Ve = new EMNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), - lepton_Vm = new EMNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), - lepton_Vt = new EMNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), - lepton_Ve_ = new EMNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), - lepton_Vm_ = new EMNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), - lepton_Vt_ = new EMNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); + lepton_Ve = new EMNeutrinoDefinition("tt.keyword.ElectronNeutrino", "\u03bd\u03b2", 1, 2e0D, 21,"Ve-"), + lepton_Vm = new EMNeutrinoDefinition("tt.keyword.MuonNeutrino", "\u03bd\u03bc", 2, 0.15e6D, 23,"Vm-"), + lepton_Vt = new EMNeutrinoDefinition("tt.keyword.TauonNeutrino", "\u03bd\u03c4", 3, 15e6D, 25,"Vt-"), + lepton_Ve_ = new EMNeutrinoDefinition("tt.keyword.PositronNeutrino", "~\u03bd\u03b2", -1, 2e0D, 22,"Ve+"), + lepton_Vm_ = new EMNeutrinoDefinition("tt.keyword.AntimuonNeutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24,"Vm+"), + lepton_Vt_ = new EMNeutrinoDefinition("tt.keyword.AntitauonNeutrino", "~\u03bd\u03c4", -3, 15e6D, 26,"Vt+"); public static final EMDefinitionStack lepton_Ve1 = new EMDefinitionStack(lepton_Ve, 1); public static final EMDefinitionStack lepton_Ve2 = new EMDefinitionStack(lepton_Ve, 2); public static final EMDefinitionStack lepton_Ve_1 = new EMDefinitionStack(lepton_Ve_, 1); public static final EMDefinitionStack lepton_Ve_2 = new EMDefinitionStack(lepton_Ve_, 2); - private EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { - super(name, symbol, type, mass, 0, -1, ID); + protected EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID,String bind) { + super(name, symbol, type, mass, 0, ID,bind); } - public static void run() { - lepton_Ve.init(lepton_Ve_, 1D, -1, -1, + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMNeutrinoDefinition.class,"tt.keyword.Neutrino")); + lepton_Ve.init(registry,lepton_Ve_, 1D, -1, -1, EMDecay.NO_PRODUCT); - lepton_Vm.init(lepton_Vm_, 1D, 1, 0, + lepton_Vm.init(registry,lepton_Vm_, 1D, 1, 0, new EMDecay(0.825D, nothing), deadEndHalf); - lepton_Vt.init(lepton_Vt_, 1, 1, 0, + lepton_Vt.init(registry,lepton_Vt_, 1, 1, 0, new EMDecay(0.75F, nothing), deadEnd); - lepton_Ve_.init(lepton_Ve, 1, -1, -1, + lepton_Ve_.init(registry,lepton_Ve, 1, -1, -1, EMDecay.NO_PRODUCT); - lepton_Vm_.init(lepton_Vm, 1, 1, 0, + lepton_Vm_.init(registry,lepton_Vm, 1, 1, 0, new EMDecay(0.825F, nothing), deadEndHalf); - lepton_Vt_.init(lepton_Vt, 1, 1, 0, + lepton_Vt_.init(registry,lepton_Vt, 1, 1, 0, new EMDecay(0.75F, nothing), deadEnd); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Neutrino")+": " + getName(); + return translateToLocal("tt.keyword.Neutrino")+": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index 41da06567d..60f87ac83b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -1,6 +1,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; import static net.minecraft.util.StatCollector.translateToLocal; @@ -8,29 +10,45 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMPrimitiveDefinition extends EMPrimitiveTemplate { +public class EMPrimitiveDefinition extends EMPrimitiveTemplate { public static final EMPrimitiveDefinition - nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, 0), - null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MIN_VALUE), - space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, Integer.MIN_VALUE+1), - magic = new EMPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), - magic_ = new EMPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); - - private EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { - super(name, symbol, type, mass, 0, color, ID); + nbtE__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNBTERROR" , "!" , 0 , 0D , -1 , Integer.MIN_VALUE , "!" ), + null__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNULLPOINTER" , "." , 0 , 0D , -3 , Integer.MIN_VALUE+1 , "." ), + space = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveSpace" , "_" , 0 , 0D , -4 , Integer.MIN_VALUE + 2 , "_" ), + space_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitivePresence" , "~_" , 0 , 0D , -4 , Integer.MIN_VALUE + 3 , "~_" ), + mass = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMass" , "#" , 0 , 1 , -4 , Integer.MIN_VALUE + 4 , "#" ), + mass_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkMass" , "~#" , 0 , 1 , -4 , Integer.MIN_VALUE + 5 , "~#" ), + energy = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveEnergy" , "E" , 4 , 0D , -4 , Integer.MIN_VALUE + 6 , "E" ), + energy_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkEnergy" , "~E" , -4 , 0 , -4 , Integer.MIN_VALUE + 7 , "~E" ), + magic = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMagic" , "Ma" , 5 , 1e5D , 0 , Integer.MIN_VALUE + 8 , "Ma" ), + magic_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveAntimagic" , "~Ma" , -5 , 1e5D , 0 , Integer.MIN_VALUE + 9 , "~Ma" ); + + + protected EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID, String bind) { + super(name, symbol, type, mass, 0, color, ID, bind); } - public static void run() { - nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMPrimitiveDefinition.class, "tt.keyword.Primitive")); + nbtE__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + null__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + space.init(registry, space_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + space_.init(registry, space, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + mass.init(registry, mass_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + mass_.init(registry, mass, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + energy.init(registry, energy_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + energy_.init(registry, energy, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + magic.init(registry, magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + magic_.init(registry, magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Primitive")+": " + getName(); + return translateToLocal("tt.keyword.Primitive") + ": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index 3f19205aeb..19162bf90d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -1,8 +1,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; import static net.minecraft.util.StatCollector.translateToLocal; @@ -10,94 +12,95 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMQuarkDefinition extends EMPrimitiveTemplate { +public class EMQuarkDefinition extends EMFermionDefinition { public static final EMQuarkDefinition - quark_u = new EMQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), - quark_c = new EMQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), - quark_t = new EMQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), - quark_d = new EMQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), - quark_s = new EMQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), - quark_b = new EMQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), - quark_u_ = new EMQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), - quark_c_ = new EMQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), - quark_t_ = new EMQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), - quark_d_ = new EMQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), - quark_s_ = new EMQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), - quark_b_ = new EMQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); + quark_u = new EMQuarkDefinition("tt.keyword.QuarkUp", "u", 1, 2.3e6D, 2, 3,"u"), + quark_c = new EMQuarkDefinition("tt.keyword.QuarkCharm", "c", 2, 1.29e9D, 2, 9,"c"), + quark_t = new EMQuarkDefinition("tt.keyword.QuarkTop", "t", 3, 172.44e9D, 2, 13,"t"), + quark_d = new EMQuarkDefinition("tt.keyword.QuarkDown", "d", 1, 4.8e6D, -1, 5,"d"), + quark_s = new EMQuarkDefinition("tt.keyword.QuarkStrange", "s", 2, 95e6D, -1, 7,"s"), + quark_b = new EMQuarkDefinition("tt.keyword.QuarkBottom", "b", 3, 4.65e9D, -1, 11,"b"), + quark_u_ = new EMQuarkDefinition("tt.keyword.QuarkAntiUp", "~u", -1, 2.3e6D, -2, 4,"~u"), + quark_c_ = new EMQuarkDefinition("tt.keyword.QuarkAntiCharm", "~c", -2, 1.29e9D, -2, 10,"~c"), + quark_t_ = new EMQuarkDefinition("tt.keyword.QuarkAntiTop", "~t", -3, 172.44e9D, -2, 14,"~t"), + quark_d_ = new EMQuarkDefinition("tt.keyword.QuarkAntiDown", "~d", -1, 4.8e6D, 1, 6,"~d"), + quark_s_ = new EMQuarkDefinition("tt.keyword.QuarkAntiStrange", "~s", -2, 95e6D, 1, 8,"~s"), + quark_b_ = new EMQuarkDefinition("tt.keyword.QuarkAntiBottom", "~b", -3, 4.65e9D, 1, 12,"~b"); - private EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, 0, ID); + protected EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) { + super(name, symbol, type, mass, charge, 0, ID,bind); } - public static void run() { - quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMQuarkDefinition.class,"tt.keyword.Quark")); + quark_u.init(registry,quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), new EMDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), new EMDecay(0.9D, quark_d, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_c.init(quark_c_, 0.5e-13D, 1, -1, + deadEnd);//makes photons and don't care + quark_c.init(registry,quark_c_, 0.5e-13D, 1, -1, new EMDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), new EMDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), new EMDecay(0.9D, quark_s, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26D, 0, -1, + deadEnd);//makes photons and don't care + quark_t.init(registry,quark_t_, 2.5e-26D, 0, -1, new EMDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), new EMDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), new EMDecay(0.9D, quark_b, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care - quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, + quark_d.init(registry,quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), new EMDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), new EMDecay(0.9D, quark_u, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_s.init(quark_s_, 0.6e-9D, 1, -1, + deadEnd);//makes photons and don't care + quark_s.init(registry,quark_s_, 0.6e-9D, 1, -1, new EMDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), new EMDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), new EMDecay(0.9D, quark_c, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13D, 0, -1, + deadEnd);//makes photons and don't care + quark_b.init(registry,quark_b_, 0.7e-13D, 0, -1, new EMDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), new EMDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), new EMDecay(0.9D, quark_t, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care - quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, + quark_u_.init(registry,quark_u, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), new EMDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), new EMDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_c_.init(quark_c, 0.5e-13D, 1, -1, + deadEnd);//makes photons and don't care + quark_c_.init(registry,quark_c, 0.5e-13D, 1, -1, new EMDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), new EMDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), new EMDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 0, -1, + deadEnd);//makes photons and don't care + quark_t_.init(registry,quark_t, 2.5e-26F, 0, -1, new EMDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), new EMDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), new EMDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care - quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, + quark_d_.init(registry,quark_d, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), new EMDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), new EMDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_s_.init(quark_s, 0.6e-9F, 1, -1, + deadEnd);//makes photons and don't care + quark_s_.init(registry,quark_s, 0.6e-9F, 1, -1, new EMDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), new EMDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), new EMDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 0, -1, + deadEnd);//makes photons and don't care + quark_b_.init(registry,quark_b, 0.7e-13F, 0, -1, new EMDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), new EMDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), new EMDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Quark")+": " + getName(); + return translateToLocal("tt.keyword.Quark")+": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java new file mode 100644 index 0000000000..5070954847 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java @@ -0,0 +1,46 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMScalarBosonDefinition extends EMBosonDefinition { + public static final EMScalarBosonDefinition + boson_H__ = new EMScalarBosonDefinition("tt.keyword.Higgs", "H0", 125.09e9D, -2, 32,"H0"); + + private EMScalarBosonDefinition(String name, String symbol, double mass, int color, int ID,String bind) { + super(name, symbol, 0, mass, 0, color, ID,bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMScalarBosonDefinition.class,"tt.keyword.ScalarBoson")); + boson_H__.init(registry,boson_H__, 1.56e-22D, 8, 8, + new EMDecay ( 0.0002171 , lepton_m , lepton_m_ ), + new EMDecay ( 0.001541 , boson_Z, boson_Y__ ), + new EMDecay ( 0.02641 , boson_Z, boson_Z), + new EMDecay ( 0.02884 , quark_c , quark_c_ ), + new EMDecay ( 0.06256 , lepton_t , lepton_t_ ), + new EMDecay ( 0.0818 , boson_g__ , boson_g__ ), + new EMDecay ( 0.2152 , boson_W_, boson_W), + new EMDecay ( 0.5809 , quark_b , quark_b_ ), + deadEnd); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.ScalarBoson")+": " + translateToLocal(getUnlocalizedName()); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index b7310485a2..68607ae737 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,11 +1,10 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; 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.mechanics.elementalMatter.core.maps.IEMMapRead; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; @@ -16,8 +15,6 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; - public class TT_recipe extends GT_Recipe { public static final String E_RECIPE_ID = "eRecipeID"; public final EMConstantStackMap[] input; @@ -257,20 +254,6 @@ public class TT_recipe extends GT_Recipe { return mRecipeMap.get(stack); } - public T findRecipe(ItemStack dataHandler){ - if(dataHandler==null || dataHandler.stackTagCompound==null) { - return null; - } - try { - return mRecipeMap.get(EMDefinitionsRegistry.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); - }catch (Exception e){ - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - public void add(T recipe){ mRecipeMap.put(recipe.mResearchEM,recipe); } diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java index d34d12c754..42fb14f55d 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java @@ -13,7 +13,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 17.12.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java index bac2dfb9ac..2a8bb37a0b 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java @@ -10,7 +10,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; /** diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java index eb590ab2e2..f3574007f2 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java @@ -18,7 +18,7 @@ import net.minecraft.world.IBlockAccess; import java.util.List; import static com.github.technus.tectech.TecTech.tectechTexturePage1; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 03.10.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java index c65870eeb7..9648e41d8d 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java @@ -16,7 +16,7 @@ import net.minecraft.world.IBlockAccess; import java.util.List; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 03.10.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java index 90f3312342..cc071d2326 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java +++ b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java @@ -28,7 +28,7 @@ import java.io.OutputStream; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; @Optional.InterfaceList( diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 752f2d1bcc..3d00fcdf35 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 2062173cfd..d909054196 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 @@ -1,15 +1,15 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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 cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -30,8 +30,8 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -61,7 +61,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { - content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -75,7 +75,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } else if (content.hasStacks()) { ((IEMContainer) metaTE).purgeOverflow(); tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); + tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols", content.getShortSymbolsNBT()); content.clear(); } @@ -94,7 +94,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } if (tNBT.hasKey("content")) { try { - content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -106,7 +106,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE tNBT.removeTag("symbols"); } else if (content.hasStacks()) { tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); + tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols", content.getShortSymbolsNBT()); content.clear(); } @@ -140,10 +140,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(IEMDefinition definition: EMDefinitionsRegistry.getStacksRegisteredForDisplay()){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 144 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1000 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); + for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){ + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); } } 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 2cca6474f4..f0f59e0e86 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.item; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; @@ -20,7 +21,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -48,7 +49,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -56,7 +57,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem } } tNBT.setTag("info", definitions.getInfoNBT()); - tNBT.setTag("content", definitions.toNBT()); + tNBT.setTag("content", definitions.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols",definitions.getShortSymbolsNBT()); return oldMap; } @@ -71,7 +72,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } try { - return EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + return EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -91,7 +92,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); 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 e517fe5f2a..8b8133a1e2 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 @@ -25,7 +25,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java index f4531a248b..4fca682268 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java +++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index d71abb34b7..b74f40f336 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 1d1da74a7a..7f9e0f0a4a 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 @@ -25,7 +25,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.thing.CustomItemList.parametrizerMemory; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java index 69ff06e9e7..bc853334d2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java @@ -193,7 +193,7 @@ public class Textures { public static ITexture TESLA_TRANSCEIVER_TOP_BA = new GT_RenderedTexture(TESLA_TRANSCEIVER_TOP); - public Textures(){ + public static void run(){ for (byte i = 0; i < MACHINE_CASINGS_TT.length; i++) { for (byte j = 0; j < MACHINE_CASINGS_TT[i].length; j++) { MACHINE_CASINGS_TT[i][j] = new GT_SidedTexture(MACHINECASINGS_BOTTOM_TT[i], MACHINECASINGS_TOP_TT[i], MACHINECASINGS_SIDE_TT[i], Dyes.getModulation(j - 1, MACHINE_METAL.mRGBa)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 0950a173ab..84f18ad2bf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -24,7 +24,7 @@ import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; @@ -83,7 +83,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta //aNBT.setFloat("lifeTimeMult",lifeTimeMult); aNBT.setDouble("OverflowMatter", overflowMatter); content.cleanUp(); - aNBT.setTag("eM_Stacks", content.toNBT()); + aNBT.setTag("eM_Stacks", content.toNBT(TecTech.definitionsRegistry)); aNBT.setShort("eID", id); } @@ -95,7 +95,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); id = aNBT.getShort("eID"); try { - content = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); + content = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eM_Stacks")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -210,7 +210,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public double getMaxStackSize() { - return mTier * (mTier - 7) * 64D * AVOGADRO_CONSTANT_144; + return mTier * (mTier - 7) * 64D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java deleted file mode 100644 index 3015d024c7..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ /dev/null @@ -1,717 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.HashMap; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; -import static com.github.technus.tectech.util.DoubleCount.add; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - private static Textures.BlockIcons.CustomIcon ScreenON_Slave; - private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; - - protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; - private static double MASS_TO_EU_INSTANT; - private static int STARTUP_COST, KEEPUP_COST; - - protected byte eTier = 0; - protected EMInstanceStack stack; - private long plasmaEnergy; - - protected boolean started = false; - //endregion - - //region collision handlers - public static final HashMap FUSE_HANDLERS = new HashMap<>(); - public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); - - public interface IPrimitiveColliderHandler { - void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); - } - - public interface IColliderHandler extends IPrimitiveColliderHandler { - byte getRequiredTier(); - } - - static { - FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); - EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); - - FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); - EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); - - FUSE_HANDLERS.put((EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); - if (collisionHandler != null) { - collisionHandler.collide(in2, in1, out); - } else { - out.putUnifyAll(in1, in2); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyExact(in1.getDefinition().getStackForm(1)); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - }); - PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> { - if (fuseAspects(in1, in2, out)) return; - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - }); - } - - private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyExact(in1.getDefinition().getStackForm(1)); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return true; - } - return false; - } - - private static void registerSimpleAspectFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - if (fuseAspects(in1, in2, out)) return; - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - - private static void registerSimpleAtomFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - //endregion - - //region parameters - protected Parameters.Group.ParameterIn mode; - private static final IStatusFunction MODE_STATUS = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE || mode == COLLIDE_MODE) { - return STATUS_OK; - } else if (mode > 1) { - return STATUS_TOO_HIGH; - } else if (mode < 0) { - return STATUS_TOO_LOW; - } - return STATUS_WRONG; - } - return STATUS_OK; - }; - private static final INameFunction MODE_NAME = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.0");//Mode: Fuse - } else if (mode == COLLIDE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.1");//Mode: Collide - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.2");//Mode: Undefined - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.3");//Currently Slaves... - }; - //endregion - - //region structure - //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition - .builder() - .addShapeOldApi("main", new String[][]{ - {"I0A0A0", "I00000", "I0A0A0",}, - {"H0000000", "G001111100", "H0000000",}, - {"F22223332222", "F41155555114", "F22223332222",}, - {"E2000000000002", "E4155111115514", "E2000000000002",}, - {"D20000E00002", "D41511E11514", "D20000E00002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0030O0300", "0151O1510", "0030O0300",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, - {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, - {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, - }) - .addElement('0', ofBlock(sBlockCasingsTT, 4)) - .addElement('1', ofBlock(sBlockCasingsTT, 7)) - .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) - .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) - .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) - .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, - textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, - textureOffset + 4, 2, sBlockCasingsTT, 4)) - .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, - textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, - textureOffset + 4, 4, sBlockCasingsTT, 4)) - .build(); - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"),//2 - Elemental Input Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.2"),//3 - Elemental Output Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction - }; - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - //endregion - - public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_collider(String aName) { - super(aName); - } - - public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* AVOGADRO_CONSTANT);//mass diff - MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; - STARTUP_COST = -heliumPlasmaValue * 10000; - KEEPUP_COST = -heliumPlasmaValue; - } - - protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU - if (partner.stack != null && stack != null) {//todo add single event mode as an option - boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) && - partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); - - EMInstanceStack stack2 = partner.stack; - double preMass = add(stack2.getMass(),stack.getMass()); - //System.out.println("preMass = " + preMass); - - EMInstanceStackMap map = new EMInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - for (EMInstanceStack newStack : map.valuesToArray()) { - check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); - } - //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new EMInstanceStackMap[]{map}; - - partner.stack = stack = null; - //System.out.println("check = " + check); - //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return check ? preMass - map.getMass() : Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! - if (partner.stack != null && stack != null) {//todo add single event mode as an option - EMInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); - //System.out.println("preMass = " + preMass); - - EMInstanceStackMap map = new EMInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new EMInstanceStackMap[]{map}; - - partner.stack = stack = null; - //System.out.println("check = " + check); - //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { - if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { - colliderHandler.collide(stack2, stack, map); - } else { - map.putUnifyAll(stack, stack2); - outputEM = new EMInstanceStackMap[]{map}; - return true; - } - return false; - } - - protected GT_MetaTileEntity_EM_collider getPartner() { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); - if (gregTechBaseTileEntity != null) { - IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); - return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && - ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && - gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? - (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; - } - return null; - } - - protected final boolean isMaster() { - return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; - } - - private void makeEU(double massDiff) { - plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; - if (DEBUG_MODE) { - System.out.println("plasmaEnergy = " + plasmaEnergy); - } - } - - private EMInstanceStackMap tickStack() { - if (stack == null) { - return null; - } - stack.setAge(stack.getAge() + 1); - EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); - if (newInstances == null) { - stack.nextColor(); - return null; - } else { - stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); - return newInstances.getOutput(); - } - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_collider(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 2; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 2; - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { - eTier = 0; - return false; - } - - if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 8) { - eTier = 1; - } else if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 9) { - eTier = 2; - } else { - eTier = 0; - return false; - } - if (structureCheck_EM("main", 11, 1, 18)) { - return true; - } - eTier = 0; - return false; - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - return false; - } - mEfficiencyIncrease = 10000; - if (started) { - if (stack == null) { - for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - EMInstanceStackMap container = inputElemental.getContentHandler(); - if (container.isEmpty()) { - continue; - } - stack = container.removeKey(container.getFirst().getDefinition()); - long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; - if (eut < Integer.MIN_VALUE + 7) { - return false; - } - mMaxProgresstime = 20; - mEUt = (int) eut; - eAmpereFlow = 5; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 1; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 2; - } else { - started = true; - mMaxProgresstime = 20; - mEUt = STARTUP_COST; - eAmpereFlow = 10; - } - return true; - } - - @Override - public void outputAfterRecipe_EM() { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - return; - } - if (isMaster()) { - switch ((int) mode.get()) { - case FUSE_MODE: - makeEU(fuse(partner)); - break; - case COLLIDE_MODE: - collide(partner);//todo - break; - default: { - outputEM = new EMInstanceStackMap[2]; - outputEM[1] = tickStack(); - if (outputEM[1] == null) { - outputEM[1] = partner.tickStack(); - } else { - EMInstanceStackMap map = partner.tickStack(); - if (map != null) { - outputEM[1].putUnifyAll(map); - } - } - } - } - if (outputEM != null) { - for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { - if (outputEM[i] != null) { - eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); - outputEM[i] = null; - } - } - } - } - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - translateToLocal("gt.blockmachines.multimachine.em.collider.desc.0"),//Collide matter at extreme velocities. - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.1")//Faster than light*!!! - }; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); - ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); - ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aFacing % 2 == 0) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; - } else { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; - } - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; - } - - @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0); - mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); - } - - @Override - public void parametersStatusesWrite_EM(boolean machineBusy) { - if (isMaster()) { - super.parametersStatusesWrite_EM(machineBusy); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("eTier", eTier);//collider tier - aNBT.setBoolean("eStarted", started); - if (stack != null) { - aNBT.setTag("eStack", stack.toNBT()); - } - aNBT.setLong("ePlasmaEnergy", plasmaEnergy); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - eTier = aNBT.getByte("eTier");//collider tier - started = aNBT.getBoolean("eStarted"); - if (aNBT.hasKey("eStack")) { - stack = EMInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); - } - plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); - } - - @Override - public void stopMachine() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - super.stopMachine(); - } - - @Override - protected void afterRecipeCheckFailed() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - getBaseMetaTileEntity().disableWorking(); - super.afterRecipeCheckFailed(); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (!aBaseMetaTileEntity.isAllowedToWork()) { - started = false; - } - super.onPreTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } - structureBuild_EM("main", 11, 1, 18, hintsOnly, stackSize); - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 84dafb8db2..1978d2acfc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -50,7 +50,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT; + public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* EM_COUNT_PER_MATERIAL_AMOUNT; private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index e769d3e480..7d5961f219 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -100,38 +100,21 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { EMInstanceStackMap map = in.getContentHandler(); for (EMInstanceStack stack : map.valuesToArray()) { - { - EMFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); - if (info != null) { - if (map.removeAllAmounts(info.input())) { - mOutputFluids = new FluidStack[]{info.output()}; - startRecipe(info.input(), stack.getEnergy()); - return true; - } - } - } - { - EMItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); - if (info != null) { - if (map.removeAllAmounts(info.input())) { - mOutputItems = new ItemStack[]{info.output()}; - startRecipe(info.input(), stack.getEnergy()); - return true; - } - } - } - { - EMOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); - if (info != null) { - if (map.removeAllAmounts(info.input())) { - ArrayList items = OreDictionary.getOres(info.getOut()); - if (items != null && !items.isEmpty()) { - mOutputItems = new ItemStack[]{items.get(0)}; - startRecipe(info.input(), stack.getEnergy()); - return true; - } + EMDequantizationInfo emDequantizationInfo = TecTech.transformationInfo.getInfoMap().get(stack.getDefinition()); + if(emDequantizationInfo!=null && emDequantizationInfo.getStack()!=null && map.removeAllAmounts(emDequantizationInfo.getInput())){ + Object out=emDequantizationInfo.getStack(); + if(out instanceof ItemStack){ + mOutputItems=new ItemStack[]{emDequantizationInfo.getItem()}; + }else if(out instanceof FluidStack){ + mOutputFluids=new FluidStack[]{emDequantizationInfo.getFluid()}; + }else if(out instanceof OreDictionaryStack){ + ArrayList items = OreDictionary.getOres(OreDictionary.getOreName(emDequantizationInfo.getOre().getOreId())); + if (items != null && !items.isEmpty()) { + mOutputItems = new ItemStack[]{items.get(0)}; } } + startRecipe(emDequantizationInfo.getInput(), stack.getEnergy()); + return true; } } } 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 64949fe402..be036050be 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 @@ -31,7 +31,6 @@ import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.DEFAULT_ENERGY_LEVEL; import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; @@ -98,9 +97,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - EMItemQuantizationInfo aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null)); + EMItemQuantizationInfo aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -109,11 +108,11 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - EMOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.getOredictQuantization().get(ID); + EMOredictQuantizationInfo aOQI = TecTech.transformationInfo.getOredictQuantization().get(ID); if (aOQI == null) { continue; } - IEMStack into = aOQI.output(); + IEMStack into = aOQI.getOut(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -136,7 +135,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - EMFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.getFluidQuantization().get(fs.getFluid().getID()); + EMFluidQuantizationInfo aFQI = TecTech.transformationInfo.getFluidQuantization().get(fs.getFluid().getID()); if (aFQI == null) { continue; } 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 74bb817142..89255b331a 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 @@ -309,7 +309,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa NBTTagCompound tNBT = mInventory[1].getTagCompound();//code above makes it not null tNBT.setString("eMachineType", machineType); - tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT()); + tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT(TecTech.definitionsRegistry)); tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator"); } else if (objectsScanned != null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)) { ElementalDefinitionScanStorage_EM.setContent(mInventory[1], objectsScanned, scanComplexity); @@ -387,7 +387,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa aNBT.setLong("eComputationRemaining", computationRemaining); aNBT.setLong("eComputationRequired", computationRequired); if (objectResearched != null) { - aNBT.setTag("eObject", objectResearched.toNBT()); + aNBT.setTag("eObject", objectResearched.toNBT(TecTech.definitionsRegistry)); } else { aNBT.removeTag("eObject"); } @@ -397,7 +397,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa aNBT.removeTag("eScanComplexity"); } if (objectsScanned != null) { - aNBT.setTag("eScanObjects", objectsScanned.toNBT()); + aNBT.setTag("eScanObjects", objectsScanned.toNBT(TecTech.definitionsRegistry)); } else { aNBT.removeTag("eScanObjects"); } @@ -409,7 +409,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa computationRemaining = aNBT.getLong("eComputationRemaining"); computationRequired = aNBT.getLong("eComputationRequired"); if (aNBT.hasKey("eObject")) { - objectResearched = EMDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); + objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eObject")); if (objectResearched.getDefinition() == nbtE__) { objectResearched = null; } @@ -423,7 +423,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } try { if (aNBT.hasKey("eScanObjects")) { - objectsScanned = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); + objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eScanObjects")); } } catch (EMException e) { objectsScanned = new EMInstanceStackMap(); 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 9a6f99bed8..2fe43cb8e1 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 @@ -757,7 +757,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt NBTTagCompound output = new NBTTagCompound(); for (int i = 0; i < outputEM.length; i++) { if (outputEM[i] != null) { - output.setTag(Integer.toString(i), outputEM[i].toNBT()); + output.setTag(Integer.toString(i), outputEM[i].toNBT(TecTech.definitionsRegistry)); } } aNBT.setTag("outputEM", output); @@ -847,7 +847,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (int i = 0; i < outputEM.length; i++) { if (compound.hasKey(Integer.toString(i))) { try { - outputEM[i] = EMInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i))); + outputEM[i] = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,compound.getCompoundTag(Integer.toString(i))); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java new file mode 100644 index 0000000000..cf8f26ff02 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java @@ -0,0 +1,709 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.HashMap; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.DoubleCount.add; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private static Textures.BlockIcons.CustomIcon ScreenON_Slave; + private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; + + protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; + private static double MASS_TO_EU_INSTANT; + private static int STARTUP_COST, KEEPUP_COST; + + protected byte eTier = 0; + protected EMInstanceStack stack; + private long plasmaEnergy; + + protected boolean started = false; + //endregion + + //region collision handlers + public static final HashMap FUSE_HANDLERS = new HashMap<>(); + public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); + + static { + FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); + + FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + + registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); + + FUSE_HANDLERS.put(((long) EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); + if (collisionHandler != null) { + collisionHandler.collide(in2, in1, out); + } else { + out.putUnifyAll(in1, in2); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + + PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + }); + PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> { + if (fuseAspects(in1, in2, out)) return; + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + }); + } + + private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return true; + } + return false; + } + + private static void registerSimpleAspectFuse(int classTypeStatic) { + FUSE_HANDLERS.put(((long) EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + if (fuseAspects(in1, in2, out)) return; + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + } + + private static void registerSimpleAtomFuse(int classTypeStatic) { + FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + } + //endregion + + //region parameters + protected Parameters.Group.ParameterIn mode; + private static final IStatusFunction MODE_STATUS = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); + if (mode == FUSE_MODE || mode == COLLIDE_MODE) { + return STATUS_OK; + } else if (mode > 1) { + return STATUS_TOO_HIGH; + } else if (mode < 0) { + return STATUS_TOO_LOW; + } + return STATUS_WRONG; + } + return STATUS_OK; + }; + private static final INameFunction MODE_NAME = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); + if (mode == FUSE_MODE) { + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.0");//Mode: Fuse + } else if (mode == COLLIDE_MODE) { + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.1");//Mode: Collide + } + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.2");//Mode: Undefined + } + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.3");//Currently Slaves... + }; + //endregion + + //region structure + //use multi A energy inputs, use less power the longer it runs + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + .builder() + .addShapeOldApi("main", new String[][]{ + {"I0A0A0", "I00000", "I0A0A0",}, + {"H0000000", "G001111100", "H0000000",}, + {"F22223332222", "F41155555114", "F22223332222",}, + {"E2000000000002", "E4155111115514", "E2000000000002",}, + {"D20000E00002", "D41511E11514", "D20000E00002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0030O0300", "0151O1510", "0030O0300",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, + {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, + {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT, 4)) + .addElement('1', ofBlock(sBlockCasingsTT, 7)) + .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) + .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) + .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, + textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, + textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, + textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, + textureOffset + 4, 4, sBlockCasingsTT, 4)) + .build(); + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"),//2 - Elemental Input Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.2"),//3 - Elemental Output Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction + }; + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + + //endregion + + public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_collider(String aName) { + super(aName); + } + + public static void setValues(int heliumPlasmaValue) { + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff + MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; + STARTUP_COST = -heliumPlasmaValue * 10000; + KEEPUP_COST = -heliumPlasmaValue; + } + + protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU + if (partner.stack != null && stack != null) {//todo add single event mode as an option + boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) && + partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); + + EMInstanceStack stack2 = partner.stack; + double preMass = add(stack2.getMass(),stack.getMass()); + //System.out.println("preMass = " + preMass); + + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } else { + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + for (EMInstanceStack newStack : map.valuesToArray()) { + check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); + } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new EMInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return check ? preMass - map.getMass() : Math.min(preMass - map.getMass(), 0); + } + return 0; + } + + protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! + if (partner.stack != null && stack != null) {//todo add single event mode as an option + EMInstanceStack stack2 = partner.stack; + double preMass = stack2.getMass() + stack.getMass(); + //System.out.println("preMass = " + preMass); + + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } else { + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new EMInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return Math.min(preMass - map.getMass(), 0); + } + return 0; + } + + private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { + if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { + colliderHandler.collide(stack2, stack, map); + } else { + map.putUnifyAll(stack, stack2); + outputEM = new EMInstanceStackMap[]{map}; + return true; + } + return false; + } + + protected GT_MetaTileEntity_EM_collider getPartner() { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); + if (gregTechBaseTileEntity != null) { + IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); + return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && + ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && + gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? + (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; + } + return null; + } + + protected final boolean isMaster() { + return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; + } + + private void makeEU(double massDiff) { + plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; + if (DEBUG_MODE) { + System.out.println("plasmaEnergy = " + plasmaEnergy); + } + } + + private EMInstanceStackMap tickStack() { + if (stack == null) { + return null; + } + stack.setAge(stack.getAge() + 1); + EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); + if (newInstances == null) { + stack.nextColor(); + return null; + } else { + stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); + return newInstances.getOutput(); + } + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_collider(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 2; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 2; + if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { + eTier = 0; + return false; + } + + if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 8) { + eTier = 1; + } else if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 9) { + eTier = 2; + } else { + eTier = 0; + return false; + } + if (structureCheck_EM("main", 11, 1, 18)) { + return true; + } + eTier = 0; + return false; + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { + return false; + } + mEfficiencyIncrease = 10000; + if (started) { + if (stack == null) { + for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { + EMInstanceStackMap container = inputElemental.getContentHandler(); + if (container.isEmpty()) { + continue; + } + stack = container.removeKey(container.getFirst().getDefinition()); + long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; + if (eut < Integer.MIN_VALUE + 7) { + return false; + } + mMaxProgresstime = 20; + mEUt = (int) eut; + eAmpereFlow = 5; + return true; + } + mMaxProgresstime = 20; + mEUt = KEEPUP_COST; + eAmpereFlow = 1; + return true; + } + mMaxProgresstime = 20; + mEUt = KEEPUP_COST; + eAmpereFlow = 2; + } else { + started = true; + mMaxProgresstime = 20; + mEUt = STARTUP_COST; + eAmpereFlow = 10; + } + return true; + } + + @Override + public void outputAfterRecipe_EM() { + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + return; + } + if (isMaster()) { + switch ((int) mode.get()) { + case FUSE_MODE: + makeEU(fuse(partner)); + break; + case COLLIDE_MODE: + collide(partner);//todo + break; + default: { + outputEM = new EMInstanceStackMap[2]; + outputEM[1] = tickStack(); + if (outputEM[1] == null) { + outputEM[1] = partner.tickStack(); + } else { + EMInstanceStackMap map = partner.tickStack(); + if (map != null) { + outputEM[1].putUnifyAll(map); + } + } + } + } + if (outputEM != null) { + for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { + if (outputEM[i] != null) { + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); + outputEM[i] = null; + } + } + } + } + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.0"),//Collide matter at extreme velocities. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.1")//Faster than light*!!! + }; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); + ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); + ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + if (aFacing % 2 == 0) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; + } else { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; + } + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; + } + + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0 = parametrization.getGroup(0); + mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); + } + + @Override + public void parametersStatusesWrite_EM(boolean machineBusy) { + if (isMaster()) { + super.parametersStatusesWrite_EM(machineBusy); + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setByte("eTier", eTier);//collider tier + aNBT.setBoolean("eStarted", started); + if (stack != null) { + aNBT.setTag("eStack", stack.toNBT(TecTech.definitionsRegistry)); + } + aNBT.setLong("ePlasmaEnergy", plasmaEnergy); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + eTier = aNBT.getByte("eTier");//collider tier + started = aNBT.getBoolean("eStarted"); + if (aNBT.hasKey("eStack")) { + stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eStack")); + } + plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); + } + + @Override + public void stopMachine() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + super.stopMachine(); + } + + @Override + protected void afterRecipeCheckFailed() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + getBaseMetaTileEntity().disableWorking(); + super.afterRecipeCheckFailed(); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (!aBaseMetaTileEntity.isAllowedToWork()) { + started = false; + } + super.onPreTick(aBaseMetaTileEntity, aTick); + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + if (hintsOnly) { + TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + TT_Container_Casings.sHintCasingsTT, 12); + } + structureBuild_EM("main", 11, 1, 18, hintsOnly, stackSize); + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return description; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java new file mode 100644 index 0000000000..0114ac847b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java @@ -0,0 +1,5 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +public interface IColliderHandler extends IPrimitiveColliderHandler { + byte getRequiredTier(); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java new file mode 100644 index 0000000000..3c4438b5e1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; + +public interface IPrimitiveColliderHandler { + void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index d1eafa22fc..e6e618a31c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -12,8 +12,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.DoubleCount.*; @@ -77,7 +76,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); double maxSafeMass = EMAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g - maxCapacity = maxSafeMass * AVOGADRO_CONSTANT_144 * radius;// eV/c^2 + maxCapacity = maxSafeMass * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * radius;// eV/c^2 } private double getRCF(double RPM) { @@ -128,7 +127,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap - if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) { + if (randomStack.isInvalidAmount()) { input.removeKey(randomStack.getDefinition()); stacks = input.valuesToArray(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 70d93b36ed..3d1259f808 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -9,10 +9,9 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; -import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.DoubleCount.mul; import static com.github.technus.tectech.util.DoubleCount.sub; @@ -89,7 +88,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; ticks =Math.max(20,(1<<(12-desiredTier))*20); - maxCapacity= EMAtomDefinition.getSomethingHeavy().getMass()*(2<=separator.length()){ + stringBuilder.setLength(length -separator.length()); + } + return stringBuilder.toString(); + } } diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 89d2b517a2..a5b5051827 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -798,20 +798,17 @@ gt.blockmachines.debug.tt.writer.desc.2=ABC axises aligned to machine front tt.keyword.ID=ID #Example: 32EU at 1A tt.keyword.at=at -#These are Thaumcraft aspects -tt.keyword.Air=Air -tt.keyword.Earth=Earth -tt.keyword.Fire=Fire -tt.keyword.Water=Water -tt.keyword.Order=Order -tt.keyword.Entropy=Entropy -tt.keyword.Primal=Primal -tt.keyword.Aspect=Aspect +#EM scan result tt.keyword.CLASS=CLASS tt.keyword.NAME=NAME tt.keyword.CHARGE=CHARGE tt.keyword.COLORLESS=COLORLESS tt.keyword.MASS=MASS +tt.keyphrase.LIFE_TIME=LIFE TIME +tt.keyphrase.CARRIES_COLOR=CARRIES COLOR +tt.keyphrase.Hint_Details=Hint Details +tt.keyphrase.At_current_energy_level=At current energy level +#debug boom tt.keyword.BOOM=BOOM! tt.keyword.Destination=Destination tt.keyword.Weight=Weight @@ -834,10 +831,6 @@ tt.keyword.Status=Status tt.keyword.Content=Content tt.keyword.PacketHistory=PacketHistory -tt.keyphrase.LIFE_TIME=LIFE TIME -tt.keyphrase.CARRIES_COLOR=CARRIES COLOR -tt.keyphrase.Hint_Details=Hint Details -tt.keyphrase.At_current_energy_level=At current energy level #Used when 0 Elemental Matter Stacks tt.keyphrase.No_Stacks=No Stacks tt.keyphrase.Contains_EM=Contains EM @@ -875,3 +868,87 @@ tt.keyphrase.Side_capabilities=Side capabilities #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret tile.turretBaseEM.name=Elemental Turret Base + +tt.keyword.mol=mol +tt.keyword.itemMols=items +tt.keyword.mbMols=mb +#EM types +tt.keyword.Primitive=Primitive +tt.keyword.Element=Element +tt.keyword.Atom=Atom +tt.keyword.Isotope=Isotope +tt.keyword.Boson=Boson +tt.keyword.Fermion=Fermion +tt.keyword.GaugeBoson=Gauge boson +tt.keyword.Meson=Meson +tt.keyword.Baryon=Baryon +tt.keyword.Tetraquark=Tetraquark +tt.keyword.Pentaquark=Pentaquark +tt.keyword.Hexaquark=Hexaquark +tt.keyword.Hadron=Hadron +tt.keyword.Neutrino=Neutrino +tt.keyword.Quark=Quark +tt.keyword.ScalarBoson=Scalar boson +#em definitions +tt.keyword.PrimitiveNBTERROR=NBT ERROR +tt.keyword.PrimitiveNULLPOINTER=NULL POINTER +tt.keyword.PrimitiveSpace=Space +tt.keyword.PrimitivePresence=Presence +tt.keyword.PrimitiveMass=Mass +tt.keyword.PrimitiveDarkMass=DarkMass +tt.keyword.PrimitiveEnergy=Energy +tt.keyword.PrimitiveDarkEnergy=DarkEnergy +tt.keyword.PrimitiveMagic=Magic +tt.keyword.PrimitiveAntimagic=Antimagic +tt.keyword.Gluon=Gluon +tt.keyword.Photon=Photon +tt.keyword.Weak0=Weak +tt.keyword.WeakPlus=Weak+ +tt.keyword.WeakMinus=Weak- +tt.keyword.Proton=Proton +tt.keyword.AntiProton=Antiproton +tt.keyword.Neutron=Neutron +tt.keyword.AntiNeutron=Antineutron +tt.keyword.Lepton=Lepton +tt.keyword.Electron=Electron +tt.keyword.Muon=Muon +tt.keyword.Tauon=Tauon +tt.keyword.Positron=Positron +tt.keyword.Antimuon=Antimuon +tt.keyword.Antitauon=Antitauon +tt.keyword.ElectronNeutrino=Electron neutrino +tt.keyword.MuonNeutrino=Muon neutrino +tt.keyword.TauonNeutrino=Tauon neutrino +tt.keyword.PositronNeutrino=Positron neutrino +tt.keyword.AntimuonNeutrino=Antimuon neutrino +tt.keyword.AntitauonNeutrino=Antitauon neutrino +tt.keyword.QuarkUp=Up +tt.keyword.QuarkCharm=Charm +tt.keyword.QuarkTop=Top +tt.keyword.QuarkDown=Down +tt.keyword.QuarkStrange=Strange +tt.keyword.QuarkBottom=Bottom +tt.keyword.QuarkAntiUp=Antiup +tt.keyword.QuarkAntiCharm=Anticharm +tt.keyword.QuarkAntiTop=Antitop +tt.keyword.QuarkAntiDown=Antidown +tt.keyword.QuarkAntiStrange=Antistrange +tt.keyword.QuarkAntiBottom=Antibottom +tt.keyword.Higgs=Higgs +#These are Thaumcraft aspects +tt.keyword.Air=Air +tt.keyword.Earth=Earth +tt.keyword.Fire=Fire +tt.keyword.Water=Water +tt.keyword.Order=Order +tt.keyword.Entropy=Entropy +tt.keyword.Chaos=Chaos + +tt.keyword.Primal=Primal +tt.keyword.Aspect=Aspect + + + + + + -- cgit From e37d21d8141e82eee9d87d4bb137c44977db8625 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 23 Jan 2022 13:44:18 +0100 Subject: Fix autocompletion for EM commands --- .../mechanics/elementalMatter/core/commands/EMGive.java | 2 +- .../mechanics/elementalMatter/core/commands/EMList.java | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java index 18f2f76498..4824053668 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -117,7 +117,7 @@ public class EMGive implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if (args.length > 1 && args.length % 2 == 0) { + if (args.length > 2 && args.length % 2 == 1) { return new ArrayList<>(TecTech.definitionsRegistry.getBinds().keySet()); } return null; 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 90eddf1e23..fe542abbde 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 @@ -28,15 +28,16 @@ public class EMList implements ICommand { if(args.length == 0) { listClasses(sender); }else { - listDefinitions(sender, Util.getConcated(args," ")); + String concated = Util.getConcated(args, " "); + listDefinitions(sender,concated, concated.replaceAll(" ","_"),concated.replaceAll("_"," ")); } } } - private void listDefinitions(ICommandSender sender, String arg) { + private void listDefinitions(ICommandSender sender,String raw, String unlocalized,String localized) { sender.addChatMessage(new ChatComponentText(" Available Direct: tag - name symbol")); for (EMType directType : TecTech.definitionsRegistry.getDirectTypes().values()) { - if ("*".equals(arg) || arg.equalsIgnoreCase(directType.getLocalizedName())) { + if ("*".equals(raw) || localized.equalsIgnoreCase(directType.getLocalizedName()) || unlocalized.equalsIgnoreCase(directType.getUnlocalizedName())) { directType.getDefinitions().forEach((bind, definition) -> sender.addChatMessage(new ChatComponentText(bind + " - " + definition.getLocalizedName() + " " + definition.getSymbol()))); } @@ -44,7 +45,7 @@ public class EMList implements ICommand { } private void listClasses(ICommandSender sender) { - sender.addChatMessage(new ChatComponentText(" Available Direct: name (use name as parameter to learn more")); + sender.addChatMessage(new ChatComponentText(" Available Direct: name (use as parameter to learn more")); TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) -> sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName()))); sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name")); @@ -69,8 +70,8 @@ public class EMList implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==0){ - return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).collect(Collectors.toList()); + if(args.length==1){ + return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).map(s->s.replaceAll(" ","_")).collect(Collectors.toList()); } return null; } -- cgit From caff4351909ce59637348c6be94271cf1d1c0a9c Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 23 Jan 2022 14:47:42 +0100 Subject: Separate EM to new tab --- src/main/java/com/github/technus/tectech/TecTech.java | 4 +++- .../com/github/technus/tectech/loader/MainLoader.java | 2 ++ .../technus/tectech/loader/gui/CreativeTabEM.java | 19 +++++++++++++++++++ .../technus/tectech/mechanics/elementalMatter/README | 5 ++++- .../elementalMatter/core/maps/EMInstanceStackMap.java | 5 ----- .../item/DebugElementalInstanceContainer_EM.java | 4 ++-- .../thing/item/ElementalDefinitionContainer_EM.java | 10 +++++----- .../thing/item/ElementalDefinitionScanStorage_EM.java | 4 ++-- .../GT_MetaTileEntity_Hatch_ElementalContainer.java | 4 ++-- src/main/resources/assets/tectech/lang/en_US.lang | 1 + 10 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index d730d64a65..10b8f69b1a 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -3,6 +3,7 @@ package com.github.technus.tectech; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler; import com.github.technus.tectech.mechanics.anomaly.CancerCommand; import com.github.technus.tectech.mechanics.anomaly.ChargeCommand; @@ -45,7 +46,8 @@ public class TecTech { public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; public static final LogHelper LOGGER = new LogHelper(Reference.MODID); - public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabEM creativeTabEM; private static IngameErrorLog moduleAdminErrorLogs; public static TecTechConfig configTecTech; diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index e2f1e2882f..b9d737f98a 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.trans import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; import com.github.technus.tectech.loader.thing.ComponentLoader; @@ -64,6 +65,7 @@ public final class MainLoader { public static void preLoad(){ creativeTabTecTech =new CreativeTabTecTech("TecTech"); + creativeTabEM =new CreativeTabEM("EM"); //set expanded texture arrays for tiers try { diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java new file mode 100644 index 0000000000..cd73d1e420 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.loader.gui; + +import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class CreativeTabEM extends CreativeTabs { + public CreativeTabEM(String name) { + super(name); + } + + @SideOnly(Side.CLIENT) + @Override + public Item getTabIconItem() { + return ElementalDefinitionContainer_EM.INSTANCE; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README index f6c0b35e5f..c774b126c8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README @@ -41,4 +41,7 @@ Trees: InstanceStack - inst stack |||||multiple to 1 - InstanceStackTree - inst container - real things go here \ No newline at end of file + InstanceStackTree - inst container - real things go here + + Preset for world: + 2;7,16x22,16x35:11,16x35:3,16x35;0; \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java index 64ff7063e8..265d219168 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java @@ -117,11 +117,6 @@ public final class EMInstanceStackMap extends EMStackMap implem return list; } - //Tick Content - public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { - return tickContent(lifeTimeMult,postEnergize,1D); - } - public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ //cleanUp(); double diff=0; diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index d909054196..ecebc6afcd 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -29,8 +29,8 @@ import java.util.Collections; import java.util.List; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,7 +46,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE setMaxStackSize(1); setUnlocalizedName("em.debugContainer"); setTextureName(MODID + ":itemDebugContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index f0f59e0e86..0de8bb007a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.FontRenderer; @@ -20,8 +20,8 @@ import java.util.Collections; import java.util.List; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -35,7 +35,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem setMaxStackSize(1); setUnlocalizedName("em.definitionContainer"); setTextureName(MODID + ":itemDefinitionContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } //return previous thing diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java index 8b8133a1e2..1cb6de1df6 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 84f18ad2bf..6cb83f5d46 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -112,7 +112,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { purgeOverflow(); - content.tickContentByOneSecond(1, postEnergize);//Hatches don't life time mult things + content.tickContent(1, postEnergize,1);//Hatches don't life time mult things purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { @@ -206,7 +206,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public int getMaxStacksCount() { - return mTier * 128; + return mTier * mTier >> 4; } public double getMaxStackSize() { diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index a5b5051827..f69f250e78 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -1,5 +1,6 @@ #Creative Tab Name itemGroup.TecTech=TecTech Interdimensional +itemGroup.EM=TecTech Elemental Matter #Blocks tile.quantumStuff.name=Quantum Stuff -- cgit From 7adcaf6d9b4a8628711a01ce2467f13582cea7d5 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 27 Jan 2022 22:09:30 +0100 Subject: Cleanup Atoms Localization, and FontRenderer --- .../technus/tectech/font/TecTechFontRender.java | 240 ++++++++++++------ .../definitions/complex/EMAtomDefinition.java | 113 ++++----- .../item/DebugElementalInstanceContainer_EM.java | 9 +- src/main/resources/META-INF/tectech_at.cfg | 17 +- src/main/resources/assets/tectech/lang/en_US.lang | 268 ++++++++++++++++++++- 5 files changed, 498 insertions(+), 149 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java index 4aea8bce92..fbbc12fe36 100644 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java @@ -1,85 +1,182 @@ package com.github.technus.tectech.font; +import com.ibm.icu.text.ArabicShaping; +import com.ibm.icu.text.ArabicShapingException; +import com.ibm.icu.text.Bidi; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.settings.GameSettings; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - @SideOnly(Side.CLIENT) public class TecTechFontRender extends FontRenderer { public static final TecTechFontRender INSTANCE = new TecTechFontRender(); - private static float DISTANCE_L = .125F; - private static float DISTANCE_L2 = DISTANCE_L *2F; + private static float DISTANCE_L = .125F; + private static float DISTANCE_L2 = DISTANCE_L * 2F; - private static float DISTANCE_M = 0.06F; - private static float DISTANCE_M2 = DISTANCE_M *2F; + private static float DISTANCE_M = 0.06F; + private static float DISTANCE_M2 = DISTANCE_M * 2F; - private static float DISTANCE_A = 0.06F; - private static float DISTANCE_A2 = DISTANCE_A *2F; + private static float DISTANCE_A = 0.06F; + private static float DISTANCE_A2 = DISTANCE_A * 2F; - private static final Method reset; - private static final Method render; - private final GameSettings gameSettings; + private TecTechFontRender() { + super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); + } - static { - Method resetMethod,renderMethod; - try { - resetMethod =FontRenderer.class.getDeclaredMethod("resetStyles"); - renderMethod=FontRenderer.class.getDeclaredMethod("renderString", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException e) { - try { - resetMethod =FontRenderer.class.getDeclaredMethod("func_78265_b"); - renderMethod=FontRenderer.class.getDeclaredMethod("func_78258_a", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException ex) { - throw new RuntimeException("Cannot get methods!",ex); - } - } - resetMethod.setAccessible(true); - renderMethod.setAccessible(true); - reset=resetMethod; - render=renderMethod; + private void resetStyles() { + this.randomStyle = false; + this.boldStyle = false; + this.italicStyle = false; + this.underlineStyle = false; + this.strikethroughStyle = false; } - private TecTechFontRender() { - super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); - gameSettings = Minecraft.getMinecraft().gameSettings; + private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_) { + if (p_78258_1_ == null) { + return 0; + } else { + if (this.bidiFlag) { + p_78258_1_ = this.bidiReorder(p_78258_1_); + } + + if ((p_78258_4_ & -67108864) == 0) { + p_78258_4_ |= -16777216; + } + + if (p_78258_5_) { + p_78258_4_ = (p_78258_4_ & 16579836) >> 2 | p_78258_4_ & -16777216; + } + + this.red = (float)(p_78258_4_ >> 16 & 255) / 255.0F; + this.blue = (float)(p_78258_4_ >> 8 & 255) / 255.0F; + this.green = (float)(p_78258_4_ & 255) / 255.0F; + this.alpha = (float)(p_78258_4_ >> 24 & 255) / 255.0F; + this.setColor(this.red, this.blue, this.green, this.alpha); + this.posX = (float)p_78258_2_; + this.posY = (float)p_78258_3_; + this.renderStringAtPos(p_78258_1_, p_78258_5_); + return (int)this.posX; + } } - private void resetStyles2(){ + private String bidiReorder(String p_147647_1_) { try { - reset.invoke(this); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method resetStyles!",e); + Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127); + bidi.setReorderingMode(0); + return bidi.writeReordered(2); + } catch (ArabicShapingException var3) { + return p_147647_1_; } } - private int renderString2(String str, int x, int y, int color, boolean dropShadow){ - try { - return (int)render.invoke(this,str,x,y,color,dropShadow); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method renderString!",e); + private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) { + for(int i = 0; i < p_78255_1_.length(); ++i) { + char c0 = p_78255_1_.charAt(i); + int j; + int k; + if (c0 == 167 && i + 1 < p_78255_1_.length()) { + j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1)); + if (j < 16) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + if (j < 0 || j > 15) { + j = 15; + } + + if (p_78255_2_) { + j += 16; + } + + k = this.colorCode[j]; + this.textColor = k; + this.setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + } else if (j == 16) { + this.randomStyle = true; + } else if (j == 17) { + this.boldStyle = true; + } else if (j == 18) { + this.strikethroughStyle = true; + } else if (j == 19) { + this.underlineStyle = true; + } else if (j == 20) { + this.italicStyle = true; + } else if (j == 21) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + this.setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; + } else { + j = "ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(c0); + if (this.randomStyle && j != -1) { + do { + k = this.fontRandom.nextInt(this.charWidth.length); + } while(this.charWidth[j] != this.charWidth[k]); + + j = k; + } + + float f1 = this.unicodeFlag ? 0.5F : 1.0F; + boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + float f = this.renderCharAtPos(j, c0, this.italicStyle); + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + if (this.boldStyle) { + this.posX += f1; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + this.renderCharAtPos(j, c0, this.italicStyle); + this.posX -= f1; + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + ++f; + } + + this.doDraw(f); + } } + } + private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) { + return p_78278_2_ == ' ' ? 4.0F : ("ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); + } @Override public int drawString(String str, int x, int y, int color, boolean dropShadow) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_A, DISTANCE_A, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_A2, 0, 0F); @@ -106,8 +203,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_M, DISTANCE_M, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_M2, 0, 0F); @@ -132,8 +228,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_L, DISTANCE_L, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_L2, 0, 0F); @@ -159,7 +254,7 @@ public class TecTechFontRender extends FontRenderer { @Override public void drawSplitString(String str, int x, int y, int maxWidth, int color) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; @@ -213,50 +308,40 @@ public class TecTechFontRender extends FontRenderer { private int drawStringFront(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); } private int drawStringBack(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); } @Override - public int getStringWidth(String p_78256_1_) - { - if(gameSettings.guiScale==1){ + public int getStringWidth(String p_78256_1_) { + if (Minecraft.getMinecraft().gameSettings.guiScale == 1) { return Minecraft.getMinecraft().fontRenderer.getStringWidth(p_78256_1_); } - if (p_78256_1_ == null) - { + if (p_78256_1_ == null) { return 0; - } - else - { - int i = 0; + } else { + int i = 0; boolean flag = false; - for (int j = 0; j < p_78256_1_.length(); ++j) - { + for (int j = 0; j < p_78256_1_.length(); ++j) { char c0 = p_78256_1_.charAt(j); - int k = this.getCharWidth(c0); + int k = this.getCharWidth(c0); - if (k < 0 && j < p_78256_1_.length() - 1) - { + if (k < 0 && j < p_78256_1_.length() - 1) { ++j; c0 = p_78256_1_.charAt(j); - if (c0 != 108 && c0 != 76) - { - if (c0 == 114 || c0 == 82) - { + if (c0 != 108 && c0 != 76) { + if (c0 == 114 || c0 == 82) { flag = false; } - } - else - { + } else { flag = true; } @@ -265,8 +350,7 @@ public class TecTechFontRender extends FontRenderer { i += k; - if (flag && k > 0) - { + if (flag && k > 0) { ++i; } } @@ -274,4 +358,6 @@ public class TecTechFontRender extends FontRenderer { return i; } } + + } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java index 76f4457e94..49fd8b5b54 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -5,8 +5,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; @@ -27,12 +27,17 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.Materials.*; import static gregtech.api.enums.OrePrefixes.dust; +import static java.lang.Math.abs; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 18.11.2016. */ public class EMAtomDefinition extends EMComplexTemplate { + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + public static final long ATOM_COMPLEXITY_LIMIT = 65536L; private static final byte BYTE_OFFSET = 32; @@ -118,7 +123,7 @@ public class EMAtomDefinition extends EMComplexTemplate { if (def.getGeneration() < 0) { containsAnti = true; } - type = Math.max(type, Math.abs(def.getGeneration())); + type = Math.max(type, abs(def.getGeneration())); if (def instanceof EMLeptonDefinition) { cLeptons += stack.getCharge(); @@ -140,12 +145,12 @@ public class EMAtomDefinition extends EMComplexTemplate { this.neutralCount = neutralCount; this.element = element; - element = Math.abs(element); + element = abs(element); //stability curve int StableIsotope = stableIzoCurve(element); int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); xstr.setSeed((element + 1L) * (neutralCount + 100L)); iaea = EMNuclideIAEA.get(element, neutralCount); @@ -215,7 +220,7 @@ public class EMAtomDefinition extends EMComplexTemplate { if (element == 0) { return 1e-35D; } else if (element == 1) { - unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; + unstabilityEXP = 1.743D - abs(izoDiff - 1) * 9.743D; } else if (element == 2) { switch (isotope) { case 4: @@ -234,9 +239,9 @@ public class EMAtomDefinition extends EMComplexTemplate { } else if (element <= 83 || isotope <= 127 && element <= 120) { double elementPow4 = Math.pow(element, 4); - unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - abs(izoDiff) * (3D - element / 13D + element * element / 1600D); } else { return -1; } @@ -334,63 +339,51 @@ public class EMAtomDefinition extends EMComplexTemplate { @Override public String getLocalizedName() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - if (Math.abs(getGeneration()) != 1) { - return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; - } - return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); + int element = abs(this.getElement()); + boolean anti = this.getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=NAME.length){ + StringBuilder s = new StringBuilder(); + if(anti){ + s.append(translateToLocal("tt.IUPAC.Anti")); + do { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } while (element > 0); + }else { + while (element >= 10) { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element + 10])); } - return translateToLocal("tt.keyword.Element") + (negative ? ": ~" : ": ") + element; + s.append(weird?translateToLocal("tt.keyword.Weird"):""); + return s.toString(); } + return translateToLocal("tt.element."+(anti?"Anti":"")+NAME[element])+(weird?translateToLocal("tt.keyword.Weird"):""); } @Override public String getSymbol() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } - } + return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } @Override public String getShortSymbol() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "?"; - } + int element = abs(this.getElement()); + boolean anti = this.getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=SYMBOL.length){ + StringBuilder s = new StringBuilder(anti?"~":""); + while (element >= 10) { + s.append(SYMBOL_IUPAC[element % 10]); + element = element / 10; + } + s.append(SYMBOL_IUPAC[element + 10]); + s.append(weird?translateToLocal("tt.keyword.Weird"):""); + return s.toString(); } + return (anti?"~":"")+SYMBOL[element]+(weird?translateToLocal("tt.keyword.Weird"):""); } @Override @@ -1133,7 +1126,7 @@ public class EMAtomDefinition extends EMComplexTemplate { private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { EMDefinitionStackMap heavy = new EMDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(Math.abs(getElement()) <= 97); + double[] liquidDrop = liquidDropFunction(abs(getElement()) <= 97); for (EMDefinitionStack stack : fissile.valuesToArray()) { if (spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && @@ -1226,7 +1219,7 @@ public class EMAtomDefinition extends EMComplexTemplate { return decays.toArray(EMDecay.NO_PRODUCT); } } - if (energyLevel < Math.abs(getCharge()) / 3 + getNeutralCount()) { + if (energyLevel < abs(getCharge()) / 3 + getNeutralCount()) { return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; } return getNaturalDecayInstant(); @@ -1363,12 +1356,6 @@ public class EMAtomDefinition extends EMComplexTemplate { return element; } - private static final class Nomenclature { - private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; - } - @Override protected String getIndirectTagValue() { return nbtType; @@ -1398,7 +1385,7 @@ public class EMAtomDefinition extends EMComplexTemplate { //stability curve int StableIsotope = stableIzoCurve(element); int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { @@ -1415,7 +1402,7 @@ public class EMAtomDefinition extends EMComplexTemplate { //stability curve int Isotope = stableIzoCurve(element); int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); isotopes.put(rawLifeTime, isotope);//todo dont add stable ones diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index ecebc6afcd..b8ce40b180 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -141,9 +141,12 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE that.setTagCompound(new NBTTagCompound()); list.add(that); for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); } } diff --git a/src/main/resources/META-INF/tectech_at.cfg b/src/main/resources/META-INF/tectech_at.cfg index e09e575a7d..fa76d13c1f 100644 --- a/src/main/resources/META-INF/tectech_at.cfg +++ b/src/main/resources/META-INF/tectech_at.cfg @@ -1,2 +1,17 @@ public net.minecraft.block.Block field_149781_w #blockResistance -public net.minecraft.block.Block field_149782_v #blockHardness \ No newline at end of file +public net.minecraft.block.Block field_149782_v #blockHardness +protected net.minecraft.client.gui.FontRenderer field_111274_c #unicodePageLocations +protected net.minecraft.client.gui.FontRenderer field_78285_g #colorCode +protected net.minecraft.client.gui.FontRenderer field_78298_i #renderEngine +protected net.minecraft.client.gui.FontRenderer field_78293_l #unicodeFlag +protected net.minecraft.client.gui.FontRenderer field_78294_m #bidiFlag +protected net.minecraft.client.gui.FontRenderer field_78291_n #red +protected net.minecraft.client.gui.FontRenderer field_78292_o #blue +protected net.minecraft.client.gui.FontRenderer field_78306_p #green +protected net.minecraft.client.gui.FontRenderer field_78305_q #alpha +protected net.minecraft.client.gui.FontRenderer field_78304_r #textColor +protected net.minecraft.client.gui.FontRenderer field_78303_s #randomStyle +protected net.minecraft.client.gui.FontRenderer field_78302_t #boldStyle +protected net.minecraft.client.gui.FontRenderer field_78301_u #italicStyle +protected net.minecraft.client.gui.FontRenderer field_78300_v #underlineStyle +protected net.minecraft.client.gui.FontRenderer field_78299_w #strikethroughStyle diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index f69f250e78..7924545051 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -948,8 +948,266 @@ tt.keyword.Chaos=Chaos tt.keyword.Primal=Primal tt.keyword.Aspect=Aspect - - - - - +tt.element.Neutronium=Neutronium +tt.element.Hydrogen=Hydrogen +tt.element.Helium=Helium +tt.element.Lithium=Lithium +tt.element.Beryllium=Beryllium +tt.element.Boron=Boron +tt.element.Carbon=Carbon +tt.element.Nitrogen=Nitrogen +tt.element.Oxygen=Oxygen +tt.element.Fluorine=Fluorine +tt.element.Neon=Neon +tt.element.Sodium=Sodium +tt.element.Magnesium=Magnesium +tt.element.Aluminium=Aluminium +tt.element.Silicon=Silicon +tt.element.Phosphorus=Phosphorus +tt.element.Sulfur=Sulfur +tt.element.Chlorine=Chlorine +tt.element.Argon=Argon +tt.element.Potassium=Potassium +tt.element.Calcium=Calcium +tt.element.Scandium=Scandium +tt.element.Titanium=Titanium +tt.element.Vanadium=Vanadium +tt.element.Chromium=Chromium +tt.element.Manganese=Manganese +tt.element.Iron=Iron +tt.element.Cobalt=Cobalt +tt.element.Nickel=Nickel +tt.element.Copper=Copper +tt.element.Zinc=Zinc +tt.element.Gallium=Gallium +tt.element.Germanium=Germanium +tt.element.Arsenic=Arsenic +tt.element.Selenium=Selenium +tt.element.Bromine=Bromine +tt.element.Krypton=Krypton +tt.element.Rubidium=Rubidium +tt.element.Strontium=Strontium +tt.element.Yttrium=Yttrium +tt.element.Zirconium=Zirconium +tt.element.Niobium=Niobium +tt.element.Molybdenum=Molybdenum +tt.element.Technetium=Technetium +tt.element.Ruthenium=Ruthenium +tt.element.Rhodium=Rhodium +tt.element.Palladium=Palladium +tt.element.Silver=Silver +tt.element.Cadmium=Cadmium +tt.element.Indium=Indium +tt.element.Tin=Tin +tt.element.Antimony=Antimony +tt.element.Tellurium=Tellurium +tt.element.Iodine=Iodine +tt.element.Xenon=Xenon +tt.element.Caesium=Caesium +tt.element.Barium=Barium +tt.element.Lanthanum=Lanthanum +tt.element.Cerium=Cerium +tt.element.Praseodymium=Praseodymium +tt.element.Neodymium=Neodymium +tt.element.Promethium=Promethium +tt.element.Samarium=Samarium +tt.element.Europium=Europium +tt.element.Gadolinium=Gadolinium +tt.element.Terbium=Terbium +tt.element.Dysprosium=Dysprosium +tt.element.Holmium=Holmium +tt.element.Erbium=Erbium +tt.element.Thulium=Thulium +tt.element.Ytterbium=Ytterbium +tt.element.Lutetium=Lutetium +tt.element.Hafnium=Hafnium +tt.element.Tantalum=Tantalum +tt.element.Tungsten=Tungsten +tt.element.Rhenium=Rhenium +tt.element.Osmium=Osmium +tt.element.Iridium=Iridium +tt.element.Platinum=Platinum +tt.element.Gold=Gold +tt.element.Mercury=Mercury +tt.element.Thallium=Thallium +tt.element.Lead=Lead +tt.element.Bismuth=Bismuth +tt.element.Polonium=Polonium +tt.element.Astatine=Astatine +tt.element.Radon=Radon +tt.element.Francium=Francium +tt.element.Radium=Radium +tt.element.Actinium=Actinium +tt.element.Thorium=Thorium +tt.element.Protactinium=Protactinium +tt.element.Uranium=Uranium +tt.element.Neptunium=Neptunium +tt.element.Plutonium=Plutonium +tt.element.Americium=Americium +tt.element.Curium=Curium +tt.element.Berkelium=Berkelium +tt.element.Californium=Californium +tt.element.Einsteinium=Einsteinium +tt.element.Fermium=Fermium +tt.element.Mendelevium=Mendelevium +tt.element.Nobelium=Nobelium +tt.element.Lawrencium=Lawrencium +tt.element.Rutherfordium=Rutherfordium +tt.element.Dubnium=Dubnium +tt.element.Seaborgium=Seaborgium +tt.element.Bohrium=Bohrium +tt.element.Hassium=Hassium +tt.element.Meitnerium=Meitnerium +tt.element.Darmstadtium=Darmstadtium +tt.element.Roentgenium=Roentgenium +tt.element.Copernicium=Copernicium +tt.element.Nihonium=Nihonium +tt.element.Flerovium=Flerovium +tt.element.Moscovium=Moscovium +tt.element.Livermorium=Livermorium +tt.element.Tennessine=Tennessine +tt.element.Oganesson=Oganesson + +tt.element.AntiNeutronium=Antineutronium +tt.element.AntiHydrogen=Antihydrogen +tt.element.AntiHelium=Antihelium +tt.element.AntiLithium=Antilithium +tt.element.AntiBeryllium=Antiberyllium +tt.element.AntiBoron=Antiboron +tt.element.AntiCarbon=Anticarbon +tt.element.AntiNitrogen=Antinitrogen +tt.element.AntiOxygen=Antioxygen +tt.element.AntiFluorine=Antifluorine +tt.element.AntiNeon=Antineon +tt.element.AntiSodium=Antisodium +tt.element.AntiMagnesium=Antimagnesium +tt.element.AntiAluminium=Antialuminium +tt.element.AntiSilicon=Antisilicon +tt.element.AntiPhosphorus=Antiphosphorus +tt.element.AntiSulfur=Antisulfur +tt.element.AntiChlorine=Antichlorine +tt.element.AntiArgon=Antiargon +tt.element.AntiPotassium=Antipotassium +tt.element.AntiCalcium=Anticalcium +tt.element.AntiScandium=Antiscandium +tt.element.AntiTitanium=Antititanium +tt.element.AntiVanadium=Antivanadium +tt.element.AntiChromium=Antichromium +tt.element.AntiManganese=Antimanganese +tt.element.AntiIron=Antiiron +tt.element.AntiCobalt=Anticobalt +tt.element.AntiNickel=Antinickel +tt.element.AntiCopper=Anticopper +tt.element.AntiZinc=Antizinc +tt.element.AntiGallium=Antigallium +tt.element.AntiGermanium=Antigermanium +tt.element.AntiArsenic=Antiarsenic +tt.element.AntiSelenium=Antiselenium +tt.element.AntiBromine=Antibromine +tt.element.AntiKrypton=Antikrypton +tt.element.AntiRubidium=Antirubidium +tt.element.AntiStrontium=Antistrontium +tt.element.AntiYttrium=Antiyttrium +tt.element.AntiZirconium=Antizirconium +tt.element.AntiNiobium=Antiniobium +tt.element.AntiMolybdenum=Antimolybdenum +tt.element.AntiTechnetium=Antitechnetium +tt.element.AntiRuthenium=Antiruthenium +tt.element.AntiRhodium=Antirhodium +tt.element.AntiPalladium=Antipalladium +tt.element.AntiSilver=Antisilver +tt.element.AntiCadmium=Anticadmium +tt.element.AntiIndium=Antiindium +tt.element.AntiTin=Antitin +tt.element.AntiAntimony=Antiantimony +tt.element.AntiTellurium=Antitellurium +tt.element.AntiIodine=Antiiodine +tt.element.AntiXenon=Antixenon +tt.element.AntiCaesium=Anticaesium +tt.element.AntiBarium=Antibarium +tt.element.AntiLanthanum=Antilanthanum +tt.element.AntiCerium=Anticerium +tt.element.AntiPraseodymium=Antipraseodymium +tt.element.AntiNeodymium=Antineodymium +tt.element.AntiPromethium=Antipromethium +tt.element.AntiSamarium=Antisamarium +tt.element.AntiEuropium=Antieuropium +tt.element.AntiGadolinium=Antigadolinium +tt.element.AntiTerbium=Antiterbium +tt.element.AntiDysprosium=Antidysprosium +tt.element.AntiHolmium=Antiholmium +tt.element.AntiErbium=Antierbium +tt.element.AntiThulium=Antithulium +tt.element.AntiYtterbium=Antiytterbium +tt.element.AntiLutetium=Antilutetium +tt.element.AntiHafnium=Antihafnium +tt.element.AntiTantalum=Antitantalum +tt.element.AntiTungsten=Antitungsten +tt.element.AntiRhenium=Antirhenium +tt.element.AntiOsmium=Antiosmium +tt.element.AntiIridium=Antiiridium +tt.element.AntiPlatinum=Antiplatinum +tt.element.AntiGold=Antigold +tt.element.AntiMercury=Antimercury +tt.element.AntiThallium=Antithallium +tt.element.AntiLead=Antilead +tt.element.AntiBismuth=Antibismuth +tt.element.AntiPolonium=Antipolonium +tt.element.AntiAstatine=Antiastatine +tt.element.AntiRadon=Antiradon +tt.element.AntiFrancium=Antifrancium +tt.element.AntiRadium=Antiradium +tt.element.AntiActinium=Antiactinium +tt.element.AntiThorium=Antithorium +tt.element.AntiProtactinium=Antiprotactinium +tt.element.AntiUranium=Antiuranium +tt.element.AntiNeptunium=Antineptunium +tt.element.AntiPlutonium=Antiplutonium +tt.element.AntiAmericium=Antiamericium +tt.element.AntiCurium=Anticurium +tt.element.AntiBerkelium=Antiberkelium +tt.element.AntiCalifornium=Antibalifornium +tt.element.AntiEinsteinium=Antieinsteinium +tt.element.AntiFermium=Antifermium +tt.element.AntiMendelevium=Antimendelevium +tt.element.AntiNobelium=Antinobelium +tt.element.AntiLawrencium=Antilawrencium +tt.element.AntiRutherfordium=Antirutherfordium +tt.element.AntiDubnium=Antidubnium +tt.element.AntiSeaborgium=Antiseaborgium +tt.element.AntiBohrium=Antibohrium +tt.element.AntiHassium=Antihassium +tt.element.AntiMeitnerium=Antimeitnerium +tt.element.AntiDarmstadtium=Antidarmstadtium +tt.element.AntiRoentgenium=Antiroentgenium +tt.element.AntiCopernicium=Anticopernicium +tt.element.AntiNihonium=Antinihonium +tt.element.AntiFlerovium=Antiflerovium +tt.element.AntiMoscovium=Antimoscovium +tt.element.AntiLivermorium=Antilivermorium +tt.element.AntiTennessine=Antitennessine +tt.element.AntiOganesson=Antioganesson + +tt.IUPAC.n=nil +tt.IUPAC.u=un +tt.IUPAC.b=bi +tt.IUPAC.t=tri +tt.IUPAC.q=quad +tt.IUPAC.p=pent +tt.IUPAC.h=hex +tt.IUPAC.s=sept +tt.IUPAC.o=oct +tt.IUPAC.e=enn +tt.IUPAC.N=Nil +tt.IUPAC.U=Un +tt.IUPAC.B=Bi +tt.IUPAC.T=Tri +tt.IUPAC.Q=Quad +tt.IUPAC.P=Pent +tt.IUPAC.H=Hex +tt.IUPAC.S=Sept +tt.IUPAC.O=Oct +tt.IUPAC.E=Enn +tt.IUPAC.ium=ium +tt.IUPAC.Anti=Anti +tt.keyword.Weird=* \ No newline at end of file -- cgit From bb09b84d7a0a863532778fa63938243e5fe25cd7 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Fri, 28 Jan 2022 19:27:37 +0800 Subject: Fix persistent hash not set on some assline recipes --- .../technus/tectech/recipe/TT_recipeAdder.java | 67 ++++++++++++++-------- 1 file changed, 43 insertions(+), 24 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index b08265d2c5..71a5419500 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -8,16 +8,20 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; import gregtech.api.util.GT_Utility; import gregtech.common.GT_RecipeAdder; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.Arrays; +import java.util.Comparator; import java.util.List; public class TT_recipeAdder extends GT_RecipeAdder { @@ -39,16 +43,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { TecTech.LOGGER.error("addResearchableAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); } } - if(researchAmperage<=0) { - researchAmperage = 1; - } else if(researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if(computationRequiredPerSec<=0) { - computationRequiredPerSec = 1; - } else if(computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; - } + researchAmperage = GT_Utility.clamp(researchAmperage, 1, Short.MAX_VALUE); + computationRequiredPerSec = GT_Utility.clamp(computationRequiredPerSec, 1, Short.MAX_VALUE); TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")}, aFluidInputs, null, assDuration, assEUt, 0,true); GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine(CustomItemList.UnusedStuff.get(1), totalComputationRequired/computationRequiredPerSec, aInputs, aFluidInputs, aOutput, assDuration, assEUt)); @@ -69,17 +65,23 @@ public class TT_recipeAdder extends GT_RecipeAdder { ItemStack[] tInputs = new ItemStack[aInputs.length]; ItemStack[][] tAlts = new ItemStack[aInputs.length][]; + int tPersistentHash = 1; for(int i = 0; i < aInputs.length; i++){ Object obj = aInputs[i]; if (obj instanceof ItemStack) { tInputs[i] = (ItemStack) obj; tAlts[i] = null; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tInputs[i], true, false); continue; } else if (obj instanceof ItemStack[]) { ItemStack[] aStacks = (ItemStack[]) obj; if (aStacks.length > 0) { tInputs[i] = aStacks[0]; - tAlts[i] = Arrays.copyOf(aStacks, aStacks.length); + tAlts[i] = (ItemStack[]) Arrays.copyOf(aStacks, aStacks.length); + for (ItemStack tAlt : tAlts[i]) { + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tAlt, true, false); + } + tPersistentHash *= 31; continue; } } else if (obj instanceof Object[]) { @@ -87,16 +89,24 @@ public class TT_recipeAdder extends GT_RecipeAdder { List tList; if (objs.length >= 2 && !(tList = GT_OreDictUnificator.getOres(objs[0])).isEmpty()) { try { + // sort the output, so the hash code is stable across launches + tList.sort(Comparator.comparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) + .thenComparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) + .thenComparingInt(Items.feather::getDamage) + .thenComparingInt(s -> s.stackSize)); int tAmount = ((Number) objs[1]).intValue(); List uList = new ArrayList<>(); for (ItemStack tStack : tList) { ItemStack uStack = GT_Utility.copyAmount(tAmount, tStack); if (GT_Utility.isStackValid(uStack)) { uList.add(uStack); - if (tInputs[i] == null) tInputs[i] = uStack; + if (tInputs[i] == null) + tInputs[i] = uStack; } } - tAlts[i] = uList.toArray(nullItem); + tAlts[i] = uList.toArray(new ItemStack[0]); + tPersistentHash = tPersistentHash * 31 + (objs[0] == null ? "" : objs[0].toString()).hashCode(); + tPersistentHash = tPersistentHash * 31 + tAmount; continue; } catch (Exception t) { TecTech.LOGGER.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> there is some ... in that recipe"); @@ -105,20 +115,29 @@ public class TT_recipeAdder extends GT_RecipeAdder { } TecTech.LOGGER.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); } - if(researchAmperage<=0) { - researchAmperage = 1; - } else if(researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if(computationRequiredPerSec<=0) { - computationRequiredPerSec = 1; - } else if(computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(aResearchItem, true, false); + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(aOutput, true, false); + for (FluidStack tFluidInput : aFluidInputs) { + if (tFluidInput == null) + continue; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tFluidInput, true, false); } + researchAmperage = GT_Utility.clamp(researchAmperage, 1, Short.MAX_VALUE); + computationRequiredPerSec = GT_Utility.clamp(computationRequiredPerSec, 1, Short.MAX_VALUE); + tPersistentHash = tPersistentHash * 31 + totalComputationRequired; + tPersistentHash = tPersistentHash * 31 + computationRequiredPerSec; + tPersistentHash = tPersistentHash * 31 + researchAmperage; + tPersistentHash = tPersistentHash * 31 + researchEUt; + tPersistentHash = tPersistentHash * 31 + assDuration; + tPersistentHash = tPersistentHash * 31 + assEUt; TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false,tInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")},aFluidInputs,null,assDuration,assEUt,0,tAlts,true); - GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( CustomItemList.UnusedStuff.get(1), totalComputationRequired/computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts)); - TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( aResearchItem, totalComputationRequired/computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts)); + GT_Recipe_AssemblyLine recipeGT = new GT_Recipe_AssemblyLine(CustomItemList.UnusedStuff.get(1), totalComputationRequired / computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts); + recipeGT.setPersistentHash(tPersistentHash); + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(recipeGT); + GT_Recipe_AssemblyLine recipeTT = new GT_Recipe_AssemblyLine(aResearchItem, totalComputationRequired / computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts); + recipeTT.setPersistentHash(tPersistentHash); + TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes.add(recipeTT); return true; } -- cgit From 676cd0538a56fe32cf58643a26e6b52146afb26c Mon Sep 17 00:00:00 2001 From: iouter <3155186831@qq.com> Date: Sat, 29 Jan 2022 04:44:03 +0800 Subject: Modify translation numbers for localization --- .../tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main') 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 c5243b8bc5..d6b5e28b18 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 @@ -224,22 +224,22 @@ public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { resetColorField(); //Public/Private Buttons newButtonWithSpacing(PUBLIC_BUTTON_ID, 0, 2, GT_GuiIcon.WHITELIST) - .setTooltipText("Public"); + .setTooltipText(trans("326", "Public")); newButtonWithSpacing(PRIVATE_BUTTON_ID, 1, 2, GT_GuiIcon.BLACKLIST) - .setTooltipText("Private"); + .setTooltipText(trans("327", "Private")); //Import/Export Buttons newButtonWithSpacing(IMPORT_BUTTON_ID, 0, 3, GT_GuiIcon.IMPORT) .setTooltipText(trans("007", "Import")); newButtonWithSpacing(EXPORT_BUTTON_ID, 1, 3, GT_GuiIcon.EXPORT) - .setTooltipText(trans("007", "Export")); + .setTooltipText(trans("006", "Export")); } @Override public void drawExtras(int mouseX, int mouseY, float parTicks) { super.drawExtras(mouseX, mouseY, parTicks); drawColorSquare(0, 0); - drawNewString("Color Value", 2, 0); - drawNewString("Public/Private", 2, 2); + drawNewString(trans("328", "Color Value"), 2, 0); + drawNewString(trans("329", "Public/Private"), 2, 2); drawNewString(trans("229", "Import/Export"), 2, 3); } -- cgit From d0a419301b457b49ba09f8f4c430ac814f853a5c Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 5 Dec 2021 09:03:50 +0100 Subject: Fix Junctions (cherry picked from commit ebd719987402bb4a60bf01a10f5b8e1480184f69) --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 53cf072293..7d0ee03320 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -68,7 +68,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_NEUTRAL; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + if (v > base.eOutputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; }; private static final IStatusFunction DST_STATUS = @@ -79,7 +79,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_LOW; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + if (v > base.eInputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; } return STATUS_NEUTRAL; -- cgit From f2bf25053f9d4d576aa0624b80c35d8bfa3efb70 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 8 Jan 2022 21:16:46 +0100 Subject: Add aspect EM containers to creative tab (cherry picked from commit bb064e24a37791838c49f5db2537acfe3cfbc36f) --- .../thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java | 2 +- .../elementalMatter/definitions/AspectDefinitionCompatEnabled.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java index 2d531858d0..c3231e6132 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java @@ -11,7 +11,7 @@ import java.util.HashMap; */ public class AspectDefinitionCompat { public static AspectDefinitionCompat aspectDefinitionCompat; - static final HashMap defToAspect = new HashMap<>(); + public static final HashMap defToAspect = new HashMap<>(); public static final HashMap aspectToDef = new HashMap<>(); public void run(){} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java index da930a1d79..3cb2eafccd 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java @@ -8,6 +8,7 @@ import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; /** * Created by Tec on 21.05.2017. @@ -58,6 +59,8 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } } } + + STACKS_REGISTERED.addAll(defToAspect.keySet()); } @Override -- cgit From 5bb0894b4c54cd10e987493ad3402ad9522407db Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 9 Jan 2022 19:19:04 +0100 Subject: Cleanup and update EM turret projectile (cherry picked from commit de8bf3e68e9e4d7cee485d0d6951a4e4ccb5859d) --- .../entity/projectiles/projectileEM.java | 55 +++++++++------------- .../tileentity/turret/TileTurretHeadEM.java | 19 +++++++- .../core/transformations/bTransformationInfo.java | 7 ++- .../item/DebugElementalInstanceContainer_EM.java | 5 +- 4 files changed, 49 insertions(+), 37 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index 702ed77315..92acd71ecd 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -18,6 +18,8 @@ import openmodularturrets.tileentity.turretbase.TurretBase; import openmodularturrets.util.PlayerUtil; import openmodularturrets.util.TurretHeadUtil; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; + /** * Created by Bass on 27/07/2017. @@ -26,7 +28,7 @@ public class projectileEM extends LaserProjectile { public float gravity=0; private TurretBase turretBase; - private boolean exotic, antiMatter,isAmped; + private boolean strange, antiMatter,isAmped; private int ampLevel; @@ -45,36 +47,23 @@ public class projectileEM extends LaserProjectile { } } - public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStackMap avalableEM) { + public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStack projectileContent) { super(par1World, turretBase); this.turretBase = turretBase; - boolean onlyQuarks=true; - if(avalableEM!=null && avalableEM.hasStacks()) { - for (cElementalInstanceStack stack : avalableEM.values()) { - if (!(stack.definition instanceof eQuarkDefinition)) { - onlyQuarks = false; - } - } - if (onlyQuarks) { - avalableEM.clear(); - } else { - cElementalInstanceStack consumeFromThis=avalableEM.get(TecTech.RANDOM.nextInt(avalableEM.size())); - massFactor =(float) (consumeFromThis.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); + if(projectileContent != null){ + massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); - if(consumeFromThis.definition.getType()>1 || consumeFromThis.definition.getType()<-1) { - exotic = true; - } - if(consumeFromThis.definition.getType()<0) { - antiMatter = true; - } - - if (consumeFromThis.definition.getCharge() == 0) { - gravity = massFactor / 100f; - } else { - gravity = Math.min(0.0025F / Math.abs(consumeFromThis.definition.getCharge()), massFactor / 100f); - } + if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) { + strange = true; + } + if(projectileContent.definition.getType()<0) { + antiMatter = true; + } - avalableEM.removeAmount(false,consumeFromThis.definition.getStackForm(1)); + if (projectileContent.definition.getCharge() == 0) { + gravity = massFactor / 100f; + } else { + gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f); } } //todo make the recipe require some overflow hatches @@ -97,7 +86,8 @@ public class projectileEM extends LaserProjectile { worldObj.createExplosion(null, movingobjectposition.blockX + 0.5D, movingobjectposition.blockY + 0.5D, - movingobjectposition.blockZ + 0.5D, (exotic?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); + movingobjectposition.blockZ + 0.5D, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } else { return; } @@ -107,18 +97,18 @@ public class projectileEM extends LaserProjectile { if(movingobjectposition.entityHit != null && !worldObj.isRemote) { worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); if(movingobjectposition.entityHit != null && !worldObj.isRemote) { - float damage = (exotic?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); + float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); if(movingobjectposition.entityHit instanceof EntityPlayer) { if(canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { - movingobjectposition.entityHit.setFire((exotic?10:1)*2); + movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; } } } else { - movingobjectposition.entityHit.setFire((exotic?10:1)*2); + movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; @@ -133,7 +123,8 @@ public class projectileEM extends LaserProjectile { worldObj.createExplosion(null, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, - movingobjectposition.entityHit.posZ, (exotic?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); + movingobjectposition.entityHit.posZ, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 2de6b39c4c..1c8d476a36 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -1,8 +1,12 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -13,6 +17,8 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; + /** * Created by Bass on 27/07/2017. */ @@ -64,7 +70,18 @@ public class TileTurretHeadEM extends TurretHead{ @Override public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { - return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), hatchContentPointer); + while(hatchContentPointer!=null && hatchContentPointer.hasStacks()) { + cElementalInstanceStack stack = hatchContentPointer.get(TecTech.RANDOM.nextInt(hatchContentPointer.size())); + if(stack.amount fluidQuantization=new HashMap<>(32); public static final Map itemQuantization=new HashMap<>(32); 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 6850b24e0f..bfd7d266c0 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 @@ -31,8 +31,7 @@ import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -145,7 +144,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE for(iElementalDefinition definition: STACKS_REGISTERED){ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT)))); list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 144 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT *1000)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); } } -- cgit From 91ca8b69b5e2a9610411a5e6b1fac66d3663de15 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 13 Jan 2022 22:27:27 +0100 Subject: cherry pick This should make the EM anomaly and projectile as it was --- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 53 ++--- .../openComputers/AvrArchitecture.java | 2 +- .../entity/projectiles/projectileEM.java | 105 ++++----- .../tileentity/turret/TileTurretHeadEM.java | 11 +- .../definitions/AspectDefinitionCompat.java | 30 --- .../definitions/AspectDefinitionCompatEnabled.java | 81 ------- .../definitions/dComplexAspectDefinition.java | 8 +- .../definitions/ePrimalAspectDefinition.java | 7 +- .../definitions/iElementalAspect.java | 8 - .../transformations/AspectDefinitionCompat.java | 29 +++ .../AspectDefinitionCompatEnabled.java | 81 +++++++ .../thing/metaTileEntity/multi/EssentiaCompat.java | 10 +- .../multi/EssentiaCompatEnabled.java | 33 +-- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 126 +++++++---- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 69 +++--- .../github/technus/tectech/loader/MainLoader.java | 6 +- .../tectech/loader/thing/MachineLoader.java | 13 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 247 +++++++++++++-------- .../tectech/mechanics/anomaly/CancerCommand.java | 10 +- .../tectech/mechanics/anomaly/ChargeCommand.java | 10 +- .../core/transformations/bTransformationInfo.java | 53 +++-- .../definitions/complex/dAtomDefinition.java | 163 +++++++------- .../definitions/complex/dHadronDefinition.java | 4 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 10 +- .../multi/GT_MetaTileEntity_EM_decay.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 61 +++-- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 +- .../thing/tileEntity/ReactorSimTileEntity.java | 2 +- 28 files changed, 657 insertions(+), 579 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index bf96d61795..72cee6d7aa 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.gtpp; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; @@ -66,34 +67,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); generate("GERMANIUM",true,true); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java index 2842a71df3..595d814fc5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java @@ -21,7 +21,7 @@ import li.cil.oc.api.machine.Signal; import li.cil.oc.common.SaveHandler; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import org.apache.commons.io.IOUtils; +import org.apache.commons.compress.utils.IOUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index 92acd71ecd..a0b6106151 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -1,10 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -18,8 +16,6 @@ import openmodularturrets.tileentity.turretbase.TurretBase; import openmodularturrets.util.PlayerUtil; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; - /** * Created by Bass on 27/07/2017. @@ -33,6 +29,7 @@ public class projectileEM extends LaserProjectile { private int ampLevel; private float massFactor; + private double mass,charge; public projectileEM(World par1World) { super(par1World); @@ -51,6 +48,8 @@ public class projectileEM extends LaserProjectile { super(par1World, turretBase); this.turretBase = turretBase; if(projectileContent != null){ + mass=projectileContent.getMass(); + charge=projectileContent.getCharge(); massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) { @@ -66,66 +65,70 @@ public class projectileEM extends LaserProjectile { gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f); } } - //todo make the recipe require some overflow hatches - - //todo add more subspace pollution } @Override protected void onImpact(MovingObjectPosition movingobjectposition) { if(ticksExisted > 1) { - if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - if(hitBlock != null){ - if (hitBlock.getMaterial().isSolid() && TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - movingobjectposition.blockX, - movingobjectposition.blockY, - movingobjectposition.blockZ); - worldObj.createExplosion(null, - movingobjectposition.blockX + 0.5D, - movingobjectposition.blockY + 0.5D, - movingobjectposition.blockZ + 0.5D, - (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } else { - return; - } - } - } - - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { + if(!worldObj.isRemote){ worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { - float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); - - if(movingobjectposition.entityHit instanceof EntityPlayer) { - if(canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { + switch (movingobjectposition.typeOfHit){ + case BLOCK: + Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + if(hitBlock != null){ + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter && hitBlock.getMaterial().isSolid()) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + movingobjectposition.blockX, + movingobjectposition.blockY, + movingobjectposition.blockZ); + worldObj.createExplosion(null, + movingobjectposition.blockX + 0.5D, + movingobjectposition.blockY + 0.5D, + movingobjectposition.blockZ + 0.5D, + TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * (strange ? 10 : 1) * massFactor * (isAmped ? ampLevel * .1f + 1 : 1) * (ticksExisted / 250f), true); + } else { + return; + } + } + break; + case ENTITY: + float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); + + if(movingobjectposition.entityHit instanceof EntityPlayer) { + EntityPlayer player=(EntityPlayer)movingobjectposition.entityHit; + if(canDamagePlayer(player)) { + movingobjectposition.entityHit.setFire((strange ?10:1)*2); + movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); + if(antiMatter) { + movingobjectposition.entityHit.hurtResistantTime = 0; + } + if(strange){ + TecTech.anomalyHandler.addCancer(player,mass); + } + if(charge!=0) { + TecTech.anomalyHandler.addCharge(player,charge); + } + } + } else { movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; } } - } else { - movingobjectposition.entityHit.setFire((strange ?10:1)*2); - movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); - if(antiMatter) { - movingobjectposition.entityHit.hurtResistantTime = 0; + + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + (int)movingobjectposition.entityHit.posX, + (int)movingobjectposition.entityHit.posY, + (int)movingobjectposition.entityHit.posZ); + worldObj.createExplosion(null, + movingobjectposition.entityHit.posX, + movingobjectposition.entityHit.posY, + movingobjectposition.entityHit.posZ, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } - } - - if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - (int)movingobjectposition.entityHit.posX, - (int)movingobjectposition.entityHit.posY, - (int)movingobjectposition.entityHit.posZ); - worldObj.createExplosion(null, - movingobjectposition.entityHit.posX, - movingobjectposition.entityHit.posY, - movingobjectposition.entityHit.posZ, - (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } + break; } } setDead(); diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 1c8d476a36..fd039a0630 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -5,8 +5,6 @@ import com.github.technus.tectech.compatibility.openmodularturrets.entity.projec import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -17,7 +15,8 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; /** * Created by Bass on 27/07/2017. @@ -72,8 +71,8 @@ public class TileTurretHeadEM extends TurretHead{ public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { while(hatchContentPointer!=null && hatchContentPointer.hasStacks()) { cElementalInstanceStack stack = hatchContentPointer.get(TecTech.RANDOM.nextInt(hatchContentPointer.size())); - if(stack.amount defToAspect = new HashMap<>(); - public static final HashMap aspectToDef = new HashMap<>(); - - public void run(){} - - Object getAspect(cElementalDefinition definition){ - return null; - } - - String getAspectTag(cElementalDefinition definition){ - return null; - } - - iElementalDefinition getDefinition(String aspect){ - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java deleted file mode 100644 index 3cb2eafccd..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import thaumcraft.api.aspects.Aspect; - -import java.util.ArrayList; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; - -/** - * Created by Tec on 21.05.2017. - */ -public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { - @Override - public void run(){ - defToAspect.put(magic_air,"aer"); - defToAspect.put(magic_earth,"terra"); - defToAspect.put(magic_fire,"ignis"); - defToAspect.put(magic_water,"aqua"); - defToAspect.put(magic_order,"ordo"); - defToAspect.put(magic_entropy,"perditio"); - - aspectToDef.put("aer",magic_air); - aspectToDef.put("terra",magic_earth); - aspectToDef.put("ignis",magic_fire); - aspectToDef.put("aqua",magic_water); - aspectToDef.put("ordo",magic_order); - aspectToDef.put("perditio",magic_entropy); - - ArrayList list=Aspect.getCompoundAspects(); - Aspect[] array= list.toArray(new Aspect[0]); - while (!list.isEmpty()) { - for (Aspect aspect : array) { - if (list.contains(aspect)) { - Aspect[] content = aspect.getComponents(); - if (content.length != 2) { - list.remove(aspect); - }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ - try { - dComplexAspectDefinition newAspect; - if(content[0].getTag().equals(content[1].getTag())){ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(2) - ); - }else{ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(1), aspectToDef.get(content[1].getTag()).getStackForm(1) - ); - } - aspectToDef.put(aspect.getTag(),newAspect); - defToAspect.put(newAspect,aspect.getTag()); - }catch (tElementalException e) { - /**/ - }finally { - list.remove(aspect); - } - } - } - } - } - - STACKS_REGISTERED.addAll(defToAspect.keySet()); - } - - @Override - Aspect getAspect(cElementalDefinition definition) { - return Aspect.getAspect(defToAspect.get(definition)); - } - - @Override - String getAspectTag(cElementalDefinition definition) { - return defToAspect.get(definition); - } - - @Override - iElementalDefinition getDefinition(String aspect) { - return aspectToDef.get(aspect); - } - -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java index ddef29b214..8f570c1247 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; @@ -24,7 +25,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class dComplexAspectDefinition extends cElementalDefinition implements iElementalAspect { +public final class dComplexAspectDefinition extends cElementalDefinition { private final int hash; public final double mass; @@ -252,11 +253,6 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme return null; } - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - @Override public iElementalDefinition getAnti() { return null; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java index 02e7d2fe21..9c6d107bff 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java @@ -8,7 +8,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class ePrimalAspectDefinition extends cElementalPrimitive implements iElementalAspect { +public final class ePrimalAspectDefinition extends cElementalPrimitive { public static final ePrimalAspectDefinition magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), @@ -35,11 +35,6 @@ public final class ePrimalAspectDefinition extends cElementalPrimitive implement return translateToLocal("tt.keyword.Primal") + ": " + name; } - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - @Override public boolean isTimeSpanHalfLife() { return false; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java deleted file mode 100644 index 3cb2d8e5e8..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -/** - * Created by Tec on 21.05.2017. - */ -public interface iElementalAspect { - Object materializeIntoAspect(); -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java new file mode 100644 index 0000000000..343071e26e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -0,0 +1,29 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import java.util.HashMap; + +/** + * Created by Tec on 21.05.2017. + */ +public class AspectDefinitionCompat { + public static AspectDefinitionCompat aspectDefinitionCompat; + public final HashMap defToAspect = new HashMap<>(); + public final HashMap aspectToDef = new HashMap<>(); + + public void run(){} + + public Object getAspect(iElementalDefinition definition){ + return null; + } + + public String getAspectTag(iElementalDefinition definition){ + return null; + } + + public iElementalDefinition getDefinition(String aspect){ + return null; + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java new file mode 100644 index 0000000000..446e9b66d5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -0,0 +1,81 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import thaumcraft.api.aspects.Aspect; + +import java.util.ArrayList; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; + +/** + * Created by Tec on 21.05.2017. + */ +public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { + @Override + public void run(){ + defToAspect.put(magic_air,"aer"); + defToAspect.put(magic_earth,"terra"); + defToAspect.put(magic_fire,"ignis"); + defToAspect.put(magic_water,"aqua"); + defToAspect.put(magic_order,"ordo"); + defToAspect.put(magic_entropy,"perditio"); + + aspectToDef.put("aer",magic_air); + aspectToDef.put("terra",magic_earth); + aspectToDef.put("ignis",magic_fire); + aspectToDef.put("aqua",magic_water); + aspectToDef.put("ordo",magic_order); + aspectToDef.put("perditio",magic_entropy); + + ArrayList list=Aspect.getCompoundAspects(); + Aspect[] array= list.toArray(new Aspect[0]); + while (!list.isEmpty()) { + for (Aspect aspect : array) { + if (list.contains(aspect)) { + Aspect[] content = aspect.getComponents(); + if (content.length != 2) { + list.remove(aspect); + }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ + try { + dComplexAspectDefinition newAspect; + if(content[0].getTag().equals(content[1].getTag())){ + newAspect = new dComplexAspectDefinition( + aspectToDef.get(content[0].getTag()).getStackForm(2)); + }else{ + newAspect = new dComplexAspectDefinition( + aspectToDef.get(content[0].getTag()).getStackForm(1), + aspectToDef.get(content[1].getTag()).getStackForm(1)); + } + aspectToDef.put(aspect.getTag(),newAspect); + defToAspect.put(newAspect,aspect.getTag()); + }catch (tElementalException e) { + /**/ + }finally { + list.remove(aspect); + } + } + } + } + } + + STACKS_REGISTERED.addAll(defToAspect.keySet()); + } + + @Override + public Aspect getAspect(iElementalDefinition definition) { + return Aspect.getAspect(defToAspect.get(definition)); + } + + @Override + public String getAspectTag(iElementalDefinition definition) { + return defToAspect.get(definition); + } + + @Override + public iElementalDefinition getDefinition(String aspect) { + return aspectToDef.get(aspect); + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index e77cab2734..63f55912a6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; @@ -18,11 +18,15 @@ public class EssentiaCompat { return null; } - public boolean putElementalInstanceStack(TileEntity conatainer, cElementalInstanceStack stack){ + public String getEssentiaName(iElementalDefinition stack){ + return null; + } + + public boolean putInContainer(TileEntity container, String name){ return false; } - public cElementalInstanceStack getFromContainer(TileEntity container){ + public iElementalDefinition getFromContainer(TileEntity container){ return null; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index 484377b179..03ff92b4e0 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,8 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.iElementalAspect; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; @@ -11,7 +9,7 @@ import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.common.tiles.TileEssentiaReservoir; import thaumcraft.common.tiles.TileJarFillable; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectToDef; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; /** * Created by Tec on 21.05.2017. @@ -30,22 +28,28 @@ public class EssentiaCompatEnabled extends EssentiaCompat { } @Override - public boolean putElementalInstanceStack(TileEntity container,cElementalInstanceStack stack){ - if(container==null || container.isInvalid()) { + public String getEssentiaName(iElementalDefinition stack) { + return aspectDefinitionCompat.defToAspect.get(stack); + } + + @Override + public boolean putInContainer(TileEntity container, String aspectName) { + if (container == null || container.isInvalid() || aspectName == null || aspectName.isEmpty()) { return false; } - if(container instanceof IAspectContainer && stack.definition instanceof iElementalAspect){ - Aspect aspect=(Aspect) ((iElementalAspect) stack.definition).materializeIntoAspect(); - if(aspect!=null){ - ((IAspectContainer) container).addToContainer(aspect,1); - return true; + if (container instanceof IAspectContainer) { + Aspect aspect = Aspect.getAspect(aspectName); + if(aspect==null){ + return false; } + int remaining=((IAspectContainer) container).addToContainer(aspect, 1); + return remaining==0; } return false; } @Override - public cElementalInstanceStack getFromContainer(TileEntity container){ + public iElementalDefinition getFromContainer(TileEntity container){ if(container==null || container.isInvalid()) { return null; } @@ -55,10 +59,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { Aspect[] aspectsArr= aspects.getAspects(); if(aspectsArr!=null && aspectsArr[0]!=null){ if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){ - cElementalDefinition def=aspectToDef.get(aspectsArr[0].getTag()); - if(def!=null){ - return new cElementalInstanceStack(def,1); - } + return aspectDefinitionCompat.aspectToDef.get(aspectsArr[0].getTag()); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 8e8aee4795..c11a68b5d0 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,35 +1,38 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,32 +41,31 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs + private static final String[][] shape = new String[][]{ + {" ", " . ", " ",}, + {"0A0", E, "0A0",}, + {"121", "232", "121",}, + {"\"\"\"", "\"2\"", "\"\"\"",}, + {"202", "0!0", "202",}, + }; + private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.1"),//2 - Elemental Input Hatch - translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.3"),//General - Some sort of Essentia Storage }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", new String[][]{ - {"DDD", "D~D", "DDD"}, - {"E E", " ", "E E"}, - {"ABA", "BCB", "ABA"}, - {"FFF", "FBF", "FFF"}, - {"BEB", "EGE", "BEB"} - }) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofBlock(sBlockCasingsTT, 8)) - .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) - .build(); - + private String outputEssentiaName; //endregion public GT_MetaTileEntity_EM_essentiaDequantizer(int aID, String aName, String aNameRegional) { @@ -81,7 +83,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); + return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override @@ -91,24 +93,49 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ stopMachine(); return false; } + cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContainerHandler(); - if (inputHatchContainer.hasStacks()) { - cElementalInstanceStack stack = inputHatchContainer.getFirst(); - inputHatchContainer.removeAmount(false, new cElementalInstanceStack(stack.definition, 1)); - if (!essentiaContainerCompat.putElementalInstanceStack(container, stack)) { - cleanStackEM_EM(stack); - } - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - eAmpereFlow = 1; - if (stack.definition instanceof ePrimalAspectDefinition) { - mEUt = (int) -V[8]; + if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) { + return false; + } + + cElementalInstanceStack stack = inputHatchContainer.get(TecTech.RANDOM.nextInt(inputHatchContainer.size())); + if (stack.amount < AVOGADRO_CONSTANT_DIMINISHED) { + cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + mEUt = (int) -V[6]; + } else { + outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.definition); + Aspect aspect = Aspect.getAspect(outputEssentiaName); + if (aspect == null) { + outputEssentiaName = null; + cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + mEUt = (int) -V[7]; } else { - mEUt = (int) -V[10]; + inputHatchContainer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT)); + if (aspect.isPrimal()) { + mEUt = (int) -V[8]; + } else { + mEUt = (int) -V[10]; + } + } + } + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eAmpereFlow = 1; + return true; + } + + @Override + public void outputAfterRecipe_EM() { + TileEntity container = essentiaContainerCompat.getContainer(this); + if (container == null) { + stopMachine(); + }else{ + if(!essentiaContainerCompat.putInContainer(container,outputEssentiaName)){ + stopMachine(); } - return true; } - return false; + outputEssentiaName=null; } @Override @@ -143,16 +170,23 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + public String[] getStructureDescription(ItemStack stackSize) { + return description; } @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setString("eOutputEssentia",outputEssentiaName); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + outputEssentiaName=aNBT.getString("eOutputEssentia"); } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 1e23408a0b..74dff47aa4 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -2,34 +2,35 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,31 +39,29 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs + private static final String[][] shape = new String[][]{ + {" ", " . ", " ",}, + {"0A0", E, "0A0",}, + {"121", "232", "121",}, + {"\"\"\"", "\"1\"", "\"\"\"",}, + {"010", "1!1", "010",}, + }; + private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.1"),//2 - Elemental Output Hatch - translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.3"),//General - Some sort of Essentia Storage }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", new String[][]{ - {"FFF", "F~F", "FFF"}, - {"E E", " ", "E E"}, - {"BAB", "ACA", "BAB"}, - {"DDD", "DBD", "DDD"}, - {"EBE", "BGB", "EBE"} - }) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofBlock(sBlockCasingsTT, 8)) - .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) - .build(); //endregion public GT_MetaTileEntity_EM_essentiaQuantizer(int aID, String aName, String aNameRegional) { @@ -80,21 +79,20 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM("main", 1, 1, 0); + return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) { - TileEntity container = essentiaContainerCompat.getContainer(this); - cElementalInstanceStack newStack = essentiaContainerCompat.getFromContainer(container); - if (newStack != null) { + iElementalDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); + if (definition != null) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; eAmpereFlow = 1; outputEM = new cElementalInstanceStackMap[]{ - new cElementalInstanceStackMap(newStack) + new cElementalInstanceStackMap(new cElementalInstanceStack(definition,AVOGADRO_CONSTANT)) }; - if (newStack.definition instanceof ePrimalAspectDefinition) { + if (definition instanceof ePrimalAspectDefinition) { mEUt = (int) -V[8]; } else { mEUt = (int) -V[10]; @@ -146,12 +144,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 8a03bd67b8..02fae0e194 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompatEnabled; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompatEnabled; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; @@ -40,7 +40,7 @@ import java.util.HashSet; import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.TecTech.*; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectDefinitionCompat; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 0bf8c57f24..91dbffa71f 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -15,6 +15,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; @@ -73,22 +74,22 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f*AVOGADRO_CONSTANT).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f*AVOGADRO_CONSTANT).getStackForm(1L)); // =================================================================================================== 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 dd388bc233..0e1771e88d 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 @@ -1,7 +1,6 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; @@ -9,6 +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.dAtomDefinition; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -20,6 +20,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -28,15 +29,20 @@ import net.minecraftforge.event.world.ChunkEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; public class AnomalyHandler implements IChunkMetaDataHandler { - public static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 10000D; - public static final int COUNT_DIV=32; - public static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; - public static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; - public static final int MEAN_DELAY =50; - private static final float CHARGE_EFFECTIVENESS = 10; - private static final float CHARGE_EXPLOSIVENESS = 5; + private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... + private static final int COUNT_DIV=32; + private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; + private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; + private static final int MEAN_DELAY =50; + private static final double CANCER_EFFECTIVENESS = 1/AVOGADRO_CONSTANT; + private static final double CHARGE_EFFECTIVENESS = 10/AVOGADRO_CONSTANT; + private static final double CHARGE_EXPLOSIVENESS = 5/AVOGADRO_CONSTANT; private boolean fixMe=false; private final ArrayList playersWithCharge = new ArrayList<>(); @@ -62,8 +68,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { public void tickWorld(HashMap data, TickEvent.WorldTickEvent aEvent) { if (TecTech.RANDOM.nextInt(MEAN_DELAY) == 0) { int dim = aEvent.world.provider.dimensionId; - data.get(dim).forEach((chunkCoordIntPair, compound) -> { - if (compound.getDouble(INTENSITY) >= SWAP_THRESHOLD) { + ChunkDataHandler.ChunkHashMap chunkHashMap = data.get(dim); + chunkHashMap.forEach((chunkCoordIntPair, compound) -> { + if (compound.getDouble(INTENSITY) > SWAP_THRESHOLD) { Chunk chunk = aEvent.world.getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos, chunkCoordIntPair.chunkZPos); if (chunk.isChunkLoaded) { worldDataArrayList.add(chunk); @@ -72,21 +79,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { }); if (worldDataArrayList.size() >= 2) { Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - Chunk b = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - double avg = .5 * (data.get(dim).get(a.getChunkCoordIntPair()).getDouble(INTENSITY) + - data.get(dim).get(b.getChunkCoordIntPair()).getDouble(INTENSITY)); - data.get(dim).get(a.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).get(b.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).markForTransmissionToClient(a.getChunkCoordIntPair()); - data.get(dim).markForTransmissionToClient(b.getChunkCoordIntPair()); - swapSomething(a, b, (float) Math.min(Math.log10(avg), 20)); + Chunk b = worldDataArrayList.get(TecTech.RANDOM.nextInt(worldDataArrayList.size())); + ChunkCoordIntPair aCoords = a.getChunkCoordIntPair(); + ChunkCoordIntPair bCoords = b.getChunkCoordIntPair(); + + double newValue = (chunkHashMap.get(aCoords).getDouble(INTENSITY) + + chunkHashMap.get(bCoords).getDouble(INTENSITY))/2-SWAP_THRESHOLD/8; + float split=TecTech.RANDOM.nextFloat(); + + chunkHashMap.get(aCoords).setDouble(INTENSITY, newValue * split); + chunkHashMap.get(bCoords).setDouble(INTENSITY, newValue * (1-split)); + chunkHashMap.markForTransmissionToClient(aCoords); + chunkHashMap.markForTransmissionToClient(bCoords); + swapSomething(a, b, newValue); } worldDataArrayList.clear(); } for (Object o : aEvent.world.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { - float charge = TecTech.playerPersistence.getDataOrSetToNewTag((EntityPlayer) o).getFloat(SPACE_CHARGE); - if (charge != 0) { + if (getCharge((EntityPlayer) o) != 0) { playersWithCharge.add((EntityPlayer) o); } } @@ -94,25 +105,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { if (playersWithCharge.size() > 0) { outer: for (EntityPlayer other : playersWithCharge) { - float fieldOther = TecTech.playerPersistence.getDataOrSetToNewTag(other).getFloat(SPACE_CHARGE); + double fieldOther = getCharge(other); for (EntityPlayer player : playersWithCharge) { if (other == player) { continue outer; } - float field = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); - float difference = Math.abs(field - fieldOther); - if (difference != 0) { + double field = getCharge(player); + double absDifference = Math.abs(field - fieldOther); + if (absDifference != 0) { if (player.getDistanceSqToEntity(other) < 1) { - float avg = (fieldOther + field) / 2; - addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * difference)); - other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.getDataOrSetToNewTag(other).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.saveData(player); - TecTech.playerPersistence.saveData(other); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(other)); + double avg = (fieldOther + field) / 2; + //addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * absDifference)); + if(TecTech.configTecTech.BOOM_ENABLE){ + other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ,(float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, (float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + } + GT_Utility.sendSoundToPlayers(other.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)other.posX, (int)other.posY, (int)other.posZ); + GT_Utility.sendSoundToPlayers(player.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)player.posX, (int)player.posY, (int)player.posZ); + setCharge(player,avg); + setCharge(other,avg); } } } @@ -121,8 +132,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - private void swapSomething(Chunk a,Chunk b,float power) { - for (int i = 0; i < 64; i++) { + private void swapSomething(Chunk a,Chunk b,double mass) { + float explosionPower=(float) Math.log(mass/AVOGADRO_CONSTANT); + for (int i = 0; i < Math.min((int)explosionPower,64); i++) { int x = TecTech.RANDOM.nextInt(16); int y = TecTech.RANDOM.nextInt(a.worldObj.getActualHeight()); int z = TecTech.RANDOM.nextInt(16); @@ -143,12 +155,14 @@ public class AnomalyHandler implements IChunkMetaDataHandler { a.worldObj.setBlockToAir((a.xPosition << 4) + x, y, (a.zPosition << 4) + z); b.worldObj.setBlockToAir((b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } - if (TecTech.RANDOM.nextBoolean()) { - a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, power, true); + if(TecTech.configTecTech.BOOM_ENABLE){ + if (TecTech.RANDOM.nextBoolean()) { + a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(a.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (a.xPosition << 4) + x, y, (a.zPosition << 4) + z); - } - if (TecTech.RANDOM.nextBoolean()) { - b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, power, true); + if (TecTech.RANDOM.nextBoolean()) { + b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(b.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } } @@ -156,13 +170,13 @@ public class AnomalyHandler implements IChunkMetaDataHandler { 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)); - aE.forEach(o -> { + for (EntityLivingBase entityLivingBase : aE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (entityLivingBase instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) entityLivingBase); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.hunger.id, 1200)); player.addPotionEffect(new PotionEffect(Potion.weakness.id, 1000)); player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 800)); @@ -171,36 +185,35 @@ public class AnomalyHandler implements IChunkMetaDataHandler { player.addPotionEffect(new PotionEffect(Potion.poison.id, 200)); player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); player.addPotionEffect(new PotionEffect(Potion.wither.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)-(float)Math.abs(TecTech.RANDOM.nextGaussian())); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, -mass * TecTech.RANDOM.nextFloat()); } + } else { + entityLivingBase.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + entityLivingBase.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); - bE.forEach(o -> { + } + for (EntityLivingBase o : bE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (o instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) o); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) -(explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 800)); player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 600)); player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 400)); player.addPotionEffect(new PotionEffect(Potion.jump.id, 200)); player.addPotionEffect(new PotionEffect(Potion.resistance.id, 100)); player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)+(float)Math.abs(TecTech.RANDOM.nextGaussian())); - - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, mass * TecTech.RANDOM.nextFloat()); } + } else { + o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); + o.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); + } } @Override @@ -218,38 +231,36 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - data.get(player.worldObj.provider.dimensionId).forEach((chunkCoordIntPair, dat) -> { + for (Map.Entry entry : data.get(player.worldObj.provider.dimensionId).entrySet()) { + ChunkCoordIntPair chunkCoordIntPair = entry.getKey(); + NBTTagCompound dat = entry.getValue(); if (Math.abs(chunkCoordIntPair.getCenterXPos() - player.posX) + Math.abs(chunkCoordIntPair.getCenterZPosition() - player.posZ) < 256) { - for (int i = 0, pow = (int) Math.min(32, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { + for (int i = 0, pow = (int) Math.min(COUNT_DIV, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { TecTech.proxy.em_particle(player.worldObj, chunkCoordIntPair.getCenterXPos() + TecTech.RANDOM.nextGaussian() * 32D, player.posY + TecTech.RANDOM.nextFloat() * 128D - 64D, chunkCoordIntPair.getCenterZPosition() + TecTech.RANDOM.nextGaussian() * 32D); } } - }); + } } else if (TecTech.RANDOM.nextInt(50) == 0) { EntityPlayer player = aEvent.player; ChunkCoordIntPair pair = new ChunkCoordIntPair(player.chunkCoordX, player.chunkCoordZ); NBTTagCompound compound = data.get(player.worldObj.provider.dimensionId).get(pair); NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); boolean saveRequired = false; - if(player.capabilities.isCreativeMode){ - if (playerTag.getDouble(SPACE_CANCER) != 0) { - playerTag.setDouble(SPACE_CANCER, 0); - saveRequired = true; - } - }else { + if (!player.capabilities.isCreativeMode) { + double cancer=getCancer(player); if (compound != null) { int badness = (int) Math.min(COUNT_DIV, compound.getDouble(INTENSITY) / PER_PARTICLE); if (badness > 0) { - playerTag.setDouble(SPACE_CANCER, Math.min(2, playerTag.getDouble(SPACE_CANCER) + 9.765625E-4f * badness)); + playerTag.setDouble(SPACE_CANCER, Math.min(2, cancer + 9.765625E-4f * badness)); player.attackEntityFrom(MainLoader.subspace,Math.max(1,badness/8f)); saveRequired = true; } } else if (playerTag.getDouble(SPACE_CANCER) > 0 && !player.isDead) { if (player.ticksExisted % 10 == 0) { - playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-5f)); + playerTag.setDouble(SPACE_CANCER, Math.max(0, cancer - 7.6293945E-5f)); saveRequired = true; } } @@ -267,29 +278,26 @@ public class AnomalyHandler implements IChunkMetaDataHandler { EntityPlayer player=TecTech.proxy.getPlayer(); if(player!=null) { if(!player.capabilities.isCreativeMode) { - NBTTagCompound tagCompound = TecTech.playerPersistence.getDataOrSetToNewTag(player); - if (tagCompound != null) { - float cancer = tagCompound.getFloat(SPACE_CANCER); - if (cancer > 0) { - player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); - player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer); - cancer*=cancer/2F; - if (cancer > 1.75f) { - player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } else { - player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } + double cancer = getCancer(player)*CANCER_EFFECTIVENESS; + if (cancer > 0) { + player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); + player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer); + cancer*=cancer/2F; + if (cancer > 1.75f) { + player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); + } else { + player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); } } - float charge = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); + double charge = getCharge(player); if(charge!=0) { for (Object o : player.worldObj.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { EntityPlayer otherPlayer=(EntityPlayer)o; - float chargeOther = TecTech.playerPersistence.getDataOrSetToNewTag(otherPlayer).getFloat(SPACE_CHARGE); + double chargeOther = getCharge(otherPlayer); if (chargeOther != 0 && player != o) { - float reaction = chargeOther * charge; + double reaction = chargeOther * charge; if (reaction !=0) { double distanceSq = otherPlayer.getDistanceSqToEntity(player); if (distanceSq >= 1) { @@ -328,19 +336,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { return 100; } - public void addAnomaly(IGregTechTileEntity iGregTechTileEntity, double amount) { - if (iGregTechTileEntity.isServerSide()) { - World w = iGregTechTileEntity.getWorld(); + public void addAnomaly(IGregTechTileEntity gtTile, double amount) { + addAnomaly(gtTile.getWorld(),gtTile.getXCoord(),gtTile.getZCoord(),amount); + } + + public void addAnomaly(TileEntity tileEntity, double amount) { + addAnomaly(tileEntity.getWorldObj(),tileEntity.xCoord,tileEntity.zCoord,amount); + } + + public void addAnomaly(World w,int x,int z, double amount) { + if (!w.isRemote) { addAnomaly(w.provider.dimensionId, new ChunkCoordIntPair( - iGregTechTileEntity.getXCoord() >> 4, - iGregTechTileEntity.getZCoord() >> 4), + x >> 4, + z >> 4), amount); } } public void addAnomaly(int world, ChunkCoordIntPair chunk, double amount) { - amount=Math.abs(amount); NBTTagCompound old = TecTech.chunkDataHandler.getChunkData(this, world, chunk); if (old == null) { NBTTagCompound data = new NBTTagCompound(); @@ -351,4 +365,45 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } TecTech.chunkDataHandler.getChunkData(this, world).markForTransmissionToClient(chunk); } + + public double getCharge(EntityPlayer player){ + return getDouble(player,SPACE_CHARGE); + } + + public void setCharge(EntityPlayer player, double amount){ + setDouble(player,SPACE_CHARGE,amount); + } + + public void addCharge(EntityPlayer player, double amount){ + addDouble(player,SPACE_CHARGE,amount); + } + + public double getCancer(EntityPlayer player){ + return getDouble(player,SPACE_CANCER); + } + + public void setCancer(EntityPlayer player, double amount){ + setDouble(player,SPACE_CANCER,amount); + } + + public void addCancer(EntityPlayer player, double amount){ + addDouble(player,SPACE_CANCER,amount); + } + + public double getDouble(EntityPlayer player,String name){ + return TecTech.playerPersistence.getDataOrSetToNewTag(player).getDouble(name); + } + + public void setDouble(EntityPlayer player,String name, double amount){ + TecTech.playerPersistence.getDataOrSetToNewTag(player).setDouble(name, amount); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } + + public void addDouble(EntityPlayer player,String name, double amount){ + NBTTagCompound data = TecTech.playerPersistence.getDataOrSetToNewTag(player); + data.setDouble(name, amount+data.getDouble(name)); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java index a153671a59..bb61f50aab 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CANCER; - public class CancerCommand implements ICommand { ArrayList aliases=new ArrayList<>(); @@ -39,13 +34,10 @@ public class CancerCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CANCER, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), player); + TecTech.anomalyHandler.setCancer(player,amount); sender.addChatMessage(new ChatComponentText("Cancer set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java index da365a92f8..4190cd0dba 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CHARGE; - public class ChargeCommand implements ICommand { ArrayList aliases=new ArrayList<>(); @@ -33,13 +28,10 @@ public class ChargeCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CHARGE, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + TecTech.anomalyHandler.setCharge(player,amount); sender.addChatMessage(new ChatComponentText("Charge set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java index ec5391a0b4..69a4b9683c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.item.ItemStack; @@ -10,36 +9,64 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static java.lang.Math.pow; /** * Created by Tec on 26.05.2017. */ public class bTransformationInfo { + /** + * Atom count per Mol + */ public static final double AVOGADRO_CONSTANT =6.02214076e23D; - public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000)/AVOGADRO_CONSTANT; - public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / (144 * 1000); - public static final double AVOGADRO_CONSTANT_KIND_OF_SMALLER =AVOGADRO_CONSTANT-AVOGADRO_CONSTANT_EPSILON; - public static final double AVOGADRO_CONSTANT_KIND_OF_BIGGER =AVOGADRO_CONSTANT+AVOGADRO_CONSTANT_EPSILON; + /** + * Min. chance of existing + */ + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48); + public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON; public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; + public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON*144D; public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D; + public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON*1000D; - public static final Map fluidQuantization=new HashMap<>(32); - public static final Map itemQuantization=new HashMap<>(32); - public static final Map oredictQuantization=new HashMap<>(32); + public static bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(); + + public Map fluidQuantization; + public Map itemQuantization; + public Map oredictQuantization; public Map fluidDequantization; public Map itemDequantization; public Map oredictDequantization; - public bTransformationInfo(int fluidCap,int itemCap, int oreCap){ - fluidDequantization = fluidCap > 0 ? new HashMap<>(fluidCap) : Collections.emptyMap(); - itemDequantization = itemCap > 0 ? new HashMap<>(itemCap) : Collections.emptyMap(); - oredictDequantization = oreCap > 0 ? new HashMap<>(oreCap) : Collections.emptyMap(); + private bTransformationInfo() { + this( + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) + ); + } + + public bTransformationInfo( + Map fluidQuantization, + Map itemQuantization, + Map oredictQuantization, + Map fluidDequantization, + Map itemDequantization, + Map oredictDequantization) { + this.fluidQuantization = fluidQuantization; + this.itemQuantization = itemQuantization; + this.oredictQuantization = oredictQuantization; + this.fluidDequantization = fluidDequantization; + this.itemDequantization = itemDequantization; + this.oredictDequantization = oredictDequantization; } public void addFluid(iHasElementalDefinition em, FluidStack fluidStack){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index 965c46cef6..e97d5994e9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -42,7 +42,6 @@ public final class dAtomDefinition extends cElementalDefinition { private static final byte BYTE_OFFSET=32; private final int hash; - public static final bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(16,0,64); public static double refMass, refUnstableMass; private static final byte nbtType = (byte) 'a'; @@ -1319,17 +1318,17 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { - return TRANSFORMATION_INFO.fluidDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.fluidDequantization.get(this); } @Override public aItemDequantizationInfo someAmountIntoItemsStack() { - return TRANSFORMATION_INFO.itemDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.itemDequantization.get(this); } @Override public aOredictDequantizationInfo someAmountIntoOredictStack() { - return TRANSFORMATION_INFO.oredictDequantization.get(this); + return bTransformationInfo.TRANSFORMATION_INFO.oredictDequantization.get(this); } private static final class Nomenclature { @@ -1475,119 +1474,119 @@ public final class dAtomDefinition extends cElementalDefinition { /*----STABLE ATOMS----**/ refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); /*----UNSTABLE ATOMS----**/ refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); try { dAtomDefinition temp; - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); - TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); + bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); double tempMass=temp.getMass(); @@ -1596,7 +1595,7 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); @@ -1605,14 +1604,14 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); somethingHeavy=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) ); - TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); + bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index c5efaf1403..4ea5eb3776 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -25,7 +25,7 @@ import java.util.Map; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.TRANSFORMATION_INFO; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; @@ -467,7 +467,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //Added to atom map, but should be in its own cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); - bTransformationInfo.oredictQuantization.put( + TRANSFORMATION_INFO.oredictQuantization.put( OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) ); 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 ff9aca01ee..2a04af23d1 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 @@ -1,7 +1,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.CommonValues; import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -29,9 +29,9 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.Locale; +import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static com.github.technus.tectech.util.CommonValues.DISPERSE_AT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static net.minecraft.util.StatCollector.translateToLocal; @@ -149,10 +149,10 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == DISPERSE_AT) { if (aBaseMetaTileEntity.isActive()) { if (overflowMatter > overflowDisperse) { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse/(Math.pow(2,mTier))); overflowMatter -= overflowDisperse; } else { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter/(Math.pow(2,mTier))); overflowMatter = 0; aBaseMetaTileEntity.setActive(false); aBaseMetaTileEntity.setLightValue((byte) 0); @@ -227,7 +227,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity @Override public void onRemoval() { if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter * 8D); + TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter); if (TecTech.configTecTech.BOOM_ENABLE) { getBaseMetaTileEntity().doExplosion(V[15]); } else { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 3fdf841b52..97b4a7786e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -53,7 +53,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenON; public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT; - private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; + private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; private String clientLocale = "en_US"; 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 5b6b2c18e7..c3e35ba90c 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 @@ -2,24 +2,24 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -31,18 +31,16 @@ import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -51,21 +49,21 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {"CCC","BAB","EEE","DBD"}, - {"C~C","ABA","EBE","BFB"}, - {"CCC","BAB","EEE","DBD"} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList,textureOffset + 4, 2)) - .build(); - + private static final String[][] shape = new String[][]{ + {" ", " . ", " ",}, + {"010", "101", "010",}, + {"\"\"\"", "\"0\"", "\"\"\"",}, + {"202", "0!0", "202",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; + private static final byte[] blockMeta = new byte[]{4, 0, 0}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.0"),//1 - Classic Hatches or High Power Casing @@ -89,7 +87,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override @@ -100,9 +98,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - aItemQuantizationInfo aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); + aItemQuantizationInfo aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -111,7 +109,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - aOredictQuantizationInfo aOQI = bTransformationInfo.oredictQuantization.get(ID); + aOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.oredictQuantization.get(ID); if (aOQI == null) { continue; } @@ -138,7 +136,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - aFluidQuantizationInfo aFQI = bTransformationInfo.fluidQuantization.get(fs.getFluid().getID()); + aFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.fluidQuantization.get(fs.getFluid().getID()); if (aFQI == null) { continue; } @@ -201,12 +199,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 a0755b947b..30c9c509ec 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 @@ -2098,13 +2098,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public void doExplosion(long aExplosionPower) { - explodeMultiblock(); if (!TecTech.configTecTech.BOOM_ENABLE) { TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord()); StackTraceElement[] ste = Thread.currentThread().getStackTrace(); TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + ste[2].toString()); return; } + explodeMultiblock(); super.doExplosion(aExplosionPower); }//Redirecting to explodemultiblock //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java index 4d66b28ca6..55fa327364 100644 --- a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -89,7 +89,7 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override public double getReactorEUEnergyOutput() { - return (double)(getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + return getReactorEnergyOutput() * 5.0F * ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear"); } //public List getSubTiles() { -- cgit From c82522576d27ba1b0fdaf7fe1283489cb9f40744 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 15 Jan 2022 00:16:05 +0100 Subject: cherry pick Cleanup EM maps --- .../tileentity/turret/TileTurretHeadEM.java | 27 +- .../tileentity/turretbase/TileTurretBaseEM.java | 4 +- .../definitions/dComplexAspectDefinition.java | 42 +- .../definitions/ePrimalAspectDefinition.java | 2 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 6 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 4 +- .../elementalMatter/core/cElementalDecay.java | 75 --- .../core/cElementalDecayResult.java | 41 -- .../core/cElementalDefinitionStackMap.java | 65 --- .../core/cElementalInstanceStackMap.java | 565 --------------------- .../core/cElementalMutableDefinitionStackMap.java | 278 ---------- .../elementalMatter/core/cElementalStackMap.java | 181 ------- .../elementalMatter/core/commands/GiveEM.java | 6 +- .../core/decay/cElementalDecay.java | 77 +++ .../core/decay/cElementalDecayResult.java | 43 ++ .../elementalMatter/core/iElementalContainer.java | 12 + .../core/iElementalInstanceContainer.java | 10 - .../core/maps/cElementalConstantStackMap.java | 58 +++ .../core/maps/cElementalDefinitionStackMap.java | 56 ++ .../core/maps/cElementalInstanceStackMap.java | 214 ++++++++ .../core/maps/cElementalStackMap.java | 50 ++ .../elementalMatter/core/maps/iElementalMapR.java | 187 +++++++ .../elementalMatter/core/maps/iElementalMapRW.java | 130 +++++ .../elementalMatter/core/rElementalRecipe.java | 56 -- .../elementalMatter/core/rElementalRecipeMap.java | 70 --- .../core/recipes/rElementalRecipe.java | 57 +++ .../core/recipes/rElementalRecipeMap.java | 73 +++ .../core/stacks/cElementalDefinitionStack.java | 35 +- .../core/stacks/cElementalInstanceStack.java | 54 +- .../core/stacks/iElementalStack.java | 23 + .../core/stacks/iHasElementalDefinition.java | 18 - .../core/templates/cElementalDefinition.java | 10 +- .../core/templates/cElementalPrimitive.java | 6 +- .../core/templates/iElementalDefinition.java | 6 +- .../transformations/aFluidDequantizationInfo.java | 14 +- .../transformations/aFluidQuantizationInfo.java | 14 +- .../transformations/aItemDequantizationInfo.java | 14 +- .../transformations/aItemQuantizationInfo.java | 16 +- .../aOredictDequantizationInfo.java | 18 +- .../transformations/aOredictQuantizationInfo.java | 18 +- .../core/transformations/bTransformationInfo.java | 16 +- .../definitions/complex/dAtomDefinition.java | 194 ++++--- .../definitions/complex/dHadronDefinition.java | 68 ++- .../primitive/cPrimitiveDefinition.java | 2 +- .../definitions/primitive/eBosonDefinition.java | 4 +- .../definitions/primitive/eLeptonDefinition.java | 2 +- .../definitions/primitive/eNeutrinoDefinition.java | 2 +- .../definitions/primitive/eQuarkDefinition.java | 2 +- .../github/technus/tectech/recipe/TT_recipe.java | 30 +- .../technus/tectech/recipe/TT_recipeAdder.java | 14 +- .../item/DebugElementalInstanceContainer_EM.java | 12 +- .../item/ElementalDefinitionContainer_EM.java | 18 +- .../item/ElementalDefinitionScanStorage_EM.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 8 +- .../GT_MetaTileEntity_Hatch_OutputElemental.java | 2 +- .../multi/GT_MetaTileEntity_EM_collider.java | 109 ++-- .../multi/GT_MetaTileEntity_EM_decay.java | 100 ++-- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 63 +-- .../multi/GT_MetaTileEntity_EM_junction.java | 6 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 14 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 114 ++--- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 90 ++-- .../multi/em_machine/Behaviour_Centrifuge.java | 8 +- .../multi/em_machine/Behaviour_Electrolyzer.java | 2 +- .../Behaviour_ElectromagneticSeparator.java | 6 +- .../multi/em_machine/Behaviour_PrecisionLaser.java | 2 +- .../multi/em_machine/Behaviour_Recycler.java | 2 +- .../multi/em_machine/Behaviour_Scanner.java | 2 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 58 +-- 69 files changed, 1568 insertions(+), 2019 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index fd039a0630..e027c83107 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -1,9 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turret; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; @@ -16,7 +15,6 @@ import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; /** * Created by Bass on 27/07/2017. @@ -54,7 +52,7 @@ public class TileTurretHeadEM extends TurretHead{ @Override public boolean requiresAmmo() { - return hatchContentPointer == null || !hatchContentPointer.hasStacks(); + return hatchContentPointer == null || hatchContentPointer.isEmpty(); } @Override @@ -69,20 +67,15 @@ public class TileTurretHeadEM extends TurretHead{ @Override public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { - while(hatchContentPointer!=null && hatchContentPointer.hasStacks()) { - cElementalInstanceStack stack = hatchContentPointer.get(TecTech.RANDOM.nextInt(hatchContentPointer.size())); - if(stack.amount(); - } - - @Deprecated - public cElementalDefinitionStackMap(iElementalDefinition... in) { - map=new cElementalMutableDefinitionStackMap(in).map; - } - - public cElementalDefinitionStackMap(cElementalDefinitionStack... in) { - map=new cElementalMutableDefinitionStackMap(in).map; - } - - public cElementalDefinitionStackMap(TreeMap in) { - map = new TreeMap<>(in); - } - - cElementalDefinitionStackMap(cElementalMutableDefinitionStackMap unsafeMap){ - map=unsafeMap.map; - } - - //IMMUTABLE DON'T NEED IT - @Override - public cElementalDefinitionStackMap clone() { - return this; - } - - public cElementalMutableDefinitionStackMap toMutable() { - return new cElementalMutableDefinitionStackMap(map); - } - - @Override - @Deprecated//BETTER TO JUST MAKE A MUTABLE VERSION AND DO SHIT ON IT - public TreeMap getRawMap() { - return toMutable().getRawMap(); - } - - public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalDefinitionStackMap(defStacks); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java deleted file mode 100644 index e1fdc6a553..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ /dev/null @@ -1,565 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.*; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.util.DoubleCount.add; -import static com.github.technus.tectech.util.DoubleCount.sub; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalInstanceStackMap implements Comparable { - TreeMap map; - - //Constructors - public cElementalInstanceStackMap() { - map = new TreeMap<>(); - } - - public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) { - this(true, inSafe); - } - - public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) { - map = new TreeMap<>(); - if (clone) { - cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length]; - for(int i=0;i inSafe) { - this(true, inSafe); - } - - @Deprecated - private cElementalInstanceStackMap(boolean clone, TreeMap in) { - if (clone) { - map = new TreeMap<>(); - for(cElementalInstanceStack stack:in.values()) { - putUnify(stack.clone()); - } - } else { - map = in; - } - } - - public cElementalInstanceStackMap(cElementalInstanceStackMap inSafe) { - this(true, inSafe.map); - } - - public cElementalInstanceStackMap(boolean copy, cElementalInstanceStackMap in) { - this(copy, in.map); - } - - @Override - public cElementalInstanceStackMap clone() { - return new cElementalInstanceStackMap(map); - } - - public cElementalMutableDefinitionStackMap toDefinitionMapForComparison() { - cElementalDefinitionStack[] list = new cElementalDefinitionStack[map.size()]; - int i = 0; - for (cElementalInstanceStack stack : map.values()) { - list[i++] = new cElementalDefinitionStack(stack.definition, stack.amount); - } - return new cElementalMutableDefinitionStackMap(list); - } - - //@Deprecated - //public cElementalStackMap toDefinitionMap(boolean mutable) { - // TreeMap newMap = new TreeMap<>(); - // for (cElementalInstanceStack stack : map.values()) { - // newMap.put(stack.definition, new cElementalDefinitionStack(stack.definition, stack.amount)); - // } - // if (mutable) { - // return new cElementalMutableDefinitionStackMap(newMap); - // } - // return new cElementalDefinitionStackMap(newMap); - //} - - @Deprecated - public Map getRawMap() { - return map; - } - - public Set> getEntrySet() { - return map.entrySet(); - } - - - //Removers - public void clear() { - map.clear(); - } - - public cElementalInstanceStack remove(iElementalDefinition def) { - return map.remove(def); - } - - @Deprecated - public cElementalInstanceStack remove(iHasElementalDefinition has) { - return map.remove(has.getDefinition()); - } - - public void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - map.remove(def); - } - } - - @Deprecated - private void removeAll(iHasElementalDefinition... hasElementalDefinition) { - for (iHasElementalDefinition has : hasElementalDefinition) { - map.remove(has.getDefinition()); - } - } - - //Remove amounts - public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - cElementalInstanceStack target = map.get(instance.definition); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= instance.amount; - } else { - double diff = sub(target.amount,instance.amount); - if (diff > 0) { - target.amount = diff; - return true; - } else if (diff == 0) { - map.remove(instance.definition); - return true; - } - } - return false; - } - - public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - cElementalInstanceStack target = map.get(stack.getDefinition()); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= stack.getAmount(); - } else { - double diff = sub(target.amount,stack.getAmount()); - if (diff > 0) { - target.amount = diff; - return true; - } else if (diff == 0) { - map.remove(stack.getDefinition()); - return true; - } - } - return false; - } - - @Deprecated - public boolean removeAmount(boolean testOnly, iElementalDefinition def) { - return removeAmount(testOnly, new cElementalDefinitionStack(def, 1D)); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { - boolean test = true; - for (cElementalInstanceStack stack : instances) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (cElementalInstanceStack stack : instances) { - removeAmount(false, stack); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, iHasElementalDefinition... stacks) { - boolean test = true; - for (iHasElementalDefinition stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iHasElementalDefinition stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - @Deprecated - public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = new cElementalDefinitionStack(definitions[i], 1); - } - return removeAllAmounts(testOnly, stacks); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(false, entry.getValue()); - } - return true; - } - - //Remove overflow - public double removeOverflow(int stacksCount, double stackCapacity) { - double massRemoved = 0; - - if (map.size() > stacksCount) { - iElementalDefinition[] keys = keys(); - for (int i = stacksCount; i < keys.length; i++) { - massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); - map.remove(keys[i]); - } - } - - for (cElementalInstanceStack instance : values()) { - if (instance.amount > stackCapacity) { - massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); - instance.amount = stackCapacity; - } - } - return massRemoved; - } - - //Put replace - public cElementalInstanceStack putReplace(cElementalInstanceStack instanceUnsafe) { - return map.put(instanceUnsafe.definition, instanceUnsafe); - } - - public void putReplaceAll(cElementalInstanceStack... instances) { - for (cElementalInstanceStack instance : instances) { - map.put(instance.definition, instance); - } - } - - private void putReplaceAll(Map inTreeUnsafe) { - map.putAll(inTreeUnsafe); - } - - public void putReplaceAll(cElementalInstanceStackMap inContainerUnsafe) { - putReplaceAll(inContainerUnsafe.map); - } - - //Put unify - public cElementalInstanceStack putUnify(cElementalInstanceStack instance) { - cElementalInstanceStack stack=map.get(instance.definition); - if(stack==null) { - return map.put(instance.definition, instance); - } - return map.put(instance.definition, stack.unifyIntoThis(instance)); - } - - public void putUnifyAll(cElementalInstanceStack... instances) { - for (cElementalInstanceStack instance : instances) { - putUnify(instance); - } - } - - private void putUnifyAll(Map inTreeUnsafe) { - for (cElementalInstanceStack in : inTreeUnsafe.values()) { - putUnify(in); - } - } - - public void putUnifyAll(cElementalInstanceStackMap containerUnsafe) { - putUnifyAll(containerUnsafe.map); - } - - //Getters - public cElementalInstanceStack getFirst(){ - return map.firstEntry().getValue(); - } - - public cElementalInstanceStack getLast(){ - return map.lastEntry().getValue(); - } - - public cElementalInstanceStack getInstance(iElementalDefinition def) { - return map.get(def); - } - - public cElementalInstanceStack get(int i){ - Collection var = map.values(); - return var.toArray(new cElementalInstanceStack[0])[i]; - } - - public String[] getShortSymbolsInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i++] = instance.definition.getShortSymbol(); - } - return info; - } - - public String[] getElementalInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ - " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ - " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ - " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ - " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); - } - return info; - } - - public ArrayList getScanShortSymbols(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanShortSymbols(list,capabilities); - } - return list; - } - - public ArrayList getScanInfo(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanResults(list,capabilities); - } - return list; - } - - public cElementalInstanceStack[] values() { - Collection var = map.values(); - return var.toArray(new cElementalInstanceStack[0]); - } - - public iElementalDefinition[] keys() { - Set var = map.keySet(); - return var.toArray(new iElementalDefinition[0]); - } - - public double getMass() { - double mass = 0; - for (cElementalInstanceStack stack : map.values()) { - mass += stack.getMass(); - } - return mass; - } - - public double getCharge() { - double charge = 0; - for (cElementalInstanceStack stack : map.values()) { - charge += stack.getCharge(); - } - return charge; - } - - public double getCountOfAllAmounts(){ - double sum=0; - for(cElementalInstanceStack stack:map.values()){ - sum= add(sum,stack.amount); - } - return sum; - } - - //Tests - public boolean containsDefinition(iElementalDefinition def) { - return map.containsKey(def); - } - - public boolean containsInstance(cElementalInstanceStack inst) { - return map.containsValue(inst); - } - - public int size() { - return map.size(); - } - - public boolean hasStacks() { - return !map.isEmpty(); - } - - public boolean isEmpty(){ - return map.isEmpty(); - } - - //Tick Content - public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { - return tickContent(lifeTimeMult,postEnergize,1D); - } - - public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ - cleanUp(); - double diff=0; - for (cElementalInstanceStack instance : values()) { - cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); - if (newInstances == null) { - instance.nextColor(); - } else { - diff=add(diff,newInstances.getMassDiff()); - removeAmount(false,instance); - putUnifyAll(newInstances.getOutput()); - } - } - return diff; - } - - //NBT - public NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanShortSymbols(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound getScanInfoNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanInfo(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", map.size()); - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - nbt.setTag(Integer.toString(i++), instance.toNBT()); - } - return nbt; - } - - public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; - for (int i = 0; i < instances.length; i++) { - instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (instances[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalInstanceStackMap(false, instances); - } - - //stackUp - public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { - cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); - inTree.putUnifyAll(in); - return inTree.values(); - } - - @Override - public int compareTo(cElementalInstanceStackMap o) { - int sizeDiff = map.size() - o.map.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - cElementalInstanceStack[] ofThis = values(), ofThat = o.values(); - for (int i = 0; i < ofThat.length; i++) { - int result = ofThis[i].compareTo(ofThat[i]); - if (result != 0) { - return result; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalInstanceStackMap) { - return compareTo((cElementalInstanceStackMap) obj) == 0; - } - if (obj instanceof cElementalStackMap) { - return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0; - } - return false; - } - - @Override - public int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (cElementalInstanceStack stack : map.values()) { - hash += stack.definition.hashCode(); - } - return hash; - } - - @Override - public String toString() { - StringBuilder build=new StringBuilder("Instance Stack Map\n"); - for(cElementalInstanceStack stack:map.values()){ - build.append(stack.toString()).append('\n'); - } - return build.toString(); - } - - public cElementalInstanceStackMap takeAllToNewMap(){ - TreeMap map=this.map; - this.map=new TreeMap<>(); - return new cElementalInstanceStackMap(map); - } - - public void cleanUp(){ - map.entrySet().removeIf(entry -> entry.getValue().amount < AVOGADRO_CONSTANT_UNCERTAINTY); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java deleted file mode 100644 index 020f5a5f8c..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java +++ /dev/null @@ -1,278 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.Map; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.util.DoubleCount.sub; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalMutableDefinitionStackMap extends cElementalStackMap {//Transient class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public cElementalMutableDefinitionStackMap() { - map = new TreeMap<>(); - } - - @Deprecated - public cElementalMutableDefinitionStackMap(iElementalDefinition... in) { - map=new TreeMap<>(); - for (iElementalDefinition def : in) { - putUnify(new cElementalDefinitionStack(def, 1)); - } - } - - public cElementalMutableDefinitionStackMap(cElementalDefinitionStack... in) { - map=new TreeMap<>(); - putUnifyAll(in); - } - - public cElementalMutableDefinitionStackMap(TreeMap in) { - this(true, in); - } - - public cElementalMutableDefinitionStackMap(boolean clone, TreeMap in) { - if (clone) { - map = new TreeMap<>(in); - } else { - map = in; - } - } - - @Override - public cElementalMutableDefinitionStackMap clone() { - return new cElementalMutableDefinitionStackMap(map); - } - - public cElementalDefinitionStackMap toImmutable() { - return new cElementalDefinitionStackMap(map); - } - public cElementalDefinitionStackMap toImmutable_optimized_unsafeLeavesExposedElementalTree() { - return new cElementalDefinitionStackMap(this); - } - - @Override - @Deprecated - public TreeMap getRawMap() { - return map; - } - - - //Removers - public void clear() { - map.clear(); - } - - public cElementalDefinitionStack remove(iElementalDefinition def) { - return map.remove(def); - } - - @Deprecated - public cElementalDefinitionStack remove(iHasElementalDefinition has) { - return map.remove(has.getDefinition()); - } - - public void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - map.remove(def); - } - } - - @Deprecated - public void removeAll(iHasElementalDefinition... hasElementalDefinition) { - for (iHasElementalDefinition has : hasElementalDefinition) { - map.remove(has.getDefinition()); - } - } - - //Remove amounts - public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - cElementalDefinitionStack target = map.get(instance.definition); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= instance.amount; - } else { - double diff = sub(target.amount,instance.amount); - if (diff > 0) { - map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); - return true; - } else if (diff == 0) { - map.remove(instance.definition); - return true; - } - } - return false; - } - - public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - cElementalDefinitionStack target = map.get(stack.getDefinition()); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= stack.getAmount(); - } else { - double diff = sub(target.amount,stack.getAmount()); - if (diff > 0) { - map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); - return true; - } else if (diff == 0) { - map.remove(stack.getDefinition()); - return true; - } - } - return false; - } - - @Deprecated - public boolean removeAmount(boolean testOnly, iElementalDefinition def) { - return removeAmount(testOnly, new cElementalDefinitionStack(def, 1)); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { - boolean test = true; - for (cElementalInstanceStack stack : instances) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (cElementalInstanceStack stack : instances) { - removeAmount(false, stack); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, iHasElementalDefinition... stacks) { - boolean test = true; - for (iHasElementalDefinition stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iHasElementalDefinition stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - @Deprecated - public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = new cElementalDefinitionStack(definitions[i], 1); - } - return removeAllAmounts(testOnly, stacks); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - boolean test=true; - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.map.entrySet()) { - test &= removeAmount(false, entry.getValue()); - } - return true; - } - - //Put replace - public cElementalDefinitionStack putReplace(cElementalDefinitionStack defStackUnsafe) { - return map.put(defStackUnsafe.definition, defStackUnsafe); - } - - public void putReplaceAll(cElementalDefinitionStack... defStacks) { - for (cElementalDefinitionStack defStack : defStacks) { - map.put(defStack.definition, defStack); - } - } - - public void putReplaceAll(cElementalStackMap inContainerUnsafe) { - map.putAll(inContainerUnsafe.map); - } - - //Put unify - public cElementalDefinitionStack putUnify(cElementalDefinitionStack def) { - cElementalDefinitionStack stack=map.get(def.definition); - if(stack==null) { - return map.put(def.definition, def); - } - return map.put(def.definition, stack.addAmountIntoNewInstance(def.amount)); - } - - @Deprecated - public cElementalDefinitionStack putUnify(iElementalDefinition def) { - return putUnify(new cElementalDefinitionStack(def, 1)); - } - - public void putUnifyAll(cElementalDefinitionStack... defs) { - for (cElementalDefinitionStack def : defs) { - putUnify(def); - } - } - - @Deprecated - public void putUnifyAll(iElementalDefinition... defs) { - for (iElementalDefinition def : defs) { - putUnify(def); - } - } - - private void putUnifyAll(Map inTreeUnsafe) { - for (cElementalDefinitionStack in : inTreeUnsafe.values()) { - putUnify(in); - } - } - - public void putUnifyAll(cElementalStackMap containerUnsafe) { - for (cElementalDefinitionStack in : containerUnsafe.map.values()) { - putUnify(in); - } - } - - public static cElementalMutableDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalMutableDefinitionStackMap(defStacks); - } - - public void cleanUp(){ - for(Map.Entry entry:map.entrySet()){ - if(entry.getValue().amount<=0) { - map.remove(entry.getKey()); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java deleted file mode 100644 index f8e7aa39e4..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.Collection; -import java.util.Set; -import java.util.TreeMap; - -import static com.github.technus.tectech.util.DoubleCount.add; - -/** - * Created by Tec on 12.05.2017. - */ -abstract class cElementalStackMap implements Comparable { - protected TreeMap map; - - @Override - public abstract cElementalStackMap clone(); - - @Deprecated - public abstract TreeMap getRawMap(); - - //Getters - public final cElementalDefinitionStack getFirst(){ - return map.firstEntry().getValue(); - } - - public final cElementalDefinitionStack getLast(){ - return map.lastEntry().getValue(); - } - - public final cElementalDefinitionStack getDefinitionStack(iElementalDefinition def) { - return map.get(def); - } - - public String[] getShortSymbolsInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalDefinitionStack instance : map.values()) { - info[i++] = instance.definition.getShortSymbol(); - } - return info; - } - - public final String[] getElementalInfo() { - String[] info = new String[map.size() * 3]; - int i = 0; - for (cElementalDefinitionStack defStack : map.values()) { - info[i] = EnumChatFormatting.BLUE + defStack.definition.getName(); - info[i + 1] = EnumChatFormatting.AQUA + defStack.definition.getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.amount; - i += 3; - } - return info; - } - - public final cElementalDefinitionStack[] values() { - Collection var = map.values(); - return var.toArray(new cElementalDefinitionStack[0]); - } - - public final iElementalDefinition[] keys() { - Set var = map.keySet(); - return var.toArray(new iElementalDefinition[0]); - } - - public double getCountOfAllAmounts(){ - double sum=0; - for(cElementalDefinitionStack stack:map.values()){ - sum= add(sum,stack.amount); - } - return sum; - } - - //Tests - public final boolean containsDefinition(iElementalDefinition def) { - return map.containsKey(def); - } - - public final boolean containsDefinitionStack(cElementalDefinitionStack inst) { - return map.containsValue(inst); - } - - public final int size() { - return map.size(); - } - - public final boolean hasStacks() { - return !map.isEmpty(); - } - - public final boolean isEmpty(){ - return map.isEmpty(); - } - - //NBT - public final NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public final NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", map.size()); - int i = 0; - for (cElementalDefinitionStack defStack : map.values()) { - nbt.setTag(Integer.toString(i++), defStack.toNBT()); - } - return nbt; - } - - @Override - public final int compareTo(cElementalStackMap o) {//this actually compares rest - int sizeDiff = map.size() - o.map.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - cElementalDefinitionStack[] ofThis = values(), ofO = o.values(); - for (int i = 0; i < ofO.length; i++) { - int result = ofThis[i].compareTo(ofO[i]); - if (result != 0) { - return result; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalStackMap) { - return compareTo((cElementalStackMap) obj) == 0; - } - if (obj instanceof cElementalInstanceStackMap) { - return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; - } - return false; - } - - @Override - public final int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (cElementalDefinitionStack stack : map.values()) { - hash += stack.definition.hashCode(); - } - return hash; - } - - public double getMass(){ - double mass=0; - for(cElementalDefinitionStack stack:map.values()){ - mass+=stack.getMass(); - } - return mass; - } - - public long getCharge(){ - long charge=0; - for(cElementalDefinitionStack stack:map.values()){ - charge+=stack.getCharge(); - } - return charge; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java index 912d44ff43..8b1f6d0c14 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; @@ -83,7 +83,7 @@ public class GiveEM implements ICommand { byte clazz = (byte) args.remove(0).charAt(0); Method constructor = cElementalDefinition.getBindsComplex().get(clazz); - cElementalMutableDefinitionStackMap stacks=new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap stacks =new cElementalDefinitionStackMap(); while(args.size()>0){ cElementalDefinitionStack tempStack=getDefinitionStack(args); if(tempStack==null) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java new file mode 100644 index 0000000000..79103f7fa0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java @@ -0,0 +1,77 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import static com.github.technus.tectech.util.DoubleCount.add; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class cElementalDecay { + public static final cElementalDecay[] noDecay = null; + //DECAY IMPOSSIBLE!!! + //Do not use regular NULL java will not make it work with varargs!!! + //Or cast null into ARRAY type but this static is more convenient!!! + public static final cElementalDecay[] noProduct = new cElementalDecay[0]; + //this in turn can be used to tell that the thing should just vanish + public final cElementalConstantStackMap outputStacks; + public final double probability; + + public cElementalDecay(iElementalDefinition... outSafe) { + this(1D, outSafe); + } + + public cElementalDecay(double probability, iElementalDefinition... outSafe) { + cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; + for (int i = 0; i < outArr.length; i++) { + outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D); + } + outputStacks = new cElementalConstantStackMap(outArr); + this.probability = probability; + } + + public cElementalDecay(cElementalDefinitionStack... outSafe) { + this(1D, outSafe); + } + + public cElementalDecay(double probability, cElementalDefinitionStack... out) { + outputStacks = new cElementalConstantStackMap(out); + this.probability = probability; + } + + public cElementalDecay(cElementalConstantStackMap tree) { + this(1D, tree); + } + + public cElementalDecay(double probability, cElementalConstantStackMap tree) { + outputStacks = tree; + this.probability = probability; + } + + public cElementalInstanceStackMap getResults(double lifeMult, double age, long energyTotalForProducts, double amountDecaying) { + cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); + if (outputStacks == null) { + return decayResult;//This is to prevent null pointer exceptions. + } + //Deny decay code is in instance! + double qtty = 0D; + for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { + qtty= add(qtty,stack.amount); + } + if (qtty <= 0D) { + return decayResult; + } + //energyTotalForProducts /= qtty; + //lifeMult /= (float) qtty; + for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { + decayResult.putUnify(new cElementalInstanceStack(stack.definition, + amountDecaying * stack.amount, + lifeMult, age/*new products*/, (long)(energyTotalForProducts / Math.max(1D, Math.abs(stack.amount)))));//get instances from stack + } + return decayResult; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java new file mode 100644 index 0000000000..43f4341720 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; + +public class cElementalDecayResult { + private final cElementalInstanceStackMap output; + private double massAffected; + private double massDiff; + + public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) { + this.output = output; + this.massAffected = massAffected; + this.massDiff = massDiff; + } + + public cElementalInstanceStackMap getOutput() { + return output; + } + + /** + * How much was lost in the process (decayed or removed) + * @return + */ + public double getMassAffected() { + return massAffected; + } + + /** + * Difference of mass of actually decayed elements + * @return + */ + public double getMassDiff() { + return massDiff; + } + + public void setMassAffected(double massAffected) { + this.massAffected = massAffected; + } + + public void setMassDiff(double massDiff) { + this.massDiff = massDiff; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java new file mode 100644 index 0000000000..457a37f7b9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; + +/** + * Created by danie_000 on 25.01.2017. + */ +public interface iElementalContainer { + cElementalInstanceStackMap getContentHandler(); + + void purgeOverflow(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java deleted file mode 100644 index 20fe1ffc5b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -/** - * Created by danie_000 on 25.01.2017. - */ -public interface iElementalInstanceContainer extends Cloneable { - cElementalInstanceStackMap getContainerHandler(); - - void purgeOverflow(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java new file mode 100644 index 0000000000..cde1d55561 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java @@ -0,0 +1,58 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Collections; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; + +/** + * Created by Tec on 12.05.2017. + */ +public final class cElementalConstantStackMap/*IMMUTABLE*/ extends cElementalStackMap {//Target class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public static final cElementalConstantStackMap EMPTY = new cElementalConstantStackMap(); + + private cElementalConstantStackMap() { + super(Collections.emptyNavigableMap()); + } + + public cElementalConstantStackMap(cElementalDefinitionStack... in) { + this(new cElementalDefinitionStackMap(in).map); + } + + public cElementalConstantStackMap(NavigableMap in) { + super(Collections.unmodifiableNavigableMap(in)); + } + + @Override + public Class getType() { + return cElementalDefinitionStack.class; + } + + //IMMUTABLE DON'T NEED IT + @Override + public cElementalConstantStackMap clone() { + return this; + } + + public cElementalDefinitionStackMap toMutable() { + return new cElementalDefinitionStackMap(new TreeMap<>(map)); + } + + public static cElementalConstantStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { + cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].definition.equals(nbtE__)) { + throw new tElementalException("Something went Wrong"); + } + } + return new cElementalConstantStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java new file mode 100644 index 0000000000..1273119bb3 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class cElementalDefinitionStackMap extends cElementalStackMap implements iElementalMapRW {//Transient class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public cElementalDefinitionStackMap() {} + + public cElementalDefinitionStackMap(cElementalDefinitionStack... in) { + putUnifyAll(in); + } + + public cElementalDefinitionStackMap(NavigableMap in) { + super(in); + } + + @Override + public Class getType() { + return cElementalDefinitionStack.class; + } + + @Override + public cElementalDefinitionStackMap clone() { + return new cElementalDefinitionStackMap(new TreeMap<>(map)); + } + + public cElementalConstantStackMap toImmutable() { + return new cElementalConstantStackMap(new TreeMap<>(map)); + } + + public cElementalConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { + return new cElementalConstantStackMap(map); + } + + public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { + cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].definition.equals(nbtE__)) { + throw new tElementalException("Something went Wrong"); + } + } + return new cElementalDefinitionStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java new file mode 100644 index 0000000000..aab1f93990 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java @@ -0,0 +1,214 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; +import java.util.Map; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class cElementalInstanceStackMap extends cElementalStackMap implements iElementalMapRW { + //Constructors + public cElementalInstanceStackMap() {} + + public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) { + this(true, inSafe); + } + + public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) { + if (clone) { + cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length]; + for(int i=0;i inSafe) { + this(true, inSafe); + } + + private cElementalInstanceStackMap(boolean clone, NavigableMap in) { + if (clone) { + map = new TreeMap<>(); + for(cElementalInstanceStack stack:in.values()) { + putUnify(stack.clone()); + } + } else { + map = in; + } + } + + @Override + public Class getType() { + return cElementalInstanceStack.class; + } + + @Override + public cElementalInstanceStackMap clone() { + return new cElementalInstanceStackMap(map); + } + + //Remove overflow + public double removeOverflow(int stacksCount, double stackCapacity) { + double massRemoved = 0; + + if (map.size() > stacksCount) { + iElementalDefinition[] keys = keySetToArray(); + for (int i = stacksCount; i < keys.length; i++) { + massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); + map.remove(keys[i]); + } + } + + for (cElementalInstanceStack instance : valuesToArray()) { + if (instance.amount > stackCapacity) { + massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); + instance.amount = stackCapacity; + } + } + return massRemoved; + } + + //Getters + public String[] getElementalInfo() { + String[] info = new String[map.size()]; + int i = 0; + for (cElementalInstanceStack instance : map.values()) { + info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ + " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ + " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ + " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ + " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); + } + return info; + } + + public ArrayList getScanShortSymbols(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e:map.entrySet()){ + e.getValue().addScanShortSymbols(list,capabilities); + } + return list; + } + + public ArrayList getScanInfo(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e:map.entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + + //Tick Content + public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { + return tickContent(lifeTimeMult,postEnergize,1D); + } + + public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ + cleanUp(); + double diff=0; + for (cElementalInstanceStack instance : valuesToArray()) { + cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); + if (newInstances == null) { + instance.nextColor(); + } else { + diff=add(diff,newInstances.getMassDiff()); + removeAmount(false,instance); + putUnifyAll(newInstances.getOutput()); + } + } + return diff; + } + + //NBT + public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanShortSymbols(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public NBTTagCompound getScanInfoNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { + cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; + for (int i = 0; i < instances.length; i++) { + instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (instances[i].definition.equals(nbtE__)) { + throw new tElementalException("Something went Wrong"); + } + } + return new cElementalInstanceStackMap(false, instances); + } + + //stackUp + public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { + cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); + inTree.putUnifyAll(in); + return inTree.valuesToArray(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof cElementalInstanceStackMap) { + return compareTo((cElementalInstanceStackMap) obj) == 0; + } + if (obj instanceof cElementalStackMap) { + return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0; + } + return false; + } + + @Override + public String toString() { + StringBuilder build=new StringBuilder("Instance Stack Map\n"); + for(cElementalInstanceStack stack:map.values()){ + build.append(stack.toString()).append('\n'); + } + return build.toString(); + } + + public cElementalInstanceStackMap takeAll(){ + cElementalInstanceStackMap newStack=new cElementalInstanceStackMap(false,new TreeMap<>(this.map));//just in case to uncouple The map + this.map.clear(); + return newStack; + } + + public cElementalDefinitionStackMap toDefinitionMapForComparison() { + cElementalDefinitionStack[] list = new cElementalDefinitionStack[size()]; + int i = 0; + for (Map.Entry entry : entrySet()) { + cElementalInstanceStack value = entry.getValue(); + list[i++] = new cElementalDefinitionStack(value.getDefinition(), value.getAmount()); + } + return new cElementalDefinitionStackMap(list); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java new file mode 100644 index 0000000000..2b144df128 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import java.util.NavigableMap; +import java.util.TreeMap; + +/** + * Created by Tec on 12.05.2017. + */ +abstract class cElementalStackMap implements iElementalMapR { + protected NavigableMap map; + + protected cElementalStackMap() { + this(new TreeMap<>()); + } + + protected cElementalStackMap(NavigableMap map) { + this.map = map; + } + + @Override + public NavigableMap getBackingMap() { + return map; + } + + @Override + public abstract cElementalStackMap clone(); + + @Override + public boolean equals(Object obj) { + if (obj instanceof cElementalInstanceStackMap) { + return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; + } + if (obj instanceof cElementalStackMap) { + return compareTo((cElementalStackMap) obj) == 0; + } + return false; + } + + @Override + public int hashCode() {//Hash only definitions to compare contents not amounts or data + int hash = -(map.size() << 4); + for (T stack : map.values()) { + hash += stack.getDefinition().hashCode(); + } + return hash; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java new file mode 100644 index 0000000000..0491c43ebc --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java @@ -0,0 +1,187 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.lang.reflect.Array; +import java.util.*; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; + +public interface iElementalMapR extends Comparable>, Cloneable { + NavigableMap getBackingMap(); + + iElementalMapR clone(); + + default Set> entrySet(){ + return getBackingMap().entrySet(); + } + + default Set keySet(){ + return getBackingMap().keySet(); + } + + default iElementalDefinition[] keySetToArray() { + return keySetToArray(new iElementalDefinition[size()]); + } + + default iElementalDefinition[] keySetToArray(iElementalDefinition[] array) { + return getBackingMap().keySet().toArray(array); + } + + default Collection values(){ + return getBackingMap().values(); + } + + @SuppressWarnings("unchecked") + default T[] valuesToArray(){ + return valuesToArray((T[]) Array.newInstance(getType(),size())); + } + + default T[] valuesToArray(T[] array){ + return getBackingMap().values().toArray(array); + } + + Class getType(); + + //Getters + default T getFirst(){ + return getBackingMap().firstEntry().getValue(); + } + + default T getLast(){ + return getBackingMap().lastEntry().getValue(); + } + + default T get(iElementalDefinition def) { + return getBackingMap().get(def); + } + + default T getNaturallySorted(int pos) { + if(pos<0 || pos>=size()){ + throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size()); + } + for (Map.Entry entry : entrySet()) { + if(pos==0){ + return entry.getValue(); + } + pos--; + } + return null; + } + + default T getRandom() { + return getNaturallySorted(TecTech.RANDOM.nextInt(size())); + } + + default String[] getShortSymbolsInfo() { + String[] info = new String[size()]; + int i = 0; + for (T instance : values()) { + info[i++] = instance.getDefinition().getShortSymbol(); + } + return info; + } + + default String[] getElementalInfo() { + String[] info = new String[size() * 3]; + int i = 0; + for (T defStack : values()) { + info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getName(); + info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); + info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; + i += 3; + } + return info; + } + + //NBT + default NBTTagCompound getShortSymbolsNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getShortSymbolsInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound getInfoNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getElementalInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger("i", size()); + int i = 0; + for (T stack : values()) { + nbt.setTag(Integer.toString(i++), stack.toNBT()); + } + return nbt; + } + + @Override + default int compareTo(iElementalMapR o) {//this actually compares rest + int sizeDiff = size() - o.size(); + if (sizeDiff != 0) { + return sizeDiff; + } + + Iterator iterator = values().iterator(); + Iterator iteratorO = o.values().iterator(); + + while (iterator.hasNext()) { + int result = iterator.next().compareTo(iteratorO.next()); + if (result != 0) { + return result; + } + } + return 0; + } + + default double getMass(){ + double mass=0; + for (Map.Entry entry : getBackingMap().entrySet()) { + mass+=entry.getValue().getMass(); + } + return mass; + } + + default long getCharge(){ + long charge=0; + for (Map.Entry entry : getBackingMap().entrySet()) { + charge+=entry.getValue().getCharge(); + } + return charge; + } + + //Tests + default boolean containsKey(iElementalDefinition def) { + return getBackingMap().containsKey(def); + } + + default boolean containsKey(iElementalStack def) { + return containsKey(def.getDefinition()); + } + + default int size() { + return getBackingMap().size(); + } + + default boolean hasStacks() { + return !isEmpty(); + } + + default boolean isEmpty(){ + return getBackingMap().isEmpty(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java new file mode 100644 index 0000000000..7f8d314858 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java @@ -0,0 +1,130 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; + +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; +import static com.github.technus.tectech.util.DoubleCount.sub; + +public interface iElementalMapRW extends iElementalMapR { + iElementalMapRW clone(); + + default void cleanUp(){ + getBackingMap().entrySet().removeIf(entry -> entry.getValue().getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY); + } + + default void clear() { + getBackingMap().clear(); + } + + //Remove + default T remove(iElementalDefinition def) { + return getBackingMap().remove(def); + } + + default T remove(iElementalStack has) { + return remove(has.getDefinition()); + } + + default void removeAll(iElementalDefinition... definitions) { + for (iElementalDefinition def : definitions) { + getBackingMap().remove(def); + } + } + + default void removeAll(iElementalStack... hasElementalDefinition) { + for (iElementalStack has : hasElementalDefinition) { + getBackingMap().remove(has.getDefinition()); + } + } + + default boolean removeAmount(boolean testOnly, iElementalStack stack) { + return removeAmount(testOnly,stack.getDefinition(),stack.getAmount()); + } + + default boolean removeAmount(boolean testOnly, iElementalDefinition def,double amount) { + T target = getBackingMap().get(def); + if (target == null) { + return false; + } + if (testOnly) { + return target.getAmount() >= amount; + } else { + double newAmount = sub(target.getAmount(),amount); + if (newAmount > 0) { + getBackingMap().put(target.getDefinition(), (T)target.mutateAmount(newAmount)); + return true; + } else if (newAmount == 0) { + getBackingMap().remove(def); + return true; + } + } + return false; + } + + default boolean removeAllAmounts(boolean testOnly, iElementalStack... stacks) { + boolean test = true; + for (iElementalStack stack : stacks) { + test &= removeAmount(true, stack); + } + if (testOnly || !test) { + return test; + } + for (iElementalStack stack : stacks) { + removeAmount(false, stack); + } + return true; + } + + default boolean removeAllAmounts(boolean testOnly, iElementalMapR container) { + boolean test=true; + for (Map.Entry entry : container.entrySet()) { + test &= removeAmount(true, entry.getValue()); + } + if (testOnly || !test) { + return test; + } + for (Map.Entry entry : container.entrySet()) { + removeAmount(false, entry.getValue()); + } + return true; + } + + //Put replace + default T putReplace(T defStackUnsafe) { + return getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); + } + + default void putReplaceAll(T... defStacks) { + for (T defStack : defStacks) { + getBackingMap().put(defStack.getDefinition(), defStack); + } + } + + default void putReplaceAll(iElementalMapR inContainerUnsafe) { + getBackingMap().putAll(inContainerUnsafe.getBackingMap()); + } + + //Put unify + default T putUnify(T def) { + T stack=getBackingMap().get(def.getDefinition()); + if(stack==null) { + return getBackingMap().put(def.getDefinition(), def); + } + return getBackingMap().put(def.getDefinition(), (T)stack.mutateAmount(def.getAmount()+stack.getAmount())); + } + + default void putUnifyAll(T... defs) { + for (T def : defs) { + putUnify(def); + } + } + + default void putUnifyAll(iElementalMapR inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnify(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java deleted file mode 100644 index e191cc0e0a..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipe implements Comparable { - public final short ID; - public final cElementalDefinitionStackMap inEM; - public final cElementalDefinitionStackMap outEM; - public final ItemStack[] outItems; - public final FluidStack[] outFluids; - public Object[] extension; - - public rElementalRecipe( - cElementalDefinitionStackMap inEM,//not null plz - short id, - cElementalDefinitionStackMap outEM, - ItemStack[] outItems, - FluidStack[] outFluids) { - this.inEM = inEM; - this.outEM = outEM; - this.outItems = outItems; - this.outFluids = outFluids; - ID = id;//allows multiple recipes with the same input EM,so u can actually extend... - } - - public rElementalRecipe extend(Object... data) { - extension = data; - return this; - } - - @Override - public int compareTo(rElementalRecipe o) { - int compare = inEM.compareTo(o.inEM); - if(compare!=0) { - return compare; - } - return Short.compare(ID, o.ID); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof rElementalRecipe) { - return compareTo((rElementalRecipe) obj) == 0; - } - return false; - } - - @Override - public int hashCode() { - return inEM.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java deleted file mode 100644 index ed5e46f43f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipeMap {//TODO FIX - //Multimap for multiple recipes from the same thing - you know parameters might differ the output - private final HashMap> recipes; - - public rElementalRecipeMap() { - recipes = new HashMap<>(); - } - - public rElementalRecipe put(rElementalRecipe in) { - HashMap r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>()); - return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) - //It is either bad, or unimportant if you use different id's - } - - public void putAll(rElementalRecipe... contents) { - for (rElementalRecipe recipe : contents) { - put(recipe); - } - } - - public rElementalRecipe remove(cElementalStackMap map, short id) { - return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap remove(cElementalStackMap map) { - return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap findExact(cElementalInstanceStackMap in) { - return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! - //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) - @Deprecated - public HashMap findExact(cElementalStackMap in) { - return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //this does check if the map contains all the requirements for any recipe, and the required amounts - //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! - @Deprecated - public HashMap findMatch(cElementalMutableDefinitionStackMap in, boolean testOnlyTruePreferred) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - public HashMap findMatch(cElementalInstanceStackMap in, boolean testOnly) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - //To check for instance data and other things use recipe extensions! -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java new file mode 100644 index 0000000000..8c0fb40a4b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java @@ -0,0 +1,57 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 02.03.2017. + */ +public class rElementalRecipe implements Comparable { + public final short ID; + public final cElementalConstantStackMap inEM; + public final cElementalConstantStackMap outEM; + public final ItemStack[] outItems; + public final FluidStack[] outFluids; + public Object[] extension; + + public rElementalRecipe( + cElementalConstantStackMap inEM,//not null plz + short id, + cElementalConstantStackMap outEM, + ItemStack[] outItems, + FluidStack[] outFluids) { + this.inEM = inEM; + this.outEM = outEM; + this.outItems = outItems; + this.outFluids = outFluids; + ID = id;//allows multiple recipes with the same input EM,so u can actually extend... + } + + public rElementalRecipe extend(Object... data) { + extension = data; + return this; + } + + @Override + public int compareTo(rElementalRecipe o) { + int compare = inEM.compareTo(o.inEM); + if(compare!=0) { + return compare; + } + return Short.compare(ID, o.ID); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof rElementalRecipe) { + return compareTo((rElementalRecipe) obj) == 0; + } + return false; + } + + @Override + public int hashCode() { + return inEM.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java new file mode 100644 index 0000000000..56a9030354 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Tec on 02.03.2017. + */ +public class rElementalRecipeMap {//TODO FIX + //Multimap for multiple recipes from the same thing - you know parameters might differ the output + private final HashMap> recipes; + + public rElementalRecipeMap() { + recipes = new HashMap<>(); + } + + public rElementalRecipe put(rElementalRecipe in) { + HashMap r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>()); + return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) + //It is either bad, or unimportant if you use different id's + } + + public void putAll(rElementalRecipe... contents) { + for (rElementalRecipe recipe : contents) { + put(recipe); + } + } + + public rElementalRecipe remove(iElementalMapR map, short id) { + return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + public HashMap remove(iElementalMapR map) { + return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + public HashMap findExact(cElementalInstanceStackMap in) { + return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that + } + + //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! + //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) + @Deprecated + public HashMap findExact(iElementalMapR in) { + return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + //this does check if the map contains all the requirements for any recipe, and the required amounts + //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! + @Deprecated + public HashMap findMatch(cElementalDefinitionStackMap in, boolean testOnlyTruePreferred) { + for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { + if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) { + return cElementalDefinitionStackMapHashMapEntry.getValue(); + } + } + return null; + } + + public HashMap findMatch(cElementalInstanceStackMap in, boolean testOnly) { + for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { + if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) { + return cElementalDefinitionStackMapHashMapEntry.getValue(); + } + } + return null; + } + + //To check for instance data and other things use recipe extensions! +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java index a2d22c30ed..1e03c8130f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java @@ -5,12 +5,11 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElem import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.util.DoubleCount.add; /** * Created by danie_000 on 20.11.2016. */ -public final class cElementalDefinitionStack implements iHasElementalDefinition { +public final class cElementalDefinitionStack implements iElementalStack { public final iElementalDefinition definition; public final double amount; @@ -24,6 +23,14 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition return this;//IMMUTABLE } + @Override + public cElementalDefinitionStack mutateAmount(double amount) { + if(this.amount==amount){ + return this; + } + return new cElementalDefinitionStack(definition,amount);//IMMUTABLE + } + @Override public iElementalDefinition getDefinition() { return definition;//IMMUTABLE @@ -57,26 +64,8 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition nbt.getLong("q")+nbt.getDouble("Q")); } - public cElementalDefinitionStack addAmountIntoNewInstance(double amount) { - if(amount==0) { - return this; - } - return new cElementalDefinitionStack(definition, add(amount,this.amount)); - } - - public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) { - if (other == null || other.length == 0) { - return this; - } - double l = 0; - for (cElementalDefinitionStack stack : other) { - l= add(l,stack.amount); - } - return addAmountIntoNewInstance(l); - } - @Override - public int compareTo(iHasElementalDefinition o) { + public int compareTo(iElementalStack o) { return definition.compareTo(o.getDefinition()); } @@ -85,8 +74,8 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition if (obj instanceof iElementalDefinition) { return definition.compareTo((iElementalDefinition) obj) == 0; } - if (obj instanceof iHasElementalDefinition) { - return definition.compareTo(((iHasElementalDefinition) obj).getDefinition()) == 0; + if (obj instanceof iElementalStack) { + return definition.compareTo(((iElementalStack) obj).getDefinition()) == 0; } return false; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index 559d7ab8d9..1c06e560db 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -1,10 +1,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.util.Util; @@ -24,7 +24,7 @@ import static java.lang.Math.*; /** * Created by danie_000 on 22.10.2016. */ -public final class cElementalInstanceStack implements iHasElementalDefinition { +public final class cElementalInstanceStack implements iElementalStack { public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16; public static double DECAY_CALL_PER=AVOGADRO_CONSTANT;//todo @@ -81,6 +81,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return new cElementalInstanceStack(this); } + @Override + public cElementalInstanceStack mutateAmount(double amount) { + this.amount = amount; + return this; + } + @Override public double getAmount() { return amount; @@ -170,7 +176,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { if (newInstances == null) { nextColor(); } else { - for (cElementalInstanceStack newInstance : newInstances.getOutput().values()) { + for (cElementalInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { newInstance.nextColor(); } } @@ -290,20 +296,20 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { cElementalInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); if(newProductsAge<0){ if(output.size()==1) { - if(output.size()==1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age=age; + if(output.size()==1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); + output.getFirst().age=age; } }else { - for (cElementalInstanceStack stack : output.values()) { + for (cElementalInstanceStack stack : output.valuesToArray()) { if (stack.definition.equals(definition)) { stack.age = age; } } } }else{ - if(output.size()==1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); + if(output.size()==1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); } } if(energy <= 0 && output.getMass() > mass){ @@ -390,20 +396,20 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } if(newProductsAge<0) { - if (output.size() == 1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age = age; + if (output.size() == 1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); + output.getFirst().age = age; } else { - for (cElementalInstanceStack stack : output.values()) { + for (cElementalInstanceStack stack : output.valuesToArray()) { if (stack.definition.equals(definition)) { stack.age = age; } } } }else{ - if(output.size()==1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age=age; + if(output.size()==1 && output.getFirst().definition.equals(definition)) { + output.getFirst().setEnergy(energy); + output.getFirst().age=age; } } if(energy <= 0 && output.getMass() > getMass()){ @@ -491,10 +497,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); } - private void scanContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + private void scanContents(ArrayList lines, cElementalConstantStackMap definitions, int depth, int[] detailsOnDepthLevels){ if(definitions!=null && depth decaysList, iaeaNuclide.iaeaDecay decay, long energy){ - cElementalMutableDefinitionStackMap withThis=elementalStacks.toMutable(),newStuff=new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new cElementalDefinitionStackMap(); switch (decay.decayName){ case "D": { if (withThis.removeAllAmounts(false, deuterium.definition.getSubParticles())){ withThis.putReplace(deuterium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; case "3H": { if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){ withThis.putReplace(tritium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; case "3HE": { if (withThis.removeAllAmounts(false, helium_3.definition.getSubParticles())){ withThis.putReplace(helium_3); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; case "8BE": { if (withThis.removeAllAmounts(false, beryllium_8.definition.getSubParticles())){ withThis.putReplace(beryllium_8); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } } break; @@ -518,8 +508,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){ newStuff.putReplace(carbon_14); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -532,8 +522,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){ newStuff.putReplace(neon_24); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -546,8 +536,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){ newStuff.putReplace(silicon_34); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -560,8 +550,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -576,8 +566,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -592,8 +582,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -608,8 +598,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -624,8 +614,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -639,8 +629,8 @@ public final class dAtomDefinition extends cElementalDefinition { withThis.putUnify(dHadronDefinition.hadron_n1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -654,8 +644,8 @@ public final class dAtomDefinition extends cElementalDefinition { withThis.putUnify(dHadronDefinition.hadron_n2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -670,8 +660,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -686,8 +676,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -703,8 +693,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -720,8 +710,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -736,8 +726,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -753,8 +743,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_n1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -770,8 +760,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_n2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -786,8 +776,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -801,8 +791,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -817,8 +807,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -833,8 +823,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -849,8 +839,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(dHadronDefinition.hadron_p3); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -863,8 +853,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ newStuff.putReplace(dHadronDefinition.hadron_n1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -877,8 +867,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ newStuff.putReplace(dHadronDefinition.hadron_n2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -891,8 +881,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -905,8 +895,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -1001,8 +991,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(eBosonDefinition.boson_Y__1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -1023,10 +1013,10 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean Emmision(ArrayList decaysList, cElementalDefinitionStack emit) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, emit)) { try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), emit)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1038,10 +1028,10 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean alphaDecay(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), alpha)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1053,11 +1043,11 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean MbetaDecay(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { try { tree.putUnify(dHadronDefinition.hadron_p1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1069,11 +1059,11 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean PbetaDecay(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1085,11 +1075,11 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean ElectronCapture(ArrayList decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1100,11 +1090,11 @@ public final class dAtomDefinition extends cElementalDefinition { return false; } - private boolean Fission(ArrayList decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,double probability,boolean spontaneousCheck) { - cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); - double[] liquidDrop= liquidDropFunction(Math.abs(element)<=97); + private boolean Fission(ArrayList decaysList, cElementalDefinitionStackMap fissile, cElementalDefinitionStackMap particles, double probability, boolean spontaneousCheck) { + cElementalDefinitionStackMap heavy = new cElementalDefinitionStackMap(); + double[] liquidDrop = liquidDropFunction(Math.abs(element)<=97); - for(cElementalDefinitionStack stack: fissile.values()){ + for(cElementalDefinitionStack stack: fissile.valuesToArray()){ if(spontaneousCheck && stack.definition instanceof dHadronDefinition && (stack.amount<=80 || stack.amount<90 && XSTR_INSTANCE.nextInt(10) decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { + for (cElementalDefinitionStack elementalStack : elementalStacks.valuesToArray()) { if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { //covers both quarks and antiquarks decaysInto.add(elementalStack); @@ -1302,12 +1292,12 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public dAtomDefinition getAnti() { - cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); - for (cElementalDefinitionStack stack : elementalStacks.values()) { + cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); + for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) { anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); } try { - return new dAtomDefinition(anti.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + return new dAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 4ea5eb3776..aa0951d98c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; @@ -58,31 +58,21 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //private final FluidStack fluidThing; //private final ItemStack itemThing; - private final cElementalDefinitionStackMap quarkStacks; - - @Deprecated - public dHadronDefinition(eQuarkDefinition... quarks) throws tElementalException { - this(true, new cElementalDefinitionStackMap(quarks)); - } - - @Deprecated - private dHadronDefinition(boolean check, eQuarkDefinition... quarks) throws tElementalException { - this(check, new cElementalDefinitionStackMap(quarks)); - } + private final cElementalConstantStackMap quarkStacks; public dHadronDefinition(cElementalDefinitionStack... quarks) throws tElementalException { - this(true, new cElementalDefinitionStackMap(quarks)); + this(true, new cElementalConstantStackMap(quarks)); } private dHadronDefinition(boolean check, cElementalDefinitionStack... quarks) throws tElementalException { - this(check, new cElementalDefinitionStackMap(quarks)); + this(check, new cElementalConstantStackMap(quarks)); } - public dHadronDefinition(cElementalDefinitionStackMap quarks) throws tElementalException { + public dHadronDefinition(cElementalConstantStackMap quarks) throws tElementalException { this(true, quarks); } - private dHadronDefinition(boolean check, cElementalDefinitionStackMap quarks) throws tElementalException { + private dHadronDefinition(boolean check, cElementalConstantStackMap quarks) throws tElementalException { if (check && !canTheyBeTogether(quarks)) { throw new tElementalException("Hadron Definition error"); } @@ -93,7 +83,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi int type = 0; boolean containsAnti = false; double mass = 0; - for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { + for (cElementalDefinitionStack quarkStack : quarkStacks.valuesToArray()) { amount += quarkStack.amount; if((int)quarkStack.amount!=quarkStack.amount){ throw new ArithmeticException("Amount cannot be safely converted to int!"); @@ -131,9 +121,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { + private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { long amount = 0; - for (cElementalDefinitionStack quarks : stacks.values()) { + for (cElementalDefinitionStack quarks : stacks.valuesToArray()) { if (!(quarks.definition instanceof eQuarkDefinition)) { return false; } @@ -153,7 +143,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi if(sym!=null){ name.append(' ').append(sym); }else { - for (cElementalDefinitionStack quark : quarkStacks.values()) { + for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount); } } @@ -184,7 +174,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi return sym; }else { StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.values()) { + for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.amount; i++) { symbol.append(quark.definition.getSymbol()); } @@ -200,7 +190,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi return sym; }else { StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.values()) { + for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.amount; i++) { symbol.append(quark.definition.getShortSymbol()); } @@ -215,13 +205,13 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public cElementalDefinitionStackMap getSubParticles() { + public cElementalConstantStackMap getSubParticles() { return quarkStacks; } @Override public cElementalDecay[] getNaturalDecayInstant() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); + cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } @@ -243,7 +233,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); + cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } @@ -277,7 +267,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public cElementalDecay[] getDecayArray() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); + cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { @@ -297,15 +287,17 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi cElementalDefinitionStack[] decay; if (Math.abs(lastQuark.getType()) > 1) { - decay = lastQuark.getDecayArray()[1].outputStacks.values(); + decay = lastQuark.getDecayArray()[1].outputStacks.valuesToArray(); } else { - decay = lastQuark.getDecayArray()[2].outputStacks.values(); + decay = lastQuark.getDecayArray()[2].outputStacks.valuesToArray(); } newBaryon.add((eQuarkDefinition) decay[0].definition); Particles[0] = decay[1].definition; Particles[1] = decay[2].definition; - eQuarkDefinition[] contentOfBaryon = newBaryon.toArray(new eQuarkDefinition[3]); + cElementalDefinitionStack[] contentOfBaryon = newBaryon.stream() + .map(eQuarkDefinition -> new cElementalDefinitionStack(eQuarkDefinition,1)) + .toArray(cElementalDefinitionStack[]::new); try { return new cElementalDecay[]{ @@ -363,12 +355,12 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public iElementalDefinition getAnti() { - cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); - for (cElementalDefinitionStack stack : quarkStacks.values()) { + cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); + for (cElementalDefinitionStack stack : quarkStacks.valuesToArray()) { anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); } try { - return new dHadronDefinition(anti.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + return new dHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -414,10 +406,10 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public static void run() { try { - hadron_p = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); + hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); protonMass = hadron_p.mass; //redefine the proton with proper lifetime (the lifetime is based on mass comparison) - hadron_p = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); + hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); SYMBOL_MAP.put(hadron_p,"p"); NAME_MAP.put(hadron_p,"Proton"); DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); @@ -425,10 +417,10 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi SYMBOL_MAP.put(hadron_p_,"~p"); NAME_MAP.put(hadron_p_,"Anti Proton"); DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); - hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); + hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.mass; //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) - hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); + hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); NAME_MAP.put(hadron_n, "Neutron"); DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java index a3efe12b7e..8096743b78 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.noDecay; +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; /** * Created by danie_000 on 22.10.2016. diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java index 9a82cdd6c0..e87df806d3 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java @@ -1,10 +1,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java index 1e3b7189a8..c8e3b07f02 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java index c55e7f6364..0f0725d208 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java index 9e5b2e66bb..798066466b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index b0b349a268..05f251924e 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import cpw.mods.fml.common.registry.GameRegistry; @@ -17,16 +17,16 @@ import java.util.HashSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; public class TT_recipe extends GT_Recipe { - public static final String E_RECIPE_ID = "eRecipeID"; - public final cElementalDefinitionStackMap[] input; - public final cElementalDefinitionStackMap[] output; - public final cElementalDefinitionStackMap[] eCatalyst; - public final IAdditionalCheck additionalCheck; + public static final String E_RECIPE_ID = "eRecipeID"; + public final cElementalConstantStackMap[] input; + public final cElementalConstantStackMap[] output; + public final cElementalConstantStackMap[] eCatalyst; + public final IAdditionalCheck additionalCheck; public TT_recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check){ + cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check){ super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue); input=in; output=out; @@ -110,7 +110,7 @@ public class TT_recipe extends GT_Recipe { } if (input != null) { if (in != null) { - for (cElementalDefinitionStackMap anInput : input) { + for (cElementalConstantStackMap anInput : input) { if (anInput != null && anInput.hasStacks()) { if (in.hasStacks()) { if (!in.removeAllAmounts(consume, anInput)) { @@ -181,7 +181,7 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) { + cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchItem=researchItem; } @@ -189,7 +189,7 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in) { + cElementalConstantStackMap[] in) { this(aOptimize, researchItem, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } @@ -199,9 +199,9 @@ public class TT_recipe extends GT_Recipe { public final GT_Recipe scannerRecipe; public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, - ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, - FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) { + ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, + FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, + cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchEM=researchEM; this.scannerRecipe=scannerRecipe; @@ -210,7 +210,7 @@ public class TT_recipe extends GT_Recipe { public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in) { + cElementalConstantStackMap[] in) { this(aOptimize, scannerRecipe, researchEM, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 71a5419500..ffa69ef78e 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.CustomItemList; @@ -150,7 +150,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMmachineRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalDefinitionStackMap[] eInputs, + ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -184,7 +184,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMcrafterRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -207,7 +207,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addScannableEMmachineRecipe( iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalDefinitionStackMap[] eInputs, + ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -234,7 +234,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); @@ -243,7 +243,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addScannableEMcrafterRecipe( iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -259,7 +259,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); 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 bfd7d266c0..b1f6d8887b 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 @@ -3,8 +3,8 @@ 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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; @@ -58,8 +58,8 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE aStack.stackSize = 1; if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof iElementalInstanceContainer) { - cElementalInstanceStackMap content = ((iElementalInstanceContainer) metaTE).getContainerHandler(); + if (metaTE instanceof iElementalContainer) { + cElementalInstanceStackMap content = ((iElementalContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); @@ -69,12 +69,12 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } return true; } - ((iElementalInstanceContainer) metaTE).purgeOverflow(); + ((iElementalContainer) metaTE).purgeOverflow(); tNBT.removeTag("content"); tNBT.removeTag("symbols"); tNBT.removeTag("info"); } else if (content.hasStacks()) { - ((iElementalInstanceContainer) metaTE).purgeOverflow(); + ((iElementalContainer) metaTE).purgeOverflow(); tNBT.setTag("info", content.getInfoNBT()); tNBT.setTag("content", content.toNBT()); tNBT.setTag("symbols", content.getShortSymbolsNBT()); 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 fa1c25cbf5..2513bdf8bf 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 @@ -3,7 +3,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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; @@ -38,17 +38,17 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem } //return previous thing - public static cElementalDefinitionStackMap setContent(ItemStack containerItem, cElementalDefinitionStackMap definitions){ + public static cElementalConstantStackMap setContent(ItemStack containerItem, cElementalConstantStackMap definitions){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { tNBT = containerItem.stackTagCompound = new NBTTagCompound(); } - cElementalDefinitionStackMap oldMap=null; + cElementalConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -63,7 +63,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalDefinitionStackMap getContent(ItemStack containerItem){ + public static cElementalConstantStackMap getContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; @@ -71,7 +71,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } try { - return cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + return cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -81,17 +81,17 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalDefinitionStackMap clearContent(ItemStack containerItem){ + public static cElementalConstantStackMap clearContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { return null; } - cElementalDefinitionStackMap oldMap=null; + cElementalConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); 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 c951229c92..e43feb2351 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index c8606f68f0..d25a0c62ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; import com.github.technus.tectech.util.Util; @@ -34,7 +34,7 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 11.12.2016. */ -public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalInstanceContainer, IConnectsToElementalPipe { +public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalContainer, IConnectsToElementalPipe { private static Textures.BlockIcons.CustomIcon EM_T_SIDES; private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; private static Textures.BlockIcons.CustomIcon EM_T_CONN; @@ -165,7 +165,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } @Override - public cElementalInstanceStackMap getContainerHandler() { + public cElementalInstanceStackMap getContentHandler() { return content; } 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 a1e4f5a8a5..1426e8a702 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 @@ -62,7 +62,7 @@ public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_H if (aMetaTileEntity != null) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental && opposite == tGTTileEntity.getFrontFacing()) { - ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContainerHandler().putUnifyAll(content); + ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContentHandler().putUnifyAll(content); ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).updateSlots(); content.clear(); return; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 49c43d6b4e..a61bf27fe3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -3,14 +3,17 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; @@ -20,9 +23,6 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -39,13 +39,12 @@ import java.util.HashMap; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.DoubleCount.add; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -86,10 +85,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnifyAll(in2.definition.getSubParticles()); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -115,10 +114,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnifyAll(in2.definition.getSubParticles()); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -140,10 +139,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -184,10 +183,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB PRIMITIVE_FUSE_HANDLERS.put(eQuarkDefinition.class.getName() + '\0' + eQuarkDefinition.class.getName(), (in1, in2, out) -> { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnify(in1.definition.getStackForm(1)); defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -211,10 +210,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static boolean fuseAspects(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnify(in1.definition.getStackForm(1)); defs.putUnify(in2.definition.getStackForm(1)); - dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(aspect, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -247,10 +246,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); + cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnify(in2.definition.getStackForm(1)); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); } catch (Exception e) { out.putUnifyAll(in1, in2); @@ -303,6 +302,49 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //region structure //use multi A energy inputs, use less power the longer it runs + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + .builder() + .addShapeOldApi("main", new String[][]{ + {"I0A0A0", "I00000", "I0A0A0",}, + {"H0000000", "G001111100", "H0000000",}, + {"F22223332222", "F41155555114", "F22223332222",}, + {"E2000000000002", "E4155111115514", "E2000000000002",}, + {"D20000E00002", "D41511E11514", "D20000E00002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0030O0300", "0151O1510", "0030O0300",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, + {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, + {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT, 4)) + .addElement('1', ofBlock(sBlockCasingsTT, 7)) + .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) + .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) + .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, + textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, + textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, + textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, + textureOffset + 4, 4, sBlockCasingsTT, 4)) + .build(); private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing @@ -312,27 +354,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "}, - {" AAAAA "," AADDDDDAA "," CDDEEEEEDDC "," CDEEDDDDDEEDC "," CDEDD DDEDC "," CDED DEDC "," CDED DEDC "," ADED DEDA "," ADED DEDA ","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA"," ADED DEDA "," ADED DEDA "," CDED DEDC "," CDED DEDC "," CDEDDBJ~JBDDEDC "," CDEEDDDDDEEDC "," CDDEEEEEDDC "}, - {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)) - .addElement('B', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) - .addElement('C', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) - .addElement('D', ofBlock(sBlockCasingsTT, 7)) - .addElement('E', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) - .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) - .addElement('I', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('J', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .build(); - @Override - public IStructureDefinition getStructure_EM() { + public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; } @@ -371,7 +394,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } - for (cElementalInstanceStack newStack : map.values()) { + for (cElementalInstanceStack newStack : map.valuesToArray()) { check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); } //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); @@ -502,7 +525,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB if (started) { if (stack == null) { for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - cElementalInstanceStackMap container = inputElemental.getContainerHandler(); + cElementalInstanceStackMap container = inputElemental.getContentHandler(); if (container.isEmpty()) { continue; } @@ -567,7 +590,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB if (outputEM != null) { for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { if (outputEM[i] != null) { - eOutputHatches.get(i).getContainerHandler().putUnifyAll(outputEM[i]); + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); outputEM[i] = null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 97b4a7786e..ed245b0e97 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,7 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -10,9 +13,6 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -21,9 +21,9 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.util.GT_Utility; import ic2.core.init.MainConfig; import ic2.core.util.ConfigUtil; +import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -32,15 +32,13 @@ import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; import static com.github.technus.tectech.util.CommonValues.VN; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -60,28 +58,30 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase //endregion //region structure + private static final String[][] shape = new String[][]{ + {"0C0", "A ", "A . ", "A ", "0C0",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, + {"01110", "12221", "12221", "12221", "01110",}, + {"01310", "12221", "32223", "12221", "01310",}, + {"01110", "12221", "12221", "12221", "01110",}, + {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"0C0", "A ", "A ", "A ", "0C0",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_decay::addClassicToMachineList, + GT_MetaTileEntity_EM_decay::addElementalToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.decay.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.decay.hint.1"),//2 - Elemental Hatches or Molecular Casing }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main",transpose(new String[][]{ - {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"}, - {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, - {" F~F ","AAAAA"," EAE ","BDDDB","CDDDC","BDDDB"," EAE ","AAAAA"," FFF "}, - {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, - {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)) - .addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)) - .addElement('D', ofBlock(sBlockCasingsTT, 8)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .build(); //endregion //region parameters @@ -110,7 +110,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 2, 2, 0); + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); } @Override @@ -118,7 +118,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase cElementalInstanceStackMap map = getInputsClone_EM(); if (map != null && map.hasStacks()) { for (GT_MetaTileEntity_Hatch_InputElemental i : eInputHatches) { - i.getContainerHandler().clear(); + i.getContentHandler().clear(); } return startRecipe(map); } @@ -132,7 +132,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase outputEM[0] = input; outputEM[1] = new cElementalInstanceStackMap(); - for (cElementalInstanceStack stack : outputEM[0].values()) { + for (cElementalInstanceStack stack : outputEM[0].valuesToArray()) { if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && getBaseMetaTileEntity().decreaseStoredEnergyUnits( (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { @@ -156,7 +156,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public void outputAfterRecipe_EM() { for (int i = 0; i < 2 && i < eOutputHatches.size(); i++) { - eOutputHatches.get(i).getContainerHandler().putUnifyAll(outputEM[i]); + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); outputEM[i] = null; } } @@ -189,30 +189,21 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return new String[]{ translateToLocalFormatted("tt.keyword.Progress", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + - EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + - translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + - EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + - translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + - EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + - EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + - translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + - EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyword.Computation", clientLocale) + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + + " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + + " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + + " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyword.Computation", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, }; } @@ -257,12 +248,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index f0dca07f9c..208219cd59 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,22 +1,23 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -28,14 +29,10 @@ import java.util.ArrayList; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -44,22 +41,21 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {"CCC","ABA","EEE","BDB"}, - {"C~C","BBB","EBE","DFD"}, - {"CCC","ABA","EEE","BDB"} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, textureOffset + 4, sHintCasingsTT, 1)) - .build(); - + private static final String[][] shape = new String[][]{ + {" ", " . ", " ",}, + {"010", "111", "010",}, + {"\"\"\"", "\"1\"", "\"\"\"",}, + {"121", "2!2", "121",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; + private static final byte[] blockMeta = new byte[]{0, 4, 0}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, + GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.0"),//1 - Classic Hatches or High Power Casing" @@ -76,7 +72,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo super(aName); } - private void startRecipe(iHasElementalDefinition from, long energy) { + private void startRecipe(iElementalStack from, long energy) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = from.getMass(); @@ -96,14 +92,14 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 1, 1, 0); + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - cElementalInstanceStackMap map = in.getContainerHandler(); - for (cElementalInstanceStack stack : map.values()) { + cElementalInstanceStackMap map = in.getContentHandler(); + for (cElementalInstanceStack stack : map.valuesToArray()) { { aFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); if (info != null) { @@ -159,12 +155,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 7d0ee03320..451443fa8a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -115,7 +115,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - if (in.getContainerHandler().hasStacks()) { + if (in.getContentHandler().hasStacks()) { mEUt = -(int) V[8]; eAmpereFlow = 1 + (eInputHatches.size() + eOutputHatches.size() >> 1); mMaxProgresstime = 20; @@ -148,8 +148,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB continue; } GT_MetaTileEntity_Hatch_OutputElemental out = eOutputHatches.get(outIndex); - out.getContainerHandler().putUnifyAll(in.getContainerHandler()); - in.getContainerHandler().clear(); + out.getContentHandler().putUnifyAll(in.getContentHandler()); + in.getContentHandler().clear(); } } } 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 c3e35ba90c..f5504eadc7 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 @@ -3,9 +3,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; @@ -113,7 +113,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (aOQI == null) { continue; } - iHasElementalDefinition into = aOQI.output(); + iElementalStack into = aOQI.output(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -124,7 +124,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage()); } - iHasElementalDefinition into = aIQI.output(); + iElementalStack into = aIQI.output(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -140,7 +140,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (aFQI == null) { continue; } - iHasElementalDefinition into = aFQI.output(); + iElementalStack into = aFQI.output(); if (into != null && fs.amount >= aFQI.input().amount && isInputEqual(true, false, new FluidStack[]{aFQI.input()}, nullItem, inF, (ItemStack[]) null)) { startRecipe(into); @@ -152,7 +152,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock return false; } - private void startRecipe(iHasElementalDefinition into) { + private void startRecipe(iElementalStack into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = into.getMass(); @@ -176,7 +176,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock stopMachine(); return; } - eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); + eOutputHatches.get(0).getContentHandler().putUnifyAll(outputEM[0]); outputEM = null; } 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 8c545b50c5..d02088e805 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 @@ -1,10 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -13,9 +16,6 @@ import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.util.CommonValues; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -23,7 +23,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -37,6 +36,7 @@ import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -45,10 +45,6 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.G 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -73,6 +69,26 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa //endregion //region structure + private static final String[][] shape = new String[][]{ + {" ", " 222 ", " 2.2 ", " 222 ", " ",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"00100", "01110", "11111", "01110", "00100",}, + {"01110", "1---1", "1---1", "1---1", "01110",}, + {"01110", "1---1", "1-A-1", "1---1", "01110",}, + {"01110", "1---1", "1---1", "1---1", "01110",}, + {"00100", "01110", "11\"11", "01110", "00100",}, + {"#####", "#000#", "#0!0#", "#000#", "#####",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4, 0, 0}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_scanner::addClassicToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.0"),//1 - Classic Hatches or High Power Casing @@ -80,24 +96,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.2"),//3 - Elemental Output Hatches or Molecular Casing translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"}, - {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, - {"CA~AC","BBBBB","DDDDD","D---D","D---D","D---D","DDGDD","EBFBE"}, - {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, - {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) - .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, textureOffset + 4, 2)) - .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, textureOffset + 4, 3)) - .build(); //endregion //region parameters @@ -110,12 +108,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa return LedStatus.STATUS_WRONG; } v = (int) v; - if (v == 0) - return LedStatus.STATUS_NEUTRAL; - if (v >= SCAN_GET_CLASS_TYPE) - return LedStatus.STATUS_TOO_HIGH; - if (v < 0) - return LedStatus.STATUS_TOO_LOW; + if (v == 0) return LedStatus.STATUS_NEUTRAL; + if (v >= SCAN_GET_CLASS_TYPE) return LedStatus.STATUS_TOO_HIGH; + if (v < 0) return LedStatus.STATUS_TOO_LOW; return LedStatus.STATUS_OK; }; protected Parameters.Group.ParameterIn[] scanConfiguration; @@ -214,7 +209,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (!structureCheck_EM("main", 2, 2, 0)) { + if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { return false; } return eInputHatches.size() == 1 && eOutputHatches.size() == 1 && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() == iGregTechTileEntity.getFrontFacing(); @@ -223,11 +218,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkRecipe_EM(ItemStack itemStack) { eRecipe = null; - if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContainerHandler().hasStacks() && !eOutputHatches.isEmpty()) { - cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContainerHandler(); + if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContentHandler().hasStacks() && !eOutputHatches.isEmpty()) { + cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { GT_Recipe scannerRecipe = null; - for (cElementalInstanceStack stackEM : researchEM.values()) { + for (cElementalInstanceStack stackEM : researchEM.valuesToArray()) { objectsScanned = null; eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.definition); if (eRecipe != null) { @@ -263,7 +258,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } else if (CustomItemList.scanContainer.isStackEqual(itemStack, false, true)) { eRecipe = null; if (researchEM.hasStacks()) { - objectsScanned = researchEM.takeAllToNewMap(); + objectsScanned = researchEM.takeAll(); cleanMassEM_EM(objectsScanned.getMass()); computationRequired = 0; @@ -352,31 +347,21 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa return new String[]{ translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t " + - translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + - EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + - translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + - EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + - translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + - EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + - EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + - translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + - EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t " + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + + " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + + " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + + " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, translateToLocalFormatted("tt.keyphrase.Computation_Remaining", clientLocale) + ":", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(computationRequired / 20L) + EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + computationRequired / 20L }; } @@ -531,12 +516,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 0, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 30c9c509ec..ba6ae223f6 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 @@ -2,26 +2,25 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; - -import com.github.technus.tectech.mechanics.structure.Structure; -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.IAlignment; -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; -import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; -import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; -import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.util.Vec3Impl; -import cpw.mods.fml.common.network.NetworkRegistry; - -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.loader.NetworkDispatcher; +import com.github.technus.tectech.mechanics.alignment.AlignmentLimits; +import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; 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.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -33,7 +32,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.*; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.IGT_HatchAdder; import gregtech.common.GT_Pollution; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -146,7 +144,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private boolean explodedThisTick = false; //front rotation val - private IAlignmentLimits alignmentLimits = IAlignmentLimits.UNLIMITED; + private IAlignmentLimits alignmentLimits = AlignmentLimits.UNLIMITED; private ExtendedFacing extendedFacing = ExtendedFacing.DEFAULT; //endregion @@ -177,12 +175,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt IGregTechTileEntity base = getBaseMetaTileEntity(); mMachine = false; if (getBaseMetaTileEntity().isServerSide()) { - //NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), - // base.getWorld().provider.dimensionId, - // base.getXCoord(), base.getYCoord(), base.getZCoord(), 512); - StructureLibAPI.sendAlignment((IAlignmentProvider) base, - new NetworkRegistry.TargetPoint(base.getWorld().provider.dimensionId, - base.getXCoord(), base.getYCoord(), base.getZCoord(), 512)); + NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), + base.getWorld().provider.dimensionId, + base.getXCoord(), base.getYCoord(), base.getZCoord(), 512); }else{ base.issueTextureUpdate(); } @@ -194,6 +189,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return alignmentLimits; } + @Override + public void setAlignmentLimits(IAlignmentLimits limits) { + alignmentLimits=limits; + } + @Override public boolean isFacingValid(byte aFacing) { return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing)); @@ -237,7 +237,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt String[][] structure,//0-9 casing, +- air no air, a-z ignore Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types - IGT_HatchAdder[] addingMethods, + IHatchAdder[] addingMethods, short[] casingTextures, Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types @@ -387,23 +387,21 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return new String[]{ "Progress:", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", "Energy Hatches:", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", (mEUt * eAmpereFlow <= 0 ? "Probably uses: " : "Probably makes: ") + - EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", - "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " Amp Rating: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", + "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + + " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " Efficiency: " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, - "Computation: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET + "Computation: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET }; } @@ -650,9 +648,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ protected long getAvailableData_EM() { long result = 0; - Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), - getBaseMetaTileEntity().getYCoord(), - getBaseMetaTileEntity().getZCoord()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) { if (in.q != null) { Long value = in.q.contentIfNotInTrace(pos); @@ -1099,7 +1095,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { isFacingValid(aBaseMetaTileEntity.getFrontFacing()); if (getBaseMetaTileEntity().isClientSide()) { - StructureLibAPI.queryAlignment((IAlignmentProvider) aBaseMetaTileEntity); + NetworkDispatcher.INSTANCE.sendToServer(new AlignmentMessage.AlignmentQuery(this)); } onFirstTick_EM(aBaseMetaTileEntity); } @@ -1301,26 +1297,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } double remaining = voider.overflowMax - voider.getOverflowMatter(); for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContainerHandler().values()) { + for (cElementalInstanceStack instance : in.getContentHandler().valuesToArray()) { double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + in.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); } } } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContainerHandler().values()) { + for (cElementalInstanceStack instance : out.getContentHandler().valuesToArray()) { double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + out.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); } } } @@ -1679,7 +1675,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { if (!drainEnergyInput_EM(mEUt, (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { - criticalStopMachine(); + stopMachine(); return false; } } @@ -1692,7 +1688,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { if (!drainEnergyInput((long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { - criticalStopMachine(); + stopMachine(); return false; } } @@ -1936,7 +1932,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final cElementalInstanceStackMap getInputsClone_EM() { cElementalInstanceStackMap in = new cElementalInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) { - in.putUnifyAll(hatch.getContainerHandler()); + in.putUnifyAll(hatch.getContentHandler()); } return in.hasStacks() ? in : null; } @@ -1945,7 +1941,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final cElementalInstanceStackMap getOutputsClone_EM() { cElementalInstanceStackMap out = new cElementalInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) { - out.putUnifyAll(hatch.getContainerHandler()); + out.putUnifyAll(hatch.getContentHandler()); } return out.hasStacks() ? out : null; } @@ -1975,7 +1971,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (target == null) { return; } - cleanMassEM_EM(target.getContainerHandler().getMass()); + cleanMassEM_EM(target.getContentHandler().getMass()); } public void cleanStackEM_EM(cElementalInstanceStack target) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 1ed1278bce..093a418056 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; @@ -116,7 +116,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav cElementalInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.values(); + cElementalInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; for (cElementalInstanceStack stack : stacks) { @@ -129,7 +129,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); - stacks = input.values(); + stacks = input.valuesToArray(); } double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; @@ -162,7 +162,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav //take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAllToNewMap().values();//cleanup stacks + stacks = input.takeAll().valuesToArray();//cleanup stacks if (stacks.length > 1) { Arrays.sort(stacks, (o1, o2) -> { double m1 = o1.definition.getMass(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java index df21feb9f2..d335bac7ab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 40e2942bab..6ac6ac74c4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; @@ -147,7 +147,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ cElementalInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.values(); + cElementalInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; for (cElementalInstanceStack stack : stacks) { @@ -185,7 +185,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ double levelsCountPlus1=precisionFullIn-precisionMinimalIn+1; //take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAllToNewMap().values();//cleanup stacks + stacks = input.takeAll().valuesToArray();//cleanup stacks for(cElementalInstanceStack stack:stacks){ double charge=stack.definition.getCharge()-offsetIn; if(charge-precisionMinimalIn){ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java index cd6f637d61..97ece16fb1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index c86c06b2a0..f7aa945d69 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java index 95bb8dce40..2dc9067e22 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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 a43bf2b128..d9217171d3 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 @@ -2,14 +2,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -23,11 +23,10 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -42,28 +41,26 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa //endregion //region structure + private static final String[][] shape = new String[][]{ + {"B0", "A ", "0 - 0", "A ", "B0",}, + {"A000", "00000", "00.00", "00000", "A000",}, + {"A121", "1---1", "2---2", "1---1", "A121",}, + {"A131", "1---1", "3-A-3", "1---1", "A131",}, + {"A121", "1---1", "2---2", "1---1", "A121",}, + {"A000", "00000", "00-00", "00000", "A000",}, + {"B0", "A!!!", "0!!!0", "A!!!", "B0",},}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; + private static final IHatchAdder[] addingMethods = adders( + GT_MetaTileEntity_EM_machine::addClassicToMachineList, + GT_MetaTileEntity_EM_machine::addElementalToMachineList); + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.processing.hint.0"),//1 - Classic Hatches or High Power Casing - translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"),//2 - Elemental Hatches or Molecular Casing - }; - - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.builder() - .addShape("main", new String[][]{ - {" A "," AAA "," EBE "," ECE "," EBE "," AAA "," A "}, - {" DDD ","AAAAA","E---E","E---E","E---E","AAAAA"," FFF "}, - {"AD-DA","AA~AA","B---B","C---C","B---B","AA-AA","AFFFA"}, - {" DDD ","AAAAA","E---E","E---E","E---E","AAAAA"," FFF "}, - {" A "," AAA "," EBE "," ECE "," EBE "," AAA "," A "} - }) - .addElement('A', ofBlock(sBlockCasingsTT, 4)) - .addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)) - .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) - .build(); + translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"),};//2 - Elemental Hatches or Molecular Casing //endregion //region parameters @@ -193,7 +190,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 2, 2, 1); + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); } @Override @@ -261,7 +258,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa for (int i = 0; i < 6; i++) { int pointer = (int) inputMux[i].get(); if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[i] = eInputHatches.get(pointer).getContainerHandler(); + handles[i] = eInputHatches.get(pointer).getContentHandler(); } } @@ -318,7 +315,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa for (int i = 0; i < 6; i++) { int pointer = (int) outputMux[i].get(); if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[i] = eOutputHatches.get(pointer).getContainerHandler(); + handles[i] = eOutputHatches.get(pointer).getContentHandler(); } } //output @@ -357,12 +354,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 2, 2, 1, hintsOnly, stackSize); - } - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; + Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override -- cgit From 7edde3bf8c069244dabc7138fb5c5f53ce40336d Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 17 Jan 2022 22:21:58 +0100 Subject: Cleanup EM api, encapsulate (cherry picked from commit 27946d59f2f7c272f2f91ec393a35f5d26f5293e) --- .../java/com/github/technus/tectech/TecTech.java | 8 +- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 60 +- .../entity/projectiles/projectileEM.java | 16 +- .../tileentity/turret/TileTurretHeadEM.java | 16 +- .../tileentity/turretbase/TileTurretBaseEM.java | 6 +- .../definitions/EMComplexAspectDefinition.java | 308 ++++ .../definitions/EMPrimalAspectDefinition.java | 42 + .../definitions/dComplexAspectDefinition.java | 308 ---- .../definitions/ePrimalAspectDefinition.java | 42 - .../transformations/AspectDefinitionCompat.java | 20 +- .../AspectDefinitionCompatEnabled.java | 68 +- .../thing/metaTileEntity/multi/EssentiaCompat.java | 6 +- .../multi/EssentiaCompatEnabled.java | 10 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 22 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 18 +- .../technus/tectech/loader/ElementalLoader.java | 34 +- .../tectech/loader/recipe/RecipeLoader.java | 8 +- .../tectech/loader/thing/MachineLoader.java | 2 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 8 +- .../elementalMatter/core/EMException.java | 10 + .../elementalMatter/core/IEMContainer.java | 12 + .../elementalMatter/core/commands/EMGive.java | 160 ++ .../elementalMatter/core/commands/EMList.java | 95 ++ .../elementalMatter/core/commands/GiveEM.java | 160 -- .../elementalMatter/core/commands/ListEM.java | 95 -- .../elementalMatter/core/decay/EMDecay.java | 90 ++ .../elementalMatter/core/decay/EMDecayResult.java | 45 + .../core/decay/cElementalDecay.java | 77 - .../core/decay/cElementalDecayResult.java | 43 - .../elementalMatter/core/iElementalContainer.java | 12 - .../core/maps/EMConstantStackMap.java | 58 + .../core/maps/EMDefinitionStackMap.java | 56 + .../core/maps/EMInstanceStackMap.java | 242 +++ .../elementalMatter/core/maps/EMStackMap.java | 50 + .../elementalMatter/core/maps/IEMMapRead.java | 275 ++++ .../elementalMatter/core/maps/IEMMapWrite.java | 112 ++ .../core/maps/IEMMapWriteExact.java | 166 ++ .../core/maps/cElementalConstantStackMap.java | 58 - .../core/maps/cElementalDefinitionStackMap.java | 56 - .../core/maps/cElementalInstanceStackMap.java | 214 --- .../core/maps/cElementalStackMap.java | 50 - .../elementalMatter/core/maps/iElementalMapR.java | 187 --- .../elementalMatter/core/maps/iElementalMapRW.java | 130 -- .../elementalMatter/core/recipes/EMRecipe.java | 87 + .../elementalMatter/core/recipes/EMRecipeMap.java | 65 + .../core/recipes/rElementalRecipe.java | 57 - .../core/recipes/rElementalRecipeMap.java | 73 - .../core/stacks/EMDefinitionStack.java | 73 + .../core/stacks/EMInstanceStack.java | 605 +++++++ .../elementalMatter/core/stacks/IEMStack.java | 37 + .../core/stacks/cElementalDefinitionStack.java | 88 - .../core/stacks/cElementalInstanceStack.java | 566 ------- .../core/stacks/iElementalStack.java | 23 - .../elementalMatter/core/tElementalException.java | 10 - .../elementalMatter/core/templates/EMComplex.java | 135 ++ .../core/templates/EMPrimitive.java | 283 ++++ .../core/templates/IEMDefinition.java | 84 + .../core/templates/cElementalDefinition.java | 135 -- .../core/templates/cElementalPrimitive.java | 275 ---- .../core/templates/iElementalDefinition.java | 85 - .../transformations/EMFluidDequantizationInfo.java | 43 + .../transformations/EMFluidQuantizationInfo.java | 43 + .../transformations/EMItemDequantizationInfo.java | 45 + .../transformations/EMItemQuantizationInfo.java | 69 + .../EMOredictDequantizationInfo.java | 60 + .../transformations/EMOredictQuantizationInfo.java | 60 + .../core/transformations/EMTransformationInfo.java | 172 ++ .../core/transformations/IEMExchangeInfo.java | 11 + .../transformations/aFluidDequantizationInfo.java | 43 - .../transformations/aFluidQuantizationInfo.java | 43 - .../transformations/aItemDequantizationInfo.java | 45 - .../transformations/aItemQuantizationInfo.java | 69 - .../aOredictDequantizationInfo.java | 52 - .../transformations/aOredictQuantizationInfo.java | 52 - .../core/transformations/bTransformationInfo.java | 124 -- .../core/transformations/iExchangeInfo.java | 11 - .../definitions/complex/EMAtomDefinition.java | 1694 ++++++++++++++++++++ .../definitions/complex/EMHadronDefinition.java | 520 ++++++ .../definitions/complex/EMNuclideIAEA.java | 336 ++++ .../definitions/complex/dAtomDefinition.java | 1678 ------------------- .../definitions/complex/dHadronDefinition.java | 512 ------ .../definitions/complex/iaeaNuclide.java | 307 ---- .../definitions/primitive/EMBosonDefinition.java | 45 + .../definitions/primitive/EMLeptonDefinition.java | 69 + .../primitive/EMNeutrinoDefinition.java | 59 + .../primitive/EMPrimitiveDefinition.java | 39 + .../definitions/primitive/EMQuarkDefinition.java | 106 ++ .../primitive/cPrimitiveDefinition.java | 39 - .../definitions/primitive/eBosonDefinition.java | 45 - .../definitions/primitive/eLeptonDefinition.java | 69 - .../definitions/primitive/eNeutrinoDefinition.java | 59 - .../definitions/primitive/eQuarkDefinition.java | 106 -- .../github/technus/tectech/recipe/TT_recipe.java | 104 +- .../technus/tectech/recipe/TT_recipeAdder.java | 22 +- .../item/DebugElementalInstanceContainer_EM.java | 40 +- .../item/ElementalDefinitionContainer_EM.java | 26 +- .../item/ElementalDefinitionScanStorage_EM.java | 4 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 22 +- .../multi/GT_MetaTileEntity_EM_collider.java | 251 +-- .../multi/GT_MetaTileEntity_EM_decay.java | 22 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 38 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 48 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 48 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 52 +- .../multi/em_machine/Behaviour_Centrifuge.java | 69 +- .../multi/em_machine/Behaviour_Electrolyzer.java | 4 +- .../Behaviour_ElectromagneticSeparator.java | 47 +- .../multi/em_machine/Behaviour_PrecisionLaser.java | 4 +- .../multi/em_machine/Behaviour_Recycler.java | 6 +- .../multi/em_machine/Behaviour_Scanner.java | 4 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 10 +- .../tectech/thing/metaTileEntity/multi/other todo | 4 +- .../github/technus/tectech/util/DoubleCount.java | 122 +- 113 files changed, 7090 insertions(+), 6618 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 809a7e877d..ef5e146bfa 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -9,8 +9,8 @@ import com.github.technus.tectech.mechanics.commands.ConvertFloat; import com.github.technus.tectech.mechanics.commands.ConvertInteger; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; import com.github.technus.tectech.mechanics.data.PlayerPersistence; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.GiveEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.ListEM; +import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMGive; +import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList; import com.github.technus.tectech.proxy.CommonProxy; import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.FMLCommonHandler; @@ -203,9 +203,9 @@ public class TecTech { public void serverLoad(FMLServerStartingEvent pEvent) { pEvent.registerServerCommand(new ConvertInteger()); pEvent.registerServerCommand(new ConvertFloat()); - pEvent.registerServerCommand(new ListEM()); + pEvent.registerServerCommand(new EMList()); if(DEBUG_MODE) { - pEvent.registerServerCommand(new GiveEM()); + pEvent.registerServerCommand(new EMGive()); pEvent.registerServerCommand(new CancerCommand()); pEvent.registerServerCommand(new ChargeCommand()); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index 72cee6d7aa..73d2955548 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.compatibility.gtpp; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.*; public class GtppAtomLoader implements Runnable{ //region reflect a bit @@ -67,34 +67,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); generate("GERMANIUM",true,true); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index a0b6106151..d594a826bc 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -44,25 +44,25 @@ public class projectileEM extends LaserProjectile { } } - public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStack projectileContent) { + public projectileEM(World par1World, TurretBase turretBase, EMInstanceStack projectileContent) { super(par1World, turretBase); this.turretBase = turretBase; if(projectileContent != null){ mass=projectileContent.getMass(); charge=projectileContent.getCharge(); - massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); + massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass()); - if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) { + if(projectileContent.getDefinition().getType()>1 || projectileContent.getDefinition().getType()<-1) { strange = true; } - if(projectileContent.definition.getType()<0) { + if(projectileContent.getDefinition().getType()<0) { antiMatter = true; } - if (projectileContent.definition.getCharge() == 0) { + if (projectileContent.getDefinition().getCharge() == 0) { gravity = massFactor / 100f; } else { - gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f); + gravity = Math.min(0.0025F / Math.abs(projectileContent.getDefinition().getCharge()), massFactor / 100f); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index e027c83107..6dc5c4f60a 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.t import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -14,13 +14,13 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; /** * Created by Bass on 27/07/2017. */ public class TileTurretHeadEM extends TurretHead{ - private cElementalInstanceStackMap hatchContentPointer; + private EMInstanceStackMap hatchContentPointer; @Override public int getTurretRange() { @@ -70,11 +70,11 @@ public class TileTurretHeadEM extends TurretHead{ if (hatchContentPointer == null || hatchContentPointer.isEmpty()) { return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null); } - cElementalInstanceStack stack = hatchContentPointer.getRandom(); - double amount = Math.min(AVOGADRO_CONSTANT,stack.amount); - hatchContentPointer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT)); + EMInstanceStack stack = hatchContentPointer.getRandom(); + double amount = Math.min(AVOGADRO_CONSTANT, stack.getAmount()); + hatchContentPointer.removeAmount(stack.getDefinition(),AVOGADRO_CONSTANT); stack=stack.clone(); - stack.amount = amount; + stack.setAmount(amount); return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java index a5d64fb886..0dbc33e007 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import cpw.mods.fml.common.Optional; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -25,7 +25,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { return "turretBaseEM"; } - public final cElementalInstanceStackMap getContainerHandler() { + public final EMInstanceStackMap getContainerHandler() { World worldIn = getWorldObj(); TileEntity te; if ((te = worldIn.getTileEntity(xCoord + 1, yCoord, zCoord)) instanceof IGregTechTileEntity && @@ -61,7 +61,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { return null; } - private cElementalInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) { + private EMInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) { hatch.updateTexture((byte) 8,(byte) 4); return hatch.getContentHandler(); } 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 new file mode 100644 index 0000000000..432d151b80 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java @@ -0,0 +1,308 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +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.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by Tec on 06.05.2017. + */ +public final class EMComplexAspectDefinition extends EMComplex { + private final int hash; + private final double mass; + + private static final byte nbtType = (byte) 'c'; + + private final EMConstantStackMap aspectStacks; + + public EMComplexAspectDefinition(EMDefinitionStack... aspects) throws EMException { + this(true, new EMConstantStackMap(aspects)); + } + + private EMComplexAspectDefinition(boolean check, EMDefinitionStack... aspects) throws EMException { + this(check, new EMConstantStackMap(aspects)); + } + + public EMComplexAspectDefinition(EMConstantStackMap aspects) throws EMException { + this(true, aspects); + } + + private EMComplexAspectDefinition(boolean check, EMConstantStackMap aspects) throws EMException { + if (check && !canTheyBeTogether(aspects)) { + throw new EMException("Hadron Definition error"); + } + aspectStacks = aspects; + float mass = 0; + for (EMDefinitionStack stack : aspects.valuesToArray()) { + mass += stack.getMass(); + } + this.mass = mass; + hash = super.hashCode(); + } + + //public but u can just try{}catch(){} the constructor it still calls this method + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + long amount = 0; + for (EMDefinitionStack aspects : stacks.valuesToArray()) { + if (!(aspects.getDefinition() instanceof EMComplexAspectDefinition) && !(aspects.getDefinition() instanceof EMPrimalAspectDefinition)) { + return false; + } + if((int) aspects.getAmount() != aspects.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + amount += aspects.getAmount(); + } + return amount == 2; + } + + @Override + public String getLocalizedName() { + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this); + if (name != null) { + name = name.substring(0, 1).toUpperCase() + name.substring(1); + } else { + name = getSymbol(); + } + return translateToLocal("tt.keyword.Aspect") + ": " + name; + } + + @Override + public String getSymbol() { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { + if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getSymbol()); + } + } else { + symbol.append('('); + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getSymbol()); + } + symbol.append(')'); + } + } + return symbol.toString(); + } + + @Override + public String getShortSymbol() { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { + if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getShortSymbol()); + } + } else { + symbol.append('('); + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getShortSymbol()); + } + symbol.append(')'); + } + } + return symbol.toString(); + } + + @Override + public NBTTagCompound toNBT() { + return getNbtTagCompound(nbtType, aspectStacks); + } + + public static NBTTagCompound getNbtTagCompound(byte nbtType, EMConstantStackMap aspectStacks) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setByte("t", nbtType); + EMDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray(); + nbt.setInteger("i", quarkStacksValues.length); + for (int i = 0; i < quarkStacksValues.length; i++) { + nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); + } + return nbt; + } + + public static EMComplexAspectDefinition fromNBT(NBTTagCompound nbt) { + EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < stacks.length; i++) { + stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + } + try { + return new EMComplexAspectDefinition(stacks); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return -1; + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } + + @Override + public int getCharge() { + return 0; + } + + @Override + public byte getType() { + return 0; + } + + @Override + public byte getColor() { + return -1; + } + + @Override + public EMConstantStackMap getSubParticles() { + return aspectStacks; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + return new EMDecay[]{new EMDecay(0.75F, aspectStacks), EMBosonDefinition.deadEnd}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + return NO_DECAY; + } + + @Override + public EMDecay[] getDecayArray() { + return NO_DECAY; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public IEMDefinition getAnti() { + return null; + } + + public static void run() { + try { + EMComplex.addCreatorFromNBT(nbtType, EMComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if (DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + -96); + } + } + + @Override + public byte getClassType() { + return -96; + } + + public static byte getClassTypeStatic() { + return -96; + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { + if (Util.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)) { + lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType()); + } + if (Util.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)) { + lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); + } + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { + lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); + } + if (Util.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/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java new file mode 100644 index 0000000000..bf9703d6d7 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -0,0 +1,42 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by Tec on 06.05.2017. + */ +public final class EMPrimalAspectDefinition extends EMPrimitive { + public static final EMPrimalAspectDefinition + magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), + magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), + magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), + magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), + magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), + magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); + + private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID) { + super(name, symbol, 0, mass, 0, -1, ID); + } + + public static void run() { + magic_air.init(null, -1F, -1, -1, NO_DECAY); + magic_earth.init(null, -1F, -1, -1, NO_DECAY); + magic_fire.init(null, -1F, -1, -1, NO_DECAY); + magic_water.init(null, -1F, -1, -1, NO_DECAY); + magic_order.init(null, -1F, -1, -1, NO_DECAY); + magic_entropy.init(null, -1F, -1, -1, NO_DECAY); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.Primal") + ": " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java deleted file mode 100644 index 98ad5bbf63..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ /dev/null @@ -1,308 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 06.05.2017. - */ -public final class dComplexAspectDefinition extends cElementalDefinition { - private final int hash; - public final double mass; - - private static final byte nbtType = (byte) 'c'; - - private final cElementalConstantStackMap aspectStacks; - - public dComplexAspectDefinition(cElementalDefinitionStack... aspects) throws tElementalException { - this(true, new cElementalConstantStackMap(aspects)); - } - - private dComplexAspectDefinition(boolean check, cElementalDefinitionStack... aspects) throws tElementalException { - this(check, new cElementalConstantStackMap(aspects)); - } - - public dComplexAspectDefinition(cElementalConstantStackMap aspects) throws tElementalException { - this(true, aspects); - } - - private dComplexAspectDefinition(boolean check, cElementalConstantStackMap aspects) throws tElementalException { - if (check && !canTheyBeTogether(aspects)) { - throw new tElementalException("Hadron Definition error"); - } - aspectStacks = aspects; - float mass = 0; - for (cElementalDefinitionStack stack : aspects.valuesToArray()) { - mass += stack.getMass(); - } - this.mass = mass; - hash = super.hashCode(); - } - - //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { - long amount = 0; - for (cElementalDefinitionStack aspects : stacks.valuesToArray()) { - if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) { - return false; - } - if((int)aspects.amount!=aspects.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - amount += aspects.amount; - } - return amount == 2; - } - - @Override - public String getName() { - String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this); - if (name != null) { - name = name.substring(0, 1).toUpperCase() + name.substring(1); - } else { - name = getSymbol(); - } - return translateToLocal("tt.keyword.Aspect") + ": " + name; - } - - @Override - public String getSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) { - if (aspect.definition instanceof ePrimalAspectDefinition) { - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - public String getShortSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) { - if (aspect.definition instanceof ePrimalAspectDefinition) { - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getShortSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getShortSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, aspectStacks); - } - - public static NBTTagCompound getNbtTagCompound(byte nbtType, cElementalConstantStackMap aspectStacks) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - cElementalDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray(); - nbt.setInteger("i", quarkStacksValues.length); - for (int i = 0; i < quarkStacksValues.length; i++) { - nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); - } - return nbt; - } - - public static dComplexAspectDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new dComplexAspectDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return -1; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } - - @Override - public int getCharge() { - return 0; - } - - @Override - public byte getType() { - return 0; - } - - @Override - public byte getColor() { - return -1; - } - - @Override - public cElementalConstantStackMap getSubParticles() { - return aspectStacks; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - return new cElementalDecay[]{new cElementalDecay(0.75F, aspectStacks), eBosonDefinition.deadEnd}; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - return noDecay; - } - - @Override - public cElementalDecay[] getDecayArray() { - return noDecay; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public iElementalDefinition getAnti() { - return null; - } - - public static void run() { - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if (DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + -96); - } - } - - @Override - public byte getClassType() { - return -96; - } - - public static byte getClassTypeStatic() { - return -96; - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if (Util.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)) { - lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType()); - } - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { - lines.add(translateToLocal("tt.keyword.NAME") + " = " + getName()); - //lines.add("SYMBOL = "+getSymbol()); - } - if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { - lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); - } - if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); - } - if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { - lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); - } - if (Util.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/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java deleted file mode 100644 index 5db067a552..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 06.05.2017. - */ -public final class ePrimalAspectDefinition extends cElementalPrimitive { - public static final ePrimalAspectDefinition - magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), - magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), - magic_fire = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), - magic_water = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), - magic_order = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), - magic_entropy = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); - - private ePrimalAspectDefinition(String name, String symbol, double mass, int ID) { - super(name, symbol, 0, mass, 0, -1, ID); - } - - public static void run() { - magic_air.init(null, -1F, -1, -1, noDecay); - magic_earth.init(null, -1F, -1, -1, noDecay); - magic_fire.init(null, -1F, -1, -1, noDecay); - magic_water.init(null, -1F, -1, -1, noDecay); - magic_order.init(null, -1F, -1, -1, noDecay); - magic_entropy.init(null, -1F, -1, -1, noDecay); - } - - @Override - public String getName() { - return translateToLocal("tt.keyword.Primal") + ": " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java index 343071e26e..c7f38eb21d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import java.util.HashMap; @@ -9,21 +9,25 @@ import java.util.HashMap; * Created by Tec on 21.05.2017. */ public class AspectDefinitionCompat { - public static AspectDefinitionCompat aspectDefinitionCompat; - public final HashMap defToAspect = new HashMap<>(); - public final HashMap aspectToDef = new HashMap<>(); + public static AspectDefinitionCompat aspectDefinitionCompat; + private final HashMap defToAspect = new HashMap<>(); + private final HashMap aspectToDef = new HashMap<>(); public void run(){} - public Object getAspect(iElementalDefinition definition){ + public String getAspectTag(IEMDefinition definition){ return null; } - public String getAspectTag(iElementalDefinition definition){ + public IEMDefinition getDefinition(String aspect){ return null; } - public iElementalDefinition getDefinition(String aspect){ - return null; + public HashMap getDefToAspect() { + return defToAspect; + } + + public HashMap getAspectToDef() { + return aspectToDef; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java index 446e9b66d5..c9ca5d7b9f 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; /** @@ -16,19 +16,19 @@ import static com.github.technus.tectech.thing.item.DebugElementalInstanceContai public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { @Override public void run(){ - defToAspect.put(magic_air,"aer"); - defToAspect.put(magic_earth,"terra"); - defToAspect.put(magic_fire,"ignis"); - defToAspect.put(magic_water,"aqua"); - defToAspect.put(magic_order,"ordo"); - defToAspect.put(magic_entropy,"perditio"); + getDefToAspect().put(magic_air,"aer"); + getDefToAspect().put(magic_earth,"terra"); + getDefToAspect().put(magic_fire,"ignis"); + getDefToAspect().put(magic_water,"aqua"); + getDefToAspect().put(magic_order,"ordo"); + getDefToAspect().put(magic_entropy,"perditio"); - aspectToDef.put("aer",magic_air); - aspectToDef.put("terra",magic_earth); - aspectToDef.put("ignis",magic_fire); - aspectToDef.put("aqua",magic_water); - aspectToDef.put("ordo",magic_order); - aspectToDef.put("perditio",magic_entropy); + getAspectToDef().put("aer",magic_air); + getAspectToDef().put("terra",magic_earth); + getAspectToDef().put("ignis",magic_fire); + getAspectToDef().put("aqua",magic_water); + getAspectToDef().put("ordo",magic_order); + getAspectToDef().put("perditio",magic_entropy); ArrayList list=Aspect.getCompoundAspects(); Aspect[] array= list.toArray(new Aspect[0]); @@ -38,20 +38,20 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat Aspect[] content = aspect.getComponents(); if (content.length != 2) { list.remove(aspect); - }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ + }else if(getAspectToDef().containsKey(content[0].getTag()) && getAspectToDef().containsKey(content[1].getTag())){ try { - dComplexAspectDefinition newAspect; + EMComplexAspectDefinition newAspect; if(content[0].getTag().equals(content[1].getTag())){ - newAspect = new dComplexAspectDefinition( - aspectToDef.get(content[0].getTag()).getStackForm(2)); + newAspect = new EMComplexAspectDefinition( + getAspectToDef().get(content[0].getTag()).getStackForm(2)); }else{ - newAspect = new dComplexAspectDefinition( - aspectToDef.get(content[0].getTag()).getStackForm(1), - aspectToDef.get(content[1].getTag()).getStackForm(1)); + newAspect = new EMComplexAspectDefinition( + getAspectToDef().get(content[0].getTag()).getStackForm(1), + getAspectToDef().get(content[1].getTag()).getStackForm(1)); } - aspectToDef.put(aspect.getTag(),newAspect); - defToAspect.put(newAspect,aspect.getTag()); - }catch (tElementalException e) { + getAspectToDef().put(aspect.getTag(),newAspect); + getDefToAspect().put(newAspect,aspect.getTag()); + }catch (EMException e) { /**/ }finally { list.remove(aspect); @@ -60,22 +60,16 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } } } - - STACKS_REGISTERED.addAll(defToAspect.keySet()); - } - - @Override - public Aspect getAspect(iElementalDefinition definition) { - return Aspect.getAspect(defToAspect.get(definition)); + STACKS_REGISTERED.addAll(getDefToAspect().keySet()); } @Override - public String getAspectTag(iElementalDefinition definition) { - return defToAspect.get(definition); + public String getAspectTag(IEMDefinition definition) { + return getDefToAspect().get(definition); } @Override - public iElementalDefinition getDefinition(String aspect) { - return aspectToDef.get(aspect); + public IEMDefinition getDefinition(String aspect) { + return getAspectToDef().get(aspect); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index 63f55912a6..d51bc8dc2d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; @@ -18,7 +18,7 @@ public class EssentiaCompat { return null; } - public String getEssentiaName(iElementalDefinition stack){ + public String getEssentiaName(IEMDefinition stack){ return null; } @@ -26,7 +26,7 @@ public class EssentiaCompat { return false; } - public iElementalDefinition getFromContainer(TileEntity container){ + public IEMDefinition getFromContainer(TileEntity container){ return null; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index 03ff92b4e0..ab682ba1a5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; @@ -28,8 +28,8 @@ public class EssentiaCompatEnabled extends EssentiaCompat { } @Override - public String getEssentiaName(iElementalDefinition stack) { - return aspectDefinitionCompat.defToAspect.get(stack); + public String getEssentiaName(IEMDefinition stack) { + return aspectDefinitionCompat.getDefToAspect().get(stack); } @Override @@ -49,7 +49,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { } @Override - public iElementalDefinition getFromContainer(TileEntity container){ + public IEMDefinition getFromContainer(TileEntity container){ if(container==null || container.isInvalid()) { return null; } @@ -59,7 +59,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { Aspect[] aspectsArr= aspects.getAspects(); if(aspectsArr!=null && aspectsArr[0]!=null){ if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){ - return aspectDefinitionCompat.aspectToDef.get(aspectsArr[0].getTag()); + return aspectDefinitionCompat.getAspectToDef().get(aspectsArr[0].getTag()); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index c939f10d6b..dbcbe7d86b 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -2,8 +2,8 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -26,8 +26,8 @@ import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -94,24 +94,24 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ return false; } - cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler(); + EMInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler(); if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) { return false; } - cElementalInstanceStack stack = inputHatchContainer.getRandom(); - if (stack.amount < AVOGADRO_CONSTANT_DIMINISHED) { - cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + EMInstanceStack stack = inputHatchContainer.getRandom(); + if (stack.getAmount() < AVOGADRO_CONSTANT_DIMINISHED) { + cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[6]; } else { - outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.definition); + outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.getDefinition()); Aspect aspect = Aspect.getAspect(outputEssentiaName); if (aspect == null) { outputEssentiaName = null; - cleanStackEM_EM(inputHatchContainer.remove(stack.definition)); + cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[7]; } else { - inputHatchContainer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT)); + inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(AVOGADRO_CONSTANT)); if (aspect.isPrimal()) { mEUt = (int) -V[8]; } else { diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 62ac339155..5606442c37 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -25,7 +25,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -84,15 +84,15 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkRecipe_EM(ItemStack itemStack) { - iElementalDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); + IEMDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); if (definition != null) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; eAmpereFlow = 1; - outputEM = new cElementalInstanceStackMap[]{ - new cElementalInstanceStackMap(new cElementalInstanceStack(definition,AVOGADRO_CONSTANT)) + outputEM = new EMInstanceStackMap[]{ + new EMInstanceStackMap(new EMInstanceStack(definition,AVOGADRO_CONSTANT)) }; - if (definition instanceof ePrimalAspectDefinition) { + if (definition instanceof EMPrimalAspectDefinition) { mEUt = (int) -V[8]; } else { mEUt = (int) -V[10]; diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index b481b82646..7ce371e57e 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.loader; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.iaeaNuclide; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMNuclideIAEA; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*; /** @@ -18,23 +18,23 @@ public class ElementalLoader implements Runnable { // Definition init // =================================================================================================== - cElementalPrimitive.run(); + EMPrimitive.run(); - cPrimitiveDefinition.run(); + EMPrimitiveDefinition.run(); - eQuarkDefinition.run(); - eLeptonDefinition.run(); - eNeutrinoDefinition.run(); - eBosonDefinition.run(); + EMQuarkDefinition.run(); + EMLeptonDefinition.run(); + EMNeutrinoDefinition.run(); + EMBosonDefinition.run(); - dHadronDefinition.run(); + EMHadronDefinition.run(); - iaeaNuclide.run(); + EMNuclideIAEA.run(); - dAtomDefinition.run(); + EMAtomDefinition.run(); - ePrimalAspectDefinition.run(); + EMPrimalAspectDefinition.run(); - dComplexAspectDefinition.run(); + EMComplexAspectDefinition.run(); } } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java index a2e2f65384..7cd5a25f4a 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java @@ -3,8 +3,8 @@ package com.github.technus.tectech.loader.recipe; import com.github.technus.tectech.Reference; import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.item.ConstructableTriggerItem; @@ -35,8 +35,8 @@ public class RecipeLoader implements Runnable { @Override public void run() { - dAtomDefinition.setTransformation(); - dHadronDefinition.setTransformations(); + EMAtomDefinition.setTransformation(); + EMHadronDefinition.setTransformations(); // =================================================================================================== // Recipes init - common goes here rest goes into methods below diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 91dbffa71f..b3df7483f5 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -15,7 +15,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; 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 0e1771e88d..c6ac34b66d 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 @@ -7,7 +7,7 @@ import com.github.technus.tectech.mechanics.data.ChunkDataHandler; 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.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.api.GregTech_API; @@ -31,11 +31,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; public class AnomalyHandler implements IChunkMetaDataHandler { - private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... + private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... private static final int COUNT_DIV=32; private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java new file mode 100644 index 0000000000..23ca5d77d9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +/** + * Created by danie_000 on 19.11.2016. + */ +public final class EMException extends Exception { + public EMException(String message) { + super(message); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java new file mode 100644 index 0000000000..d731078988 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; + +/** + * Created by danie_000 on 25.01.2017. + */ +public interface IEMContainer { + EMInstanceStackMap getContentHandler(); + + void purgeOverflow(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java new file mode 100644 index 0000000000..64e9bcea1e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -0,0 +1,160 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.commands; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +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.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 30.12.2017. + */ +public class EMGive implements ICommand { + ArrayList aliases=new ArrayList<>(); + + public EMGive(){ + aliases.add("em_give"); + aliases.add("give_em"); + aliases.add("gib_em"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { + if(args.length < 3) { + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + }else{ + TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args)); + + ArrayList list = new ArrayList<>(Arrays.asList(args)); + String energy=list.remove(0); + + EMDefinitionStack def = getDefinitionStack(list); + if(def!=null) { + EMInstanceStack instanceStack = new EMInstanceStack(def, 1D, 0D, Long.parseLong(energy)); + + sender.addChatMessage(new ChatComponentText(instanceStack.getDefinition().getSymbol() + " - " + instanceStack.getDefinition().getLocalizedName())); + + EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack); + + ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); + NBTTagCompound contents = new NBTTagCompound(); + contents.setTag("info", instanceMap.getInfoNBT()); + contents.setTag("content", instanceMap.toNBT()); + itemStack.setTagCompound(contents); + + ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); + } + } + } + } + + private EMDefinitionStack getDefinitionStack(ArrayList args){ + if(args.get(0).equals("<")){ + args.remove(0); + return null; + } + double amount=Double.parseDouble(args.remove(0)); + try{ + int id=Integer.parseInt(args.get(0)); + args.remove(0); + IEMDefinition primitive = EMPrimitive.getBindsPrimitive().get(id); + return new EMDefinitionStack(primitive,amount); + }catch (NumberFormatException e){ + byte clazz = (byte) args.remove(0).charAt(0); + Method constructor = EMComplex.getBindsComplex().get(clazz); + + EMDefinitionStackMap stacks =new EMDefinitionStackMap(); + while(args.size()>0){ + EMDefinitionStack tempStack =getDefinitionStack(args); + if(tempStack==null) { + break; + }else { + stacks.putUnifyExact(tempStack); + } + } + + try { + return ((IEMDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount); + } catch (Exception e1) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return nbtE__.getStackForm(amount); + } + } + } + + @Override + public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { + return false; + } + + @Override + public List getCommandAliases() { + return aliases; + } + + @Override + public String getCommandName() { + return aliases.get(0); + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args) { + if(args.length==2){ + return completionsForClassOrID(); + } + return null; + } + + private List completionsForClassOrID(){ + ArrayList strings=new ArrayList<>(8); + Map binds= EMComplex.getBindsComplex(); + for (Map.Entry e:binds.entrySet()) { + strings.add(String.valueOf((char)e.getKey().byteValue())); + } + Map bindsBO = EMPrimitive.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { + strings.add(String.valueOf(e.getKey().byteValue())); + } + return strings; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "em_give Energy Count ClassOrId (Count ClassOrId ... <)"; + } + + @Override + public int compareTo(Object o) { + if(o instanceof ICommand){ + return getCommandName().compareTo(((ICommand) o).getCommandName()); + } + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } +} 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 new file mode 100644 index 0000000000..395592036f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java @@ -0,0 +1,95 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.commands; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Created by danie_000 on 30.12.2017. + */ +public class EMList implements ICommand { + ArrayList aliases=new ArrayList<>(); + + public EMList(){ + aliases.add("em_list"); + aliases.add("list_em"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (!sender.getEntityWorld().isRemote) { + if(args.length == 0) { + sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); + Map binds= EMComplex.getBindsComplex(); + for (Map.Entry e:binds.entrySet()) { + sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); + } + }else if(args.length==1){ + sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); + if(args[0].equals(String.valueOf((char) EMPrimitive.nbtType))){ + Map bindsBO = EMPrimitive.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { + sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName())); + } + }else{ + sender.addChatMessage(new ChatComponentText("Complex definition - needs contents")); + } + }else{ + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + } + } + } + + @Override + public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { + return false; + } + + @Override + public List getCommandAliases() { + return aliases; + } + + @Override + public String getCommandName() { + return aliases.get(0); + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args) { + if(args.length==0){ + Map binds= EMComplex.getBindsComplex(); + ArrayList strings=new ArrayList<>(binds.size()); + for (Map.Entry e:binds.entrySet()) { + strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); + } + return strings; + } + return null; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "em_list (optional class tag)"; + } + + @Override + public int compareTo(Object o) { + if(o instanceof ICommand){ + return getCommandName().compareTo(((ICommand) o).getCommandName()); + } + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java deleted file mode 100644 index 8b1f6d0c14..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class GiveEM implements ICommand { - ArrayList aliases=new ArrayList<>(); - - public GiveEM(){ - aliases.add("em_give"); - aliases.add("give_em"); - aliases.add("gib_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - if(args.length < 3) { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - }else{ - TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args)); - - ArrayList list = new ArrayList<>(Arrays.asList(args)); - String energy=list.remove(0); - - cElementalDefinitionStack def= getDefinitionStack(list); - if(def!=null) { - cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1D, 0D, Long.parseLong(energy)); - - sender.addChatMessage(new ChatComponentText(instanceStack.definition.getSymbol() + " - " + instanceStack.definition.getName())); - - cElementalInstanceStackMap instanceMap = new cElementalInstanceStackMap(instanceStack); - - ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); - NBTTagCompound contents = new NBTTagCompound(); - contents.setTag("info", instanceMap.getInfoNBT()); - contents.setTag("content", instanceMap.toNBT()); - itemStack.setTagCompound(contents); - - ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); - } - } - } - } - - private cElementalDefinitionStack getDefinitionStack(ArrayList args){ - if(args.get(0).equals("<")){ - args.remove(0); - return null; - } - double amount=Double.parseDouble(args.remove(0)); - try{ - int id=Integer.parseInt(args.get(0)); - args.remove(0); - iElementalDefinition primitive=cElementalPrimitive.getBindsPrimitive().get(id); - return new cElementalDefinitionStack(primitive,amount); - }catch (NumberFormatException e){ - byte clazz = (byte) args.remove(0).charAt(0); - Method constructor = cElementalDefinition.getBindsComplex().get(clazz); - - cElementalDefinitionStackMap stacks =new cElementalDefinitionStackMap(); - while(args.size()>0){ - cElementalDefinitionStack tempStack=getDefinitionStack(args); - if(tempStack==null) { - break; - }else { - stacks.putUnify(tempStack); - } - } - - try { - return ((iElementalDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount); - } catch (Exception e1) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__.getStackForm(amount); - } - } - } - - @Override - public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==2){ - return completionsForClassOrID(); - } - return null; - } - - private List completionsForClassOrID(){ - ArrayList strings=new ArrayList<>(8); - Map binds= cElementalDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())); - } - Map bindsBO = cElementalPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - strings.add(String.valueOf(e.getKey().byteValue())); - } - return strings; - } - - @Override - public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_give Energy Count ClassOrId (Count ClassOrId ... <)"; - } - - @Override - public int compareTo(Object o) { - if(o instanceof ICommand){ - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java deleted file mode 100644 index 20110c0b0d..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class ListEM implements ICommand { - ArrayList aliases=new ArrayList<>(); - - public ListEM(){ - aliases.add("em_list"); - aliases.add("list_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (!sender.getEntityWorld().isRemote) { - if(args.length == 0) { - sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); - Map binds= cElementalDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); - } - }else if(args.length==1){ - sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); - if(args[0].equals(String.valueOf((char)cElementalPrimitive.nbtType))){ - Map bindsBO = cElementalPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getName())); - } - }else{ - sender.addChatMessage(new ChatComponentText("Complex definition - needs contents")); - } - }else{ - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - } - } - } - - @Override - public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==0){ - Map binds= cElementalDefinition.getBindsComplex(); - ArrayList strings=new ArrayList<>(binds.size()); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); - } - return strings; - } - return null; - } - - @Override - public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_list (optional class tag)"; - } - - @Override - public int compareTo(Object o) { - if(o instanceof ICommand){ - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java new file mode 100644 index 0000000000..bed49a5040 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java @@ -0,0 +1,90 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +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.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; + +import static com.github.technus.tectech.util.DoubleCount.mul; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMDecay { + public static final EMDecay[] NO_DECAY = null; + //DECAY IMPOSSIBLE!!! + //Do not use regular NULL java will not make it work with varargs!!! + //Or cast null into ARRAY type but this static is more convenient!!! + public static final EMDecay[] NO_PRODUCT = new EMDecay[0]; + //this in turn can be used to tell that the thing should just vanish + private final EMConstantStackMap outputStacks; + private final double probability; + + public EMDecay(IEMDefinition... outSafe) { + this(1D, outSafe); + } + + public EMDecay(double probability, IEMDefinition... outSafe) { + EMDefinitionStack[] outArr = new EMDefinitionStack[outSafe.length]; + for (int i = 0; i < outArr.length; i++) { + outArr[i] = new EMDefinitionStack(outSafe[i], 1D); + } + outputStacks = new EMConstantStackMap(outArr); + this.probability = probability; + } + + public EMDecay(EMDefinitionStack... outSafe) { + this(1D, outSafe); + } + + public EMDecay(double probability, EMDefinitionStack... out) { + outputStacks = new EMConstantStackMap(out); + this.probability = probability; + } + + public EMDecay(EMConstantStackMap tree) { + this(1D, tree); + } + + public EMDecay(double probability, EMConstantStackMap tree) { + outputStacks = tree; + this.probability = probability; + } + + public EMInstanceStackMap getResults(double lifeMult, double age, long newEnergyLevel, double amountDecaying) { + EMInstanceStackMap decayResult = new EMInstanceStackMap(); + if (getOutputStacks() == null) { + return decayResult;//This is to prevent null pointer exceptions. + } + //Deny decay code is in instance! + boolean empty=true; + for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { + if(stack.getAmount() >0){ + empty=false; + break; + } + } + if (empty) { + return decayResult; + } + //newEnergyLevel /= qtty; + //lifeMult /= (float) qtty; + for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { + decayResult.putUnify(new EMInstanceStack(stack.getDefinition(), + mul(amountDecaying, stack.getAmount()), + lifeMult, + age/*new products*/, + (long)(newEnergyLevel / Math.max(1D, Math.abs(stack.getAmount())))));//get instances from stack + } + return decayResult; + } + + public EMConstantStackMap getOutputStacks() { + return outputStacks; + } + + public double getProbability() { + return probability; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java new file mode 100644 index 0000000000..0a00a519f9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; + +public class EMDecayResult { + private final EMInstanceStackMap output; + private double massAffected; + private double massDiff; + + public EMDecayResult(EMInstanceStackMap output, double massAffected, double massDiff) { + this.output = output; + this.massAffected = massAffected; + this.massDiff = massDiff; + } + + public EMInstanceStackMap getOutput() { + return output; + } + + /** + * How much was lost in the process (decayed or removed) + * + * @return + */ + public double getMassAffected() { + return massAffected; + } + + /** + * Difference of mass of actually decayed elements + * + * @return + */ + public double getMassDiff() { + return massDiff; + } + + public void setMassAffected(double massAffected) { + this.massAffected = massAffected; + } + + public void setMassDiff(double massDiff) { + this.massDiff = massDiff; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java deleted file mode 100644 index 79103f7fa0..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.decay; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -import static com.github.technus.tectech.util.DoubleCount.add; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cElementalDecay { - public static final cElementalDecay[] noDecay = null; - //DECAY IMPOSSIBLE!!! - //Do not use regular NULL java will not make it work with varargs!!! - //Or cast null into ARRAY type but this static is more convenient!!! - public static final cElementalDecay[] noProduct = new cElementalDecay[0]; - //this in turn can be used to tell that the thing should just vanish - public final cElementalConstantStackMap outputStacks; - public final double probability; - - public cElementalDecay(iElementalDefinition... outSafe) { - this(1D, outSafe); - } - - public cElementalDecay(double probability, iElementalDefinition... outSafe) { - cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; - for (int i = 0; i < outArr.length; i++) { - outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D); - } - outputStacks = new cElementalConstantStackMap(outArr); - this.probability = probability; - } - - public cElementalDecay(cElementalDefinitionStack... outSafe) { - this(1D, outSafe); - } - - public cElementalDecay(double probability, cElementalDefinitionStack... out) { - outputStacks = new cElementalConstantStackMap(out); - this.probability = probability; - } - - public cElementalDecay(cElementalConstantStackMap tree) { - this(1D, tree); - } - - public cElementalDecay(double probability, cElementalConstantStackMap tree) { - outputStacks = tree; - this.probability = probability; - } - - public cElementalInstanceStackMap getResults(double lifeMult, double age, long energyTotalForProducts, double amountDecaying) { - cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); - if (outputStacks == null) { - return decayResult;//This is to prevent null pointer exceptions. - } - //Deny decay code is in instance! - double qtty = 0D; - for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { - qtty= add(qtty,stack.amount); - } - if (qtty <= 0D) { - return decayResult; - } - //energyTotalForProducts /= qtty; - //lifeMult /= (float) qtty; - for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) { - decayResult.putUnify(new cElementalInstanceStack(stack.definition, - amountDecaying * stack.amount, - lifeMult, age/*new products*/, (long)(energyTotalForProducts / Math.max(1D, Math.abs(stack.amount)))));//get instances from stack - } - return decayResult; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java deleted file mode 100644 index 43f4341720..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.decay; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; - -public class cElementalDecayResult { - private final cElementalInstanceStackMap output; - private double massAffected; - private double massDiff; - - public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) { - this.output = output; - this.massAffected = massAffected; - this.massDiff = massDiff; - } - - public cElementalInstanceStackMap getOutput() { - return output; - } - - /** - * How much was lost in the process (decayed or removed) - * @return - */ - public double getMassAffected() { - return massAffected; - } - - /** - * Difference of mass of actually decayed elements - * @return - */ - public double getMassDiff() { - return massDiff; - } - - public void setMassAffected(double massAffected) { - this.massAffected = massAffected; - } - - public void setMassDiff(double massDiff) { - this.massDiff = massDiff; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java deleted file mode 100644 index 457a37f7b9..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; - -/** - * Created by danie_000 on 25.01.2017. - */ -public interface iElementalContainer { - cElementalInstanceStackMap getContentHandler(); - - void purgeOverflow(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java new file mode 100644 index 0000000000..d9297436a0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java @@ -0,0 +1,58 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Collections; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by Tec on 12.05.2017. + */ +public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap {//Target class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public static final EMConstantStackMap EMPTY = new EMConstantStackMap(); + + private EMConstantStackMap() { + super(Collections.emptyNavigableMap()); + } + + public EMConstantStackMap(EMDefinitionStack... in) { + this(new EMDefinitionStackMap(in).getBackingMap()); + } + + public EMConstantStackMap(NavigableMap in) { + super(Collections.unmodifiableNavigableMap(in)); + } + + @Override + public Class getType() { + return EMDefinitionStack.class; + } + + //IMMUTABLE DON'T NEED IT + @Override + public EMConstantStackMap clone() { + return this; + } + + public EMDefinitionStackMap toMutable() { + return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); + } + + public static EMConstantStackMap fromNBT(NBTTagCompound nbt) throws EMException { + EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + return new EMConstantStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java new file mode 100644 index 0000000000..45ce50d5c7 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class EMDefinitionStackMap extends EMStackMap implements IEMMapWriteExact {//Transient class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public EMDefinitionStackMap() {} + + public EMDefinitionStackMap(EMDefinitionStack... in) { + putUnifyAllExact(in); + } + + public EMDefinitionStackMap(NavigableMap in) { + super(in); + } + + @Override + public Class getType() { + return EMDefinitionStack.class; + } + + @Override + public EMDefinitionStackMap clone() { + return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); + } + + public EMConstantStackMap toImmutable() { + return new EMConstantStackMap(new TreeMap<>(getBackingMap())); + } + + public EMConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { + return new EMConstantStackMap(getBackingMap()); + } + + public static EMDefinitionStackMap fromNBT(NBTTagCompound nbt) throws EMException { + EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + return new EMDefinitionStackMap(defStacks); + } +} 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 new file mode 100644 index 0000000000..c15142787f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java @@ -0,0 +1,242 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +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.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; +import java.util.Map; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class EMInstanceStackMap extends EMStackMap implements IEMMapWrite { + //Constructors + public EMInstanceStackMap() {} + + public EMInstanceStackMap(EMInstanceStack... inSafe) { + this(true, inSafe); + } + + public EMInstanceStackMap(boolean clone, EMInstanceStack... in) { + if (clone) { + EMInstanceStack[] stacks =new EMInstanceStack[in.length]; + for(int i=0;i inSafe) { + this(true, inSafe); + } + + private EMInstanceStackMap(boolean clone, NavigableMap in) { + super(clone?new TreeMap<>():in); + if (clone) { + for(EMInstanceStack stack:in.values()) { + putUnify(stack.clone()); + } + } + } + + @Override + public Class getType() { + return EMInstanceStack.class; + } + + @Override + public EMInstanceStackMap clone() { + return new EMInstanceStackMap(getBackingMap()); + } + + //Remove overflow + public double removeOverflow(int stacksCount, double stackCapacity) { + double massRemoved = 0; + + if (getBackingMap().size() > stacksCount) { + IEMDefinition[] keys = keySetToArray(); + for (int i = stacksCount; i < keys.length; i++) { + massRemoved += getBackingMap().get(keys[i]).getDefinitionStack().getMass(); + getBackingMap().remove(keys[i]); + } + } + + for (EMInstanceStack instance : valuesToArray()) { + if (instance.getAmount() > stackCapacity) { + massRemoved += instance.getDefinition().getMass() * (instance.getAmount() - stackCapacity); + instance.setAmount(stackCapacity); + } + } + return massRemoved; + } + + //Getters + public String[] getElementalInfo() { + String[] info = new String[getBackingMap().size()]; + int i = 0; + for (EMInstanceStack instance : getBackingMap().values()) { + info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName()+ + " "+ EnumChatFormatting.AQUA + instance.getDefinition().getSymbol()+ EnumChatFormatting.RESET+ + " #: " + EnumChatFormatting.GREEN + String.format("%.3E", instance.getAmount() / AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ + " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ + " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); + } + return info; + } + + public ArrayList getScanShortSymbols(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e: getBackingMap().entrySet()){ + e.getValue().addScanShortSymbols(list,capabilities); + } + return list; + } + + public ArrayList getScanInfo(int[] capabilities) { + ArrayList list=new ArrayList<>(16); + for(Map.Entry e: getBackingMap().entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + + //Tick Content + public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { + return tickContent(lifeTimeMult,postEnergize,1D); + } + + public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ + cleanUp(); + double diff=0; + for (EMInstanceStack instance : valuesToArray()) { + instance.setAge(instance.getAge() + seconds); + EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize); + if (newInstances == null) { + instance.nextColor(); + } else { + diff=add(diff,newInstances.getMassDiff()); + removeAmount(instance);//todo check maybe this should be removeKey + putUnifyAll(newInstances.getOutput()); + } + } + return diff; + } + + //NBT + public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanShortSymbols(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public NBTTagCompound getScanInfoNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public static EMInstanceStackMap fromNBT(NBTTagCompound nbt) throws EMException { + EMInstanceStack[] instances = new EMInstanceStack[nbt.getInteger("i")]; + for (int i = 0; i < instances.length; i++) { + instances[i] = EMInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + if (instances[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + 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"); + for(EMInstanceStack stack: getBackingMap().values()){ + build.append(stack.toString()).append('\n'); + } + return build.toString(); + } + + public EMInstanceStackMap takeAll(){ + EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map + this.getBackingMap().clear(); + return newStack; + } + + public EMDefinitionStackMap toDefinitionMapForComparison() { + EMDefinitionStack[] list = new EMDefinitionStack[size()]; + int i = 0; + for (Map.Entry entry : entrySet()) { + EMInstanceStack value = entry.getValue(); + list[i++] = new EMDefinitionStack(value.getDefinition(), value.getAmount()); + } + return new EMDefinitionStackMap(list); + } + + @Override + public EMInstanceStack putUnify(EMInstanceStack stack) { + EMInstanceStack target =get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = add(target.getAmount(), stack.getAmount()); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=target.unifyIntoThis(stack); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + @Override + public EMInstanceStack putUnifyExact(EMInstanceStack stack) { + EMInstanceStack target =get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = target.getAmount()+stack.getAmount(); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=target.unifyIntoThis(stack); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java new file mode 100644 index 0000000000..4c798499b5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; + +import java.util.NavigableMap; +import java.util.TreeMap; + +/** + * Created by Tec on 12.05.2017. + */ +abstract class EMStackMap implements IEMMapRead { + private final NavigableMap backingMap; + + protected EMStackMap() { + this(new TreeMap<>()); + } + + protected EMStackMap(NavigableMap map) { + this.backingMap =map; + } + + @Override + public NavigableMap getBackingMap() { + return backingMap; + } + + @Override + public abstract EMStackMap clone(); + + @Override + public boolean equals(Object obj) { + if (obj instanceof EMInstanceStackMap) { + return compareTo(((EMInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; + } + if (obj instanceof EMStackMap) { + return compareTo((EMStackMap) obj) == 0; + } + return false; + } + + @Override + public int hashCode() {//Hash only definitions to compare contents not amounts or data + int hash = -(getBackingMap().size() << 4); + for (T stack : getBackingMap().values()) { + hash += stack.getDefinition().hashCode(); + } + return hash; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java new file mode 100644 index 0000000000..392d06f5cf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java @@ -0,0 +1,275 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.lang.reflect.Array; +import java.util.*; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; +import static com.github.technus.tectech.util.DoubleCount.ulpSigned; + +public interface IEMMapRead extends Comparable>, Cloneable { + static boolean isValidAmount(double amount){ + return amount>=AVOGADRO_CONSTANT_UNCERTAINTY; + } + + static boolean isInvalidAmount(double amount){ + return amount getBackingMap(); + + IEMMapRead clone(); + + default Set> entrySet(){ + return getBackingMap().entrySet(); + } + + default Set keySet(){ + return getBackingMap().keySet(); + } + + default IEMDefinition[] keySetToArray() { + return keySetToArray(new IEMDefinition[size()]); + } + + default IEMDefinition[] keySetToArray(IEMDefinition[] array) { + return keySet().toArray(array); + } + + default Collection values(){ + return getBackingMap().values(); + } + + @SuppressWarnings("unchecked") + default T[] valuesToArray(){ + return valuesToArray((T[]) Array.newInstance(getType(),size())); + } + + default T[] valuesToArray(T[] array){ + return values().toArray(array); + } + + Class getType(); + + //Getters + default T getFirst(){ + return getBackingMap().firstEntry().getValue(); + } + + default T getLast(){ + return getBackingMap().lastEntry().getValue(); + } + + default T get(IEMStack stack) { + return get(stack.getDefinition()); + } + + default T get(IEMDefinition def) { + return getBackingMap().get(def); + } + + default T getNaturallySorted(int pos) { + if(pos<0 || pos>=size()){ + throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size()); + } + for (Map.Entry entry : entrySet()) { + if(pos==0){ + return entry.getValue(); + } + pos--; + } + return null; + } + + default T getRandom() { + return getNaturallySorted(TecTech.RANDOM.nextInt(size())); + } + + default String[] getShortSymbolsInfo() { + String[] info = new String[size()]; + int i = 0; + for (T instance : values()) { + info[i++] = instance.getDefinition().getShortSymbol(); + } + return info; + } + + default String[] getElementalInfo() { + String[] info = new String[size() * 3]; + int i = 0; + for (T defStack : values()) { + info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getLocalizedName(); + info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); + info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; + i += 3; + } + return info; + } + + //NBT + default NBTTagCompound getShortSymbolsNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getShortSymbolsInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound getInfoNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getElementalInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger("i", size()); + int i = 0; + for (T stack : values()) { + nbt.setTag(Integer.toString(i++), stack.toNBT()); + } + return nbt; + } + + @Override + default int compareTo(IEMMapRead o) {//this actually compares rest + int sizeDiff = size() - o.size(); + if (sizeDiff != 0) { + return sizeDiff; + } + + Iterator iterator = values().iterator(); + Iterator iteratorO = o.values().iterator(); + + while (iterator.hasNext()) { + int result = iterator.next().compareTo(iteratorO.next()); + if (result != 0) { + return result; + } + } + return 0; + } + + default double getMass(){ + double mass=0; + for (Map.Entry entry : entrySet()) { + mass+=entry.getValue().getMass(); + } + return mass; + } + + default long getCharge(){ + long charge=0; + for (Map.Entry entry : entrySet()) { + charge+=entry.getValue().getCharge(); + } + return charge; + } + + //Tests + default boolean containsKey(IEMDefinition def) { + return getBackingMap().containsKey(def); + } + + default boolean containsKey(IEMStack def) { + return containsKey(def.getDefinition()); + } + + default boolean containsAllKeys(IEMDefinition... definitions) { + for (IEMDefinition def : definitions) { + if (!containsKey(def)) { + return false; + } + } + return true; + } + + default boolean containsAllKeys(IEMStack... hasElementalDefinition) { + for (IEMStack has : hasElementalDefinition) { + if (!containsKey(has)) { + return false; + } + } + return true; + } + + default boolean containsAmountExact(IEMDefinition def, double amount) { + T target = getBackingMap().get(def); + return target != null && target.getAmount() >= amount; + } + + default boolean containsAmountExact(IEMStack stack) { + return containsAmountExact(stack.getDefinition(),stack.getAmount()); + } + + default boolean containsAllAmountsExact(IEMStack... stacks) { + for (IEMStack stack : stacks) { + if(!containsAmountExact(stack)){ + return false; + } + } + return true; + } + + default boolean containsAllAmountsExact(IEMMapRead container) { + for (Map.Entry entry : container.entrySet()) { + if(!containsAmountExact(entry.getValue())){ + return false; + } + } + return true; + } + + default boolean containsAmount(IEMDefinition def, double amountToConsume) { + double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + if(amountRequired==amountToConsume){ + amountRequired-=ulpSigned(amountRequired); + } + return containsAmountExact(def,amountRequired); + } + + default boolean containsAmount(IEMStack stack) { + return containsAmount(stack.getDefinition(),stack.getAmount()); + } + + default boolean containsAllAmounts(IEMStack... stacks) { + for (IEMStack stack : stacks) { + if(!containsAmount(stack)){ + return false; + } + } + return true; + } + + default boolean containsAllAmounts(IEMMapRead container) { + for (Map.Entry entry : container.entrySet()) { + if(!containsAmount(entry.getValue())){ + return false; + } + } + return true; + } + + default int size() { + return getBackingMap().size(); + } + + default boolean hasStacks() { + return !isEmpty(); + } + + default boolean isEmpty(){ + return getBackingMap().isEmpty(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java new file mode 100644 index 0000000000..cc22267474 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -0,0 +1,112 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; + +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_EPSILON; +import static com.github.technus.tectech.util.DoubleCount.*; + +public interface IEMMapWrite extends IEMMapWriteExact { + IEMMapWrite clone(); + + /** + * Consumes amount from map + * @param def def to consume + * @param amountToConsume should be comparable to {@link EMTransformationInfo#AVOGADRO_CONSTANT} + * @return consumed successfully + */ + default boolean removeAmount(IEMDefinition def, double amountToConsume){ + double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + if(amountRequired==amountToConsume){ + amountRequired-=ulpSigned(amountRequired); + } + return removeAmount(def,amountToConsume,amountRequired); + } + + default boolean removeAmount(IEMDefinition def, double amountToConsume, double amountRequired){ + T current=getBackingMap().get(def); + if(current!=null){ + if(current.getAmount()>=amountRequired){ + double newAmount=sub(current.getAmount(),amountToConsume); + if(IEMMapRead.isValidAmount(current.getAmount())){ + current=(T)current.mutateAmount(newAmount); + getBackingMap().put(current.getDefinition(),current); + }else { + getBackingMap().remove(current.getDefinition()); + } + return true; + } + } + return false; + } + + default boolean removeAmount(IEMStack stack) { + return removeAmount(stack.getDefinition(),stack.getAmount()); + } + + default boolean removeAllAmounts(IEMStack... stacks) { + boolean test = true; + for (IEMStack stack : stacks) { + test &= containsAmount(stack); + } + if (!test) { + return test; + } + for (IEMStack stack : stacks) { + removeAmount(stack); + } + return true; + } + + default boolean removeAllAmounts(IEMMapRead map) { + boolean test=true; + for (Map.Entry entry : map.entrySet()) { + test &= containsAmount(entry.getValue()); + } + if (!test) { + return test; + } + for (Map.Entry entry : map.entrySet()) { + removeAmount(entry.getValue()); + } + return true; + } + + //Put unify + /** + * + * @param stack thing to put + * @return new mapping or null if merging actually removed stuff + */ + default T putUnify(T stack) { + T target=getBackingMap().get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = add(target.getAmount(), stack.getAmount()); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=(T) target.mutateAmount(newAmount); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + default void putUnifyAll(T... defs) { + for (T def : defs) { + putUnify(def); + } + } + + default void putUnifyAll(IEMMapRead inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnify(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java new file mode 100644 index 0000000000..7b8853a2f4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -0,0 +1,166 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; + +import java.util.Map; + +public interface IEMMapWriteExact extends IEMMapRead { + default void cleanUp(){ + entrySet().removeIf(entry -> IEMMapRead.isInvalidAmount(entry.getValue().getAmount())); + } + + default void clear() { + getBackingMap().clear(); + } + + IEMMapWriteExact clone(); + + //Remove + default T removeKey(IEMDefinition def) { + return getBackingMap().remove(def); + } + + default T removeKey(IEMStack has) { + return removeKey(has.getDefinition()); + } + + default boolean removeKeys(IEMDefinition... definitions) { + boolean hadAll=true; + for (IEMDefinition def : definitions) { + hadAll&=removeKey(def)!=null; + } + return hadAll; + } + + default boolean removeKeys(IEMStack... hasElementalDefinition) { + boolean hadAll=true; + for (IEMStack has : hasElementalDefinition) { + hadAll&=removeKey(has)!=null; + } + return hadAll; + } + + default boolean removeAllKeys(IEMDefinition... definitions) { + boolean hadAll=containsAllKeys(definitions); + if(hadAll){ + for (IEMDefinition def : definitions) { + removeKey(def); + } + } + return hadAll; + } + + default boolean removeAllKeys(IEMStack... hasElementalDefinition) { + boolean hadAll=containsAllKeys(hasElementalDefinition); + if(hadAll){ + for (IEMStack stack : hasElementalDefinition) { + removeKey(stack); + } + } + return hadAll; + } + + default void putReplace(T defStackUnsafe) { + getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); + } + + default void putReplaceAll(T... defStacksUnsafe) { + for (T defStack : defStacksUnsafe) { + putReplace(defStack); + } + } + + default void putReplaceAll(IEMMapRead inContainerUnsafe) { + getBackingMap().putAll(inContainerUnsafe.getBackingMap()); + } + + /** + * Should only be used when modifying definitions to alter the integer count correctly + * @param def + * @return + */ + default boolean removeAmountExact(IEMStack def){ + return removeAmountExact(def.getDefinition(),def.getAmount()); + } + + /** + * Should only be used when modifying definitions to alter the integer count correctly + * @param def + * @param amountToConsume + * @return + */ + default boolean removeAmountExact(IEMDefinition def, double amountToConsume){ + T current=getBackingMap().get(def); + if(current!=null){ + double newAmount=current.getAmount()-amountToConsume; + if(newAmount>=0){ + if(IEMMapRead.isValidAmount(current.getAmount())){ + current=(T)current.mutateAmount(newAmount); + getBackingMap().put(current.getDefinition(),current); + } else { + getBackingMap().remove(current.getDefinition()); + } + return true; + } + } + return false; + } + + default boolean removeAllAmountsExact(IEMStack... stacks) { + boolean test = true; + for (IEMStack stack : stacks) { + test &= containsAmountExact(stack); + } + if (!test) { + return test; + } + for (IEMStack stack : stacks) { + removeAmountExact(stack); + } + return true; + } + + default boolean removeAllAmountsExact(IEMMapRead map) { + boolean test=true; + for (Map.Entry entry : map.entrySet()) { + test &= containsAmountExact(entry.getValue()); + } + if (!test) { + return test; + } + for (Map.Entry entry : map.entrySet()) { + removeAmountExact(entry.getValue()); + } + return true; + } + + default T putUnifyExact(T stack) { + T target=getBackingMap().get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = target.getAmount()+stack.getAmount(); + if (IEMMapRead.isValidAmount(newAmount)) { + stack=(T) target.mutateAmount(newAmount); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + default void putUnifyAllExact(T... defs) { + for (T def : defs) { + putUnifyExact(def); + } + } + + default void putUnifyAllExact(IEMMapRead inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnifyExact(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java deleted file mode 100644 index cde1d55561..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.Collections; -import java.util.NavigableMap; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by Tec on 12.05.2017. - */ -public final class cElementalConstantStackMap/*IMMUTABLE*/ extends cElementalStackMap {//Target class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public static final cElementalConstantStackMap EMPTY = new cElementalConstantStackMap(); - - private cElementalConstantStackMap() { - super(Collections.emptyNavigableMap()); - } - - public cElementalConstantStackMap(cElementalDefinitionStack... in) { - this(new cElementalDefinitionStackMap(in).map); - } - - public cElementalConstantStackMap(NavigableMap in) { - super(Collections.unmodifiableNavigableMap(in)); - } - - @Override - public Class getType() { - return cElementalDefinitionStack.class; - } - - //IMMUTABLE DON'T NEED IT - @Override - public cElementalConstantStackMap clone() { - return this; - } - - public cElementalDefinitionStackMap toMutable() { - return new cElementalDefinitionStackMap(new TreeMap<>(map)); - } - - public static cElementalConstantStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalConstantStackMap(defStacks); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java deleted file mode 100644 index 1273119bb3..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.NavigableMap; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalDefinitionStackMap extends cElementalStackMap implements iElementalMapRW {//Transient class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public cElementalDefinitionStackMap() {} - - public cElementalDefinitionStackMap(cElementalDefinitionStack... in) { - putUnifyAll(in); - } - - public cElementalDefinitionStackMap(NavigableMap in) { - super(in); - } - - @Override - public Class getType() { - return cElementalDefinitionStack.class; - } - - @Override - public cElementalDefinitionStackMap clone() { - return new cElementalDefinitionStackMap(new TreeMap<>(map)); - } - - public cElementalConstantStackMap toImmutable() { - return new cElementalConstantStackMap(new TreeMap<>(map)); - } - - public cElementalConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { - return new cElementalConstantStackMap(map); - } - - public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalDefinitionStackMap(defStacks); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java deleted file mode 100644 index aab1f93990..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.ArrayList; -import java.util.Map; -import java.util.NavigableMap; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.util.DoubleCount.add; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalInstanceStackMap extends cElementalStackMap implements iElementalMapRW { - //Constructors - public cElementalInstanceStackMap() {} - - public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) { - this(true, inSafe); - } - - public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) { - if (clone) { - cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length]; - for(int i=0;i inSafe) { - this(true, inSafe); - } - - private cElementalInstanceStackMap(boolean clone, NavigableMap in) { - if (clone) { - map = new TreeMap<>(); - for(cElementalInstanceStack stack:in.values()) { - putUnify(stack.clone()); - } - } else { - map = in; - } - } - - @Override - public Class getType() { - return cElementalInstanceStack.class; - } - - @Override - public cElementalInstanceStackMap clone() { - return new cElementalInstanceStackMap(map); - } - - //Remove overflow - public double removeOverflow(int stacksCount, double stackCapacity) { - double massRemoved = 0; - - if (map.size() > stacksCount) { - iElementalDefinition[] keys = keySetToArray(); - for (int i = stacksCount; i < keys.length; i++) { - massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); - map.remove(keys[i]); - } - } - - for (cElementalInstanceStack instance : valuesToArray()) { - if (instance.amount > stackCapacity) { - massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); - instance.amount = stackCapacity; - } - } - return massRemoved; - } - - //Getters - public String[] getElementalInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ - " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ - " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ - " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ - " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); - } - return info; - } - - public ArrayList getScanShortSymbols(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanShortSymbols(list,capabilities); - } - return list; - } - - public ArrayList getScanInfo(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e:map.entrySet()){ - e.getValue().addScanResults(list,capabilities); - } - return list; - } - - //Tick Content - public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { - return tickContent(lifeTimeMult,postEnergize,1D); - } - - public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ - cleanUp(); - double diff=0; - for (cElementalInstanceStack instance : valuesToArray()) { - cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); - if (newInstances == null) { - instance.nextColor(); - } else { - diff=add(diff,newInstances.getMassDiff()); - removeAmount(false,instance); - putUnifyAll(newInstances.getOutput()); - } - } - return diff; - } - - //NBT - public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanShortSymbols(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound getScanInfoNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanInfo(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; - for (int i = 0; i < instances.length; i++) { - instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (instances[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalInstanceStackMap(false, instances); - } - - //stackUp - public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { - cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); - inTree.putUnifyAll(in); - return inTree.valuesToArray(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalInstanceStackMap) { - return compareTo((cElementalInstanceStackMap) obj) == 0; - } - if (obj instanceof cElementalStackMap) { - return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0; - } - return false; - } - - @Override - public String toString() { - StringBuilder build=new StringBuilder("Instance Stack Map\n"); - for(cElementalInstanceStack stack:map.values()){ - build.append(stack.toString()).append('\n'); - } - return build.toString(); - } - - public cElementalInstanceStackMap takeAll(){ - cElementalInstanceStackMap newStack=new cElementalInstanceStackMap(false,new TreeMap<>(this.map));//just in case to uncouple The map - this.map.clear(); - return newStack; - } - - public cElementalDefinitionStackMap toDefinitionMapForComparison() { - cElementalDefinitionStack[] list = new cElementalDefinitionStack[size()]; - int i = 0; - for (Map.Entry entry : entrySet()) { - cElementalInstanceStack value = entry.getValue(); - list[i++] = new cElementalDefinitionStack(value.getDefinition(), value.getAmount()); - } - return new cElementalDefinitionStackMap(list); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java deleted file mode 100644 index 2b144df128..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -import java.util.NavigableMap; -import java.util.TreeMap; - -/** - * Created by Tec on 12.05.2017. - */ -abstract class cElementalStackMap implements iElementalMapR { - protected NavigableMap map; - - protected cElementalStackMap() { - this(new TreeMap<>()); - } - - protected cElementalStackMap(NavigableMap map) { - this.map = map; - } - - @Override - public NavigableMap getBackingMap() { - return map; - } - - @Override - public abstract cElementalStackMap clone(); - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalInstanceStackMap) { - return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; - } - if (obj instanceof cElementalStackMap) { - return compareTo((cElementalStackMap) obj) == 0; - } - return false; - } - - @Override - public int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (T stack : map.values()) { - hash += stack.getDefinition().hashCode(); - } - return hash; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java deleted file mode 100644 index 0491c43ebc..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.lang.reflect.Array; -import java.util.*; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; - -public interface iElementalMapR extends Comparable>, Cloneable { - NavigableMap getBackingMap(); - - iElementalMapR clone(); - - default Set> entrySet(){ - return getBackingMap().entrySet(); - } - - default Set keySet(){ - return getBackingMap().keySet(); - } - - default iElementalDefinition[] keySetToArray() { - return keySetToArray(new iElementalDefinition[size()]); - } - - default iElementalDefinition[] keySetToArray(iElementalDefinition[] array) { - return getBackingMap().keySet().toArray(array); - } - - default Collection values(){ - return getBackingMap().values(); - } - - @SuppressWarnings("unchecked") - default T[] valuesToArray(){ - return valuesToArray((T[]) Array.newInstance(getType(),size())); - } - - default T[] valuesToArray(T[] array){ - return getBackingMap().values().toArray(array); - } - - Class getType(); - - //Getters - default T getFirst(){ - return getBackingMap().firstEntry().getValue(); - } - - default T getLast(){ - return getBackingMap().lastEntry().getValue(); - } - - default T get(iElementalDefinition def) { - return getBackingMap().get(def); - } - - default T getNaturallySorted(int pos) { - if(pos<0 || pos>=size()){ - throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size()); - } - for (Map.Entry entry : entrySet()) { - if(pos==0){ - return entry.getValue(); - } - pos--; - } - return null; - } - - default T getRandom() { - return getNaturallySorted(TecTech.RANDOM.nextInt(size())); - } - - default String[] getShortSymbolsInfo() { - String[] info = new String[size()]; - int i = 0; - for (T instance : values()) { - info[i++] = instance.getDefinition().getShortSymbol(); - } - return info; - } - - default String[] getElementalInfo() { - String[] info = new String[size() * 3]; - int i = 0; - for (T defStack : values()) { - info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getName(); - info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; - i += 3; - } - return info; - } - - //NBT - default NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - default NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - default NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", size()); - int i = 0; - for (T stack : values()) { - nbt.setTag(Integer.toString(i++), stack.toNBT()); - } - return nbt; - } - - @Override - default int compareTo(iElementalMapR o) {//this actually compares rest - int sizeDiff = size() - o.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - - Iterator iterator = values().iterator(); - Iterator iteratorO = o.values().iterator(); - - while (iterator.hasNext()) { - int result = iterator.next().compareTo(iteratorO.next()); - if (result != 0) { - return result; - } - } - return 0; - } - - default double getMass(){ - double mass=0; - for (Map.Entry entry : getBackingMap().entrySet()) { - mass+=entry.getValue().getMass(); - } - return mass; - } - - default long getCharge(){ - long charge=0; - for (Map.Entry entry : getBackingMap().entrySet()) { - charge+=entry.getValue().getCharge(); - } - return charge; - } - - //Tests - default boolean containsKey(iElementalDefinition def) { - return getBackingMap().containsKey(def); - } - - default boolean containsKey(iElementalStack def) { - return containsKey(def.getDefinition()); - } - - default int size() { - return getBackingMap().size(); - } - - default boolean hasStacks() { - return !isEmpty(); - } - - default boolean isEmpty(){ - return getBackingMap().isEmpty(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java deleted file mode 100644 index 7f8d314858..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.maps; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -import java.util.Map; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; -import static com.github.technus.tectech.util.DoubleCount.sub; - -public interface iElementalMapRW extends iElementalMapR { - iElementalMapRW clone(); - - default void cleanUp(){ - getBackingMap().entrySet().removeIf(entry -> entry.getValue().getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY); - } - - default void clear() { - getBackingMap().clear(); - } - - //Remove - default T remove(iElementalDefinition def) { - return getBackingMap().remove(def); - } - - default T remove(iElementalStack has) { - return remove(has.getDefinition()); - } - - default void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - getBackingMap().remove(def); - } - } - - default void removeAll(iElementalStack... hasElementalDefinition) { - for (iElementalStack has : hasElementalDefinition) { - getBackingMap().remove(has.getDefinition()); - } - } - - default boolean removeAmount(boolean testOnly, iElementalStack stack) { - return removeAmount(testOnly,stack.getDefinition(),stack.getAmount()); - } - - default boolean removeAmount(boolean testOnly, iElementalDefinition def,double amount) { - T target = getBackingMap().get(def); - if (target == null) { - return false; - } - if (testOnly) { - return target.getAmount() >= amount; - } else { - double newAmount = sub(target.getAmount(),amount); - if (newAmount > 0) { - getBackingMap().put(target.getDefinition(), (T)target.mutateAmount(newAmount)); - return true; - } else if (newAmount == 0) { - getBackingMap().remove(def); - return true; - } - } - return false; - } - - default boolean removeAllAmounts(boolean testOnly, iElementalStack... stacks) { - boolean test = true; - for (iElementalStack stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iElementalStack stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - default boolean removeAllAmounts(boolean testOnly, iElementalMapR container) { - boolean test=true; - for (Map.Entry entry : container.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry entry : container.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - //Put replace - default T putReplace(T defStackUnsafe) { - return getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); - } - - default void putReplaceAll(T... defStacks) { - for (T defStack : defStacks) { - getBackingMap().put(defStack.getDefinition(), defStack); - } - } - - default void putReplaceAll(iElementalMapR inContainerUnsafe) { - getBackingMap().putAll(inContainerUnsafe.getBackingMap()); - } - - //Put unify - default T putUnify(T def) { - T stack=getBackingMap().get(def.getDefinition()); - if(stack==null) { - return getBackingMap().put(def.getDefinition(), def); - } - return getBackingMap().put(def.getDefinition(), (T)stack.mutateAmount(def.getAmount()+stack.getAmount())); - } - - default void putUnifyAll(T... defs) { - for (T def : defs) { - putUnify(def); - } - } - - default void putUnifyAll(iElementalMapR inTreeUnsafe) { - for (T in : inTreeUnsafe.values()) { - putUnify(in); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java new file mode 100644 index 0000000000..4b0792eac9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java @@ -0,0 +1,87 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 02.03.2017. + */ +public class EMRecipe implements Comparable> { + private final int ID; + private final EMConstantStackMap inEM; + private final IEMMapRead outEM; + private final ItemStack[] outItems; + private final FluidStack[] outFluids; + private T extension; + + public EMRecipe( + EMConstantStackMap inEM,//not null plz + int id, + IEMMapRead outEM, + ItemStack[] outItems, + FluidStack[] outFluids) { + this.inEM = inEM; + this.outEM = outEM; + this.outItems = outItems; + this.outFluids = outFluids; + ID = id;//allows multiple recipes with the same input EM,so u can actually extend... + } + + public EMRecipe extend(T data) { + setExtension(data); + return this; + } + + @Override + public int compareTo(EMRecipe o) { + int compare = getInEM().compareTo(o.getInEM()); + if(compare!=0) { + return compare; + } + return Integer.compare(getID(), o.getID()); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof EMRecipe) { + return compareTo((EMRecipe) obj) == 0; + } + return false; + } + + @Override + public int hashCode() { + return getInEM().hashCode(); + } + + public int getID() { + return ID; + } + + public EMConstantStackMap getInEM() { + return inEM; + } + + public IEMMapRead getOutEM() { + return outEM; + } + + public ItemStack[] getOutItems() { + return outItems; + } + + public FluidStack[] getOutFluids() { + return outFluids; + } + + public T getExtension() { + return extension; + } + + public void setExtension(T extension) { + this.extension = extension; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java new file mode 100644 index 0000000000..811a9bc370 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java @@ -0,0 +1,65 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Tec on 02.03.2017. + */ +public class EMRecipeMap {//TODO FIX + //Multimap for multiple recipes from the same thing - you know parameters might differ the output + private final Map>> recipes; + + public EMRecipeMap() { + recipes = new HashMap<>(); + } + + public EMRecipe put(EMRecipe in) { + Map> r = getRecipes().computeIfAbsent(in.getInEM(), k -> new HashMap<>()); + return r.put(in.getID(), in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) + //It is either bad, or unimportant if you use different id's + } + + public void putAll(EMRecipe... contents) { + for (EMRecipe recipe : contents) { + put(recipe); + } + } + + public EMRecipe remove(IEMMapRead map, int id) { + Map> recipesMap = getRecipes().get(map); + return recipesMap != null ? recipesMap.remove(id) : null;//todo check, suspicious but ok, equals and hashcode methods are adjusted for that + } + + public Map> remove(IEMMapRead map) { + return getRecipes().remove(map);//todo check, suspicious but ok, equals and hashcode methods are adjusted for that + } + + //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! + //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) + @Deprecated + public Map> findExact(IEMMapRead in) { + return getRecipes().get(in);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + //this does check if the map contains all the requirements for any recipe, and the required amounts + //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! + public Map> findMatch(IEMMapRead in) { + for (Map.Entry>> cElementalDefinitionStackMapHashMapEntry : getRecipes().entrySet()) { + if (in.containsAllAmounts(cElementalDefinitionStackMapHashMapEntry.getKey())) { + return cElementalDefinitionStackMapHashMapEntry.getValue(); + } + } + return null; + } + + public Map>> getRecipes() { + return recipes; + } + + //To check for instance data and other things use recipe extensions! +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java deleted file mode 100644 index 8c0fb40a4b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipe implements Comparable { - public final short ID; - public final cElementalConstantStackMap inEM; - public final cElementalConstantStackMap outEM; - public final ItemStack[] outItems; - public final FluidStack[] outFluids; - public Object[] extension; - - public rElementalRecipe( - cElementalConstantStackMap inEM,//not null plz - short id, - cElementalConstantStackMap outEM, - ItemStack[] outItems, - FluidStack[] outFluids) { - this.inEM = inEM; - this.outEM = outEM; - this.outItems = outItems; - this.outFluids = outFluids; - ID = id;//allows multiple recipes with the same input EM,so u can actually extend... - } - - public rElementalRecipe extend(Object... data) { - extension = data; - return this; - } - - @Override - public int compareTo(rElementalRecipe o) { - int compare = inEM.compareTo(o.inEM); - if(compare!=0) { - return compare; - } - return Short.compare(ID, o.ID); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof rElementalRecipe) { - return compareTo((rElementalRecipe) obj) == 0; - } - return false; - } - - @Override - public int hashCode() { - return inEM.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java deleted file mode 100644 index 56a9030354..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; - -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipeMap {//TODO FIX - //Multimap for multiple recipes from the same thing - you know parameters might differ the output - private final HashMap> recipes; - - public rElementalRecipeMap() { - recipes = new HashMap<>(); - } - - public rElementalRecipe put(rElementalRecipe in) { - HashMap r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>()); - return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) - //It is either bad, or unimportant if you use different id's - } - - public void putAll(rElementalRecipe... contents) { - for (rElementalRecipe recipe : contents) { - put(recipe); - } - } - - public rElementalRecipe remove(iElementalMapR map, short id) { - return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap remove(iElementalMapR map) { - return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap findExact(cElementalInstanceStackMap in) { - return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! - //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) - @Deprecated - public HashMap findExact(iElementalMapR in) { - return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //this does check if the map contains all the requirements for any recipe, and the required amounts - //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! - @Deprecated - public HashMap findMatch(cElementalDefinitionStackMap in, boolean testOnlyTruePreferred) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - public HashMap findMatch(cElementalInstanceStackMap in, boolean testOnly) { - for (Map.Entry> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - //To check for instance data and other things use recipe extensions! -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java new file mode 100644 index 0000000000..fe0c73e795 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +/** + * Created by danie_000 on 20.11.2016. + */ +public final class EMDefinitionStack implements IEMStack { + private final IEMDefinition definition; + private final double amount; + + public EMDefinitionStack(IEMDefinition def, double amount) { + definition = def == null ? null__ : def; + this.amount = amount; + } + + @Override + public EMDefinitionStack clone() { + return this;//IMMUTABLE + } + + @Override + public EMDefinitionStack mutateAmount(double newAmount) { + if(getAmount() == newAmount){ + return this; + } + return new EMDefinitionStack(getDefinition(), newAmount);//IMMUTABLE + } + + @Override + public IEMDefinition getDefinition() { + return definition;//IMMUTABLE + } + + @Override + public double getAmount() { + return amount; + } + + public NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("d", getDefinition().toNBT()); + nbt.setDouble("Q", getAmount()); + return nbt; + } + + public static EMDefinitionStack fromNBT(NBTTagCompound nbt) { + return new EMDefinitionStack( + EMComplex.fromNBT(nbt.getCompoundTag("d")), + nbt.getLong("q")+nbt.getDouble("Q")); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof IEMDefinition) { + return getDefinition().compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + //Amount shouldn't be hashed if this is just indicating amount and not structure + @Override + public int hashCode() { + return getDefinition().hashCode(); + } +} 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 new file mode 100644 index 0000000000..b73bd21f02 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java @@ -0,0 +1,605 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +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.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.util.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.DoubleCount.*; +import static java.lang.Math.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMInstanceStack implements IEMStack { + public static int MIN_MULTIPLE_DECAY_CALLS = 4, MAX_MULTIPLE_DECAY_CALLS = 16; + public static double DECAY_CALL_PER = AVOGADRO_CONSTANT;//todo + + private final IEMDefinition definition; + private double amount; + + private double age; + //energy - if positive then particle should try to decay + private long energy; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private byte color; + private double lifeTime; + private double lifeTimeMult; + + public EMInstanceStack(IEMStack stackSafe) { + this(stackSafe.getDefinition(), stackSafe.getAmount(), 1D, 0D, 0); + } + + public EMInstanceStack(IEMStack stackSafe, double lifeTimeMult, double age, long energy) { + this(stackSafe.getDefinition(), stackSafe.getAmount(), lifeTimeMult, age, energy); + } + + public EMInstanceStack(IEMDefinition defSafe, double amount) { + this(defSafe, amount, 1D, 0D, 0); + } + + public EMInstanceStack(IEMDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { + definition = defSafe == null ? null__ : defSafe; + byte bColor = getDefinition().getColor(); + if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color + this.color = bColor; + } else { + this.color = (byte) TecTech.RANDOM.nextInt(3); + } + this.lifeTimeMult = lifeTimeMult; + lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult; + setEnergy(energy); + this.setAge(age); + this.setAmount(amount); + } + + //Clone proxy + private EMInstanceStack(EMInstanceStack stack) { + definition = stack.getDefinition(); + color = stack.color; + setAge(stack.getAge()); + setAmount(stack.getAmount()); + lifeTime = stack.lifeTime; + lifeTimeMult = stack.lifeTimeMult; + energy = stack.energy; + } + + @Override + public EMInstanceStack clone() { + return new EMInstanceStack(this); + } + + @Override + public EMInstanceStack mutateAmount(double newAmount) { + this.setAmount(newAmount); + return this; + } + + @Override + public double getAmount() { + return amount; + } + + public long getEnergy() { + return energy; + } + + public void setEnergy(long newEnergyLevel) { + energy = newEnergyLevel; + setLifeTimeMultiplier(getLifeTimeMultiplier()); + } + + public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel) { + return getDefinition().getEnergyDiffBetweenStates(currentEnergyLevel, newEnergyLevel) * getAmount(); + } + + public double getEnergySettingCost(long newEnergyLevel) { + return getEnergySettingCost(energy, newEnergyLevel) * getAmount(); + } + + public EMDefinitionStack getDefinitionStack() { + return new EMDefinitionStack(getDefinition(), getAmount()); + } + + @Override + public IEMDefinition getDefinition() { + return definition; + } + + public byte getColor() { + return color; + } + + public void setColor(byte color) {//does not allow changing magic element + if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { + return; + } + this.color = color; + } + + public void nextColor() {//does not allow changing magic element + if (color < 0 || color > 2) { + return; + } + color = (byte) TecTech.RANDOM.nextInt(3); + } + + public double getLifeTime() { + return lifeTime; + } + + public void setLifeTimeMultiplier(double mult) { + if (mult <= 0) //since infinity*0=nan + { + throw new IllegalArgumentException("multiplier must be >0"); + } + lifeTimeMult = mult; + if (getDefinition().getRawTimeSpan(energy) <= 0) { + return; + } + lifeTime = getDefinition().getRawTimeSpan(energy) * lifeTimeMult; + } + + public double getLifeTimeMultiplier() { + return lifeTimeMult; + } + + public EMDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize) { + return tickStack(lifeTimeMult, postEnergize, 1D); + } + + public EMDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds) { + setAge(getAge() + seconds); + EMDecayResult newInstances = decay(lifeTimeMult, getAge(), postEnergize); + if (newInstances == null) { + nextColor(); + } else { + for (EMInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { + newInstance.nextColor(); + } + } + return newInstances; + } + + public EMDecayResult decay() { + return decay(1D, getAge(), 0);//try to decay without changes + } + + public EMDecayResult decay(double apparentAge, long postEnergize) { + return decay(1D, apparentAge, postEnergize); + } + + public EMDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) { + long newEnergyLevel = postEnergize + energy; + if (newEnergyLevel > 0) { + newEnergyLevel -= 1; + } else if (newEnergyLevel < 0) { + newEnergyLevel += 1; + } + EMDecayResult output; + if (getDefinition().usesMultipleDecayCalls(energy)) { + double amountTemp = getAmount(); + int decayCnt = (int) min(MAX_MULTIPLE_DECAY_CALLS, max(getAmount() / DECAY_CALL_PER, MIN_MULTIPLE_DECAY_CALLS)); + setAmount(div(getAmount(), decayCnt)); + decayCnt--; + + output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + if (output == null) { + setAmount(amountTemp); + return null; + } + + for (int i = 0; i < decayCnt; i++) { + EMDecayResult map = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + if (map != null) { + output.getOutput().putUnifyAll(map.getOutput()); + output.setMassDiff(add(output.getMassDiff(), map.getMassDiff())); + output.setMassAffected(output.getMassDiff() + map.getMassDiff()); + } + } + setAmount(amountTemp); + } else { + output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + } + if (output != null) { + output.getOutput().cleanUp(); + } + return output; + } + + private EMDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) { + if (energy > 0 && !getDefinition().usesSpecialEnergeticDecayHandling()) { + setLifeTimeMultiplier(getLifeTimeMultiplier()); + return decayCompute(getDefinition().getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); + } else if (getDefinition().getRawTimeSpan(energy) < 0) { + return null;//return null, decay cannot be achieved + } else if (getDefinition().isTimeSpanHalfLife()) { + return exponentialDecayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, -1D, newEnergyLevel); + } else { + if (1 > lifeTime) { + return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel); + } else if (apparentAge > lifeTime) { + return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, 0D, newEnergyLevel); + } + } + return null;//return null since decay cannot be achieved + } + + //Use to get direct decay output providing correct decay array + private EMDecayResult exponentialDecayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + double newAmount = div(getAmount(), Math.pow(2D, 1D/* 1 second */ / lifeTime)); + + //if(definition.getSymbol().startsWith("U ")) { + // System.out.println("newAmount = " + newAmount); + // System.out.println("amountRemaining = " + amountRemaining); + // for(cElementalDecay decay:decays){ + // System.out.println("prob = "+decay.probability); + // for(cElementalDefinitionStack stack:decay.outputStacks.values()){ + // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount); + // } + // } + //} + if (newAmount == getAmount()) { + newAmount -= ulpSigned(newAmount); + } else if (newAmount < 1) { + return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + } + + //split to non decaying and decaying part + double amount = this.getAmount(); + this.setAmount(this.getAmount() - newAmount); + EMDecayResult products = decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + this.setAmount(newAmount); + if (products != null) { + products.getOutput().putUnify(clone()); + } + this.setAmount(amount); + return products; + } + + //Use to get direct decay output providing correct decay array + private EMDecayResult decayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + if (decays == null) { + return null;//Can not decay so it won't + } + boolean makesEnergy = getDefinition().decayMakesEnergy(energy); + double mass = getMass(); + if (decays.length == 0) { + return makesEnergy ? null : new EMDecayResult(new EMInstanceStackMap(), mass, 0); + //provide non null 0 length array for annihilation + } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end + if (decays[0] == deadEnd) { + return makesEnergy ? null : new EMDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()), mass, 0); + } + EMInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()); + if (newProductsAge < 0) { + if (output.size() == 1) { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } + } else { + for (EMInstanceStack stack : output.valuesToArray()) { + if (stack.getDefinition().equals(getDefinition())) { + stack.setAge(getAge()); + } + } + } + } else { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + } + } + if (energy <= 0 && output.getMass() > mass) { + return null;//no energy usage to decay + } + return new EMDecayResult(new EMInstanceStackMap(), mass, makesEnergy ? output.getMass() - mass : 0); + } else { + EMDecayResult totalOutput = new EMDecayResult(new EMInstanceStackMap(), getMass(), 0); + EMInstanceStackMap output = totalOutput.getOutput(), results; + int differentDecays = decays.length; + double[] probabilities = new double[differentDecays]; + for (int i = 0; i < probabilities.length; i++) { + probabilities[i] = decays[i].getProbability(); + } + double[] qttyOfDecay; + try { + qttyOfDecay = distribute(getAmount(), probabilities); + } catch (ArithmeticException e) { + Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: " + this, e)); + return null; + } + //long amountRemaining = this.amount, amount = this.amount; + //float remainingProbability = 1D; +// + //for (int i = 0; i < differentDecays; i++) { + // if (decays[i].probability >= 1D) { + // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); + // if (thisDecayAmount > 0) { + // if (thisDecayAmount <= amountRemaining) { + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // }else {//in case too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // } + // } + // break; + // } + // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); + // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // } else if (thisDecayAmount > amountRemaining) {//too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // break; + // } + // remainingProbability -= decays[i].probability; + // if(remainingProbability<=0) { + // break; + // } + //} + + //for (int i = 0; i < amountRemaining; i++) { + // double rand = TecTech.RANDOM.nextDouble(); + // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into + // rand -= decays[j].probability; + // if (rand <= 0D) { + // qttyOfDecay[j]++; + // break; + // } + // } + //} + + if (getDefinition().decayMakesEnergy(energy)) { + for (int i = differentDecays - 1; i >= 0; i--) { + if (decays[i] == deadEnd) { + EMInstanceStack clone = clone(); + clone.setAmount(qttyOfDecay[i]); + output.putUnify(clone); + } else { + results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + totalOutput.setMassDiff(add(totalOutput.getMassDiff(), results.getMass() - mass)); + } + } + } else { + for (int i = differentDecays - 1; i >= 0; i--) { + results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + } + } + + if (newProductsAge < 0) { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } else { + for (EMInstanceStack stack : output.valuesToArray()) { + if (stack.getDefinition().equals(getDefinition())) { + stack.setAge(getAge()); + } + } + } + } else { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } + } + if (energy <= 0 && output.getMass() > getMass()) { + return null;//no energy usage to decay + } + return totalOutput; + } + } + + public EMInstanceStack unifyIntoThis(EMInstanceStack... instances) { + if (instances == null) { + return this; + } + //returns with the definition from the first object passed + double energyTotal = getEnergySettingCost(0, energy); + long maxEnergy = energy; + long minEnergy = energy; + + for (EMInstanceStack instance : instances) { + //if (instance != null && compareTo(instance) == 0) { + setAmount(add(getAmount(), instance.getAmount())); + energyTotal += instance.getEnergySettingCost(0, instance.energy); + maxEnergy = max(instance.energy, maxEnergy); + minEnergy = min(instance.energy, maxEnergy); + lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); + setAge(max(getAge(), instance.getAge())); + //} + } + + if (energyTotal >= 0) { + for (; maxEnergy > 0; maxEnergy--) { + if (getEnergySettingCost(0, maxEnergy) < energyTotal) { + break; + } + } + setEnergy(maxEnergy); + } else { + for (; minEnergy < 0; minEnergy++) { + if (getEnergySettingCost(minEnergy, 0) < energyTotal) { + break; + } + } + setEnergy(minEnergy); + } + return this; + } + + public EMInstanceStack unifyIntoThisExact(EMInstanceStack... instances) { + if (instances == null) { + return this; + } + //returns with the definition from the first object passed + double energyTotal = getEnergySettingCost(0, energy); + long maxEnergy = energy; + long minEnergy = energy; + + for (EMInstanceStack instance : instances) { + //if (instance != null && compareTo(instance) == 0) { + setAmount(getAmount() + instance.getAmount()); + energyTotal += instance.getEnergySettingCost(0, instance.energy); + maxEnergy = max(instance.energy, maxEnergy); + minEnergy = min(instance.energy, maxEnergy); + lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); + setAge(max(getAge(), instance.getAge())); + //} + } + + if (energyTotal >= 0) { + for (; maxEnergy > 0; maxEnergy--) { + if (getEnergySettingCost(0, maxEnergy) < energyTotal) { + break; + } + } + setEnergy(maxEnergy); + } else { + for (; minEnergy < 0; minEnergy++) { + if (getEnergySettingCost(minEnergy, 0) < energyTotal) { + break; + } + } + setEnergy(minEnergy); + } + return this; + } + + public void addScanShortSymbols(ArrayList lines, int[] detailsOnDepthLevels) { + int capabilities = detailsOnDepthLevels[0]; + getDefinition().addScanShortSymbols(lines, capabilities, energy); + //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); + } + + //private void scanShortSymbolsContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + // if(definitions!=null && depth lines, int[] detailsOnDepthLevels) { + int capabilities = detailsOnDepthLevels[0]; + if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { + lines.add("DEPTH = " + 0); + } + getDefinition().addScanResults(lines, capabilities, energy); + if (Util.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { + lines.add("TIME MULT = " + lifeTimeMult); + if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("TIME SPAN = " + lifeTime + " s"); + } + } + if (Util.areBitsSet(SCAN_GET_AGE, capabilities)) { + lines.add("AGE = " + getAge() + " s"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add("COLOR = " + color + " RGB or CMY"); + } + if (Util.areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { + lines.add("ENERGY = " + energy); + } + if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { + lines.add("AMOUNT = " + getAmount() / AVOGADRO_CONSTANT + " mol"); + } + scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); + } + + private void scanContents(ArrayList lines, EMConstantStackMap definitions, int depth, int[] detailsOnDepthLevels) { + if (definitions != null && depth < detailsOnDepthLevels.length) { + int deeper = depth + 1; + for (EMDefinitionStack definitionStack : definitions.valuesToArray()) { + lines.add("");//def separator + if (Util.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])) { + lines.add("AMOUNT = " + definitionStack.getAmount()); + } + scanContents(lines, definitionStack.getDefinition().getSubParticles(), deeper, detailsOnDepthLevels); + } + } + } + + public NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("d", getDefinition().toNBT()); + nbt.setDouble("Q", getAmount()); + nbt.setLong("e", energy); + nbt.setByte("c", color); + nbt.setDouble("A", getAge()); + nbt.setDouble("M", lifeTimeMult); + return nbt; + } + + public static EMInstanceStack fromNBT(NBTTagCompound nbt) { + NBTTagCompound definition = nbt.getCompoundTag("d"); + EMInstanceStack instance = new EMInstanceStack( + EMComplex.fromNBT(definition), + nbt.getLong("q") + nbt.getDouble("Q"), + nbt.getFloat("m") + nbt.getDouble("M"), + nbt.getLong("a") + nbt.getDouble("A"), + nbt.getLong("e")); + instance.setColor(nbt.getByte("c")); + return instance; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof IEMDefinition) { + return getDefinition().compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + //Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT creativeTabTecTech INFO + @Override + public int hashCode() { + return getDefinition().hashCode(); + } + + @Override + public String toString() { + return getDefinition().toString() + '\n' + getAmount() / AVOGADRO_CONSTANT + " mol\n" + getMass(); + } + + public void setAmount(double amount) { + this.amount = amount; + } + + public double getAge() { + return age; + } + + public void setAge(double age) { + this.age = age; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java new file mode 100644 index 0000000000..94c76634d9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Created by danie_000 on 30.01.2017. + */ +public interface IEMStack extends Comparable,Cloneable { + IEMDefinition getDefinition(); + + double getAmount(); + + default double getCharge(){ + return getDefinition().getCharge()*getAmount(); + } + + default double getMass(){ + return getDefinition().getMass()*getAmount(); + } + + IEMStack clone(); + + /** + * Will return stack with mutated amount, it might be a new object! + * @param newAmount new amount + * @return new stack (or previous one if was mutable) + */ + IEMStack mutateAmount(double newAmount); + + NBTTagCompound toNBT(); + + @Override + default int compareTo(IEMStack o){ + return getDefinition().compareTo(o.getDefinition()); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java deleted file mode 100644 index 1e03c8130f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; - -/** - * Created by danie_000 on 20.11.2016. - */ -public final class cElementalDefinitionStack implements iElementalStack { - public final iElementalDefinition definition; - public final double amount; - - public cElementalDefinitionStack(iElementalDefinition def, double amount) { - definition = def == null ? null__ : def; - this.amount = amount; - } - - @Override - public cElementalDefinitionStack clone() { - return this;//IMMUTABLE - } - - @Override - public cElementalDefinitionStack mutateAmount(double amount) { - if(this.amount==amount){ - return this; - } - return new cElementalDefinitionStack(definition,amount);//IMMUTABLE - } - - @Override - public iElementalDefinition getDefinition() { - return definition;//IMMUTABLE - } - - @Override - public double getAmount() { - return amount; - } - - @Override - public double getCharge() { - return definition.getCharge() * amount; - } - - @Override - public double getMass() { - return definition.getMass() * amount; - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", definition.toNBT()); - nbt.setDouble("Q", amount); - return nbt; - } - - public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) { - return new cElementalDefinitionStack( - cElementalDefinition.fromNBT(nbt.getCompoundTag("d")), - nbt.getLong("q")+nbt.getDouble("Q")); - } - - @Override - public int compareTo(iElementalStack o) { - return definition.compareTo(o.getDefinition()); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof iElementalDefinition) { - return definition.compareTo((iElementalDefinition) obj) == 0; - } - if (obj instanceof iElementalStack) { - return definition.compareTo(((iElementalStack) obj).getDefinition()) == 0; - } - return false; - } - - //Amount shouldn't be hashed if this is just indicating amount and not structure - @Override - public int hashCode() { - return definition.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java deleted file mode 100644 index 1c06e560db..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ /dev/null @@ -1,566 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.crash.CrashReport; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static com.github.technus.tectech.util.DoubleCount.*; -import static java.lang.Math.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cElementalInstanceStack implements iElementalStack { - public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16; - public static double DECAY_CALL_PER=AVOGADRO_CONSTANT;//todo - - public final iElementalDefinition definition; - //energy - if positive then particle should try to decay - private long energy; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private byte color; - public double age; - public double amount; - private double lifeTime; - private double lifeTimeMult; - - public cElementalInstanceStack(cElementalDefinitionStack stackSafe) { - this(stackSafe.definition, stackSafe.amount, 1D, 0D, 0); - } - - public cElementalInstanceStack(cElementalDefinitionStack stackSafe, double lifeTimeMult, double age, long energy) { - this(stackSafe.definition, stackSafe.amount, lifeTimeMult, age, energy); - } - - public cElementalInstanceStack(iElementalDefinition defSafe, double amount) { - this(defSafe, amount, 1D, 0D, 0); - } - - public cElementalInstanceStack(iElementalDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { - definition = defSafe == null ? null__ : defSafe; - byte bColor = definition.getColor(); - if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color - this.color = bColor; - } else { - this.color = (byte) TecTech.RANDOM.nextInt(3); - } - this.lifeTimeMult = lifeTimeMult; - lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; - setEnergy(energy); - this.age = age; - this.amount = amount; - } - - //Clone proxy - private cElementalInstanceStack(cElementalInstanceStack stack) { - definition = stack.definition; - color = stack.color; - age = stack.age; - amount = stack.amount; - lifeTime = stack.lifeTime; - lifeTimeMult = stack.lifeTimeMult; - energy = stack.energy; - } - - @Override - public cElementalInstanceStack clone() { - return new cElementalInstanceStack(this); - } - - @Override - public cElementalInstanceStack mutateAmount(double amount) { - this.amount = amount; - return this; - } - - @Override - public double getAmount() { - return amount; - } - - @Override - public double getCharge() { - return definition.getCharge() * amount; - } - - @Override - public double getMass() { - return definition.getMass() * amount; - } - - public long getEnergy() { - return energy; - } - - public void setEnergy(long newEnergyLevel){ - energy=newEnergyLevel; - setLifeTimeMultiplier(getLifeTimeMultiplier()); - } - - public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ - return definition.getEnergyDiffBetweenStates(currentEnergyLevel,newEnergyLevel)*amount; - } - - public double getEnergySettingCost(long newEnergyLevel){ - return definition.getEnergyDiffBetweenStates(energy,newEnergyLevel)*amount; - } - - public cElementalDefinitionStack getDefinitionStack() { - return new cElementalDefinitionStack(definition, amount); - } - - @Override - public iElementalDefinition getDefinition() { - return definition; - } - - public byte getColor() { - return color; - } - - public byte setColor(byte color) {//does not allow changing magic element - if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { - return this.color; - } - return this.color = color; - } - - public byte nextColor() {//does not allow changing magic element - if (color < 0 || color > 2) { - return color; - } - return color = (byte) TecTech.RANDOM.nextInt(3); - } - - public double getLifeTime() { - return lifeTime; - } - - public double setLifeTimeMultiplier(double mult) { - if(mult<=0) //since infinity*0=nan - { - throw new IllegalArgumentException("multiplier must be >0"); - } - lifeTimeMult = mult; - if (definition.getRawTimeSpan(energy) <= 0) { - return lifeTime; - } - lifeTime = definition.getRawTimeSpan(energy) * lifeTimeMult; - return lifeTime; - } - - public double getLifeTimeMultiplier() { - return lifeTimeMult; - } - - public cElementalDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize){ - return tickStack(lifeTimeMult,postEnergize,1D); - } - - public cElementalDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds){ - cElementalDecayResult newInstances = decay(lifeTimeMult, age += seconds, postEnergize); - if (newInstances == null) { - nextColor(); - } else { - for (cElementalInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { - newInstance.nextColor(); - } - } - return newInstances; - } - - public cElementalDecayResult decay() { - return decay(1D, age, 0);//try to decay without changes - } - - public cElementalDecayResult decay(double apparentAge, long postEnergize) { - return decay(1D,apparentAge,postEnergize); - } - - public cElementalDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) { - long newEnergyLevel = postEnergize + energy; - if (newEnergyLevel > 0) { - newEnergyLevel -= 1; - } else if (newEnergyLevel < 0) { - newEnergyLevel += 1; - } - cElementalDecayResult output; - if(definition.usesMultipleDecayCalls(energy)){ - double amountTemp=amount; - int decayCnt=(int) min(MAX_MULTIPLE_DECAY_CALLS,max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS)); - amount= div(amount,decayCnt); - decayCnt--; - - output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); - if(output==null){ - amount=amountTemp; - return null; - } - - for(int i=0;i 0 && !definition.usesSpecialEnergeticDecayHandling()) { - setLifeTimeMultiplier(getLifeTimeMultiplier()); - return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); - } else if (definition.getRawTimeSpan(energy) < 0) { - return null;//return null, decay cannot be achieved - } else if (definition.isTimeSpanHalfLife()) { - return exponentialDecayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, -1D, newEnergyLevel); - } else { - if (1 > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel); - } else if (apparentAge > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, 0D, newEnergyLevel); - } - } - return null;//return null since decay cannot be achieved - } - - //Use to get direct decay output providing correct decay array - private cElementalDecayResult exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { - double newAmount= div(amount,Math.pow(2D,1D/* 1 second *//lifeTime)); - - //if(definition.getSymbol().startsWith("U ")) { - // System.out.println("newAmount = " + newAmount); - // System.out.println("amountRemaining = " + amountRemaining); - // for(cElementalDecay decay:decays){ - // System.out.println("prob = "+decay.probability); - // for(cElementalDefinitionStack stack:decay.outputStacks.values()){ - // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount); - // } - // } - //} - if(newAmount==amount) { - newAmount-=ulp(newAmount); - } else if(newAmount<1) { - return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); - } - - //split to non decaying and decaying part - double amount=this.amount; - this.amount-=newAmount; - cElementalDecayResult products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); - this.amount=newAmount; - if(products!=null){ - products.getOutput().putUnify(clone()); - } - this.amount=amount; - return products; - } - - //Use to get direct decay output providing correct decay array - private cElementalDecayResult decayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { - if (decays == null) { - return null;//Can not decay so it wont - } - boolean makesEnergy=definition.decayMakesEnergy(energy); - double mass=getMass(); - if (decays.length == 0) { - return makesEnergy ? null : new cElementalDecayResult(new cElementalInstanceStackMap(), mass, 0); - //provide non null 0 length array for annihilation - } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end - if(decays[0]==deadEnd) { - return makesEnergy ? null : new cElementalDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount), mass, 0); - } - cElementalInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); - if(newProductsAge<0){ - if(output.size()==1) { - if(output.size()==1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - output.getFirst().age=age; - } - }else { - for (cElementalInstanceStack stack : output.valuesToArray()) { - if (stack.definition.equals(definition)) { - stack.age = age; - } - } - } - }else{ - if(output.size()==1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - } - } - if(energy <= 0 && output.getMass() > mass){ - return null;//no energy usage to decay - } - return new cElementalDecayResult(new cElementalInstanceStackMap(), mass, makesEnergy ? output.getMass()-mass:0); - } else { - cElementalDecayResult totalOutput = new cElementalDecayResult(new cElementalInstanceStackMap(),getMass(),0); - cElementalInstanceStackMap output=totalOutput.getOutput(),results; - int differentDecays = decays.length; - double[] probabilities=new double[differentDecays]; - for (int i = 0; i < probabilities.length; i++) { - probabilities[i]=decays[i].probability; - } - double[] qttyOfDecay; - try{ - qttyOfDecay = distribute(amount, probabilities); - }catch (ArithmeticException e){ - Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: "+this.toString(),e)); - return null; - } - //long amountRemaining = this.amount, amount = this.amount; - //float remainingProbability = 1D; -// - //for (int i = 0; i < differentDecays; i++) { - // if (decays[i].probability >= 1D) { - // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); - // if (thisDecayAmount > 0) { - // if (thisDecayAmount <= amountRemaining) { - // amountRemaining -= thisDecayAmount; - // qttyOfDecay[i] += thisDecayAmount; - // }else {//in case too much was made - // qttyOfDecay[i] += amountRemaining; - // amountRemaining = 0; - // //remainingProbability=0; - // } - // } - // break; - // } - // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); - // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made - // amountRemaining -= thisDecayAmount; - // qttyOfDecay[i] += thisDecayAmount; - // } else if (thisDecayAmount > amountRemaining) {//too much was made - // qttyOfDecay[i] += amountRemaining; - // amountRemaining = 0; - // //remainingProbability=0; - // break; - // } - // remainingProbability -= decays[i].probability; - // if(remainingProbability<=0) { - // break; - // } - //} - - //for (int i = 0; i < amountRemaining; i++) { - // double rand = TecTech.RANDOM.nextDouble(); - // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into - // rand -= decays[j].probability; - // if (rand <= 0D) { - // qttyOfDecay[j]++; - // break; - // } - // } - //} - - if(definition.decayMakesEnergy(energy)){ - for (int i = differentDecays - 1; i >= 0; i--) { - if(decays[i]==deadEnd){ - cElementalInstanceStack clone=clone(); - clone.amount=qttyOfDecay[i]; - output.putUnify(clone); - }else { - results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); - output.putUnifyAll(results); - totalOutput.setMassDiff(add(totalOutput.getMassDiff(),results.getMass()-mass)); - } - } - }else{ - for (int i = differentDecays - 1; i >= 0; i--) { - results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); - output.putUnifyAll(results); - } - } - - if(newProductsAge<0) { - if (output.size() == 1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - output.getFirst().age = age; - } else { - for (cElementalInstanceStack stack : output.valuesToArray()) { - if (stack.definition.equals(definition)) { - stack.age = age; - } - } - } - }else{ - if(output.size()==1 && output.getFirst().definition.equals(definition)) { - output.getFirst().setEnergy(energy); - output.getFirst().age=age; - } - } - if(energy <= 0 && output.getMass() > getMass()){ - return null;//no energy usage to decay - } - return totalOutput; - } - } - - public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) { - if (instances == null) { - return this; - } - //returns with the definition from the first object passed - double energyTotal = this.energy * amount; - long maxEnergy=this.energy; - double lifeTimeMul = lifeTimeMult; - - for (cElementalInstanceStack instance : instances) { - if (instance != null && compareTo(instance) == 0) { - amount= add(amount,instance.amount); - energyTotal += instance.energy * instance.amount; - if(instance.energy>maxEnergy){ - maxEnergy=instance.energy; - } - lifeTimeMul = min(lifeTimeMul, instance.lifeTimeMult); - age = max(age, instance.age); - } - } - - if (amount != 0) { - energyTotal /= Math.abs(amount); - } - - double wholeParts=Math.floor(energyTotal); - energyTotal= min(energyTotal-wholeParts,1D)+(wholeParts>=0?-0.11709966304863834D:0.11709966304863834D); - long energy=(long) wholeParts + ((energyTotal > TecTech.RANDOM.nextDouble()) ? 1 : 0); - if(energy*energyTotal<0){ - energy=0; - } - setEnergy(min(maxEnergy,energy)); - return this; - } - - public void addScanShortSymbols(ArrayList lines, int[] detailsOnDepthLevels){ - int capabilities=detailsOnDepthLevels[0]; - definition.addScanShortSymbols(lines,capabilities,energy); - //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); - } - - //private void scanShortSymbolsContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ - // if(definitions!=null && depth lines, int[] detailsOnDepthLevels){ - int capabilities=detailsOnDepthLevels[0]; - if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)) { - lines.add("DEPTH = " + 0); - } - definition.addScanResults(lines,capabilities,energy); - if(Util.areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)) { - lines.add("TIME MULT = " + lifeTimeMult); - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)) { - lines.add("TIME SPAN = " + lifeTime + " s"); - } - } - if(Util.areBitsSet(SCAN_GET_AGE,capabilities)) { - lines.add("AGE = " + age + " s"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add("COLOR = " + color + " RGB or CMY"); - } - if(Util.areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)) { - lines.add("ENERGY = " + energy); - } - if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) { - lines.add("AMOUNT = " + amount/ AVOGADRO_CONSTANT +" mol"); - } - scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); - } - - private void scanContents(ArrayList lines, cElementalConstantStackMap definitions, int depth, int[] detailsOnDepthLevels){ - if(definitions!=null && depth,Cloneable { - iElementalDefinition getDefinition(); - - double getAmount(); - - double getCharge(); - - double getMass(); - - iElementalStack clone(); - - iElementalStack mutateAmount(double amount); - - NBTTagCompound toNBT(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java deleted file mode 100644 index 2adadfd062..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -/** - * Created by danie_000 on 19.11.2016. - */ -public final class tElementalException extends Exception { - public tElementalException(String message) { - super(message); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java new file mode 100644 index 0000000000..7fc074bded --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java @@ -0,0 +1,135 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.templates; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 23.01.2017. + */ +public abstract class EMComplex implements IEMDefinition { + //Nothing array + public static final IEMDefinition[] nothing = new EMPrimitive[0]; + + //add text based creators for recipe formula input? + private static final Map nbtCreationBind = new HashMap<>();//creator methods in subclasses + private static final HashSet classSet = new HashSet<>(); + + protected static void addCreatorFromNBT(byte shortcutNBT, Method constructorFromNBT,byte classID) { + if(nbtCreationBind.put(shortcutNBT, constructorFromNBT)!=null) { + throw new Error("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); + } + if(!classSet.add(classID)) { + throw new Error("Duplicate Class ID! " + classID + " used for class comparison"); + } + } + + public static Map getBindsComplex(){ + return nbtCreationBind; + } + + @Override + public final EMComplex clone() { + return this;//IMMUTABLE + } + + public static IEMDefinition fromNBT(NBTTagCompound nbt) { + try { + return (IEMDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return nbtE__; + } + } + + @Override + public int compareTo(IEMDefinition o) { + int classCompare = compareClassID(o); + if (classCompare != 0) { + return classCompare; + } + + //only of the internal def stacks!!! + //that allows neat check if the same thing and + //top hierarchy amount can be used to store amount info + return compareInnerContentsWithAmounts(getSubParticles().valuesToArray(), o.getSubParticles().valuesToArray()); + } + + //use only for nested operations! + private static int compareInnerContentsWithAmounts(EMDefinitionStack[] tc, EMDefinitionStack[] sc) { + if (tc == null) { + if (sc == null) { + return 0; + } else { + return -1; + } + } + if (sc == null) { + return 1; + } + + int lenDiff = tc.length - sc.length; + if (lenDiff != 0) { + return lenDiff; + } + + for (int i = 0; i < tc.length; i++) { + int cn = tc[i].getDefinition().compareTo(sc[i].getDefinition()); + if (cn != 0) { + return cn; + } + + if (tc[i].getAmount() > sc[i].getAmount()) { + return 1; + } + if (tc[i].getAmount() < sc[i].getAmount()) { + return -1; + } + } + return 0; + } + + @Override + public final EMDefinitionStack getStackForm(double amount) { + return new EMDefinitionStack(this, amount); + } + + @Override + public final boolean equals(Object obj) { + if(this==obj) { + return true; + } + if (obj instanceof IEMDefinition) { + return compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + @Override + public int hashCode() {//Internal amounts should be also hashed + int hash = -(getSubParticles().size() << 4); + for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { + int amount=(int) stack.getAmount(); + hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); + } + return hash; + } + + @Override + public String toString() { + return getLocalizedName()+ '\n' + getSymbol(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java new file mode 100644 index 0000000000..587affd0f1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java @@ -0,0 +1,283 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.templates; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.util.Util.areBitsSet; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; + +/** + * Created by danie_000 on 22.10.2016. + * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) + */ +public abstract class EMPrimitive extends EMComplex { + public static final byte nbtType = (byte) 'p'; + + private static final Map bindsBO = new HashMap<>(); + + public static Map getBindsPrimitive() { + return bindsBO; + } + + private final String name; + private final String symbol; + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private final byte color; + //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti + private final byte type; + + private EMPrimitive anti;//IMMUTABLE + private EMDecay[] elementalDecays; + private byte naturalDecayInstant; + private byte energeticDecayInstant; + private double rawLifeTime; + + private final int ID; + + //no _ at end - normal particle + // _ at end - anti particle + // __ at end - self is antiparticle + + protected EMPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { + this.name = name; + this.symbol = symbol; + this.type = (byte) type; + this.mass = mass; + this.charge = charge; + this.color = (byte) color; + this.ID = ID; + if (bindsBO.put(ID, this) != null) { + Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new EMException("Duplicate ID"))); + } + STACKS_REGISTERED.add(this); + } + + // + protected void init(EMPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { + anti = antiParticle; + this.rawLifeTime = rawLifeTime; + naturalDecayInstant = (byte) naturalInstant; + energeticDecayInstant = (byte) energeticInstant; + elementalDecays =elementalDecaysArray; + } + + @Override + public String getLocalizedName() { + return "Undefined: " + getName(); + } + + @Override + public String getSymbol() { + return symbol; + } + + @Override + public String getShortSymbol() { + return getSymbol(); + } + + @Override + public IEMDefinition getAnti() { + return anti;//no need for copy + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public byte getColor() { + return color; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + if (naturalDecayInstant < 0) { + return elementalDecays; + }else if (naturalDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[naturalDecayInstant]}; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (energeticDecayInstant < 0) { + return elementalDecays; + }else if (energeticDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[energeticDecayInstant]}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + return elementalDecays; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return rawLifeTime; + } + + @Override + public final EMConstantStackMap getSubParticles() { + return null; + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public byte getType() { + return type; + } + + @Override + public final NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setByte("t", nbtType); + nbt.setInteger("c", getID()); + return nbt; + } + + public static EMPrimitive fromNBT(NBTTagCompound content) { + EMPrimitive primitive = bindsBO.get(content.getInteger("c")); + return primitive == null ? null__ : primitive; + } + + @Override + public final byte getClassType() { + return -128; + } + + public static byte getClassTypeStatic(){ + return -128; + } + + @Override + public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + nbtType + ' ' + getClassType()); + } + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+ getLocalizedName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + + public static void run() { + try { + EMComplex.addCreatorFromNBT(nbtType, EMPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Primitive " + nbtType + ' ' + -128); + } + } + + @Override + public final int compareTo(IEMDefinition o) { + if (getClassType() == o.getClassType()) { + int oID = ((EMPrimitive) o).getID(); + return Integer.compare(getID(), oID); + } + return compareClassID(o); + } + + @Override + public final int hashCode() { + return getID(); + } + + public String getName() { + return name; + } + + public int getID() { + return ID; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java new file mode 100644 index 0000000000..7ae6d0395c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java @@ -0,0 +1,84 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.templates; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +/** + * Created by danie_000 on 11.11.2016. + */ +public interface IEMDefinition extends Comparable,Cloneable {//IMMUTABLE + double STABLE_RAW_LIFE_TIME =1.5e36D; + double NO_DECAY_RAW_LIFE_TIME=-1D; + long DEFAULT_ENERGY_LEVEL=0; + double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels + + //Nomenclature + String getLocalizedName(); + + String getSymbol(); + + String getShortSymbol(); + + void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); + + void addScanResults(ArrayList lines, int capabilities, long energyLevel); + + byte getType(); + + byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + + //Not dynamically changing stuff + IEMDefinition getAnti();//gives new anti particle def + + EMDecay[] getDecayArray();//possible decays + + EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick + + EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay + + boolean usesSpecialEnergeticDecayHandling(); + + boolean usesMultipleDecayCalls(long energyLevel); + + boolean decayMakesEnergy(long energyLevel); + + boolean fusionMakesEnergy(long energyLevel); + + double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative + + double getMass();//mass... MeV/c^2 + + int getCharge();//charge 1/3 electron charge + + //dynamically changing stuff + byte getColor();//-1 nope cannot 0 it can but undefined + + double getRawTimeSpan(long currentEnergy);//defined in static fields or generated + + boolean isTimeSpanHalfLife(); + + EMConstantStackMap getSubParticles();//contents... null if none + + EMFluidDequantizationInfo someAmountIntoFluidStack(); + + EMItemDequantizationInfo someAmountIntoItemsStack(); + + EMOredictDequantizationInfo someAmountIntoOredictStack(); + + NBTTagCompound toNBT(); + + EMDefinitionStack getStackForm(double amount); + + IEMDefinition clone(); + + default int compareClassID(IEMDefinition obj) { + return (int) getClassType() - obj.getClassType(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java deleted file mode 100644 index 43e42df988..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 23.01.2017. - */ -public abstract class cElementalDefinition extends iElementalDefinition { - //Nothing array - public static final iElementalDefinition[] nothing = new cElementalPrimitive[0]; - - //add text based creators for recipe formula input? - private static final Map nbtCreationBind = new HashMap<>();//creator methods in subclasses - private static final HashSet classSet = new HashSet<>(); - - protected static void addCreatorFromNBT(byte shortcutNBT, Method constructorFromNBT,byte classID) { - if(nbtCreationBind.put(shortcutNBT, constructorFromNBT)!=null) { - throw new Error("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); - } - if(!classSet.add(classID)) { - throw new Error("Duplicate Class ID! " + classID + " used for class comparison"); - } - } - - public static Map getBindsComplex(){ - return nbtCreationBind; - } - - @Override - public final cElementalDefinition clone() { - return this;//IMMUTABLE - } - - public static iElementalDefinition fromNBT(NBTTagCompound nbt) { - try { - return (iElementalDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__; - } - } - - @Override - public int compareTo(iElementalDefinition o) { - int classCompare = compareClassID(o); - if (classCompare != 0) { - return classCompare; - } - - //only of the internal def stacks!!! - //that allows neat check if the same thing and - //top hierarchy amount can be used to store amount info - return compareInnerContentsWithAmounts(getSubParticles().valuesToArray(), o.getSubParticles().valuesToArray()); - } - - //use only for nested operations! - private static int compareInnerContentsWithAmounts(cElementalDefinitionStack[] tc, cElementalDefinitionStack[] sc) { - if (tc == null) { - if (sc == null) { - return 0; - } else { - return -1; - } - } - if (sc == null) { - return 1; - } - - int lenDiff = tc.length - sc.length; - if (lenDiff != 0) { - return lenDiff; - } - - for (int i = 0; i < tc.length; i++) { - int cn = tc[i].definition.compareTo(sc[i].definition); - if (cn != 0) { - return cn; - } - - if (tc[i].amount > sc[i].amount) { - return 1; - } - if (tc[i].amount < sc[i].amount) { - return -1; - } - } - return 0; - } - - @Override - public final cElementalDefinitionStack getStackForm(double amount) { - return new cElementalDefinitionStack(this, amount); - } - - @Override - public final boolean equals(Object obj) { - if(this==obj) { - return true; - } - if (obj instanceof iElementalDefinition) { - return compareTo((iElementalDefinition) obj) == 0; - } - if (obj instanceof iElementalStack) { - return compareTo(((iElementalStack) obj).getDefinition()) == 0; - } - return false; - } - - @Override - public int hashCode() {//Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 4); - for (cElementalDefinitionStack stack : getSubParticles().valuesToArray()) { - int amount=(int)stack.amount; - hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.definition.hashCode(); - } - return hash; - } - - @Override - public String toString() { - return getName()+ '\n' + getSymbol(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java deleted file mode 100644 index 70af6445c9..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import net.minecraft.client.Minecraft; -import net.minecraft.crash.CrashReport; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; - -import static com.github.technus.tectech.util.Util.areBitsSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; - -/** - * Created by danie_000 on 22.10.2016. - * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) - */ -public abstract class cElementalPrimitive extends cElementalDefinition { - public static final byte nbtType = (byte) 'p'; - - private static final Map bindsBO = new HashMap<>(); - - public static Map getBindsPrimitive() { - return bindsBO; - } - - public final String name; - public final String symbol; - //float-mass in eV/c^2 - public final double mass; - //int -electric charge in 1/3rds of electron charge for optimization - public final byte charge; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - public final byte color; - //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - public final byte type; - - private cElementalPrimitive anti;//IMMUTABLE - private cElementalDecay[] elementalDecays; - private byte naturalDecayInstant; - private byte energeticDecayInstant; - private double rawLifeTime; - - public final int ID; - - //no _ at end - normal particle - // _ at end - anti particle - // __ at end - self is antiparticle - - protected cElementalPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { - this.name = name; - this.symbol = symbol; - this.type = (byte) type; - this.mass = mass; - this.charge = (byte) charge; - this.color = (byte) color; - this.ID = ID; - if (bindsBO.put(ID, this) != null) { - Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new tElementalException("Duplicate ID"))); - } - STACKS_REGISTERED.add(this); - } - - // - protected void init(cElementalPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { - anti = antiParticle; - this.rawLifeTime = rawLifeTime; - naturalDecayInstant = (byte) naturalInstant; - energeticDecayInstant = (byte) energeticInstant; - elementalDecays =elementalDecaysArray; - } - - @Override - public String getName() { - return "Undefined: " + name; - } - - @Override - public String getSymbol() { - return symbol; - } - - @Override - public String getShortSymbol() { - return symbol; - } - - @Override - public iElementalDefinition getAnti() { - return anti;//no need for copy - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public byte getColor() { - return color; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - if (naturalDecayInstant < 0) { - return elementalDecays; - }else if (naturalDecayInstant>=elementalDecays.length){ - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{elementalDecays[naturalDecayInstant]}; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - if (energeticDecayInstant < 0) { - return elementalDecays; - }else if (energeticDecayInstant>=elementalDecays.length){ - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{elementalDecays[energeticDecayInstant]}; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getDecayArray() { - return elementalDecays; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public final cElementalConstantStackMap getSubParticles() { - return null; - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public byte getType() { - return type; - } - - @Override - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - nbt.setInteger("c", ID); - return nbt; - } - - public static cElementalPrimitive fromNBT(NBTTagCompound content) { - cElementalPrimitive primitive = bindsBO.get(content.getInteger("c")); - return primitive == null ? null__ : primitive; - } - - @Override - public final byte getClassType() { - return -128; - } - - public static byte getClassTypeStatic(){ - return -128; - } - - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" "+"At current energy level"); - } - } - - public static void run() { - try { - cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Primitive " + nbtType + ' ' + -128); - } - } - - @Override - public final int compareTo(iElementalDefinition o) { - if (getClassType() == o.getClassType()) { - int oID = ((cElementalPrimitive) o).ID; - return Integer.compare(ID, oID); - } - return compareClassID(o); - } - - @Override - public final int hashCode() { - return ID; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java deleted file mode 100644 index 8065e9c170..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -/** - * Created by danie_000 on 11.11.2016. - */ -public abstract class iElementalDefinition implements Comparable,Cloneable {//IMMUTABLE - public static final double STABLE_RAW_LIFE_TIME =1.5e36D; - public static final double NO_DECAY_RAW_LIFE_TIME=-1D; - public static final long DEFAULT_ENERGY_LEVEL=0; - public static final double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels - - //Nomenclature - public abstract String getName(); - - public abstract String getSymbol(); - - public abstract String getShortSymbol(); - - public abstract void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); - - public abstract void addScanResults(ArrayList lines, int capabilities, long energyLevel); - - public abstract byte getType(); - - public abstract byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - - //Not dynamically changing stuff - public abstract iElementalDefinition getAnti();//gives new anti particle def - - public abstract cElementalDecay[] getDecayArray();//possible decays - - public abstract cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick - - public abstract cElementalDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay - - public abstract boolean usesSpecialEnergeticDecayHandling(); - - public abstract boolean usesMultipleDecayCalls(long energyLevel); - - public abstract boolean decayMakesEnergy(long energyLevel); - - public abstract boolean fusionMakesEnergy(long energyLevel); - - public abstract double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative - - public abstract double getMass();//mass... MeV/c^2 - - public abstract int getCharge();//charge 1/3 electron charge - - //dynamically changing stuff - public abstract byte getColor();//-1 nope cannot 0 it can but undefined - - public abstract double getRawTimeSpan(long currentEnergy);//defined in static fields or generated - - public abstract boolean isTimeSpanHalfLife(); - - public abstract cElementalConstantStackMap getSubParticles();//contents... null if none - - public abstract aFluidDequantizationInfo someAmountIntoFluidStack(); - - public abstract aItemDequantizationInfo someAmountIntoItemsStack(); - - public abstract aOredictDequantizationInfo someAmountIntoOredictStack(); - - public abstract NBTTagCompound toNBT(); - - public abstract cElementalDefinitionStack getStackForm(double amount); - - @Override - public abstract iElementalDefinition clone(); - - final int compareClassID(iElementalDefinition obj) { - return (int) getClassType() - obj.getClassType(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java new file mode 100644 index 0000000000..d74c36170e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMFluidDequantizationInfo implements IEMExchangeInfo { + private final IEMStack in; + private final FluidStack out; + + public EMFluidDequantizationInfo(IEMStack emIn, FluidStack fluidStackOut){ + in=emIn; + out=fluidStackOut; + } + + public EMFluidDequantizationInfo(IEMStack emIn, Fluid fluid, int fluidAmount){ + in=emIn; + out=new FluidStack(fluid,fluidAmount); + } + + @Override + public IEMStack input() { + return in.clone();//MEH! + } + + @Override + public FluidStack output() { + return out.copy(); + } + + @Override + public int hashCode() { + return in.getDefinition().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMFluidDequantizationInfo && hashCode() == obj.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java new file mode 100644 index 0000000000..43fb5550aa --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMFluidQuantizationInfo implements IEMExchangeInfo { + private final FluidStack in; + private final IEMStack out; + + public EMFluidQuantizationInfo(FluidStack fluidStackIn, IEMStack emOut){ + in=fluidStackIn; + out=emOut; + } + + public EMFluidQuantizationInfo(Fluid fluid, int fluidAmount, IEMStack emOut){ + in=new FluidStack(fluid,fluidAmount); + out=emOut; + } + + @Override + public FluidStack input() { + return in.copy(); + } + + @Override + public IEMStack output() { + return out.clone(); + } + + @Override + public int hashCode() { + return in.getFluidID(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMFluidQuantizationInfo && hashCode() == obj.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java new file mode 100644 index 0000000000..af741c703d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMItemDequantizationInfo implements IEMExchangeInfo { + private final IEMStack in; + private final ItemStack out; + + public EMItemDequantizationInfo(IEMStack emIn, ItemStack itemStackOut){ + in=emIn; + out=itemStackOut; + } + + public EMItemDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int amount) { + in = emIn; + out = GT_OreDictUnificator.get(prefix, material, amount); + } + + @Override + public IEMStack input() { + return in.clone(); + } + + @Override + public ItemStack output() { + return out.copy(); + } + + @Override + public int hashCode() { + return in.getDefinition().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMItemDequantizationInfo && hashCode() == obj.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java new file mode 100644 index 0000000000..553e806d38 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java @@ -0,0 +1,69 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMItemQuantizationInfo implements IEMExchangeInfo { + private final ItemStack in; + private final boolean skipNBT; + private final IEMStack out; + + public EMItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, IEMStack emOut) { + in = itemStackIn; + out = emOut; + this.skipNBT = skipNBT; + } + + public EMItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, IEMStack emOut) { + in = GT_OreDictUnificator.get(prefix, material, amount); + out = emOut; + this.skipNBT = skipNBT; + } + + @Override + public ItemStack input() { + return in.copy(); + } + + @Override + public IEMStack output() { + return out.clone(); + } + + @Override + public int hashCode() { + return (GameRegistry.findUniqueIdentifierFor(in.getItem())+":"+in.getUnlocalizedName()+ ':' +in.getItemDamage()).hashCode(); + } + + @Override + public boolean equals(Object obj) { + if(obj instanceof EMItemQuantizationInfo){ + //alias + ItemStack stack=((EMItemQuantizationInfo) obj).in; + if(!in.getUnlocalizedName().equals(((EMItemQuantizationInfo) obj).in.getUnlocalizedName())) { + return false; + } + + if(!GameRegistry.findUniqueIdentifierFor(in.getItem()).equals( + GameRegistry.findUniqueIdentifierFor(((EMItemQuantizationInfo) obj).in.getItem()))) { + return false; + } + + if(in.getItemDamage() != OreDictionary.WILDCARD_VALUE && stack.getItemDamage() != OreDictionary.WILDCARD_VALUE) { + if (in.getItemDamage() != stack.getItemDamage()) { + return false; + } + } + return skipNBT || ItemStack.areItemStackTagsEqual(in, stack); + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java new file mode 100644 index 0000000000..c8e337c7fd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java @@ -0,0 +1,60 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMOredictDequantizationInfo implements IEMExchangeInfo { + private final IEMStack in; + private final String out; + private final int amount; + + public EMOredictDequantizationInfo(IEMStack emIn, String name, int qty) { + in = emIn; + out =name; + amount = qty; + } + + public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int qty) { + in = emIn; + out = prefix.name() + material.mName; + amount = qty; + } + + public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, String materialName, int qty) { + in = emIn; + out = prefix.name() + materialName; + amount = qty; + } + + @Override + public IEMStack input() { + return in.clone();//MEH! + } + + @Override + public String output() { + return getOut(); + } + + @Override + public int hashCode() { + return in.getDefinition().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMOredictDequantizationInfo && hashCode() == obj.hashCode(); + } + + public String getOut() { + return out; + } + + public int getAmount() { + return amount; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java new file mode 100644 index 0000000000..0ca0415b0d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java @@ -0,0 +1,60 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMOredictQuantizationInfo implements IEMExchangeInfo { + private final String in; + private final int amount; + private final IEMStack out; + + public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut){ + in=name; + amount=qty; + out=emOut; + } + + public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut){ + in=prefix.name() + material.mName; + amount=qty; + out=emOut; + } + + public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut){ + in=prefix.name() + materialName; + amount=qty; + out=emOut; + } + + @Override + public String input() { + return getIn(); + } + + @Override + public IEMStack output() { + return out.clone(); + } + + @Override + public int hashCode() { + return getIn().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMOredictQuantizationInfo && hashCode() == obj.hashCode(); + } + + public String getIn() { + return in; + } + + public int getAmount() { + return amount; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java new file mode 100644 index 0000000000..fca79b0b6f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java @@ -0,0 +1,172 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static java.lang.Math.pow; + +/** + * Created by Tec on 26.05.2017. + */ +public class EMTransformationInfo { + /** + * Atom count per Mol + */ + public static final double AVOGADRO_CONSTANT =6.02214076e23D; + /** + * Min. chance of existing + */ + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48); + public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON; + public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; + public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON; + public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D; + public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON; + + public static EMTransformationInfo TRANSFORMATION_INFO = new EMTransformationInfo(); + + private Map fluidQuantization; + private Map itemQuantization; + private Map oredictQuantization; + + private Map fluidDequantization; + private Map itemDequantization; + private Map oredictDequantization; + + private EMTransformationInfo() { + this( + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) + ); + } + + public EMTransformationInfo( + Map fluidQuantization, + Map itemQuantization, + Map oredictQuantization, + Map fluidDequantization, + Map itemDequantization, + Map oredictDequantization) { + this.setFluidQuantization(fluidQuantization); + this.setItemQuantization(itemQuantization); + this.setOredictQuantization(oredictQuantization); + this.setFluidDequantization(fluidDequantization); + this.setItemDequantization(itemDequantization); + this.setOredictDequantization(oredictDequantization); + } + + public void addFluid(IEMStack em, FluidStack fluidStack){ + getFluidQuantization().put(fluidStack.getFluidID(),new EMFluidQuantizationInfo(fluidStack,em)); + getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluidStack)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addFluid(IEMStack em, Fluid fluid, int fluidAmount){ + getFluidQuantization().put(fluid.getID(),new EMFluidQuantizationInfo(fluid,fluidAmount,em)); + getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluid,fluidAmount)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + private void addItemQuantization(EMItemQuantizationInfo aIQI){ + getItemQuantization().put(aIQI,aIQI); + } + + public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT){ + addItemQuantization(new EMItemQuantizationInfo(itemStack,skipNBT,em)); + getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,itemStack)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ + addItemQuantization(new EMItemQuantizationInfo(prefix,material,amount,skipNBT,em)); + getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,prefix,material,amount)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addOredict(IEMStack em, String name, int qty){ + getOredictQuantization().put(OreDictionary.getOreID(name),new EMOredictQuantizationInfo(name,qty,em)); + getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,name,qty)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty){ + getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + material.mName),new EMOredictQuantizationInfo(prefix,material,qty,em)); + getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,material,qty)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty){ + getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + materialName),new EMOredictQuantizationInfo(prefix,materialName,qty,em)); + getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,materialName,qty)); + STACKS_REGISTERED.add(em.getDefinition()); + STACKS_REGISTERED.add(em.getDefinition().getAnti()); + } + + public Map getFluidQuantization() { + return fluidQuantization; + } + + public void setFluidQuantization(Map fluidQuantization) { + this.fluidQuantization = fluidQuantization; + } + + public Map getItemQuantization() { + return itemQuantization; + } + + public void setItemQuantization(Map itemQuantization) { + this.itemQuantization = itemQuantization; + } + + public Map getOredictQuantization() { + return oredictQuantization; + } + + public void setOredictQuantization(Map oredictQuantization) { + this.oredictQuantization = oredictQuantization; + } + + public Map getFluidDequantization() { + return fluidDequantization; + } + + public void setFluidDequantization(Map fluidDequantization) { + this.fluidDequantization = fluidDequantization; + } + + public Map getItemDequantization() { + return itemDequantization; + } + + public void setItemDequantization(Map itemDequantization) { + this.itemDequantization = itemDequantization; + } + + public Map getOredictDequantization() { + return oredictDequantization; + } + + public void setOredictDequantization(Map oredictDequantization) { + this.oredictDequantization = oredictDequantization; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java new file mode 100644 index 0000000000..e20b0af3b5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java @@ -0,0 +1,11 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +/** + * Created by Tec on 23.05.2017. + */ +public interface IEMExchangeInfo { + OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. + //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) + + IN input();//same as above but for input +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java deleted file mode 100644 index 0d91b57ed5..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aFluidDequantizationInfo implements iExchangeInfo { - private final iElementalStack in; - private final FluidStack out; - - public aFluidDequantizationInfo(iElementalStack emIn, FluidStack fluidStackOut){ - in=emIn; - out=fluidStackOut; - } - - public aFluidDequantizationInfo(iElementalStack emIn, Fluid fluid, int fluidAmount){ - in=emIn; - out=new FluidStack(fluid,fluidAmount); - } - - @Override - public iElementalStack input() { - return in.clone();//MEH! - } - - @Override - public FluidStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aFluidDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java deleted file mode 100644 index 39e4ec4671..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aFluidQuantizationInfo implements iExchangeInfo { - private final FluidStack in; - private final iElementalStack out; - - public aFluidQuantizationInfo(FluidStack fluidStackIn, iElementalStack emOut){ - in=fluidStackIn; - out=emOut; - } - - public aFluidQuantizationInfo(Fluid fluid, int fluidAmount, iElementalStack emOut){ - in=new FluidStack(fluid,fluidAmount); - out=emOut; - } - - @Override - public FluidStack input() { - return in.copy(); - } - - @Override - public iElementalStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return in.getFluidID(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aFluidQuantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java deleted file mode 100644 index fb71275276..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import net.minecraft.item.ItemStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aItemDequantizationInfo implements iExchangeInfo { - private final iElementalStack in; - private final ItemStack out; - - public aItemDequantizationInfo(iElementalStack emIn, ItemStack itemStackOut){ - in=emIn; - out=itemStackOut; - } - - public aItemDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int amount) { - in = emIn; - out = GT_OreDictUnificator.get(prefix, material, amount); - } - - @Override - public iElementalStack input() { - return in.clone(); - } - - @Override - public ItemStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aItemDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java deleted file mode 100644 index da9950a186..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * Created by Tec on 23.05.2017. - */ -public class aItemQuantizationInfo implements iExchangeInfo { - private final ItemStack in; - private final boolean skipNBT; - private final iElementalStack out; - - public aItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, iElementalStack emOut) { - in = itemStackIn; - out = emOut; - this.skipNBT = skipNBT; - } - - public aItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, iElementalStack emOut) { - in = GT_OreDictUnificator.get(prefix, material, amount); - out = emOut; - this.skipNBT = skipNBT; - } - - @Override - public ItemStack input() { - return in.copy(); - } - - @Override - public iElementalStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return (GameRegistry.findUniqueIdentifierFor(in.getItem())+":"+in.getUnlocalizedName()+ ':' +in.getItemDamage()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if(obj instanceof aItemQuantizationInfo){ - //alias - ItemStack stack=((aItemQuantizationInfo) obj).in; - if(!in.getUnlocalizedName().equals(((aItemQuantizationInfo) obj).in.getUnlocalizedName())) { - return false; - } - - if(!GameRegistry.findUniqueIdentifierFor(in.getItem()).equals( - GameRegistry.findUniqueIdentifierFor(((aItemQuantizationInfo) obj).in.getItem()))) { - return false; - } - - if(in.getItemDamage() != OreDictionary.WILDCARD_VALUE && stack.getItemDamage() != OreDictionary.WILDCARD_VALUE) { - if (in.getItemDamage() != stack.getItemDamage()) { - return false; - } - } - return skipNBT || ItemStack.areItemStackTagsEqual(in, stack); - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java deleted file mode 100644 index 20f2252bd8..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; - -/** - * Created by Tec on 23.05.2017. - */ -public class aOredictDequantizationInfo implements iExchangeInfo { - private final iElementalStack in; - public final String out; - public final int amount; - - public aOredictDequantizationInfo(iElementalStack emIn, String name, int qty) { - in = emIn; - out =name; - amount = qty; - } - - public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int qty) { - in = emIn; - out = prefix.name() + material.mName; - amount = qty; - } - - public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, String materialName, int qty) { - in = emIn; - out = prefix.name() + materialName; - amount = qty; - } - - @Override - public iElementalStack input() { - return in.clone();//MEH! - } - - @Override - public String output() { - return out; - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aOredictDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java deleted file mode 100644 index 252b524185..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; - -/** - * Created by Tec on 23.05.2017. - */ -public class aOredictQuantizationInfo implements iExchangeInfo { - public final String in; - public final int amount; - private final iElementalStack out; - - public aOredictQuantizationInfo(String name, int qty, iElementalStack emOut){ - in=name; - amount=qty; - out=emOut; - } - - public aOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, iElementalStack emOut){ - in=prefix.name() + material.mName; - amount=qty; - out=emOut; - } - - public aOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, iElementalStack emOut){ - in=prefix.name() + materialName; - amount=qty; - out=emOut; - } - - @Override - public String input() { - return in; - } - - @Override - public iElementalStack output() { - return out.clone(); - } - - @Override - public int hashCode() { - return in.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aOredictQuantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java deleted file mode 100644 index 39f946c54a..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.HashMap; -import java.util.Map; - -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; -import static java.lang.Math.pow; - -/** - * Created by Tec on 26.05.2017. - */ -public class bTransformationInfo { - /** - * Atom count per Mol - */ - public static final double AVOGADRO_CONSTANT =6.02214076e23D; - /** - * Min. chance of existing - */ - public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT; - /** - * Quantity considered to be indifferent when computing stuff - */ - public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48); - public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON; - public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; - public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON*144D; - public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D; - public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON*1000D; - - public static bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(); - - public Map fluidQuantization; - public Map itemQuantization; - public Map oredictQuantization; - - public Map fluidDequantization; - public Map itemDequantization; - public Map oredictDequantization; - - private bTransformationInfo() { - this( - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) - ); - } - - public bTransformationInfo( - Map fluidQuantization, - Map itemQuantization, - Map oredictQuantization, - Map fluidDequantization, - Map itemDequantization, - Map oredictDequantization) { - this.fluidQuantization = fluidQuantization; - this.itemQuantization = itemQuantization; - this.oredictQuantization = oredictQuantization; - this.fluidDequantization = fluidDequantization; - this.itemDequantization = itemDequantization; - this.oredictDequantization = oredictDequantization; - } - - public void addFluid(iElementalStack em, FluidStack fluidStack){ - fluidQuantization.put(fluidStack.getFluidID(),new aFluidQuantizationInfo(fluidStack,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addFluid(iElementalStack em, Fluid fluid, int fluidAmount){ - fluidQuantization.put(fluid.getID(),new aFluidQuantizationInfo(fluid,fluidAmount,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluid,fluidAmount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - private void addItemQuantization(aItemQuantizationInfo aIQI){ - itemQuantization.put(aIQI,aIQI); - } - - public void addItem(iElementalStack em, ItemStack itemStack, boolean skipNBT){ - addItemQuantization(new aItemQuantizationInfo(itemStack,skipNBT,em)); - itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,itemStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addItem(iElementalStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ - addItemQuantization(new aItemQuantizationInfo(prefix,material,amount,skipNBT,em)); - itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,prefix,material,amount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iElementalStack em, String name, int qty){ - oredictQuantization.put(OreDictionary.getOreID(name),new aOredictQuantizationInfo(name,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,name,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iElementalStack em, OrePrefixes prefix, Materials material, int qty){ - oredictQuantization.put(OreDictionary.getOreID(prefix.name() + material.mName),new aOredictQuantizationInfo(prefix,material,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,material,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iElementalStack em, OrePrefixes prefix, String materialName, int qty){ - oredictQuantization.put(OreDictionary.getOreID(prefix.name() + materialName),new aOredictQuantizationInfo(prefix,materialName,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,materialName,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java deleted file mode 100644 index 2e8ef92073..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -/** - * Created by Tec on 23.05.2017. - */ -public interface iExchangeInfo { - OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. - //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) - - IN input();//same as above but for input -} 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 new file mode 100644 index 0000000000..77ac6c46c4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -0,0 +1,1694 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import com.github.technus.tectech.Reference; +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +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.XSTR; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.Materials; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; +import static gregtech.api.enums.OrePrefixes.dust; + +/** + * Created by danie_000 on 18.11.2016. + */ +public final class EMAtomDefinition extends EMComplex { + public static final long ATOM_COMPLEXITY_LIMIT=65536L; + private static final byte BYTE_OFFSET=32; + + private final int hash; + public static double refMass, refUnstableMass; + + private static final byte nbtType = (byte) 'a'; + private static final Random xstr = new XSTR();//NEEDS SEPARATE! + private static Map> stableIsotopes = new HashMap<>(); + private static final Map stableAtoms = new HashMap<>(); + private static Map> mostStableUnstableIsotopes = new HashMap<>(); + private static final Map unstableAtoms = new HashMap<>(); + private static EMDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; + private static final HashMap lifetimeOverrides = new HashMap<>(); + + private final EMNuclideIAEA iaea; + + private static EMAtomDefinition somethingHeavy; + public static EMAtomDefinition getSomethingHeavy() { + return somethingHeavy; + } + + private static final ArrayList overrides = new ArrayList<>(); + public static void addOverride(EMAtomDefinition atom, double rawLifeTime){ + lifetimeOverrides.put(atom,rawLifeTime); + } + + //float-mass in eV/c^2 + private final double mass; + //public final int charge; + private final int charge; + //int -electric charge in 1/3rds of electron charge for optimization + private final int chargeLeptons; + private double rawLifeTime; + //generation max present inside - minus if contains any anti quark + private final byte type; + + private final byte decayMode;//t neutron to proton+,0,f proton to neutron + //public final boolean stable; + + private final int neutralCount; + private final int element; + + private final boolean iaeaDefinitionExistsAndHasEnergyLevels; + + private final EMConstantStackMap elementalStacks; + + //stable is rawLifeTime>=10^9 + + public EMAtomDefinition(EMDefinitionStack... things) throws EMException { + this(true, new EMConstantStackMap(things)); + } + + private EMAtomDefinition(boolean check, EMDefinitionStack... things) throws EMException { + this(check, new EMConstantStackMap(things)); + } + + public EMAtomDefinition(EMConstantStackMap things) throws EMException { + this(true, things); + } + + private EMAtomDefinition(boolean check, EMConstantStackMap things) throws EMException { + if (check && !canTheyBeTogether(things)) { + throw new EMException("Atom Definition error"); + } + elementalStacks = things; + + double mass = 0; + int cLeptons = 0; + int cNucleus = 0; + int neutralCount = 0, element = 0; + int type = 0; + boolean containsAnti = false; + for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { + IEMDefinition def = stack.getDefinition(); + int amount = (int) stack.getAmount(); + if((int) stack.getAmount() != stack.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + mass += stack.getMass(); + if (def.getType() < 0) { + containsAnti = true; + } + type = Math.max(type, Math.abs(def.getType())); + + if (def instanceof EMLeptonDefinition) { + cLeptons += stack.getCharge(); + } else { + cNucleus += stack.getCharge(); + if (def.getCharge() == 3) { + element += amount; + } else if (def.getCharge() == -3) { + element -= amount; + } else if (def.getCharge() == 0) { + neutralCount += amount; + } + } + } + this.type = containsAnti ? (byte) -type : (byte) type; + //this.mass = mass; + chargeLeptons = cLeptons; + charge = cNucleus + cLeptons; + this.neutralCount = neutralCount; + this.element = element; + + element = Math.abs(element); + + //stability curve + int StableIsotope = stableIzoCurve(element); + int izoDiff = neutralCount - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + + xstr.setSeed((element + 1L) * (neutralCount + 100L)); + iaea = EMNuclideIAEA.get(element,neutralCount); + if(getIaea() !=null){ + if(Double.isNaN(getIaea().getMass())) { + this.mass = mass; + } else { + this.mass = getIaea().getMass(); + } + + if(Double.isNaN(getIaea().getHalfTime())) { + Double overriddenLifeTime= lifetimeOverrides.get(this); + double rawLifeTimeTemp; + if(overriddenLifeTime!=null) { + rawLifeTimeTemp = overriddenLifeTime; + } else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); + }else { + rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : getIaea().getHalfTime(); + } + iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length>1; + }else{ + this.mass=mass; + + Double overriddenLifeTime= lifetimeOverrides.get(this); + double rawLifeTimeTemp; + if(overriddenLifeTime!=null) { + rawLifeTimeTemp = overriddenLifeTime; + } else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); + + iaeaDefinitionExistsAndHasEnergyLevels =false; + } + + if(getIaea() ==null || getIaea().getEnergeticStatesArray()[0].energy!=0) { + if (izoDiff == 0) { + decayMode = 0; + } else { + decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); + } + }else{ + decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); + } + //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; + hash=super.hashCode(); + } + + private static int stableIzoCurve(int element) { + return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) + + 1.60885E-04D * Math.pow(element, 3D) + + 3.76604E-04D * Math.pow(element, 2D) + + 1.08418E+00D * (double) element); + } + + private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { + double rawLifeTime; + + if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { + rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); + } else { + //Y = (X-A)/(B-A) * (D-C) + C + double unstabilityEXP; + if (element == 0) { + return 1e-35D; + } else if (element == 1) { + unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; + } else if (element == 2) { + switch (isotope) { + case 4: + unstabilityEXP = 1.61D; + break; + case 5: + unstabilityEXP = -7.523D; + break; + case 6: + unstabilityEXP = -1.51D; + break; + default: + unstabilityEXP = -(izoDiffAbs * 6.165D); + break; + } + } else if (element <= 83 || isotope <= 127 && element <= 120) { + double elementPow4 = Math.pow(element, 4); + + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); + } else if (element < 180) { + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); + } else { + return -1; + } + if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { + unstabilityEXP -= 1.8D; + } + if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { + unstabilityEXP += 6; + } + if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) { + unstabilityEXP += 6; + } + rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); + } + + if (rawLifeTime < 8e-15D) { + return 1e-35D; + } + if (rawLifeTime > 8e28D) { + return 8e30D; + } + return rawLifeTime; + } + + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + boolean nuclei = false; + long qty=0; + for (EMDefinitionStack stack : stacks.valuesToArray()) { + if (stack.getDefinition() instanceof EMHadronDefinition) { + if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) { + return false; + } + nuclei = true; + } else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) { + return false; + } + if((int) stack.getAmount() != stack.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + qty+= stack.getAmount(); + } + return nuclei && qty= getIaea().getEnergeticStatesArray().length){ + return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].Thalf/(currentEnergy- getIaea().getEnergeticStatesArray().length+1); + } + return getIaea().getEnergeticStatesArray()[(int)currentEnergy].Thalf; + } + return rawLifeTime/(currentEnergy+1); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } + + @Override + public byte getColor() { + return -10; + } + + @Override + public String getLocalizedName() { + int element = Math.abs(this.getElement()); + boolean negative = this.getElement() < 0; + try { + if (Math.abs(getType()) != 1) { + return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; + } + return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return (negative ? "Element: ~" : "Element: ") + element; + } + } + + @Override + public String getSymbol() { + int element = Math.abs(this.getElement()); + boolean negative = this.getElement() < 0; + try { + return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + try { + int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + } catch (Exception E) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + } + } + } + + @Override + public String getShortSymbol() { + int element = Math.abs(this.getElement()); + boolean negative = this.getElement() < 0; + try { + return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + try { + int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; + } catch (Exception E) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return (negative ? "~" : "") + "?"; + } + } + } + + @Override + public EMConstantStackMap getSubParticles() { + return elementalStacks.clone(); + } + + @Override + public EMDecay[] getDecayArray() { + ArrayList decaysList =new ArrayList<>(4); + return getDecayArray(decaysList, getDecayMode(),true); + } + + private EMDecay[] getDecayArray(ArrayList decaysList, int decayMode, boolean tryAnti) {//todo? + if (getType() == 1) { + switch (decayMode) { + case -2: + if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } else if(PbetaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case -1: + if(Emmision(decaysList, EMHadronDefinition.hadron_p1)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 0: + if(alphaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 1: + if(Emmision(decaysList, EMHadronDefinition.hadron_n1)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 2: + if(MbetaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + default: + if(decayMode>8){ + if(iaeaDecay(decaysList,0)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); + } + } + return EMDecay.NO_DECAY; + }else if(getType() ==-1){ + EMAtomDefinition anti =getAnti(); + if(anti!=null) { + return anti.getDecayArray(decaysList, decayMode, false); + } + } + return getNaturalDecayInstant(); + } + + private boolean iaeaDecay(ArrayList decaysList, long energy){ + EMNuclideIAEA.energeticState state; + if(energy> getIaea().getEnergeticStatesArray().length) { + state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; + } else if(energy<=0) { + state = getIaea().getEnergeticStatesArray()[0]; + } else { + state = getIaea().getEnergeticStatesArray()[(int) energy]; + } + for (int i=0;i decaysList, EMNuclideIAEA.iaeaDecay decay, long energy){ + EMDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new EMDefinitionStackMap(); + switch (decay.decayName){ + case "D": { + if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())){ + withThis.putReplace(deuterium); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "3H": { + if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())){ + withThis.putReplace(tritium); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "3HE": { + if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())){ + withThis.putReplace(helium_3); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "8BE": { + if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())){ + withThis.putReplace(beryllium_8); + decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } break; + case "14C": { + if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())){ + newStuff.putReplace(carbon_14); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "24NE": { + if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())){ + newStuff.putReplace(neon_24); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "34SI": { + if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())){ + newStuff.putReplace(silicon_34); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "A": case "A?": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)){ + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2B-": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p2); + newStuff.putReplace(EMLeptonDefinition.lepton_e2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "EC": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2EC": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B++EC": case "EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+A": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B+2P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-A": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_n1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-2N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_n2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "B-P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECA": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECP": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "EC2P": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECP+EC2P": {//todo look at branching ratios + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(EMHadronDefinition.hadron_p3); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + newStuff.putReplace(EMHadronDefinition.hadron_n1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + newStuff.putReplace(EMHadronDefinition.hadron_n2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "2P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "SF": { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { + return true; + } + } break; + case "B-F": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "ECF": case "ECSF": case "EC(+SF)": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "SF(+EC+B+)": case "SF+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "SF+EC+B-": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)){ + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + return true; + } + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "IT": case "IT?": case "G": { + if(energy>0){ + decaysList.add(new EMDecay(decay.chance, this, boson_Y__)); + }else{ + if(DEBUG_MODE) { + TecTech.LOGGER.info("Tried to emit Gamma from ground state"); + } + decaysList.add(new EMDecay(decay.chance, this)); + } + return true; + } //break; + case "IT+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(EMBosonDefinition.boson_Y__1); + try{ + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } break; + case "DEAD_END": + decaysList.add(deadEnd); + return true; + default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName); + } + return false; + } + + private boolean Emmision(ArrayList decaysList, EMDefinitionStack emit) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(emit)) { + try { + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean alphaDecay(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmountsExact(alpha.getDefinition().getSubParticles())) { + try { + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean MbetaDecay(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(EMHadronDefinition.hadron_n1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_p1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e1, EMNeutrinoDefinition.lepton_Ve_1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean PbetaDecay(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(EMHadronDefinition.hadron_p1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_n1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e_1, EMNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean ElectronCapture(ArrayList decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_n1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { + EMDefinitionStackMap heavy = new EMDefinitionStackMap(); + double[] liquidDrop = liquidDropFunction(Math.abs(getElement())<=97); + + for(EMDefinitionStack stack: fissile.valuesToArray()){ + if(spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && + (stack.getAmount() <=80 || stack.getAmount() <90 && XSTR_INSTANCE.nextInt(10)< stack.getAmount() -80)) { + return false; + } + if(stack.getDefinition().getCharge()==0){ + //if(stack.definition instanceof dHadronDefinition){ + double neutrals= stack.getAmount() *liquidDrop[2]; + int neutrals_cnt=(int)Math.floor(neutrals); + neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0; + particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); + + int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[1]); + while(heavy_cnt+neutrals_cnt> stack.getAmount()) { + heavy_cnt--; + } + fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(),heavy_cnt+neutrals_cnt)); + heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); + //}else{ + // particles.add(stack); + // light.remove(stack.definition); + //} + }else{ + int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[0]); + if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { + heavy_cnt--; + } + EMDefinitionStack new_stack =new EMDefinitionStack(stack.getDefinition(), heavy_cnt); + fissile.removeAmountExact(new_stack); + heavy.putReplace(new_stack); + } + } + + try { + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); + decaysList.add(new EMDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if(DEBUG_MODE) { + e.printStackTrace(); + } + } + return false; + } + + private static double[] liquidDropFunction(boolean asymmetric) { + double[] out = new double[3]; + + out[0] = XSTR_INSTANCE.nextGaussian(); + + if (out[0] < 1 && out[0] >= -1) { + if (XSTR_INSTANCE.nextBoolean()) { + out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; + } + } + + if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) { + out[0] = -out[0]; + } + + //scale to splitting ratio + out[0] = out[0] * 0.05d + .6d; + + if (out[0] < 0 || out[0] > 1) { + return liquidDropFunction(asymmetric); + } + if (out[0] < .5d) { + out[0] = 1d - out[0]; + } + + //extra neutrals + out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; + + if (asymmetric) { + out[1] = out[0]; + } else { + out[1] = out[0] - out[2] * .5d; + } + + return out; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (iaeaDefinitionExistsAndHasEnergyLevels) { + ArrayList decays =new ArrayList<>(4); + if(iaeaDecay(decays,energyLevel)){ + return decays.toArray(EMDecay.NO_PRODUCT); + } + } + if(energyLevel< Math.abs(getCharge())/3+ getNeutralCount()) { + return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; + } + return getNaturalDecayInstant(); + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { + if(iaeaDefinitionExistsAndHasEnergyLevels){ + double result=0; + boolean backwards=newEnergyLevel= getIaea().getEnergeticStatesArray().length){ + if(currentEnergyLevel>= getIaea().getEnergeticStatesArray().length) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } else { + result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - getIaea().getEnergeticStatesArray().length + 1); + } + result+= getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].energy; + }else { + result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy; + } + + return backwards?-result:result; + } + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + if(!iaeaDefinitionExistsAndHasEnergyLevels) return false; + EMNuclideIAEA.energeticState state; + if(energyLevel> getIaea().getEnergeticStatesArray().length) { + state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; + } else if(energyLevel<=0) { + state = getIaea().getEnergeticStatesArray()[0]; + } else { + state = getIaea().getEnergeticStatesArray()[(int) energyLevel]; + } + for (EMNuclideIAEA.iaeaDecay decay:state.decaymodes){ + if(decay.decayName.contains("F")) return true;//if is fissile + } + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return getIaea() !=null || iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + //disembody + ArrayList decaysInto = new ArrayList<>(); + for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { + if (elementalStack.getDefinition().getType() == 1 || elementalStack.getDefinition().getType() == -1) { + //covers both quarks and antiquarks + decaysInto.add(elementalStack); + } else { + //covers both quarks and antiquarks + decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); + } + } + return new EMDecay[]{new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), deadEnd}; + } + + //@Override + //public iElementalDefinition getAnti() { + // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); + // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // for (int i = 0; i < antiElements.length; i++) { + // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // } + // try { + // return new dAtomDefinition(false, antiElements); + // } catch (tElementalException e) { + // if (DEBUG_MODE) e.printStackTrace(); + // return null; + // } + //} + + @Override + public EMAtomDefinition getAnti() { + EMDefinitionStackMap anti = new EMDefinitionStackMap(); + for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { + anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); + } + try { + return new EMAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return EMTransformationInfo.TRANSFORMATION_INFO.getFluidDequantization().get(this); + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return EMTransformationInfo.TRANSFORMATION_INFO.getItemDequantization().get(this); + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return EMTransformationInfo.TRANSFORMATION_INFO.getOredictDequantization().get(this); + } + + public EMNuclideIAEA getIaea() { + return iaea; + } + + public byte getDecayMode() { + return decayMode; + } + + public int getNeutralCount() { + return neutralCount; + } + + public int getElement() { + return element; + } + + private static final class Nomenclature { + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + } + + @Override + public NBTTagCompound toNBT() { + return getNbtTagCompound(nbtType, elementalStacks); + } + + public static EMAtomDefinition fromNBT(NBTTagCompound nbt) { + EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < stacks.length; i++) { + stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + } + try { + return new EMAtomDefinition(stacks); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + public static void run() { + for (Runnable r : overrides) { + r.run(); + } + + for(Map.Entry entry:lifetimeOverrides.entrySet()){ + try { + lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); + }catch (EMException e){ + e.printStackTrace(); //Impossible + } + } + + //populate stable isotopes + for (int element = 1; element < 83; element++)//Up to Bismuth exclusive + { + for (int isotope = 0; isotope < 130; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + int StableIsotope = stableIzoCurve(element); + int izoDiff = isotope - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); + if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { + TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); + isotopes.add(isotope); + } + } + } + + //populate unstable isotopes + for (int element = 83; element < 150; element++) { + for (int isotope = 100; isotope < 180; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + int Isotope = stableIzoCurve(element); + int izoDiff = isotope - Isotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); + isotopes.put(rawLifeTime, isotope); + } + } + + try { + for (Map.Entry> integerTreeSetEntry : stableIsotopes.entrySet()) { + stableAtoms.put(integerTreeSetEntry.getKey(), new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeSetEntry.getKey()), + new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeSetEntry.getKey()))); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); + } + } + for (Map.Entry> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { + unstableAtoms.put(integerTreeMapEntry.getKey(), new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), + new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeMapEntry.getKey()))); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); + } + } + deuterium=new EMAtomDefinition( + EMHadronDefinition.hadron_p1, + EMHadronDefinition.hadron_n1, + EMLeptonDefinition.lepton_e1).getStackForm(1); + tritium=new EMAtomDefinition( + EMHadronDefinition.hadron_p1, + EMHadronDefinition.hadron_n2, + EMLeptonDefinition.lepton_e1).getStackForm(1); + helium_3=new EMAtomDefinition( + EMHadronDefinition.hadron_p2, + EMHadronDefinition.hadron_n1, + EMLeptonDefinition.lepton_e2).getStackForm(1); + alpha = new EMAtomDefinition( + EMHadronDefinition.hadron_p2, + EMHadronDefinition.hadron_n2).getStackForm(1); + beryllium_8=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 4), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 4), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 4)).getStackForm(1); + carbon_14=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 6), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 8), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 6)).getStackForm(1); + neon_24=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 10), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 14), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 10)).getStackForm(1); + silicon_34=new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 14), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 20), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 14)).getStackForm(1); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + + try { + EMComplex.addCreatorFromNBT(nbtType, EMAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64); + } + } + + public static void setTransformation(){ + /*----STABLE ATOMS----**/ + refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; + + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); + + /*----UNSTABLE ATOMS----**/ + refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; + + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); + //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); + + try { + EMAtomDefinition temp; + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(deuterium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); + + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(tritium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); + + EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(helium_3.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); + + temp=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 146) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); + + double tempMass=temp.getMass(); + + temp=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 143) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); + + TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); + + temp=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 145) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); + + somethingHeavy=new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 147) + ); + EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); + + TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); + + TecTech.LOGGER.info("Neutron Mass: "+ EMHadronDefinition.hadron_n.getMass()); + + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + + if(Loader.isModLoaded(Reference.GTPLUSPLUS)) { + new GtppAtomLoader().run(); + } + } + + public static EMAtomDefinition getFirstStableIsotope(int element) { + return stableAtoms.get(element); + } + + public static EMAtomDefinition getBestUnstableIsotope(int element) { + return unstableAtoms.get(element); + } + + @Override + public byte getClassType() { + return 64; + } + + public static byte getClassTypeStatic(){ + return 64; + } + + @Override + public int hashCode() { + return hash; + } + + @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)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + nbtType + ' ' + getClassType()); + } + if(Util.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)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(iaeaDefinitionExistsAndHasEnergyLevels && Util.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)){ + 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 new file mode 100644 index 0000000000..384087770f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java @@ -0,0 +1,520 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.*; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import com.github.technus.tectech.util.Util; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static gregtech.api.enums.OrePrefixes.dust; + +/** + * Created by danie_000 on 17.11.2016. + */ +public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o + private final int hash; + + private static final byte nbtType = (byte) 'h'; + //Helpers + public static final Map SYMBOL_MAP =new HashMap<>(); + public static final Map NAME_MAP =new HashMap<>(); + public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; + public static EMDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; + private static double protonMass = 0D; + private static double neutronMass = 0D; + private static final double actualProtonMass=938272081.3D; + private static final double actualNeutronMass=939565413.3D; + + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + private final double rawLifeTime; + private final int amount; + //generation max present inside - minus if contains any antiquark + private final byte type; + //private final FluidStack fluidThing; + //private final ItemStack itemThing; + + private final EMConstantStackMap quarkStacks; + + public EMHadronDefinition(EMDefinitionStack... quarks) throws EMException { + this(true, new EMConstantStackMap(quarks)); + } + + private EMHadronDefinition(boolean check, EMDefinitionStack... quarks) throws EMException { + this(check, new EMConstantStackMap(quarks)); + } + + public EMHadronDefinition(EMConstantStackMap quarks) throws EMException { + this(true, quarks); + } + + private EMHadronDefinition(boolean check, EMConstantStackMap quarks) throws EMException { + if (check && !canTheyBeTogether(quarks)) { + throw new EMException("Hadron Definition error"); + } + quarkStacks = quarks; + + int amount = 0; + int charge = 0; + int type = 0; + boolean containsAnti = false; + double mass = 0; + for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) { + amount += quarkStack.getAmount(); + if((int) quarkStack.getAmount() != quarkStack.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + mass += quarkStack.getMass(); + charge += quarkStack.getCharge(); + type = Math.max(Math.abs(quarkStack.getDefinition().getType()), type); + if (quarkStack.getDefinition().getType() < 0) { + containsAnti = true; + } + } + this.amount = amount; + this.charge = charge; + this.type = containsAnti ? (byte) -type : (byte) type; + long mult = this.getAmount() * this.getAmount() * (this.getAmount() - 1); + mass = mass * 5.543D * mult;//yes it becomes heavier + + if (mass == protonMass && this.getAmount() == 3) { + rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME; + mass=actualProtonMass; + } else if (mass == neutronMass && this.getAmount() == 3) { + rawLifeTime = 882D; + mass=actualNeutronMass; + } else { + if (this.getAmount() == 3) { + rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); + } else if (this.getAmount() == 2) { + rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); + } else { + rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); + } + } + this.mass=mass; + hash=super.hashCode(); + } + + //public but u can just try{}catch(){} the constructor it still calls this method + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + long amount = 0; + for (EMDefinitionStack quarks : stacks.valuesToArray()) { + if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) { + return false; + } + if((int) quarks.getAmount() != quarks.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + amount += quarks.getAmount(); + } + return amount >= 2 && amount <= 12; + } + + @Override + public String getLocalizedName() { + StringBuilder name= new StringBuilder(getSimpleName()); + name.append(':'); + String sym= NAME_MAP.get(this); + if(sym!=null){ + name.append(' ').append(sym); + }else { + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount()); + } + } + return name.toString(); + } + + private String getSimpleName() { + switch (getAmount()) { + case 2: + return "Meson"; + case 3: + return "Baryon"; + case 4: + return "Tetraquark"; + case 5: + return "Pentaquark"; + case 6: + return "Hexaquark"; + default: + return "Hadron"; + } + } + + @Override + public String getSymbol() { + String sym=SYMBOL_MAP.get(this); + if(sym!=null){ + return sym; + }else { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + for (int i = 0; i < quark.getAmount(); i++) { + symbol.append(quark.getDefinition().getSymbol()); + } + } + return symbol.toString(); + } + } + + @Override + public String getShortSymbol() { + String sym=SYMBOL_MAP.get(this); + if(sym!=null){ + return sym; + }else { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + for (int i = 0; i < quark.getAmount(); i++) { + symbol.append(quark.getDefinition().getShortSymbol()); + } + } + return symbol.toString(); + } + } + + @Override + public byte getColor() { + return -7; + } + + @Override + public EMConstantStackMap getSubParticles() { + return quarkStacks; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + return EMDecay.NO_PRODUCT; + } + ArrayList decaysInto = new ArrayList<>(); + for (EMDefinitionStack quarks : quarkStacks) { + if (quarks.getDefinition().getType() == 1 || quarks.getDefinition().getType() == -1) { + //covers both quarks and antiquarks + decaysInto.add(quarks); + } else { + //covers both quarks and antiquarks + decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); + } + } + return new EMDecay[]{ + new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), + EMBosonDefinition.deadEnd + }; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && + quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && + quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + return EMDecay.NO_PRODUCT; + } else if (getAmount() != 3) { + return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + } else { + ArrayList newBaryon = new ArrayList<>(); + IEMDefinition[] Particles = new IEMDefinition[2]; + for (EMDefinitionStack quarks : quarkStacks) { + for (int i = 0; i < quarks.getAmount(); i++) { + newBaryon.add((EMQuarkDefinition) quarks.getDefinition()); + } + } + //remove last + EMQuarkDefinition lastQuark = newBaryon.remove(2); + + EMDefinitionStack[] decay; + if (Math.abs(lastQuark.getType()) > 1) { + decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); + } else { + decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); + } + newBaryon.add((EMQuarkDefinition) decay[0].getDefinition()); + Particles[0] = decay[1].getDefinition(); + Particles[1] = decay[2].getDefinition(); + + EMDefinitionStack[] contentOfBaryon = newBaryon.stream() + .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition,1)) + .toArray(EMDefinitionStack[]::new); + + try { + return new EMDecay[]{ + new EMDecay(0.001D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), + new EMDecay(0.99D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), + EMBosonDefinition.deadEnd}; + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return new EMDecay[]{EMBosonDefinition.deadEnd}; + } + } + } + + @Override + public double getMass() { + return mass; + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return getRawLifeTime(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } + + @Override + public byte getType() { + return type; + } + + //@Override + //public iElementalDefinition getAnti() { + // cElementalDefinitionStack[] stacks = this.quarkStacks.values(); + // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // for (int i = 0; i < antiElements.length; i++) { + // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // } + // try { + // return new dHadronDefinition(false, antiElements); + // } catch (tElementalException e) { + // if (DEBUG_MODE) e.printStackTrace(); + // return null; + // } + //} + + @Override + public IEMDefinition getAnti() { + EMDefinitionStackMap anti = new EMDefinitionStackMap(); + for (EMDefinitionStack stack : quarkStacks.valuesToArray()) { + anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); + } + try { + return new EMHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public NBTTagCompound toNBT() { + return getNbtTagCompound(nbtType, quarkStacks); + } + + public static EMHadronDefinition fromNBT(NBTTagCompound nbt) { + EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < stacks.length; i++) { + stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + } + try { + return new EMHadronDefinition(stacks); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + public static void run() { + try { + hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); + protonMass = hadron_p.getMass(); + //redefine the proton with proper lifetime (the lifetime is based on mass comparison) + hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); + SYMBOL_MAP.put(hadron_p,"p"); + NAME_MAP.put(hadron_p,"Proton"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); + hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); + SYMBOL_MAP.put(hadron_p_,"~p"); + NAME_MAP.put(hadron_p_,"Anti Proton"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); + neutronMass = hadron_n.getMass(); + //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); + SYMBOL_MAP.put(hadron_n, "n"); + NAME_MAP.put(hadron_n, "Neutron"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); + hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); + SYMBOL_MAP.put(hadron_n_,"~n"); + NAME_MAP.put(hadron_n_,"Anti Neutron"); + DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + protonMass = -1; + neutronMass = -1; + } + hadron_p1 = new EMDefinitionStack(hadron_p, 1D); + hadron_n1 = new EMDefinitionStack(hadron_n, 1D); + hadron_p2 = new EMDefinitionStack(hadron_p, 2D); + hadron_n2 = new EMDefinitionStack(hadron_n, 2D); + hadron_p3 = new EMDefinitionStack(hadron_p, 3D); + hadron_n3 = new EMDefinitionStack(hadron_n, 3D); + hadron_p5 = new EMDefinitionStack(hadron_p, 5D); + + try { + EMComplex.addCreatorFromNBT(nbtType, EMHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + if(DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + -64); + } + } + + public static void setTransformations(){ + //Added to atom map, but should be in its own + EMDefinitionStack neutrons =new EMDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); + TRANSFORMATION_INFO.getOredictDequantization().put(neutrons.getDefinition(),new EMOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); + TRANSFORMATION_INFO.getOredictQuantization().put( + OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), + new EMOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) + ); + } + + @Override + public byte getClassType() { + return -64; + } + + public static byte getClassTypeStatic(){ + return -64; + } + + @Override + public int hashCode() { + return hash; + } + + @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)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + nbtType + ' ' + getClassType()); + } + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+getSimpleName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + + public double getRawLifeTime() { + return rawLifeTime; + } + + public int getAmount() { + return amount; + } +} 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 new file mode 100644 index 0000000000..9a22f54941 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java @@ -0,0 +1,336 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.util.Util.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; + + //Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery + //Abund. [mole fract.] BR [%] [?N] [barn] [keV] [keV] [keV] [keV] [keV] [keV] [keV] [? AMU] [keV] + + //Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc, + //Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc, + private static final HashMap NUCLIDES =new HashMap<>(); + + public static void run(){ + String line=""; + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclides.csv"))); + ArrayList blockOfData=new ArrayList<>(4); + while((line=reader.readLine())!=null) { + String[] split= splitButDifferent(line,","); + if(split.length!=19) { + throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); + } + if(!split[1].isEmpty() && !blockOfData.isEmpty()) { + new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); + blockOfData.clear(); + } + blockOfData.add(split); + } + if(!blockOfData.isEmpty()) { + new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); + blockOfData.clear(); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclidesTable.csv"))); + while((line=reader.readLine())!=null) { + String[] split= splitButDifferent(line,","); + if(split.length!=47) { + throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclidesTable database " + line); + } + get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("energyLevels.csv"))); + while((line=reader.readLine())!=null) { + String[] split= splitButDifferent(line,","); + if(split.length!=27) { + throw new Error("Invalid count (" + split.length + ") of separators in IAEA energyLevels database " + line); + } + new energeticState(split); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + for(EMNuclideIAEA nuclide:NUCLIDES.values()) { + nuclide.makeArrayOfEnergyStates(); + } + } + + public static EMNuclideIAEA get(int protons, int neutrons){ + return NUCLIDES.get((protons<<16)+neutrons); + } + + private final short N; + private final short Z; + private final double halfTime;//sec + private final double mass;//eV/c^2 + private final short discovery;//year + private TreeMap energeticStates; + private energeticState[] energeticStatesArray; + + + private EMNuclideIAEA(String[][] rows){ + N=Short.parseShort(rows[1][2]); + Z=Short.parseShort(rows[1][0]); + NUCLIDES.put(((int) getZ() <<16)+ getN(),this); + + String[] parts = splitButDifferent(rows[0][16], "|"); + double Mass=doubleOrNaN(parts[0],"mass"); + if(!Double.isNaN(Mass)) { + //System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); + mass = Mass* MICRO_AMU_TO_EV_DIV_C_C; + } + else { + mass = Double.NaN; + } + + discovery=(short)doubleOrNaN(rows[0][18],"discovery"); + + if(rows[0][3].contains("STABLE")){ + halfTime = STABLE_RAW_LIFE_TIME; + }else{ + parts = splitButDifferent(rows[0][4], "|"); + halfTime = doubleOrNaN(parts[0],"half life"); + } + } + + private void getMoreData(String[] cells){ + //if(DEBUG_MODE) { + // if (add(cells[14])) System.out.println(N + " " + Z); + // if (add(cells[17])) System.out.println(N + " " + Z); + // if (add(cells[20])) System.out.println(N + " " + Z); + //} + new energeticState(this, getHalfTime(), getDecaysFixed( + cells[14], + doubleOrNaN(cells[15],"chance1"), + cells[17], + doubleOrNaN(cells[18],"chance1"), + cells[20], + doubleOrNaN(cells[21],"chance1"))); + } + + private static final energeticState[] empty=new energeticState[0]; + private void makeArrayOfEnergyStates(){ + if(energeticStates==null || energeticStates.isEmpty()) { + setEnergeticStatesArray(empty); + } else { + setEnergeticStatesArray(energeticStates.values().toArray(new energeticState[0])); + double life= getHalfTime(); + for (energeticState energeticState : getEnergeticStatesArray()) { + if(Double.isNaN(energeticState.Thalf)){ + energeticState.Thalf=life; + }else { + life=energeticState.Thalf; + } + } + } + } + + private double doubleOrNaN(String s, String name){ + s=s.replaceAll("#",""); + if(!s.isEmpty()) { + try { + double value=Double.parseDouble(s); + if(Double.isNaN(value)) { + return Double.NaN; + } + return value != 0 ?value:Double.NaN; + } catch (Exception e) { + System.out.println("Invalid Value " + name + ' ' + getN() + ' ' + getZ() + ' ' + s); + e.printStackTrace(); + } + } + return Double.NaN; + } + + public short getN() { + return N; + } + + public short getZ() { + return Z; + } + + public double getHalfTime() { + return halfTime; + } + + public double getMass() { + return mass; + } + + public short getDiscovery() { + return discovery; + } + + public energeticState[] getEnergeticStatesArray() { + return energeticStatesArray; + } + + public void setEnergeticStatesArray(energeticState[] energeticStatesArray) { + this.energeticStatesArray = energeticStatesArray; + } + + public static final class energeticState{ + public final double energy; + public double Thalf; + public final iaeaDecay[] decaymodes; + + private energeticState(EMNuclideIAEA nuclide, double Thalf, iaeaDecay[] decaymodes){ + energy=0; + this.Thalf=Thalf; + this.decaymodes=decaymodes; + if(nuclide.energeticStates==null) { + nuclide.energeticStates = new TreeMap<>(); + } + nuclide.energeticStates.put(energy,this); + } + + private energeticState(String[] cells){ + EMNuclideIAEA nuclide = get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); + if(nuclide==null) { + throw new Error("Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") + ' ' + (int) doubleOrNaN(cells[1], "neutrons")); + } + energy =doubleOrNaN(cells[3],"energy level",nuclide)*1000D;//to eV + if(energy<0) { + throw new Error("Invalid energy " + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + cells[3]); + } + Thalf =doubleOrNaN(cells[10],"half life",nuclide); + if(nuclide.energeticStates==null) { + new Exception("Should be initialized before doing this... "+ nuclide.getN() + ' ' + nuclide.getZ()).printStackTrace(); + nuclide.energeticStates = new TreeMap<>(); + } + nuclide.energeticStates.put(energy,this); + //if(DEBUG_MODE) { + // if (add(cells[12])) System.out.println(nuclide.N + " " + nuclide.Z); + // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); + // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); + //} + decaymodes = getDecaysFixed( + cells[12], + doubleOrNaN(cells[13],"chance 1",nuclide), + cells[15], + doubleOrNaN(cells[16],"chance 2",nuclide), + cells[18], + doubleOrNaN(cells[19],"chance 3",nuclide)); + } + + private double doubleOrNaN(String s, String name){ + return doubleOrNaN(s,name,null); + } + + private double doubleOrNaN(String s, String name, EMNuclideIAEA nuclide){ + s = s.replaceAll("#", ""); + if (!s.isEmpty()) { + try { + return Double.parseDouble(s); + } catch (Exception e) { + if(nuclide==null){ + System.out.println("Invalid Value " + name + ' ' + s); + }else { + System.out.println("Invalid Value " + name + ' ' + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + s); + } + e.printStackTrace(); + } + } + return Double.NaN; + } + } + + private static HashSet decays=new HashSet<>(); + private static boolean add(String s){ + if(decays.add(s)){ + System.out.println(s); + return true; + } + return false; + } + + private static iaeaDecay[] getDecaysFixed(String decay1, double chance1,String decay2, double chance2,String decay3, double chance3){ + boolean do1,do2,do3; + do1= !decay1.isEmpty() && !Double.isNaN(chance1); + do2= !decay2.isEmpty() && !Double.isNaN(chance2); + do3= !decay3.isEmpty() && !Double.isNaN(chance3); + TreeMap decays=new TreeMap<>(); + if(do1 && do2 && chance1==100 && chance2==100 && chance3!=100){ + decays.put(1D, new iaeaDecay(1D, decay1)); + if(do3) { + chance3/=100d; + decays.put(chance3, new iaeaDecay(chance3, decay2)); + chance2=1d-chance3; + } + chance2/=2d; + decays.put(chance2, new iaeaDecay(chance2, decay2)); + }else if(do1 && chance1==100){ + decays.put(1D, new iaeaDecay(1D, decay1)); + if(do2) { + chance2/=100d; + decays.put(chance2, new iaeaDecay(chance2, decay2)); + } + if(do3) { + chance3 /= 100d; + if(do2) { + chance3 *= chance2; + } + decays.put(chance3, new iaeaDecay(chance3, decay3)); + } + }else{ + double normalization= (do1?chance1:0) + (do2?chance2:0) + (do3?chance3:0); + if(do1) { + chance1/=normalization; + decays.put(chance1, new iaeaDecay(chance1, decay1)); + } + if(do2) { + chance2/=normalization; + decays.put(chance2, new iaeaDecay(chance2, decay2)); + } + if(do3) { + chance3/=normalization; + decays.put(chance3, new iaeaDecay(chance3, decay3)); + } + if(do1||do2||do3) { + decays.put(1D, iaeaDecay.DEAD_END); + } + } + //if(DEBUG_MODE){ + // System.out.println("INVALID SUM?\t"+normalization+"\t"+decay1+"\t"+chance1+"\t"+decay2+"\t"+chance2+"\t"+decay3+"\t"+chance3); + //} + return decays.values().toArray(new iaeaDecay[0]); + } + + public static final class iaeaDecay{ + public final double chance; + public final String decayName; + public static final iaeaDecay DEAD_END=new iaeaDecay(1D,"DEAD_END"); + private iaeaDecay(double chance,String decayName){ + this.chance=chance; + this.decayName=decayName; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java deleted file mode 100644 index 291ec8fe6b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ /dev/null @@ -1,1678 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.util.XSTR; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Materials; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; -import static gregtech.api.enums.OrePrefixes.dust; - -/** - * Created by danie_000 on 18.11.2016. - */ -public final class dAtomDefinition extends cElementalDefinition { - public static final long ATOM_COMPLEXITY_LIMIT=65536L; - private static final byte BYTE_OFFSET=32; - - private final int hash; - public static double refMass, refUnstableMass; - - private static final byte nbtType = (byte) 'a'; - private static final Random xstr = new XSTR();//NEEDS SEPARATE! - private static Map> stableIsotopes = new HashMap<>(); - private static final Map stableAtoms = new HashMap<>(); - private static Map> mostStableUnstableIsotopes = new HashMap<>(); - private static final Map unstableAtoms = new HashMap<>(); - private static cElementalDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; - private static final HashMap lifetimeOverrides = new HashMap<>(); - - public final iaeaNuclide iaea; - - private static dAtomDefinition somethingHeavy; - public static dAtomDefinition getSomethingHeavy() { - return somethingHeavy; - } - - private static final ArrayList overrides = new ArrayList<>(); - public static void addOverride(dAtomDefinition atom, double rawLifeTime){ - lifetimeOverrides.put(atom,rawLifeTime); - } - - //float-mass in eV/c^2 - public final double mass; - //public final int charge; - public final int charge; - //int -electric charge in 1/3rds of electron charge for optimization - public final int chargeLeptons; - private double rawLifeTime; - //generation max present inside - minus if contains any anti quark - public final byte type; - - public final byte decayMode;//t neutron to proton+,0,f proton to neutron - //public final boolean stable; - - public final int neutralCount; - public final int element; - - private final boolean iaeaDefinitionExistsAndHasEnergyLevels; - - private final cElementalConstantStackMap elementalStacks; - - //stable is rawLifeTime>=10^9 - - public dAtomDefinition(cElementalDefinitionStack... things) throws tElementalException { - this(true, new cElementalConstantStackMap(things)); - } - - private dAtomDefinition(boolean check, cElementalDefinitionStack... things) throws tElementalException { - this(check, new cElementalConstantStackMap(things)); - } - - public dAtomDefinition(cElementalConstantStackMap things) throws tElementalException { - this(true, things); - } - - private dAtomDefinition(boolean check, cElementalConstantStackMap things) throws tElementalException { - if (check && !canTheyBeTogether(things)) { - throw new tElementalException("Atom Definition error"); - } - elementalStacks = things; - - double mass = 0; - int cLeptons = 0; - int cNucleus = 0; - int neutralCount = 0, element = 0; - int type = 0; - boolean containsAnti = false; - for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) { - iElementalDefinition def = stack.definition; - int amount = (int)stack.amount; - if((int)stack.amount!=stack.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - mass += stack.getMass(); - if (def.getType() < 0) { - containsAnti = true; - } - type = Math.max(type, Math.abs(def.getType())); - - if (def instanceof eLeptonDefinition) { - cLeptons += stack.getCharge(); - } else { - cNucleus += stack.getCharge(); - if (def.getCharge() == 3) { - element += amount; - } else if (def.getCharge() == -3) { - element -= amount; - } else if (def.getCharge() == 0) { - neutralCount += amount; - } - } - } - this.type = containsAnti ? (byte) -type : (byte) type; - //this.mass = mass; - chargeLeptons = cLeptons; - charge = cNucleus + cLeptons; - this.neutralCount = neutralCount; - this.element = element; - - element = Math.abs(element); - - //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - - xstr.setSeed((element + 1L) * (neutralCount + 100L)); - iaea =iaeaNuclide.get(element,neutralCount); - if(iaea!=null){ - if(Double.isNaN(iaea.mass)) { - this.mass = mass; - } else { - this.mass = iaea.mass; - } - - if(Double.isNaN(iaea.halfTime)) { - Double overriddenLifeTime= lifetimeOverrides.get(this); - double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { - rawLifeTimeTemp = overriddenLifeTime; - } else { - rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); - } - rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - }else { - rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : iaea.halfTime; - } - iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1; - }else{ - this.mass=mass; - - Double overriddenLifeTime= lifetimeOverrides.get(this); - double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { - rawLifeTimeTemp = overriddenLifeTime; - } else { - rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); - } - rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - - iaeaDefinitionExistsAndHasEnergyLevels =false; - } - - if(iaea==null || iaea.energeticStatesArray[0].energy!=0) { - if (izoDiff == 0) { - decayMode = 0; - } else { - decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); - } - }else{ - decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); - } - //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - hash=super.hashCode(); - } - - private static int stableIzoCurve(int element) { - return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) + - 1.60885E-04D * Math.pow(element, 3D) + - 3.76604E-04D * Math.pow(element, 2D) + - 1.08418E+00D * (double) element); - } - - private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { - double rawLifeTime; - - if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { - rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); - } else { - //Y = (X-A)/(B-A) * (D-C) + C - double unstabilityEXP; - if (element == 0) { - return 1e-35D; - } else if (element == 1) { - unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; - } else if (element == 2) { - switch (isotope) { - case 4: - unstabilityEXP = 1.61D; - break; - case 5: - unstabilityEXP = -7.523D; - break; - case 6: - unstabilityEXP = -1.51D; - break; - default: - unstabilityEXP = -(izoDiffAbs * 6.165D); - break; - } - } else if (element <= 83 || isotope <= 127 && element <= 120) { - double elementPow4 = Math.pow(element, 4); - - unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); - } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); - } else { - return -1; - } - if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { - unstabilityEXP -= 1.8D; - } - if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { - unstabilityEXP += 6; - } - if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) { - unstabilityEXP += 6; - } - rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); - } - - if (rawLifeTime < 8e-15D) { - return 1e-35D; - } - if (rawLifeTime > 8e28D) { - return 8e30D; - } - return rawLifeTime; - } - - private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { - boolean nuclei = false; - long qty=0; - for (cElementalDefinitionStack stack : stacks.valuesToArray()) { - if (stack.definition instanceof dHadronDefinition) { - if (((dHadronDefinition) stack.definition).amount != 3) { - return false; - } - nuclei = true; - } else if (!(stack.definition instanceof eLeptonDefinition)) { - return false; - } - if((int)stack.amount!=stack.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - qty+=stack.amount; - } - return nuclei && qty=iaea.energeticStatesArray.length){ - return iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].Thalf/(currentEnergy-iaea.energeticStatesArray.length+1); - } - return iaea.energeticStatesArray[(int)currentEnergy].Thalf; - } - return rawLifeTime/(currentEnergy+1); - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } - - @Override - public byte getColor() { - return -10; - } - - @Override - public String getName() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - if (Math.abs(type) != 1) { - return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; - } - return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "Element: ~" : "Element: ") + element; - } - } - - @Override - public String getSymbol() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "? N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); - } - } - } - - @Override - public String getShortSymbol() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "?"; - } - } - } - - @Override - public cElementalConstantStackMap getSubParticles() { - return elementalStacks.clone(); - } - - @Override - public cElementalDecay[] getDecayArray() { - ArrayList decaysList=new ArrayList<>(4); - return getDecayArray(decaysList,decayMode,true); - } - - private cElementalDecay[] getDecayArray(ArrayList decaysList,int decayMode,boolean tryAnti) {//todo? - if (type == 1) { - switch (decayMode) { - case -2: - if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } else if(PbetaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case -1: - if(Emmision(decaysList, dHadronDefinition.hadron_p1)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 0: - if(alphaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 1: - if(Emmision(decaysList, dHadronDefinition.hadron_n1)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 2: - if(MbetaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - default: - if(decayMode>8){ - if(iaeaDecay(decaysList,0)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); - } - } - return cElementalDecay.noDecay; - }else if(type ==-1){ - dAtomDefinition anti=getAnti(); - if(anti!=null) { - return anti.getDecayArray(decaysList, decayMode, false); - } - } - return getNaturalDecayInstant(); - } - - private boolean iaeaDecay(ArrayList decaysList,long energy){ - iaeaNuclide.energeticState state; - if(energy>iaea.energeticStatesArray.length) { - state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1]; - } else if(energy<=0) { - state = iaea.energeticStatesArray[0]; - } else { - state = iaea.energeticStatesArray[(int) energy]; - } - for (int i=0;i decaysList, iaeaNuclide.iaeaDecay decay, long energy){ - cElementalDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new cElementalDefinitionStackMap(); - switch (decay.decayName){ - case "D": { - if (withThis.removeAllAmounts(false, deuterium.definition.getSubParticles())){ - withThis.putReplace(deuterium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "3H": { - if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){ - withThis.putReplace(tritium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "3HE": { - if (withThis.removeAllAmounts(false, helium_3.definition.getSubParticles())){ - withThis.putReplace(helium_3); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "8BE": { - if (withThis.removeAllAmounts(false, beryllium_8.definition.getSubParticles())){ - withThis.putReplace(beryllium_8); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } - } break; - case "14C": { - if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){ - newStuff.putReplace(carbon_14); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "24NE": { - if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){ - newStuff.putReplace(neon_24); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "34SI": { - if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){ - newStuff.putReplace(silicon_34); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "A": case "A?": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2B-": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - withThis.putUnify(dHadronDefinition.hadron_p2); - newStuff.putReplace(eLeptonDefinition.lepton_e2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "EC": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2EC": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e2)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B++EC": case "EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+A": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+2P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-A": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3, dHadronDefinition.hadron_p1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_n1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-2N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_n2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECA": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1,eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECP": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "EC2P": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECP+EC2P": {//todo look at branching ratios - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e2,dHadronDefinition.hadron_p5)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(dHadronDefinition.hadron_p3); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(dHadronDefinition.hadron_n1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - newStuff.putReplace(dHadronDefinition.hadron_n2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF": { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } break; - case "B-F": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECF": case "ECSF": case "EC(+SF)": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF(+EC+B+)": case "SF+EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF+EC+B-": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "IT": case "IT?": case "G": { - if(energy>0){ - decaysList.add(new cElementalDecay(decay.chance, this, boson_Y__)); - }else{ - if(DEBUG_MODE) { - TecTech.LOGGER.info("Tried to emit Gamma from ground state"); - } - decaysList.add(new cElementalDecay(decay.chance, this)); - } - return true; - } //break; - case "IT+EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(eBosonDefinition.boson_Y__1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "DEAD_END": - decaysList.add(deadEnd); - return true; - default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + neutralCount+ ' ' +element); - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Failed to decay " + element + ' ' + neutralCount + ' ' + decay.decayName); - } - return false; - } - - private boolean Emmision(ArrayList decaysList, cElementalDefinitionStack emit) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmount(false, emit)) { - try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean alphaDecay(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { - try { - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean MbetaDecay(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { - try { - tree.putUnify(dHadronDefinition.hadron_p1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean PbetaDecay(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { - try { - tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean ElectronCapture(ArrayList decaysList) { - cElementalDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { - try { - tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean Fission(ArrayList decaysList, cElementalDefinitionStackMap fissile, cElementalDefinitionStackMap particles, double probability, boolean spontaneousCheck) { - cElementalDefinitionStackMap heavy = new cElementalDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(Math.abs(element)<=97); - - for(cElementalDefinitionStack stack: fissile.valuesToArray()){ - if(spontaneousCheck && stack.definition instanceof dHadronDefinition && - (stack.amount<=80 || stack.amount<90 && XSTR_INSTANCE.nextInt(10)XSTR_INSTANCE.nextDouble()?1:0; - particles.putUnify(new cElementalDefinitionStack(stack.definition, neutrals_cnt)); - - int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[1]); - while(heavy_cnt+neutrals_cnt>stack.amount) { - heavy_cnt--; - } - fissile.removeAmount(false,new cElementalDefinitionStack(stack.definition,heavy_cnt+neutrals_cnt)); - heavy.putReplace(new cElementalDefinitionStack(stack.definition, heavy_cnt)); - //}else{ - // particles.add(stack); - // light.remove(stack.definition); - //} - }else{ - int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[0]); - if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { - heavy_cnt--; - } - cElementalDefinitionStack new_stack=new cElementalDefinitionStack(stack.definition, heavy_cnt); - fissile.removeAmount(false,new_stack); - heavy.putReplace(new_stack); - } - } - - try { - particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); - particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); - decaysList.add(new cElementalDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - return false; - } - - private static double[] liquidDropFunction(boolean asymmetric) { - double[] out = new double[3]; - - out[0] = XSTR_INSTANCE.nextGaussian(); - - if (out[0] < 1 && out[0] >= -1) { - if (XSTR_INSTANCE.nextBoolean()) { - out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; - } - } - - if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) { - out[0] = -out[0]; - } - - //scale to splitting ratio - out[0] = out[0] * 0.05d + .6d; - - if (out[0] < 0 || out[0] > 1) { - return liquidDropFunction(asymmetric); - } - if (out[0] < .5d) { - out[0] = 1d - out[0]; - } - - //extra neutrals - out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; - - if (asymmetric) { - out[1] = out[0]; - } else { - out[1] = out[0] - out[2] * .5d; - } - - return out; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - if (iaeaDefinitionExistsAndHasEnergyLevels) { - ArrayList decays=new ArrayList<>(4); - if(iaeaDecay(decays,energyLevel)){ - return decays.toArray(cElementalDecay.noProduct); - } - } - if(energyLevel< Math.abs(charge)/3+neutralCount) { - return new cElementalDecay[]{new cElementalDecay(1, this, boson_Y__)}; - } - return getNaturalDecayInstant(); - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { - if(iaeaDefinitionExistsAndHasEnergyLevels){ - double result=0; - boolean backwards=newEnergyLevel=iaea.energeticStatesArray.length){ - if(currentEnergyLevel>=iaea.energeticStatesArray.length) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } else { - result += iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - iaea.energeticStatesArray.length + 1); - } - result+=iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].energy; - }else { - result += iaea.energeticStatesArray[(int) Math.max(0, newEnergyLevel)].energy; - } - - return backwards?-result:result; - } - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - if(!iaeaDefinitionExistsAndHasEnergyLevels) return false; - iaeaNuclide.energeticState state; - if(energyLevel>iaea.energeticStatesArray.length) { - state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1]; - } else if(energyLevel<=0) { - state = iaea.energeticStatesArray[0]; - } else { - state = iaea.energeticStatesArray[(int) energyLevel]; - } - for (iaeaNuclide.iaeaDecay decay:state.decaymodes){ - if(decay.decayName.contains("F")) return true;//if is fissile - } - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return iaea!=null || iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - //disembody - ArrayList decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack elementalStack : elementalStacks.valuesToArray()) { - if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { - //covers both quarks and antiquarks - decaysInto.add(elementalStack); - } else { - //covers both quarks and antiquarks - decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); - } - } - return new cElementalDecay[]{new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), deadEnd}; - } - - //@Override - //public iElementalDefinition getAnti() { - // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); - // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; - // for (int i = 0; i < antiElements.length; i++) { - // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); - // } - // try { - // return new dAtomDefinition(false, antiElements); - // } catch (tElementalException e) { - // if (DEBUG_MODE) e.printStackTrace(); - // return null; - // } - //} - - @Override - public dAtomDefinition getAnti() { - cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); - for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) { - anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); - } - try { - return new dAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return bTransformationInfo.TRANSFORMATION_INFO.fluidDequantization.get(this); - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return bTransformationInfo.TRANSFORMATION_INFO.itemDequantization.get(this); - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return bTransformationInfo.TRANSFORMATION_INFO.oredictDequantization.get(this); - } - - private static final class Nomenclature { - private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, elementalStacks); - } - - public static dAtomDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new dAtomDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { - for (Runnable r : overrides) { - r.run(); - } - - for(Map.Entry entry:lifetimeOverrides.entrySet()){ - try { - lifetimeOverrides.put(new dAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); - }catch (tElementalException e){ - e.printStackTrace(); //Impossible - } - } - - //populate stable isotopes - for (int element = 1; element < 83; element++)//Up to Bismuth exclusive - { - for (int isotope = 0; isotope < 130; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - iaeaNuclide nuclide = iaeaNuclide.get(element, isotope); - if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.halfTime >= STABLE_RAW_LIFE_TIME) { - TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); - isotopes.add(isotope); - } - } - } - - //populate unstable isotopes - for (int element = 83; element < 150; element++) { - for (int isotope = 100; isotope < 180; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - //stability curve - int Isotope = stableIzoCurve(element); - int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); - isotopes.put(rawLifeTime, isotope); - } - } - - try { - for (Map.Entry> integerTreeSetEntry : stableIsotopes.entrySet()) { - stableAtoms.put(integerTreeSetEntry.getKey(), new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeSetEntry.getKey()), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeSetEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); - } - } - for (Map.Entry> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { - unstableAtoms.put(integerTreeMapEntry.getKey(), new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeMapEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); - } - } - deuterium=new dAtomDefinition( - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n1, - eLeptonDefinition.lepton_e1).getStackForm(1); - tritium=new dAtomDefinition( - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n2, - eLeptonDefinition.lepton_e1).getStackForm(1); - helium_3=new dAtomDefinition( - dHadronDefinition.hadron_p2, - dHadronDefinition.hadron_n1, - eLeptonDefinition.lepton_e2).getStackForm(1); - alpha = new dAtomDefinition( - dHadronDefinition.hadron_p2, - dHadronDefinition.hadron_n2).getStackForm(1); - beryllium_8=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 4), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 4), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 4)).getStackForm(1); - carbon_14=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 6), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 8), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 6)).getStackForm(1); - neon_24=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 10), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 14), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 10)).getStackForm(1); - silicon_34=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 14), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 20), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 14)).getStackForm(1); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64); - } - } - - public static void setTransformation(){ - /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; - - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); - - /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; - - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); - //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); - - try { - dAtomDefinition temp; - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); - - bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); - - double tempMass=temp.getMass(); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); - - TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); - - somethingHeavy=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) - ); - bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); - - TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); - - TecTech.LOGGER.info("Neutron Mass: "+dHadronDefinition.hadron_n.getMass()); - - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - if(Loader.isModLoaded(Reference.GTPLUSPLUS)) { - new GtppAtomLoader().run(); - } - } - - public static dAtomDefinition getFirstStableIsotope(int element) { - return stableAtoms.get(element); - } - - public static dAtomDefinition getBestUnstableIsotope(int element) { - return unstableAtoms.get(element); - } - - @Override - public byte getClassType() { - return 64; - } - - public static byte getClassTypeStatic(){ - return 64; - } - - @Override - public int hashCode() { - return hash; - } - - @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)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(iaeaDefinitionExistsAndHasEnergyLevels && Util.areBitsSet(SCAN_GET_ENERGY_STATES,capabilities)){ - for(int i=1;i SYMBOL_MAP =new HashMap<>(); - public static final Map NAME_MAP =new HashMap<>(); - public static dHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; - public static cElementalDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; - private static double protonMass = 0D; - private static double neutronMass = 0D; - private static final double actualProtonMass=938272081.3D; - private static final double actualNeutronMass=939565413.3D; - - //float-mass in eV/c^2 - public final double mass; - //int -electric charge in 1/3rds of electron charge for optimization - public final int charge; - public final double rawLifeTime; - public final int amount; - //generation max present inside - minus if contains any antiquark - public final byte type; - //private final FluidStack fluidThing; - //private final ItemStack itemThing; - - private final cElementalConstantStackMap quarkStacks; - - public dHadronDefinition(cElementalDefinitionStack... quarks) throws tElementalException { - this(true, new cElementalConstantStackMap(quarks)); - } - - private dHadronDefinition(boolean check, cElementalDefinitionStack... quarks) throws tElementalException { - this(check, new cElementalConstantStackMap(quarks)); - } - - public dHadronDefinition(cElementalConstantStackMap quarks) throws tElementalException { - this(true, quarks); - } - - private dHadronDefinition(boolean check, cElementalConstantStackMap quarks) throws tElementalException { - if (check && !canTheyBeTogether(quarks)) { - throw new tElementalException("Hadron Definition error"); - } - quarkStacks = quarks; - - int amount = 0; - int charge = 0; - int type = 0; - boolean containsAnti = false; - double mass = 0; - for (cElementalDefinitionStack quarkStack : quarkStacks.valuesToArray()) { - amount += quarkStack.amount; - if((int)quarkStack.amount!=quarkStack.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - mass += quarkStack.getMass(); - charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.definition.getType()), type); - if (quarkStack.definition.getType() < 0) { - containsAnti = true; - } - } - this.amount = amount; - this.charge = charge; - this.type = containsAnti ? (byte) -type : (byte) type; - long mult = this.amount * this.amount * (this.amount - 1); - mass = mass * 5.543D * mult;//yes it becomes heavier - - if (mass == protonMass && this.amount == 3) { - rawLifeTime = iElementalDefinition.STABLE_RAW_LIFE_TIME; - mass=actualProtonMass; - } else if (mass == neutronMass && this.amount == 3) { - rawLifeTime = 882D; - mass=actualNeutronMass; - } else { - if (this.amount == 3) { - rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); - } else if (this.amount == 2) { - rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); - } else { - rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); - } - } - this.mass=mass; - hash=super.hashCode(); - } - - //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) { - long amount = 0; - for (cElementalDefinitionStack quarks : stacks.valuesToArray()) { - if (!(quarks.definition instanceof eQuarkDefinition)) { - return false; - } - if((int)quarks.amount!=quarks.amount){ - throw new ArithmeticException("Amount cannot be safely converted to int!"); - } - amount += quarks.amount; - } - return amount >= 2 && amount <= 12; - } - - @Override - public String getName() { - StringBuilder name= new StringBuilder(getSimpleName()); - name.append(':'); - String sym= NAME_MAP.get(this); - if(sym!=null){ - name.append(' ').append(sym); - }else { - for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { - name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount); - } - } - return name.toString(); - } - - private String getSimpleName() { - switch (amount) { - case 2: - return "Meson"; - case 3: - return "Baryon"; - case 4: - return "Tetraquark"; - case 5: - return "Pentaquark"; - case 6: - return "Hexaquark"; - default: - return "Hadron"; - } - } - - @Override - public String getSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ - return sym; - }else { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { - for (int i = 0; i < quark.amount; i++) { - symbol.append(quark.definition.getSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public String getShortSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ - return sym; - }else { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) { - for (int i = 0; i < quark.amount; i++) { - symbol.append(quark.definition.getShortSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public byte getColor() { - return -7; - } - - @Override - public cElementalConstantStackMap getSubParticles() { - return quarkStacks; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { - return cElementalDecay.noProduct; - } - ArrayList decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack quarks : quarkStacks) { - if (quarks.definition.getType() == 1 || quarks.definition.getType() == -1) { - //covers both quarks and antiquarks - decaysInto.add(quarks); - } else { - //covers both quarks and antiquarks - decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); - } - } - return new cElementalDecay[]{ - new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), - eBosonDefinition.deadEnd - }; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{new cElementalDecay(0.75D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getDecayArray() { - cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (amount == 2 && quarkStacks.length == 2 && - quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && - quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { - return cElementalDecay.noProduct; - } else if (amount != 3) { - return new cElementalDecay[]{new cElementalDecay(0.95D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks - } else { - ArrayList newBaryon = new ArrayList<>(); - iElementalDefinition[] Particles = new iElementalDefinition[2]; - for (cElementalDefinitionStack quarks : quarkStacks) { - for (int i = 0; i < quarks.amount; i++) { - newBaryon.add((eQuarkDefinition) quarks.definition); - } - } - //remove last - eQuarkDefinition lastQuark = newBaryon.remove(2); - - cElementalDefinitionStack[] decay; - if (Math.abs(lastQuark.getType()) > 1) { - decay = lastQuark.getDecayArray()[1].outputStacks.valuesToArray(); - } else { - decay = lastQuark.getDecayArray()[2].outputStacks.valuesToArray(); - } - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; - - cElementalDefinitionStack[] contentOfBaryon = newBaryon.stream() - .map(eQuarkDefinition -> new cElementalDefinitionStack(eQuarkDefinition,1)) - .toArray(cElementalDefinitionStack[]::new); - - try { - return new cElementalDecay[]{ - new cElementalDecay(0.001D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), - new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), - eBosonDefinition.deadEnd}; - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return new cElementalDecay[]{eBosonDefinition.deadEnd}; - } - } - } - - @Override - public double getMass() { - return mass; - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } - - @Override - public byte getType() { - return type; - } - - //@Override - //public iElementalDefinition getAnti() { - // cElementalDefinitionStack[] stacks = this.quarkStacks.values(); - // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; - // for (int i = 0; i < antiElements.length; i++) { - // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); - // } - // try { - // return new dHadronDefinition(false, antiElements); - // } catch (tElementalException e) { - // if (DEBUG_MODE) e.printStackTrace(); - // return null; - // } - //} - - @Override - public iElementalDefinition getAnti() { - cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap(); - for (cElementalDefinitionStack stack : quarkStacks.valuesToArray()) { - anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); - } - try { - return new dHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, quarkStacks); - } - - public static dHadronDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new dHadronDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { - try { - hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); - protonMass = hadron_p.mass; - //redefine the proton with proper lifetime (the lifetime is based on mass comparison) - hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); - SYMBOL_MAP.put(hadron_p,"p"); - NAME_MAP.put(hadron_p,"Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); - hadron_p_ = (dHadronDefinition) hadron_p.getAnti(); - SYMBOL_MAP.put(hadron_p_,"~p"); - NAME_MAP.put(hadron_p_,"Anti Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); - hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); - neutronMass = hadron_n.mass; - //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) - hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); - SYMBOL_MAP.put(hadron_n, "n"); - NAME_MAP.put(hadron_n, "Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); - hadron_n_ = (dHadronDefinition) hadron_n.getAnti(); - SYMBOL_MAP.put(hadron_n_,"~n"); - NAME_MAP.put(hadron_n_,"Anti Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - protonMass = -1; - neutronMass = -1; - } - hadron_p1 = new cElementalDefinitionStack(hadron_p, 1D); - hadron_n1 = new cElementalDefinitionStack(hadron_n, 1D); - hadron_p2 = new cElementalDefinitionStack(hadron_p, 2D); - hadron_n2 = new cElementalDefinitionStack(hadron_n, 2D); - hadron_p3 = new cElementalDefinitionStack(hadron_p, 3D); - hadron_n3 = new cElementalDefinitionStack(hadron_n, 3D); - hadron_p5 = new cElementalDefinitionStack(hadron_p, 5D); - - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + -64); - } - } - - public static void setTransformations(){ - //Added to atom map, but should be in its own - cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); - TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); - TRANSFORMATION_INFO.oredictQuantization.put( - OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), - new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) - ); - } - - @Override - public byte getClassType() { - return -64; - } - - public static byte getClassTypeStatic(){ - return -64; - } - - @Override - public int hashCode() { - return hash; - } - - @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)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getSimpleName()); - //lines.add("SYMBOL = "+getSymbol()); - } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(Util.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/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java deleted file mode 100644 index 8b09bfd2e0..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.util.Util.splitButDifferent; - -public final class iaeaNuclide { - public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D; - - //Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery - //Abund. [mole fract.] BR [%] [?N] [barn] [keV] [keV] [keV] [keV] [keV] [keV] [keV] [? AMU] [keV] - - //Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc, - //Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc, - private static final HashMap NUCLIDES=new HashMap<>(); - - public static void run(){ - String line=""; - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclides.csv"))); - ArrayList blockOfData=new ArrayList<>(4); - while((line=reader.readLine())!=null) { - String[] split= splitButDifferent(line,","); - if(split.length!=19) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); - } - if(!split[1].isEmpty() && !blockOfData.isEmpty()) { - new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][])); - blockOfData.clear(); - } - blockOfData.add(split); - } - if(!blockOfData.isEmpty()) { - new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][])); - blockOfData.clear(); - } - reader.close(); - }catch (Exception e){ - System.out.println(line); - e.printStackTrace(); - } - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclidesTable.csv"))); - while((line=reader.readLine())!=null) { - String[] split= splitButDifferent(line,","); - if(split.length!=47) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclidesTable database " + line); - } - get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); - } - reader.close(); - }catch (Exception e){ - System.out.println(line); - e.printStackTrace(); - } - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("energyLevels.csv"))); - while((line=reader.readLine())!=null) { - String[] split= splitButDifferent(line,","); - if(split.length!=27) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA energyLevels database " + line); - } - new energeticState(split); - } - reader.close(); - }catch (Exception e){ - System.out.println(line); - e.printStackTrace(); - } - - for(iaeaNuclide nuclide:NUCLIDES.values()) { - nuclide.makeArrayOfEnergyStates(); - } - } - - public static iaeaNuclide get(int protons, int neutrons){ - return NUCLIDES.get((protons<<16)+neutrons); - } - - public final short N,Z; - public final double halfTime;//sec - public final double mass;//eV/c^2 - public final short discovery;//year - private TreeMap energeticStates; - public energeticState[] energeticStatesArray; - - - private iaeaNuclide(String[][] rows){ - N=Short.parseShort(rows[1][2]); - Z=Short.parseShort(rows[1][0]); - NUCLIDES.put(((int)Z <<16)+N,this); - - String[] parts = splitButDifferent(rows[0][16], "|"); - double Mass=doubleOrNaN(parts[0],"mass"); - if(!Double.isNaN(Mass)) { - //System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); - mass = Mass* MICRO_AMU_TO_EV_DIV_C_C; - } - else { - mass = Double.NaN; - } - - discovery=(short)doubleOrNaN(rows[0][18],"discovery"); - - if(rows[0][3].contains("STABLE")){ - halfTime = STABLE_RAW_LIFE_TIME; - }else{ - parts = splitButDifferent(rows[0][4], "|"); - halfTime = doubleOrNaN(parts[0],"half life"); - } - } - - private void getMoreData(String[] cells){ - //if(DEBUG_MODE) { - // if (add(cells[14])) System.out.println(N + " " + Z); - // if (add(cells[17])) System.out.println(N + " " + Z); - // if (add(cells[20])) System.out.println(N + " " + Z); - //} - new energeticState(this, halfTime, getDecaysFixed( - cells[14], - doubleOrNaN(cells[15],"chance1"), - cells[17], - doubleOrNaN(cells[18],"chance1"), - cells[20], - doubleOrNaN(cells[21],"chance1"))); - } - - private static final energeticState[] empty=new energeticState[0]; - private void makeArrayOfEnergyStates(){ - if(energeticStates==null || energeticStates.isEmpty()) { - energeticStatesArray = empty; - } else { - energeticStatesArray = energeticStates.values().toArray(new energeticState[0]); - double life=halfTime; - for (energeticState energeticState : energeticStatesArray) { - if(Double.isNaN(energeticState.Thalf)){ - energeticState.Thalf=life; - }else { - life=energeticState.Thalf; - } - } - } - } - - private double doubleOrNaN(String s, String name){ - s=s.replaceAll("#",""); - if(!s.isEmpty()) { - try { - double value=Double.parseDouble(s); - if(Double.isNaN(value)) { - return Double.NaN; - } - return value != 0 ?value:Double.NaN; - } catch (Exception e) { - System.out.println("Invalid Value " + name + ' ' + N + ' ' + Z + ' ' + s); - e.printStackTrace(); - } - } - return Double.NaN; - } - - public static final class energeticState{ - public final double energy; - public double Thalf; - public final iaeaDecay[] decaymodes; - - private energeticState(iaeaNuclide nuclide,double Thalf,iaeaDecay[] decaymodes){ - energy=0; - this.Thalf=Thalf; - this.decaymodes=decaymodes; - if(nuclide.energeticStates==null) { - nuclide.energeticStates = new TreeMap<>(); - } - nuclide.energeticStates.put(energy,this); - } - - private energeticState(String[] cells){ - iaeaNuclide nuclide= get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); - if(nuclide==null) { - throw new Error("Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") + ' ' + (int) doubleOrNaN(cells[1], "neutrons")); - } - energy =doubleOrNaN(cells[3],"energy level",nuclide)*1000D;//to eV - if(energy<0) { - throw new Error("Invalid energy " + nuclide.N + ' ' + nuclide.Z + ' ' + cells[3]); - } - Thalf =doubleOrNaN(cells[10],"half life",nuclide); - if(nuclide.energeticStates==null) { - new Exception("Should be initialized before doing this... "+ nuclide.N + ' ' +nuclide.Z).printStackTrace(); - nuclide.energeticStates = new TreeMap<>(); - } - nuclide.energeticStates.put(energy,this); - //if(DEBUG_MODE) { - // if (add(cells[12])) System.out.println(nuclide.N + " " + nuclide.Z); - // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); - // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); - //} - decaymodes = getDecaysFixed( - cells[12], - doubleOrNaN(cells[13],"chance 1",nuclide), - cells[15], - doubleOrNaN(cells[16],"chance 2",nuclide), - cells[18], - doubleOrNaN(cells[19],"chance 3",nuclide)); - } - - private double doubleOrNaN(String s, String name){ - return doubleOrNaN(s,name,null); - } - - private double doubleOrNaN(String s, String name, iaeaNuclide nuclide){ - s = s.replaceAll("#", ""); - if (!s.isEmpty()) { - try { - return Double.parseDouble(s); - } catch (Exception e) { - if(nuclide==null){ - System.out.println("Invalid Value " + name + ' ' + s); - }else { - System.out.println("Invalid Value " + name + ' ' + nuclide.N + ' ' + nuclide.Z + ' ' + s); - } - e.printStackTrace(); - } - } - return Double.NaN; - } - } - - private static HashSet decays=new HashSet<>(); - private static boolean add(String s){ - if(decays.add(s)){ - System.out.println(s); - return true; - } - return false; - } - - private static iaeaDecay[] getDecaysFixed(String decay1, double chance1,String decay2, double chance2,String decay3, double chance3){ - boolean do1,do2,do3; - do1= !decay1.isEmpty() && !Double.isNaN(chance1); - do2= !decay2.isEmpty() && !Double.isNaN(chance2); - do3= !decay3.isEmpty() && !Double.isNaN(chance3); - TreeMap decays=new TreeMap<>(); - if(do1 && do2 && chance1==100 && chance2==100 && chance3!=100){ - decays.put(1D, new iaeaDecay(1D, decay1)); - if(do3) { - chance3/=100d; - decays.put(chance3, new iaeaDecay(chance3, decay2)); - chance2=1d-chance3; - } - chance2/=2d; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - }else if(do1 && chance1==100){ - decays.put(1D, new iaeaDecay(1D, decay1)); - if(do2) { - chance2/=100d; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - } - if(do3) { - chance3 /= 100d; - if(do2) { - chance3 *= chance2; - } - decays.put(chance3, new iaeaDecay(chance3, decay3)); - } - }else{ - double normalization= (do1?chance1:0) + (do2?chance2:0) + (do3?chance3:0); - if(do1) { - chance1/=normalization; - decays.put(chance1, new iaeaDecay(chance1, decay1)); - } - if(do2) { - chance2/=normalization; - decays.put(chance2, new iaeaDecay(chance2, decay2)); - } - if(do3) { - chance3/=normalization; - decays.put(chance3, new iaeaDecay(chance3, decay3)); - } - if(do1||do2||do3) { - decays.put(1D, iaeaDecay.DEAD_END); - } - } - //if(DEBUG_MODE){ - // System.out.println("INVALID SUM?\t"+normalization+"\t"+decay1+"\t"+chance1+"\t"+decay2+"\t"+chance2+"\t"+decay3+"\t"+chance3); - //} - return decays.values().toArray(new iaeaDecay[0]); - } - - public static final class iaeaDecay{ - public final double chance; - public final String decayName; - public static final iaeaDecay DEAD_END=new iaeaDecay(1D,"DEAD_END"); - private iaeaDecay(double chance,String decayName){ - this.chance=chance; - this.decayName=decayName; - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java new file mode 100644 index 0000000000..e3efa3b7e6 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMBosonDefinition extends EMPrimitive { + public static final EMBosonDefinition + boson_Y__ = new EMBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), + boson_H__ = new EMBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); + //deadEnd + public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); + public static final EMDecay deadEndHalf = new EMDecay(boson_Y__); + public static final EMDefinitionStack boson_Y__1 =new EMDefinitionStack(boson_Y__,1); + + private EMBosonDefinition(String name, String symbol, double mass, int color, int ID) { + super(name, symbol, 0, mass, 0, color, ID); + } + + public static void run() { + boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + boson_H__.init(null, 1.56e-22D, 2, 2, + new EMDecay(0.01D, quark_b, quark_b_), + new EMDecay(0.02D, lepton_t, lepton_t_), + new EMDecay(0.96D, new EMDefinitionStack(boson_Y__, 4)), + deadEnd); + } + + @Override + public String getLocalizedName() { + return "Boson: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return this==boson_H__; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java new file mode 100644 index 0000000000..98bdf7ca5c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -0,0 +1,69 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMLeptonDefinition extends EMPrimitive { + public static final EMLeptonDefinition + lepton_e = new EMLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), + lepton_m = new EMLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), + lepton_t = new EMLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), + lepton_e_ = new EMLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), + lepton_m_ = new EMLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), + lepton_t_ = new EMLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); + + public static final EMDefinitionStack lepton_e1 = new EMDefinitionStack(lepton_e, 1); + public static final EMDefinitionStack lepton_e2 = new EMDefinitionStack(lepton_e, 2); + public static final EMDefinitionStack lepton_e_1 = new EMDefinitionStack(lepton_e_, 1); + public static final EMDefinitionStack lepton_e_2 = new EMDefinitionStack(lepton_e_, 2); + + private EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { + super(name, symbol, type, mass, charge, -1, ID); + //this.itemThing=null; + //this.fluidThing=null; + } + + public static void run() { + lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, + deadEnd, + new EMDecay(lepton_e,boson_Y__)); + lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, + new EMDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), + deadEnd);//makes photons and don't care + lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, + new EMDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), + new EMDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), + new EMDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), + deadEnd);//makes photons and don't care + + lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, + deadEnd, + new EMDecay(lepton_e,boson_Y__)); + lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, + new EMDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), + deadEnd);//makes photons and don't care + lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, + new EMDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), + new EMDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), + new EMDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), + deadEnd);//makes photons and don't care + } + + @Override + public String getLocalizedName() { + return "Lepton: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java new file mode 100644 index 0000000000..e77c74ed89 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -0,0 +1,59 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMNeutrinoDefinition extends EMPrimitive { + public static final EMNeutrinoDefinition + lepton_Ve = new EMNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), + lepton_Vm = new EMNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), + lepton_Vt = new EMNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), + lepton_Ve_ = new EMNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), + lepton_Vm_ = new EMNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), + lepton_Vt_ = new EMNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); + + public static final EMDefinitionStack lepton_Ve1 = new EMDefinitionStack(lepton_Ve, 1); + public static final EMDefinitionStack lepton_Ve2 = new EMDefinitionStack(lepton_Ve, 2); + public static final EMDefinitionStack lepton_Ve_1 = new EMDefinitionStack(lepton_Ve_, 1); + public static final EMDefinitionStack lepton_Ve_2 = new EMDefinitionStack(lepton_Ve_, 2); + + private EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { + super(name, symbol, type, mass, 0, -1, ID); + } + + public static void run() { + lepton_Ve.init(lepton_Ve_, 1D, -1, -1, + EMDecay.NO_PRODUCT); + lepton_Vm.init(lepton_Vm_, 1D, 1, 0, + new EMDecay(0.825D, nothing), + deadEndHalf); + lepton_Vt.init(lepton_Vt_, 1, 1, 0, + new EMDecay(0.75F, nothing), + deadEnd); + + lepton_Ve_.init(lepton_Ve, 1, -1, -1, + EMDecay.NO_PRODUCT); + lepton_Vm_.init(lepton_Vm, 1, 1, 0, + new EMDecay(0.825F, nothing), + deadEndHalf); + lepton_Vt_.init(lepton_Vt, 1, 1, 0, + new EMDecay(0.75F, nothing), + deadEnd); + } + + @Override + public String getLocalizedName() { + return "Lepton: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java new file mode 100644 index 0000000000..68591cc4e6 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -0,0 +1,39 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMPrimitiveDefinition extends EMPrimitive { + public static final EMPrimitiveDefinition + nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), + null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), + space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), + magic = new EMPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), + magic_ = new EMPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); + + private EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { + super(name, symbol, type, mass, 0, color, ID); + } + + public static void run() { + nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + } + + @Override + public String getLocalizedName() { + return "Primitive: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java new file mode 100644 index 0000000000..b0a5c419e1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -0,0 +1,106 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMQuarkDefinition extends EMPrimitive { + public static final EMQuarkDefinition + quark_u = new EMQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), + quark_c = new EMQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), + quark_t = new EMQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), + quark_d = new EMQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), + quark_s = new EMQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), + quark_b = new EMQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), + quark_u_ = new EMQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), + quark_c_ = new EMQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), + quark_t_ = new EMQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), + quark_d_ = new EMQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), + quark_s_ = new EMQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), + quark_b_ = new EMQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); + + private EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { + super(name, symbol, type, mass, charge, 0, ID); + } + + public static void run() { + quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), + new EMDecay(0.9D, quark_d, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_c.init(quark_c_, 0.5e-13D, 1, -1, + new EMDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), + new EMDecay(0.9D, quark_s, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_t.init(quark_t_, 2.5e-26D, 0, -1, + new EMDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), + new EMDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), + new EMDecay(0.9D, quark_b, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + + quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), + new EMDecay(0.9D, quark_u, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_s.init(quark_s_, 0.6e-9D, 1, -1, + new EMDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), + new EMDecay(0.9D, quark_c, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_b.init(quark_b_, 0.7e-13D, 0, -1, + new EMDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), + new EMDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), + new EMDecay(0.9D, quark_t, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + + quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), + new EMDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_c_.init(quark_c, 0.5e-13D, 1, -1, + new EMDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), + new EMDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_t_.init(quark_t, 2.5e-26F, 0, -1, + new EMDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), + new EMDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), + new EMDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), + EMBosonDefinition.deadEnd);//makes photons and don't care + + quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), + new EMDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_s_.init(quark_s, 0.6e-9F, 1, -1, + new EMDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), + new EMDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + quark_b_.init(quark_b, 0.7e-13F, 0, -1, + new EMDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), + new EMDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), + new EMDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), + EMBosonDefinition.deadEnd);//makes photons and don't care + } + + @Override + public String getLocalizedName() { + return "Quark: " + getName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java deleted file mode 100644 index 8096743b78..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cPrimitiveDefinition extends cElementalPrimitive { - public static final cPrimitiveDefinition - nbtE__ = new cPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), - null__ = new cPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), - space__ = new cPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), - magic = new cPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), - magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); - - private cPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { - super(name, symbol, type, mass, 0, color, ID); - } - - public static void run() { - nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - } - - @Override - public String getName() { - return "Primitive: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java deleted file mode 100644 index e87df806d3..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eBosonDefinition extends cElementalPrimitive { - public static final eBosonDefinition - boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), - boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); - //deadEnd - public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__, boson_Y__); - public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__); - public static final cElementalDefinitionStack boson_Y__1=new cElementalDefinitionStack(boson_Y__,1); - - private eBosonDefinition(String name, String symbol, double mass, int color, int ID) { - super(name, symbol, 0, mass, 0, color, ID); - } - - public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - boson_H__.init(null, 1.56e-22D, 2, 2, - new cElementalDecay(0.01D, quark_b, quark_b_), - new cElementalDecay(0.02D, lepton_t, lepton_t_), - new cElementalDecay(0.96D, new cElementalDefinitionStack(boson_Y__, 4)), - deadEnd); - } - - @Override - public String getName() { - return "Boson: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return this==boson_H__; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java deleted file mode 100644 index c8e3b07f02..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eLeptonDefinition extends cElementalPrimitive { - public static final eLeptonDefinition - lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), - lepton_m = new eLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), - lepton_t = new eLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), - lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), - lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), - lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); - - public static final cElementalDefinitionStack lepton_e1 = new cElementalDefinitionStack(lepton_e, 1); - public static final cElementalDefinitionStack lepton_e2 = new cElementalDefinitionStack(lepton_e, 2); - public static final cElementalDefinitionStack lepton_e_1 = new cElementalDefinitionStack(lepton_e_, 1); - public static final cElementalDefinitionStack lepton_e_2 = new cElementalDefinitionStack(lepton_e_, 2); - - private eLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, -1, ID); - //this.itemThing=null; - //this.fluidThing=null; - } - - public static void run() { - lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, - deadEnd, - new cElementalDecay(lepton_e,boson_Y__)); - lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, - new cElementalDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), - deadEnd);//makes photons and don't care - lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, - new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), - new cElementalDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), - new cElementalDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), - deadEnd);//makes photons and don't care - - lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, - deadEnd, - new cElementalDecay(lepton_e,boson_Y__)); - lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, - new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), - deadEnd);//makes photons and don't care - lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, - new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), - new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), - new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), - deadEnd);//makes photons and don't care - } - - @Override - public String getName() { - return "Lepton: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java deleted file mode 100644 index 0f0725d208..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eNeutrinoDefinition extends cElementalPrimitive { - public static final eNeutrinoDefinition - lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), - lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), - lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), - lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), - lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), - lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); - - public static final cElementalDefinitionStack lepton_Ve1 = new cElementalDefinitionStack(lepton_Ve, 1); - public static final cElementalDefinitionStack lepton_Ve2 = new cElementalDefinitionStack(lepton_Ve, 2); - public static final cElementalDefinitionStack lepton_Ve_1 = new cElementalDefinitionStack(lepton_Ve_, 1); - public static final cElementalDefinitionStack lepton_Ve_2 = new cElementalDefinitionStack(lepton_Ve_, 2); - - private eNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { - super(name, symbol, type, mass, 0, -1, ID); - } - - public static void run() { - lepton_Ve.init(lepton_Ve_, 1D, -1, -1, - cElementalDecay.noProduct); - lepton_Vm.init(lepton_Vm_, 1D, 1, 0, - new cElementalDecay(0.825D, nothing), - deadEndHalf); - lepton_Vt.init(lepton_Vt_, 1, 1, 0, - new cElementalDecay(0.75F, nothing), - deadEnd); - - lepton_Ve_.init(lepton_Ve, 1, -1, -1, - cElementalDecay.noProduct); - lepton_Vm_.init(lepton_Vm, 1, 1, 0, - new cElementalDecay(0.825F, nothing), - deadEndHalf); - lepton_Vt_.init(lepton_Vt, 1, 1, 0, - new cElementalDecay(0.75F, nothing), - deadEnd); - } - - @Override - public String getName() { - return "Lepton: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java deleted file mode 100644 index 798066466b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eQuarkDefinition extends cElementalPrimitive { - public static final eQuarkDefinition - quark_u = new eQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), - quark_c = new eQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), - quark_t = new eQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), - quark_d = new eQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), - quark_s = new eQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), - quark_b = new eQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), - quark_u_ = new eQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), - quark_c_ = new eQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), - quark_t_ = new eQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), - quark_d_ = new eQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), - quark_s_ = new eQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), - quark_b_ = new eQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); - - private eQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, 0, ID); - } - - public static void run() { - quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), - new cElementalDecay(0.9D, quark_d, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_c.init(quark_c_, 0.5e-13D, 1, -1, - new cElementalDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), - new cElementalDecay(0.9D, quark_s, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26D, 0, -1, - new cElementalDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), - new cElementalDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), - new cElementalDecay(0.9D, quark_b, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - - quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), - new cElementalDecay(0.9D, quark_u, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_s.init(quark_s_, 0.6e-9D, 1, -1, - new cElementalDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), - new cElementalDecay(0.9D, quark_c, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13D, 0, -1, - new cElementalDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), - new cElementalDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), - new cElementalDecay(0.9D, quark_t, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - - quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), - new cElementalDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_c_.init(quark_c, 0.5e-13D, 1, -1, - new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), - new cElementalDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), - new cElementalDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 0, -1, - new cElementalDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), - new cElementalDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), - new cElementalDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), - eBosonDefinition.deadEnd);//makes photons and don't care - - quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), - new cElementalDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_s_.init(quark_s, 0.6e-9F, 1, -1, - new cElementalDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), - new cElementalDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), - new cElementalDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 0, -1, - new cElementalDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), - new cElementalDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), - new cElementalDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), - eBosonDefinition.deadEnd);//makes photons and don't care - } - - @Override - public String getName() { - return "Quark: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index 05f251924e..f5cfad22f3 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,9 +1,11 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +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.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; @@ -17,16 +19,16 @@ import java.util.HashSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; public class TT_recipe extends GT_Recipe { - public static final String E_RECIPE_ID = "eRecipeID"; - public final cElementalConstantStackMap[] input; - public final cElementalConstantStackMap[] output; - public final cElementalConstantStackMap[] eCatalyst; - public final IAdditionalCheck additionalCheck; + public static final String E_RECIPE_ID = "eRecipeID"; + public final EMConstantStackMap[] input; + public final IEMMapRead[] output; + public final EMConstantStackMap[] eCatalyst; + public final IAdditionalCheck additionalCheck; public TT_recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check){ + EMConstantStackMap[] in, IEMMapRead[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check){ super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue); input=in; output=out; @@ -38,11 +40,11 @@ public class TT_recipe extends GT_Recipe { return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,null,null); } - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in){ + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in){ return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); } - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] catalyst) { + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) { return false; } @@ -51,7 +53,7 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < eCatalyst.length; i++) { if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) { + if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { return false; } } else { @@ -68,8 +70,14 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < input.length; i++) { if (input[i] != null && input[i].hasStacks()) { if (in[i] != null && in[i].hasStacks()) { - if (!in[i].removeAllAmounts(consume, input[i])) { - return false; + if(consume){ + if (!in[i].removeAllAmounts(input[i])) { + return false; + } + }else { + if (!in[i].containsAllAmounts(input[i])) { + return false; + } } } else { return false; @@ -83,11 +91,13 @@ public class TT_recipe extends GT_Recipe { return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks); } - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in){ + @Deprecated + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in){ return EMisRecipeInputEqualConsumeFromOne(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); } - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] catalyst) { + @Deprecated + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) { return false; } @@ -96,7 +106,7 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < eCatalyst.length; i++) { if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) { + if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { return false; } } else { @@ -110,11 +120,17 @@ public class TT_recipe extends GT_Recipe { } if (input != null) { if (in != null) { - for (cElementalConstantStackMap anInput : input) { + for (EMConstantStackMap anInput : input) { if (anInput != null && anInput.hasStacks()) { if (in.hasStacks()) { - if (!in.removeAllAmounts(consume, anInput)) { - return false; + if(consume){ + if (!in.removeAllAmounts(anInput)) { + return false; + } + }else { + if (!in.containsAllAmounts(anInput)) { + return false; + } } } else { return false; @@ -129,8 +145,8 @@ public class TT_recipe extends GT_Recipe { } public interface IAdditionalCheck { - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] e); - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] e); + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] e); + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] e); } public static class TT_Recipe_Map { @@ -166,12 +182,20 @@ public class TT_recipe extends GT_Recipe { } public static class GT_Recipe_MapTT extends GT_Recipe.GT_Recipe_Map { - public static GT_Recipe_MapTT sResearchableFakeRecipes =new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1,1,0,1,"", 1, "", true, false);//nei to false - using custom handler - public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32),"gt.recipe.em_scanner","EM Scanner Research", null,"gregtech:textures/gui/multimachines/ResearchFake",1,1,1,0,1,"",1,"",true,false); - public static ArrayList sAssemblylineRecipes=new ArrayList<>(); + public static GT_Recipe_MapTT sResearchableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false);//nei to false - using custom handler + public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.em_scanner", "EM Scanner Research", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false); + public static ArrayList sAssemblylineRecipes = new ArrayList<>(); - public GT_Recipe_MapTT(Collection aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_MapTT(Collection aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, + int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { + super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, + aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, + aShowVoltageAmperageInNEI, aNEIAllowed); } } @@ -181,7 +205,7 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { + EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchItem=researchItem; } @@ -189,28 +213,28 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in) { + EMConstantStackMap[] in) { this(aOptimize, researchItem, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } public static class TT_EMRecipe extends TT_recipe{ - public final iElementalDefinition mResearchEM; - public final GT_Recipe scannerRecipe; + public final IEMDefinition mResearchEM; + public final GT_Recipe scannerRecipe; - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, + public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) { + EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchEM=researchEM; this.scannerRecipe=scannerRecipe; } - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, + public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalConstantStackMap[] in) { + EMConstantStackMap[] in) { this(aOptimize, scannerRecipe, researchEM, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } @@ -219,8 +243,8 @@ public class TT_recipe extends GT_Recipe { public static TT_Recipe_Map_EM sCrafterRecipesEM = new TT_Recipe_Map_EM<>("EM Crafter Recipes","gt.recipe.em_crafter",null); public static TT_Recipe_Map_EM sMachineRecipesEM = new TT_Recipe_Map_EM<>("EM Machinert Recipe","gt.recipe.em_machinery",null); - private final HashMap mRecipeMap; - public final String mNEIName,mUnlocalizedName,mNEIGUIPath; + private final HashMap mRecipeMap; + public final String mNEIName,mUnlocalizedName,mNEIGUIPath; public TT_Recipe_Map_EM(String mNEIName,String mUnlocalizedName,String mNEIGUIPath){ mRecipeMap =new HashMap<>(16); @@ -229,7 +253,7 @@ public class TT_recipe extends GT_Recipe { this.mNEIGUIPath=mNEIGUIPath; } - public T findRecipe(iElementalDefinition stack){ + public T findRecipe(IEMDefinition stack){ return mRecipeMap.get(stack); } @@ -238,7 +262,7 @@ public class TT_recipe extends GT_Recipe { return null; } try { - return mRecipeMap.get(cElementalDefinition.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); + return mRecipeMap.get(EMComplex.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); }catch (Exception e){ if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index ffa69ef78e..c72bf0ab9e 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +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.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; @@ -150,7 +150,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMmachineRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, + ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -184,7 +184,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMcrafterRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -206,8 +206,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { } public static boolean addScannableEMmachineRecipe( - iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs, + IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -234,7 +234,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); @@ -242,8 +242,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { } public static boolean addScannableEMcrafterRecipe( - iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -259,7 +259,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); 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 b1f6d8887b..107cb97103 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 @@ -3,11 +3,11 @@ 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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; @@ -31,7 +31,7 @@ import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -39,7 +39,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by Tec on 15.03.2017. */ public final class DebugElementalInstanceContainer_EM extends Item implements IElementalItem { - public static final TreeSet STACKS_REGISTERED =new TreeSet<>(); + public static final TreeSet STACKS_REGISTERED =new TreeSet<>(); public static DebugElementalInstanceContainer_EM INSTANCE; @@ -58,23 +58,23 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE aStack.stackSize = 1; if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof iElementalContainer) { - cElementalInstanceStackMap content = ((iElementalContainer) metaTE).getContentHandler(); + if (metaTE instanceof IEMContainer) { + EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { - content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { + content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } return true; } - ((iElementalContainer) metaTE).purgeOverflow(); + ((IEMContainer) metaTE).purgeOverflow(); tNBT.removeTag("content"); tNBT.removeTag("symbols"); tNBT.removeTag("info"); } else if (content.hasStacks()) { - ((iElementalContainer) metaTE).purgeOverflow(); + ((IEMContainer) metaTE).purgeOverflow(); tNBT.setTag("info", content.getInfoNBT()); tNBT.setTag("content", content.toNBT()); tNBT.setTag("symbols", content.getShortSymbolsNBT()); @@ -87,7 +87,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE return aPlayer instanceof EntityPlayerMP; } - public ItemStack setContent(ItemStack aStack,cElementalInstanceStackMap content){ + public ItemStack setContent(ItemStack aStack, EMInstanceStackMap content){ NBTTagCompound tNBT = aStack.getTagCompound(); if(tNBT==null){ tNBT=new NBTTagCompound(); @@ -95,8 +95,8 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } if (tNBT.hasKey("content")) { try { - content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { + content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -141,10 +141,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(iElementalDefinition definition: STACKS_REGISTERED){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 144 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); + for(IEMDefinition definition: STACKS_REGISTERED){ + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 144 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_144)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1000 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); } } 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 2513bdf8bf..2cca6474f4 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 @@ -3,8 +3,8 @@ 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.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; @@ -38,18 +38,18 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem } //return previous thing - public static cElementalConstantStackMap setContent(ItemStack containerItem, cElementalConstantStackMap definitions){ + public static EMConstantStackMap setContent(ItemStack containerItem, EMConstantStackMap definitions){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { tNBT = containerItem.stackTagCompound = new NBTTagCompound(); } - cElementalConstantStackMap oldMap =null; + EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -63,7 +63,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalConstantStackMap getContent(ItemStack containerItem){ + public static EMConstantStackMap getContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; @@ -71,8 +71,8 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } try { - return cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + return EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -81,18 +81,18 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalConstantStackMap clearContent(ItemStack containerItem){ + public static EMConstantStackMap clearContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { return null; } - cElementalConstantStackMap oldMap =null; + EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } 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 e43feb2351..e517fe5f2a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; @@ -44,7 +44,7 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl } //return previous thing - public static void setContent(ItemStack containerItem, cElementalInstanceStackMap definitions, int[] detailsOnDepthLevels){ + public static void setContent(ItemStack containerItem, EMInstanceStackMap definitions, int[] detailsOnDepthLevels){ if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) { if (containerItem.stackTagCompound == null) { containerItem.stackTagCompound = new NBTTagCompound(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index d25a0c62ed..0950a173ab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; @@ -24,7 +24,7 @@ import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; @@ -34,16 +34,16 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 11.12.2016. */ -public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalContainer, IConnectsToElementalPipe { +public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements IEMContainer, IConnectsToElementalPipe { private static Textures.BlockIcons.CustomIcon EM_T_SIDES; private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; private static Textures.BlockIcons.CustomIcon EM_T_CONN; private String clientLocale = "en_US"; - protected cElementalInstanceStackMap content = new cElementalInstanceStackMap(); + protected EMInstanceStackMap content = new EMInstanceStackMap(); //float lifeTimeMult=1f; - public int postEnergize = 0; + public int postEnergize = 0; public double overflowMatter = 0f; public short id = -1; private byte deathDelay = 2; @@ -95,13 +95,13 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); id = aNBT.getShort("eID"); try { - content = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); - } catch (tElementalException e) { + content = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } if (content == null) { - content = new cElementalInstanceStackMap(); + content = new EMInstanceStackMap(); } } } @@ -165,7 +165,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } @Override - public cElementalInstanceStackMap getContentHandler() { + public EMInstanceStackMap getContentHandler() { return content; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index a61bf27fe3..4a0bb55784 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -38,7 +38,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -61,9 +61,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static double MASS_TO_EU_INSTANT; private static int STARTUP_COST, KEEPUP_COST; - protected byte eTier = 0; - protected cElementalInstanceStack stack; - private long plasmaEnergy; + protected byte eTier = 0; + protected EMInstanceStack stack; + private long plasmaEnergy; protected boolean started = false; //endregion @@ -73,7 +73,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); public interface IPrimitiveColliderHandler { - void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out); + void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); } public interface IColliderHandler extends IPrimitiveColliderHandler { @@ -81,23 +81,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } static { - FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnifyAll(in2.definition.getSubParticles()); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -106,27 +106,27 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 1; } }); - registerSimpleAtomFuse(dHadronDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(dComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(cElementalPrimitive.getClassTypeStatic()); + registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMPrimitive.getClassTypeStatic()); - FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | dHadronDefinition.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnifyAll(in2.definition.getSubParticles()); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -135,23 +135,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 2; } }); - FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -161,13 +161,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } }); - registerSimpleAspectFuse(dComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(cElementalPrimitive.getClassTypeStatic()); + registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAspectFuse(EMPrimitive.getClassTypeStatic()); - FUSE_HANDLERS.put((cElementalPrimitive.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMPrimitive.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName() + '\0' + in2.definition.getClass().getName()); + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); if (collisionHandler != null) { collisionHandler.collide(in2, in1, out); } else { @@ -181,40 +181,40 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } }); - PRIMITIVE_FUSE_HANDLERS.put(eQuarkDefinition.class.getName() + '\0' + eQuarkDefinition.class.getName(), (in1, in2, out) -> { + PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnify(in1.definition.getStackForm(1)); - defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } }); - PRIMITIVE_FUSE_HANDLERS.put(ePrimalAspectDefinition.class.getName() + '\0' + ePrimalAspectDefinition.class.getName(), (in1, in2, out) -> { + PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> { if (fuseAspects(in1, in2, out)) return; - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } }); } - private static boolean fuseAspects(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnify(in1.definition.getStackForm(1)); - defs.putUnify(in2.definition.getStackForm(1)); - dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(aspect, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return true; @@ -223,14 +223,14 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } private static void registerSimpleAspectFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((dComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + FUSE_HANDLERS.put((EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { if (fuseAspects(in1, in2, out)) return; - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -242,23 +242,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } private static void registerSimpleAtomFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { - cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnify(in2.definition.getStackForm(1)); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); } catch (Exception e) { out.putUnifyAll(in1, in2); return; } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); } } @@ -378,27 +378,27 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU if (partner.stack != null && stack != null) {//todo add single event mode as an option - boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && - partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); + boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) && + partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); - cElementalInstanceStack stack2 = partner.stack; - double preMass = add(stack2.getMass(),stack.getMass()); + EMInstanceStack stack2 = partner.stack; + double preMass = add(stack2.getMass(),stack.getMass()); //System.out.println("preMass = " + preMass); - cElementalInstanceStackMap map = new cElementalInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } else { - colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } - for (cElementalInstanceStack newStack : map.valuesToArray()) { - check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); + for (EMInstanceStack newStack : map.valuesToArray()) { + check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); } //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new cElementalInstanceStackMap[]{map}; + outputEM = new EMInstanceStackMap[]{map}; partner.stack = stack = null; //System.out.println("check = " + check); @@ -410,21 +410,21 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! if (partner.stack != null && stack != null) {//todo add single event mode as an option - cElementalInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); + EMInstanceStack stack2 = partner.stack; + double preMass = stack2.getMass() + stack.getMass(); //System.out.println("preMass = " + preMass); - cElementalInstanceStackMap map = new cElementalInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } else { - colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); if (handleRecipe(stack2, map, colliderHandler)) return 0; } //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new cElementalInstanceStackMap[]{map}; + outputEM = new EMInstanceStackMap[]{map}; partner.stack = stack = null; //System.out.println("check = " + check); @@ -434,12 +434,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 0; } - private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) { + private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { colliderHandler.collide(stack2, stack, map); } else { map.putUnifyAll(stack, stack2); - outputEM = new cElementalInstanceStackMap[]{map}; + outputEM = new EMInstanceStackMap[]{map}; return true; } return false; @@ -472,16 +472,17 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } } - private cElementalInstanceStackMap tickStack() { + private EMInstanceStackMap tickStack() { if (stack == null) { return null; } - cElementalDecayResult newInstances = stack.decay(1, stack.age += 1, 0); + stack.setAge(stack.getAge() + 1); + EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); if (newInstances == null) { stack.nextColor(); return null; } else { - stack = newInstances.getOutput().remove(newInstances.getOutput().getLast().definition); + stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); return newInstances.getOutput(); } } @@ -525,12 +526,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB if (started) { if (stack == null) { for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - cElementalInstanceStackMap container = inputElemental.getContentHandler(); + EMInstanceStackMap container = inputElemental.getContentHandler(); if (container.isEmpty()) { continue; } - stack = container.remove(container.getFirst().definition); - long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / dAtomDefinition.getSomethingHeavy().getMass())) / 2; + stack = container.removeKey(container.getFirst().getDefinition()); + long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; if (eut < Integer.MIN_VALUE + 7) { return false; } @@ -575,12 +576,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB collide(partner);//todo break; default: { - outputEM = new cElementalInstanceStackMap[2]; + outputEM = new EMInstanceStackMap[2]; outputEM[1] = tickStack(); if (outputEM[1] == null) { outputEM[1] = partner.tickStack(); } else { - cElementalInstanceStackMap map = partner.tickStack(); + EMInstanceStackMap map = partner.tickStack(); if (map != null) { outputEM[1].putUnifyAll(map); } @@ -659,7 +660,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB eTier = aNBT.getByte("eTier");//collider tier started = aNBT.getBoolean("eStarted"); if (aNBT.hasKey("eStack")) { - stack = cElementalInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); + stack = EMInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); } plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index ed245b0e97..84dafb8db2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; @@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -115,7 +115,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean checkRecipe_EM(ItemStack itemStack) { - cElementalInstanceStackMap map = getInputsClone_EM(); + EMInstanceStackMap map = getInputsClone_EM(); if (map != null && map.hasStacks()) { for (GT_MetaTileEntity_Hatch_InputElemental i : eInputHatches) { i.getContentHandler().clear(); @@ -125,20 +125,20 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return false; } - private boolean startRecipe(cElementalInstanceStackMap input) { + private boolean startRecipe(EMInstanceStackMap input) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - outputEM = new cElementalInstanceStackMap[2]; + outputEM = new EMInstanceStackMap[2]; outputEM[0] = input; - outputEM[1] = new cElementalInstanceStackMap(); + outputEM[1] = new EMInstanceStackMap(); - for (cElementalInstanceStack stack : outputEM[0].valuesToArray()) { - if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && + for (EMInstanceStack stack : outputEM[0].valuesToArray()) { + if (stack.getEnergy() == 0 && stack.getDefinition().decayMakesEnergy(1) && getBaseMetaTileEntity().decreaseStoredEnergyUnits( (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { stack.setEnergy(1); - } else if (!stack.definition.decayMakesEnergy(stack.getEnergy())) { - outputEM[0].remove(stack.definition); + } else if (!stack.getDefinition().decayMakesEnergy(stack.getEnergy())) { + outputEM[0].removeKey(stack.getDefinition()); outputEM[1].putReplace(stack); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 208219cd59..466f82071b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -26,9 +26,9 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -72,7 +72,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo super(aName); } - private void startRecipe(iElementalStack from, long energy) { + private void startRecipe(IEMStack from, long energy) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = from.getMass(); @@ -98,12 +98,12 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - cElementalInstanceStackMap map = in.getContentHandler(); - for (cElementalInstanceStack stack : map.valuesToArray()) { + EMInstanceStackMap map = in.getContentHandler(); + for (EMInstanceStack stack : map.valuesToArray()) { { - aFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); + EMFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); if (info != null) { - if (map.removeAllAmounts(false, info.input())) { + if (map.removeAllAmounts(info.input())) { mOutputFluids = new FluidStack[]{info.output()}; startRecipe(info.input(), stack.getEnergy()); return true; @@ -111,9 +111,9 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } } { - aItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); + EMItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); if (info != null) { - if (map.removeAllAmounts(false, info.input())) { + if (map.removeAllAmounts(info.input())) { mOutputItems = new ItemStack[]{info.output()}; startRecipe(info.input(), stack.getEnergy()); return true; @@ -121,10 +121,10 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } } { - aOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); + EMOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); if (info != null) { - if (map.removeAllAmounts(false, info.input())) { - ArrayList items = OreDictionary.getOres(info.out); + if (map.removeAllAmounts(info.input())) { + ArrayList items = OreDictionary.getOres(info.getOut()); if (items != null && !items.isEmpty()) { mOutputItems = new ItemStack[]{items.get(0)}; startRecipe(info.input(), stack.getEnergy()); 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 f5504eadc7..630569a25d 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 @@ -3,12 +3,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.mechanics.elementalMatter.core.transformations.EMFluidQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -29,11 +29,11 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.DEFAULT_ENERGY_LEVEL; +import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; @@ -98,9 +98,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - aItemQuantizationInfo aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); + EMItemQuantizationInfo aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -109,12 +109,12 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - aOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.oredictQuantization.get(ID); + EMOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.getOredictQuantization().get(ID); if (aOQI == null) { continue; } - iElementalStack into = aOQI.output(); - if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) { + IEMStack into = aOQI.output(); + if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage())}, null, inI)) { startRecipe(into); return true; } @@ -124,7 +124,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage()); } - iElementalStack into = aIQI.output(); + IEMStack into = aIQI.output(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -136,11 +136,11 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - aFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.fluidQuantization.get(fs.getFluid().getID()); + EMFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.getFluidQuantization().get(fs.getFluid().getID()); if (aFQI == null) { continue; } - iElementalStack into = aFQI.output(); + IEMStack into = aFQI.output(); if (into != null && fs.amount >= aFQI.input().amount && isInputEqual(true, false, new FluidStack[]{aFQI.input()}, nullItem, inF, (ItemStack[]) null)) { startRecipe(into); @@ -152,7 +152,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock return false; } - private void startRecipe(iElementalStack into) { + private void startRecipe(IEMStack into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; double mass = into.getMass(); @@ -163,10 +163,10 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } else { mEUt = (int) -V[6]; } - outputEM = new cElementalInstanceStackMap[]{ - into instanceof cElementalInstanceStack ? - new cElementalInstanceStackMap((cElementalInstanceStack) into) : - new cElementalInstanceStackMap(new cElementalInstanceStack(into.getDefinition(), into.getAmount())) + outputEM = new EMInstanceStackMap[]{ + into instanceof EMInstanceStack ? + new EMInstanceStackMap((EMInstanceStack) into) : + new EMInstanceStackMap(new EMInstanceStack(into.getDefinition(), into.getAmount())) }; } 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 d02088e805..74bb817142 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 @@ -2,10 +2,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.EMException; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; @@ -35,7 +35,7 @@ import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; @@ -59,9 +59,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; - private cElementalDefinitionStack objectResearched; - private cElementalInstanceStackMap objectsScanned; - private String machineType; + private EMDefinitionStack objectResearched; + private EMInstanceStackMap objectsScanned; + private String machineType; private long computationRemaining, computationRequired; private int[] scanComplexity; @@ -219,31 +219,31 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa public boolean checkRecipe_EM(ItemStack itemStack) { eRecipe = null; if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContentHandler().hasStacks() && !eOutputHatches.isEmpty()) { - cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); + EMInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { GT_Recipe scannerRecipe = null; - for (cElementalInstanceStack stackEM : researchEM.valuesToArray()) { + for (EMInstanceStack stackEM : researchEM.valuesToArray()) { objectsScanned = null; - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.getDefinition()); if (eRecipe != null) { scannerRecipe = eRecipe.scannerRecipe; machineType = machine; - objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); + objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); //cleanMassEM_EM(objectResearched.getMass()); - researchEM.remove(objectResearched.definition); + researchEM.removeKey(objectResearched.getDefinition()); break; } - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.getDefinition()); if (eRecipe != null) { scannerRecipe = eRecipe.scannerRecipe; machineType = crafter; - objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); + objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); //cleanMassEM_EM(objectResearched.getMass()); - researchEM.remove(objectResearched.definition); + researchEM.removeKey(objectResearched.getDefinition()); break; } cleanStackEM_EM(stackEM); - researchEM.remove(stackEM.definition); + researchEM.removeKey(stackEM.getDefinition()); } if (eRecipe != null && scannerRecipe != null) {//todo make sure it werks computationRequired = computationRemaining = scannerRecipe.mDuration * 20L; @@ -409,8 +409,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa computationRemaining = aNBT.getLong("eComputationRemaining"); computationRequired = aNBT.getLong("eComputationRequired"); if (aNBT.hasKey("eObject")) { - objectResearched = cElementalDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); - if (objectResearched.definition == nbtE__) { + objectResearched = EMDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); + if (objectResearched.getDefinition() == nbtE__) { objectResearched = null; } } else { @@ -423,10 +423,10 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } try { if (aNBT.hasKey("eScanObjects")) { - objectsScanned = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); + objectsScanned = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); } - } catch (tElementalException e) { - objectsScanned = new cElementalInstanceStackMap(); + } catch (EMException e) { + objectsScanned = new EMInstanceStackMap(); } } @@ -445,11 +445,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (computationRemaining > 0 && objectResearched != null) { eRecipe = null; if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.getDefinition()); if (eRecipe != null) { machineType = machine; } else { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.getDefinition()); if (eRecipe != null) { machineType = crafter; } 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 ba6ae223f6..9a6f99bed8 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 @@ -10,10 +10,10 @@ import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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.EMException; import com.github.technus.tectech.mechanics.structure.IStructureDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; @@ -109,7 +109,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //storage for output EM that will be auto handled in case of failure to finish recipe //if you succed to use a recipe - be sure to output EM from outputEM to hatches in the output method - protected cElementalInstanceStackMap[] outputEM; + protected EMInstanceStackMap[] outputEM; //are parameters correct - change in check recipe/output/update params etc. (maintenance status boolean) protected boolean eParameters = true; @@ -842,13 +842,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt int outputLen = aNBT.getInteger("eOutputStackCount"); if (outputLen > 0) { - outputEM = new cElementalInstanceStackMap[outputLen]; + outputEM = new EMInstanceStackMap[outputLen]; NBTTagCompound compound = aNBT.getCompoundTag("outputEM"); for (int i = 0; i < outputEM.length; i++) { if (compound.hasKey(Integer.toString(i))) { try { - outputEM[i] = cElementalInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i))); - } catch (tElementalException e) { + outputEM[i] = EMInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -966,7 +966,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private void cleanOrExplode() { if (outputEM != null) { float mass = 0; - for (cElementalInstanceStackMap tree : outputEM) { + for (EMInstanceStackMap tree : outputEM) { if (tree != null) { mass += tree.getMass(); } @@ -1155,7 +1155,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt explodeMultiblock(); } if (outputEM != null) { - for (cElementalInstanceStackMap tree : outputEM) { + for (EMInstanceStackMap tree : outputEM) { if (tree != null && tree.hasStacks()) { explodeMultiblock(); } @@ -1297,26 +1297,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } double remaining = voider.overflowMax - voider.getOverflowMatter(); for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContentHandler().valuesToArray()) { - double qty = div(remaining,instance.definition.getMass()); + for (EMInstanceStack instance : in.getContentHandler().valuesToArray()) { + double qty = div(remaining, instance.getDefinition().getMass()); if (qty > 0) { - qty = min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { + qty = min(qty, instance.getAmount()); + if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - in.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + in.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); } } } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContentHandler().valuesToArray()) { - double qty = div(remaining,instance.definition.getMass()); + for (EMInstanceStack instance : out.getContentHandler().valuesToArray()) { + double qty = div(remaining, instance.getDefinition().getMass()); if (qty > 0) { - qty = min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { + qty = min(qty, instance.getAmount()); + if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } - out.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + out.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); } } } @@ -1929,8 +1929,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region convenience copies input and output EM //new Method - public final cElementalInstanceStackMap getInputsClone_EM() { - cElementalInstanceStackMap in = new cElementalInstanceStackMap(); + public final EMInstanceStackMap getInputsClone_EM() { + EMInstanceStackMap in = new EMInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) { in.putUnifyAll(hatch.getContentHandler()); } @@ -1938,8 +1938,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //new Method - public final cElementalInstanceStackMap getOutputsClone_EM() { - cElementalInstanceStackMap out = new cElementalInstanceStackMap(); + public final EMInstanceStackMap getOutputsClone_EM() { + EMInstanceStackMap out = new EMInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) { out.putUnifyAll(hatch.getContentHandler()); } @@ -1974,7 +1974,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt cleanMassEM_EM(target.getContentHandler().getMass()); } - public void cleanStackEM_EM(cElementalInstanceStack target) { + public void cleanStackEM_EM(EMInstanceStack target) { if (target == null) { return; } @@ -2006,7 +2006,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return; } float mass = 0; - for (cElementalInstanceStackMap map : outputEM) { + for (EMInstanceStackMap map : outputEM) { if (map != null) { mass += map.getMass(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 093a418056..d1eafa22fc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; @@ -12,7 +12,8 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.DoubleCount.*; @@ -74,7 +75,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav radius = 0.5D - (12D - tier) / 64D; maxRCF = Math.pow(Math.E, tier) * 12D; maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); - double maxSafeMass = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); + double maxSafeMass = EMAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g maxCapacity = maxSafeMass * AVOGADRO_CONSTANT_144 * radius;// eV/c^2 } @@ -83,12 +84,12 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav return RPM * RPM * radius * 0.001118; } - private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - double amountPerFraction = div(me.amount,fractionCount); - cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; + private void addRandomly(EMInstanceStack me, EMInstanceStackMap[] toThis, int fractionCount) { + double amountPerFraction = div(me.getAmount(),fractionCount); + EMInstanceStack[] stacks = new EMInstanceStack[fractionCount]; for (int i = 0; i < fractionCount; i++) { stacks[i] = me.clone(); - stacks[i].amount = amountPerFraction; + stacks[i].setAmount(amountPerFraction); toThis[i].putReplace(stacks[i]); } //int remainingAmount = (int) (me.amount % fractionCount); @@ -112,23 +113,23 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - cElementalInstanceStackMap input = inputs[0]; + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + EMInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.valuesToArray(); + EMInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { inputMass += Math.abs(stack.getMass()); } double excessMass = 0; while (inputMass > maxCapacity) { - cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); - randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap - if (randomStack.amount <= 0) { - input.remove(randomStack.definition); + EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap + if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) { + input.removeKey(randomStack.getDefinition()); stacks = input.valuesToArray(); } double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; @@ -142,10 +143,10 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav if (inputMass * RCF > maxForce) return new MultiblockControl<>(excessMass);//AND THEN IT EXPLODES // how many output hatches to use - int fractionCount = (int) settingFraction.get(); - cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[fractionCount]; + int fractionCount = (int) settingFraction.get(); + EMInstanceStackMap[] outputs = new EMInstanceStackMap[fractionCount]; for (int i = 0; i < fractionCount; i++) { - outputs[i] = new cElementalInstanceStackMap(); + outputs[i] = new EMInstanceStackMap(); } //mixing factor... @@ -165,21 +166,21 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav stacks = input.takeAll().valuesToArray();//cleanup stacks if (stacks.length > 1) { Arrays.sort(stacks, (o1, o2) -> { - double m1 = o1.definition.getMass(); - double m2 = o2.definition.getMass(); + double m1 = o1.getDefinition().getMass(); + double m2 = o2.getDefinition().getMass(); if (m1 < m2) return -1; if (m1 > m2) return 1; return o1.compareTo(o2); }); double absMassPerOutput = 0;//"volume" - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { double tempMass=Math.abs(stack.getMass()); if(tempMass!=0) { - double amount = stack.amount; - stack.amount = mul(stack.amount,mixingFactor); + double amount = stack.getAmount(); + stack.setAmount(mul(stack.getAmount(),mixingFactor)); addRandomly(stack, outputs, fractionCount); - stack.amount = sub(amount,stack.amount); + stack.setAmount(sub(amount, stack.getAmount())); absMassPerOutput += tempMass; } } @@ -197,7 +198,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (int stackNo = 0; stackNo < stacks.length; stackNo++) { if (stacks[stackNo] != null) { double stackMass = Math.abs(stacks[stackNo].getMass()); - double amount = div(remaining,Math.abs(stacks[stackNo].definition.getMass())); + double amount = div(remaining,Math.abs(stacks[stackNo].getDefinition().getMass())); //if(DEBUG_MODE){ // TecTech.LOGGER.info("stackMass "+stackMass); // TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass()); @@ -207,16 +208,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav if (stackMass == 0) { addRandomly(stacks[stackNo], outputs, fractionCount); stacks[stackNo] = null; - } else if (amount >= stacks[stackNo].amount) { + } else if (amount >= stacks[stackNo].getAmount()) { remaining= sub(remaining,stackMass); outputs[fraction].putUnify(stacks[stackNo]); stacks[stackNo] = null; } else if (amount > 0) { - remaining= sub(remaining, mul(amount,stacks[stackNo].definition.getMass())); - cElementalInstanceStack clone = stacks[stackNo].clone(); - clone.amount = amount; + remaining= sub(remaining, mul(amount, stacks[stackNo].getDefinition().getMass())); + EMInstanceStack clone = stacks[stackNo].clone(); + clone.setAmount(amount); outputs[fraction].putUnify(clone); - stacks[stackNo].amount= sub(stacks[stackNo].amount,amount); + stacks[stackNo].setAmount(sub(stacks[stackNo].getAmount(),amount)); //if(DEBUG_MODE){ // TecTech.LOGGER.info("remainingAfter "+remaining); // TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount); @@ -228,7 +229,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } } //add remaining - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { if (stack != null) { outputs[fractionCount - 1].putUnify(stack); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java index d335bac7ab..4c95c2acd7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.IBeh } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 6ac6ac74c4..70d93b36ed 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -1,15 +1,16 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.DoubleCount.mul; @@ -88,7 +89,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; ticks =Math.max(20,(1<<(12-desiredTier))*20); - maxCapacity= dAtomDefinition.getSomethingHeavy().getMass()*(2< process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - cElementalInstanceStackMap input = inputs[0]; + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + EMInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.valuesToArray(); + EMInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { inputMass += Math.abs(stack.getMass()); } float excessMass = 0; while (inputMass > maxCapacity) { - cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); - randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap - if (randomStack.amount <= 0) { - input.remove(randomStack.definition); + EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap + if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) { + input.removeKey(randomStack.getDefinition()); } double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; @@ -174,9 +175,9 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ int mTicks=(int)(ticks*(inputMass/maxCapacity)); mTicks=Math.max(mTicks,20); - cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[3]; + EMInstanceStackMap[] outputs = new EMInstanceStackMap[3]; for (int i = 0; i < 3; i++) { - outputs[i] = new cElementalInstanceStackMap(); + outputs[i] = new EMInstanceStackMap(); } double offsetIn=offsetSetting.get(); @@ -186,8 +187,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ //take all from hatch handler and put into new map - this takes from hatch to inner data storage stacks = input.takeAll().valuesToArray();//cleanup stacks - for(cElementalInstanceStack stack:stacks){ - double charge=stack.definition.getCharge()-offsetIn; + for(EMInstanceStack stack:stacks){ + double charge= stack.getDefinition().getCharge()-offsetIn; if(charge-precisionMinimalIn){ outputs[1].putReplace(stack); }else if(charge>=precisionFullIn){ @@ -195,13 +196,13 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ }else if(charge<=-precisionFullIn){ outputs[0].putReplace(stack); }else{ - double amount=mul(stack.amount,(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check - if (amount < stack.amount) { - cElementalInstanceStack clone = stack.clone(); - clone.amount = sub(clone.amount, amount); + double amount=mul(stack.getAmount(),(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check + if (amount < stack.getAmount()) { + EMInstanceStack clone = stack.clone(); + clone.setAmount(sub(clone.getAmount(), amount)); outputs[1].putReplace(clone); - stack.amount = amount; + stack.setAmount(amount); } if(charge>0){ outputs[2].putReplace(stack); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java index 97ece16fb1..7d472de847 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.IB } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index f7aa945d69..05050a3c66 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -26,9 +26,9 @@ public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehavio } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { double mass=0; - for (cElementalInstanceStackMap input : inputs) { + for (EMInstanceStackMap input : inputs) { if (input != null) { mass += input.getMass(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java index 2dc9067e22..fa517c73d4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.IBehaviou } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } 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 d9217171d3..e653c1a357 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 @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -161,7 +161,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa * @param parameters array passed from previous method! * @return null if recipe should not start, control object to set machine state and start recipe */ - MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); + MultiblockControl process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); } private void quantumStuff(boolean shouldIExist) { @@ -254,7 +254,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return false; } - cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; + EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; for (int i = 0; i < 6; i++) { int pointer = (int) inputMux[i].get(); if (pointer >= 0 && pointer < eInputHatches.size()) { @@ -272,7 +272,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } } - MultiblockControl control = currentBehaviour.process(handles, this, parametrization); + MultiblockControl control = currentBehaviour.process(handles, this, parametrization); if (control == null) { return false; } @@ -311,7 +311,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return; } - cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; + EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; for (int i = 0; i < 6; i++) { int pointer = (int) outputMux[i].get(); if (pointer >= 0 && pointer < eOutputHatches.size()) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo index 7059fdf6fd..a195157a17 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo @@ -23,16 +23,16 @@ BlockFakeLight.java for turrets: floodlightb +mega - projects + fix eu/t checks if needs maintenance!!! make microwave grinder cap autosmelting based on power - iterative halflife formula: =prev qty* 2^(-t diff / t half) - actual ion cannons diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java index b37c0987ae..576123079c 100644 --- a/src/main/java/com/github/technus/tectech/util/DoubleCount.java +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -3,26 +3,40 @@ package com.github.technus.tectech.util; import java.util.Arrays; import static java.lang.Math.*; -import static java.lang.Math.max; -import static java.lang.Math.ulp; public class DoubleCount { - public static double[] distribute(double count,double... probabilities) throws ArithmeticException { - if (probabilities == null) { + /** + * Distributes count across probabilities + * + * @param count the count to divide + * @param probabilities probability ratios to divide by, descending + * @return divided count + * @throws ArithmeticException + */ + public static double[] distribute(double count, double... probabilities) throws ArithmeticException { + if (probabilities == null || Double.isNaN(count)) { return null; } else if (count == 0) { return new double[probabilities.length]; + } else if (Double.isInfinite(count)) { + double[] doubles = new double[probabilities.length]; + Arrays.fill(doubles, count); + return doubles; } else { switch (probabilities.length) { default: { - int size = probabilities.length; + int size = probabilities.length; double[] output = new double[size]; size--; - double remaining = count, previous = probabilities[size], probability, out, sum = 0; + double remaining = count, previous = probabilities[size], probability, out; for (int i = size - 1; i >= 0; i--) { probability = probabilities[i]; - remaining -= out = count * probability - ulp(probability); - sum += output[i] = out; + out = count * probability; + out -= ulpSigned(out); + + remaining -= out; + output[i] = out; + if (previous < probability) { throw new ArithmeticException("Malformed probability order: " + Arrays.toString(probabilities)); } @@ -31,14 +45,10 @@ public class DoubleCount { break; } } - if (remaining * count < 0) { + if (remaining * count < 0) {//overshoot finishIt(size, output, remaining); } else { - sum += output[size] = remaining - ulp(remaining) * size; - if (sum > count) { - remaining = sum - count; - finishIt(size, output, remaining); - } + output[size] = remaining; } return output; } @@ -50,84 +60,58 @@ public class DoubleCount { } } + public static double ulpSigned(double number) { + if (number == 0) { + return 0; + } + return number > 0 ? ulp(number) : -ulp(number); + } + private static void finishIt(int size, double[] output, double remaining) { for (int i = size - 1; i >= 0; i--) { if (abs(output[i]) >= abs(remaining)) { output[i] -= remaining; break; } else { - remaining+=output[i]; - output[i]=0; + remaining += output[i]; + output[i] = 0; } } } - public static double div(double count,double divisor){ - if (divisor == 0) { - throw new ArithmeticException("Divide by 0"); - }else if(count==0 || divisor==1){ - return count; - }else if(divisor==-1){ - return -count; + public static double div(double count, double divisor) { + if (count == 0 || abs(divisor) == 1 || abs(count)==abs(divisor)) { + return count/divisor; } else { double result = count / divisor; - if(result*count<0){ - return 0; - } - return result-ulp(result); + return result - ulpSigned(result); } } - public static double mul(double count,double multiplier){ - if(count==0 || multiplier==1){ - return count; - }else if(multiplier==-1){ - return -count; + public static double mul(double count, double multiplier) { + if (count == 0 || multiplier == 0 || abs(multiplier)==1 || abs(count)==1) { + return count*multiplier; } else { double result = count * multiplier; - if(result*count<0){ - return 0; - } - return result-ulp(result); + return result - ulpSigned(result); } } - public static double sub(double count,double value){ - if(value==0){ - return count; - } - if(count==0){ - return -value; - } - if(value==count){ - return 0; - } - return value < 0 ? addInternal(count, -value) : subInternal(count, value); - } - - public static double add(double count,double value){ - if(value==0){ - return count; - } - if(count==0){ - return value; - } - return value < 0 ? subInternal(count, -value) : addInternal(count, value); - } - - private static double subInternal(double count,double value){ - double result = count - max(value,ulp(count)); - if (result+value>count || value>count-result){ - result-=ulp(result); + public static double sub(double count, double value) { + if (count == 0 || value == 0 || count == value) { + return count - value; + } else { + double result = count - value; + return result - ulpSigned(result); } - return result; } - private static double addInternal(double count,double value){ - double result = count + value; - if (result-value>count || result-count>value){ - result-=ulp(result); + public static double add(double count, double value) { + if (count == 0 || value == 0 || count == -value) { + return count + value; + } else { + double result = count + value; + return result - ulpSigned(result); } - return result; } } -- cgit From 3dcc0761ab6247cb20dbe16a83e19abe675a13ed Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 18 Jan 2022 21:57:53 +0100 Subject: Cleanup serialization of EM (cherry picked from commit 44c86af58ecb24de8ba66fa6cf8fa81324a32a28) --- .../entity/projectiles/projectileEM.java | 4 +- .../definitions/EMComplexAspectDefinition.java | 30 +-- .../definitions/EMPrimalAspectDefinition.java | 4 +- .../transformations/AspectDefinitionCompat.java | 2 +- .../AspectDefinitionCompatEnabled.java | 4 +- .../thing/metaTileEntity/multi/EssentiaCompat.java | 2 +- .../multi/EssentiaCompatEnabled.java | 2 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../technus/tectech/loader/ElementalLoader.java | 3 - .../elementalMatter/core/EMException.java | 17 +- .../elementalMatter/core/commands/EMGive.java | 15 +- .../elementalMatter/core/commands/EMList.java | 14 +- .../elementalMatter/core/decay/EMDecay.java | 2 +- .../core/definitions/EMComplexTemplate.java | 73 ++++++ .../core/definitions/EMDefinitionsRegistry.java | 110 ++++++++ .../core/definitions/EMPrimitiveTemplate.java | 243 ++++++++++++++++++ .../core/definitions/IEMDefinition.java | 85 +++++++ .../core/maps/EMConstantStackMap.java | 2 +- .../core/maps/EMDefinitionStackMap.java | 2 +- .../core/maps/EMInstanceStackMap.java | 2 +- .../elementalMatter/core/maps/EMStackMap.java | 2 +- .../elementalMatter/core/maps/IEMMapRead.java | 39 ++- .../elementalMatter/core/maps/IEMMapWrite.java | 2 +- .../core/maps/IEMMapWriteExact.java | 2 +- .../core/stacks/EMDefinitionStack.java | 6 +- .../core/stacks/EMInstanceStack.java | 7 +- .../elementalMatter/core/stacks/IEMStack.java | 2 +- .../elementalMatter/core/templates/EMComplex.java | 135 ---------- .../core/templates/EMPrimitive.java | 283 --------------------- .../core/templates/IEMDefinition.java | 84 ------ .../core/transformations/EMTransformationInfo.java | 25 +- .../definitions/complex/EMAtomDefinition.java | 34 +-- .../definitions/complex/EMHadronDefinition.java | 50 ++-- .../definitions/complex/EMNuclideIAEA.java | 2 +- .../definitions/primitive/EMBosonDefinition.java | 4 +- .../definitions/primitive/EMLeptonDefinition.java | 4 +- .../primitive/EMNeutrinoDefinition.java | 4 +- .../primitive/EMPrimitiveDefinition.java | 10 +- .../definitions/primitive/EMQuarkDefinition.java | 4 +- .../github/technus/tectech/recipe/TT_recipe.java | 6 +- .../technus/tectech/recipe/TT_recipeAdder.java | 2 +- .../item/DebugElementalInstanceContainer_EM.java | 7 +- .../multi/GT_MetaTileEntity_EM_collider.java | 10 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 4 +- 45 files changed, 692 insertions(+), 656 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index d594a826bc..785b59f093 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -52,10 +52,10 @@ public class projectileEM extends LaserProjectile { charge=projectileContent.getCharge(); massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass()); - if(projectileContent.getDefinition().getType()>1 || projectileContent.getDefinition().getType()<-1) { + if(projectileContent.getDefinition().getMatterType()>1 || projectileContent.getDefinition().getMatterType()<-1) { strange = true; } - if(projectileContent.getDefinition().getType()<0) { + if(projectileContent.getDefinition().getMatterType()<0) { antiMatter = true; } 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 432d151b80..e56e31f166 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 @@ -2,13 +2,14 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defi import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; 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.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; @@ -25,7 +26,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class EMComplexAspectDefinition extends EMComplex { +public final class EMComplexAspectDefinition extends EMComplexTemplate { private final int hash; private final double mass; @@ -123,19 +124,8 @@ public final class EMComplexAspectDefinition extends EMComplex { } @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, aspectStacks); - } - - public static NBTTagCompound getNbtTagCompound(byte nbtType, EMConstantStackMap aspectStacks) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - EMDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray(); - nbt.setInteger("i", quarkStacksValues.length); - for (int i = 0; i < quarkStacksValues.length; i++) { - nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); - } - return nbt; + protected int getIndirectTagValue() { + return nbtType; } public static EMComplexAspectDefinition fromNBT(NBTTagCompound nbt) { @@ -169,7 +159,7 @@ public final class EMComplexAspectDefinition extends EMComplex { } @Override - public byte getType() { + public byte getMatterType() { return 0; } @@ -250,20 +240,20 @@ public final class EMComplexAspectDefinition extends EMComplex { public static void run() { try { - EMComplex.addCreatorFromNBT(nbtType, EMComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96); + EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMComplexAspectDefinition::fromNBT,EMComplexAspectDefinition.class, getClassTypeStatic()); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } if (DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + -96); + TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + getClassTypeStatic()); } } @Override public byte getClassType() { - return -96; + return getClassTypeStatic(); } public static byte getClassTypeStatic() { diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java index bf9703d6d7..e62c2e5278 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; import static net.minecraft.util.StatCollector.translateToLocal; @@ -8,7 +8,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 06.05.2017. */ -public final class EMPrimalAspectDefinition extends EMPrimitive { +public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { public static final EMPrimalAspectDefinition magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java index c7f38eb21d..a4328d2e03 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import java.util.HashMap; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java index c9ca5d7b9f..ead8a5fdef 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -2,13 +2,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry.STACKS_REGISTERED; /** * Created by Tec on 21.05.2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index d51bc8dc2d..35d3a1b91f 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index ab682ba1a5..37df2c48cc 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 5606442c37..5fe8c973fe 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defin import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index 7ce371e57e..61989e7b13 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMNuclideIAEA; @@ -18,8 +17,6 @@ public class ElementalLoader implements Runnable { // Definition init // =================================================================================================== - EMPrimitive.run(); - EMPrimitiveDefinition.run(); EMQuarkDefinition.run(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java index 23ca5d77d9..e00e72446d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java @@ -3,8 +3,23 @@ package com.github.technus.tectech.mechanics.elementalMatter.core; /** * Created by danie_000 on 19.11.2016. */ -public final class EMException extends Exception { +public final class EMException extends RuntimeException { public EMException(String message) { super(message); } + + public EMException(String message, Throwable cause) { + super(message, cause); + } + + public EMException(Throwable cause) { + super(cause); + } + + public EMException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + + public EMException() { + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java index 64e9bcea1e..af4caf854b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -5,9 +5,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstance import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; 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.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; @@ -77,11 +76,11 @@ public class EMGive implements ICommand { try{ int id=Integer.parseInt(args.get(0)); args.remove(0); - IEMDefinition primitive = EMPrimitive.getBindsPrimitive().get(id); + IEMDefinition primitive = IEMDefinition.getBindsPrimitive().get(id); return new EMDefinitionStack(primitive,amount); }catch (NumberFormatException e){ byte clazz = (byte) args.remove(0).charAt(0); - Method constructor = EMComplex.getBindsComplex().get(clazz); + Method constructor = IEMDefinition.getBindsComplex().get(clazz); EMDefinitionStackMap stacks =new EMDefinitionStackMap(); while(args.size()>0){ @@ -129,12 +128,12 @@ public class EMGive implements ICommand { private List completionsForClassOrID(){ ArrayList strings=new ArrayList<>(8); - Map binds= EMComplex.getBindsComplex(); + Map binds= IEMDefinition.getBindsComplex(); for (Map.Entry e:binds.entrySet()) { strings.add(String.valueOf((char)e.getKey().byteValue())); } - Map bindsBO = EMPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { + Map bindsBO = IEMDefinition.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { strings.add(String.valueOf(e.getKey().byteValue())); } return strings; 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 395592036f..13531dbf85 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; @@ -27,15 +27,15 @@ public class EMList implements ICommand { if (!sender.getEntityWorld().isRemote) { if(args.length == 0) { sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); - Map binds= EMComplex.getBindsComplex(); + Map binds= IEMDefinition.getBindsComplex(); for (Map.Entry e:binds.entrySet()) { sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); } }else if(args.length==1){ sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); - if(args[0].equals(String.valueOf((char) EMPrimitive.nbtType))){ - Map bindsBO = EMPrimitive.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { + if(args[0].equals(String.valueOf((char) EMPrimitiveTemplate.nbtType))){ + Map bindsBO = IEMDefinition.getBindsPrimitive(); + for (Map.Entry e:bindsBO.entrySet()) { sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName())); } }else{ @@ -65,7 +65,7 @@ public class EMList implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { if(args.length==0){ - Map binds= EMComplex.getBindsComplex(); + Map binds= IEMDefinition.getBindsComplex(); ArrayList strings=new ArrayList<>(binds.size()); for (Map.Entry e:binds.entrySet()) { strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java index bed49a5040..a6bd623414 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java @@ -4,7 +4,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstant import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import static com.github.technus.tectech.util.DoubleCount.mul; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java new file mode 100644 index 0000000000..94a50ce322 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Created by danie_000 on 23.01.2017. + */ +public abstract class EMComplexTemplate implements IEMDefinition { + /** + * Just empty array? + */ + public static final IEMDefinition[] nothing = new EMPrimitiveTemplate[0]; + + @Override + public final EMComplexTemplate clone() { + return this;//IMMUTABLE + } + + @Override + public int compareTo(IEMDefinition o) { + int classCompare = compareClassID(o); + if (classCompare != 0) { + return classCompare; + } + //that allows neat check if the same thing and + //top hierarchy amount can be used to store amount info + return getSubParticles().compareWithAmountsInternal(o.getSubParticles()); + } + + @Override + public final EMDefinitionStack getStackForm(double amount) { + return new EMDefinitionStack(this, amount); + } + + @Override + public final boolean equals(Object obj) { + if(this==obj) { + return true; + } + if (obj instanceof IEMDefinition) { + return compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + @Override + public int hashCode() {//Internal amounts should be also hashed + int hash = -(getSubParticles().size() << 4); + for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { + int amount=(int) stack.getAmount(); + hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); + } + return hash; + } + + @Override + public String toString() { + return getLocalizedName()+ '\n' + getSymbol(); + } + + public NBTTagCompound toNBT() { + NBTTagCompound nbtTagCompound = getSubParticles().toNBT(); + nbtTagCompound.setInteger(EMDefinitionsRegistry.getIndirectTagName(), getIndirectTagValue()); + return nbtTagCompound; + } + + protected abstract int getIndirectTagValue(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java new file mode 100644 index 0000000000..c0f9df32f2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java @@ -0,0 +1,110 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; +import java.util.function.Function; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +public class EMDefinitionsRegistry { + private static final NavigableSet STACKS_REGISTERED = new TreeSet<>(); + private static final Map DIRECT_BINDS = new HashMap<>(); + private static final Map> CLASS_BINDS = new HashMap<>();//creator methods in subclasses + private static final Map> CLASSES = new HashMap<>(); + private static final Map, Integer> CLASS_TYPES = new HashMap<>(); + private static final String INDIRECT_TAG = "t"; + private static final String DIRECT_TAG = "c"; + + private EMDefinitionsRegistry() { + } + + static { + CLASS_BINDS.put(0, EMDefinitionsRegistry::getDefinitionDirect); + CLASS_BINDS.put((int) 'p', EMDefinitionsRegistry::getDefinitionDirect); + } + + private static IEMDefinition getDefinitionDirect(NBTTagCompound nbt) { + return DIRECT_BINDS.get(nbt.getInteger(getDirectTagName())); + } + + public static IEMDefinition fromNBT(NBTTagCompound nbt) { + IEMDefinition apply; + try { + apply = CLASS_BINDS.get(nbt.getInteger(getIndirectTagName())).apply(nbt); + } catch (Exception e) { + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + if (!DEBUG_MODE) { + if (apply == nbtE__) { + throw new EMException("Deserialized to NBT ERROR!"); + } else if (apply == null__ || apply == null) { + throw new EMException("Deserialized to NULL POINTER!"); + } + } + if (apply == null) { + return null__; + } + return apply; + } + + public static void registerDefinitionClass(int shortcutNBT, Function creator, Class clazz, int classID) { + if (CLASS_BINDS.put(shortcutNBT, creator) != null) { + EMException e = new EMException("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + if (CLASSES.put(classID, clazz) != null) { + EMException e = new EMException("Duplicate Class ID! " + classID + " used for class comparison"); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + CLASS_TYPES.put(clazz, classID); + } + + public static void registerDirectDefinition(IEMDefinition definition, int id) { + IEMDefinition old = DIRECT_BINDS.put(id, definition); + if (old != null) { + EMException e = new EMException("Duplicate primitive EM ID: " + id + + " for " + definition.getLocalizedName() + + " and " + old.getLocalizedName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public static NavigableSet getStacksRegisteredForDisplay() { + return STACKS_REGISTERED; + } + + public static void registerForDisplay(IEMDefinition definition){ + STACKS_REGISTERED.add(definition); + STACKS_REGISTERED.add(definition.getAnti()); + } + + public static String getIndirectTagName() { + return INDIRECT_TAG; + } + + public static String getDirectTagName() { + return DIRECT_TAG; + } +} 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 new file mode 100644 index 0000000000..f3ce34dd1d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java @@ -0,0 +1,243 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +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; + +/** + * Created by danie_000 on 22.10.2016. + * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! + */ +public abstract class EMPrimitiveTemplate extends EMComplexTemplate { + private final String name; + private final String symbol; + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private final byte color; + //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti + private final byte type; + + private EMPrimitiveTemplate anti;//IMMUTABLE + private EMDecay[] elementalDecays; + private byte naturalDecayInstant; + private byte energeticDecayInstant; + private double rawLifeTime; + + private final int ID; + + //no _ at end - normal particle + // _ at end - anti particle + // __ at end - self is antiparticle + + protected EMPrimitiveTemplate(String name, String symbol, int type, double mass, int charge, int color, int ID) { + this.name = name; + this.symbol = symbol; + this.type = (byte) type; + this.mass = mass; + this.charge = charge; + this.color = (byte) color; + this.ID = ID; + EMDefinitionsRegistry.registerDirectDefinition(this,ID); + } + + // + protected void init(EMPrimitiveTemplate antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { + anti = antiParticle; + this.rawLifeTime = rawLifeTime; + naturalDecayInstant = (byte) naturalInstant; + energeticDecayInstant = (byte) energeticInstant; + elementalDecays =elementalDecaysArray; + EMDefinitionsRegistry.registerForDisplay(this); + } + + @Override + public String getLocalizedName() { + return "Undefined: " + getName(); + } + + @Override + public String getSymbol() { + return symbol; + } + + @Override + public String getShortSymbol() { + return getSymbol(); + } + + @Override + public IEMDefinition getAnti() { + return anti;//no need for copy + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public byte getColor() { + return color; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + if (naturalDecayInstant < 0) { + return elementalDecays; + }else if (naturalDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[naturalDecayInstant]}; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (energeticDecayInstant < 0) { + return elementalDecays; + }else if (energeticDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[energeticDecayInstant]}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + return elementalDecays; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return rawLifeTime; + } + + @Override + public final EMConstantStackMap getSubParticles() { + return null; + } + + @Override + public EMFluidDequantizationInfo someAmountIntoFluidStack() { + return null; + } + + @Override + public EMItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public EMOredictDequantizationInfo someAmountIntoOredictStack() { + return null; + } + + @Override + public byte getMatterType() { + return type; + } + + @Override + public final NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger(EMDefinitionsRegistry.getDirectTagName(), ID); + return nbt; + } + + @Override + public final byte getClassType() { + return getClassTypeStatic(); + } + + public static byte getClassTypeStatic(){ + return -128; + } + + @Override + public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + EMDefinitionsRegistry.getDirectTagName() + ' ' + getClassType()); + } + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+ getLocalizedName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + } + if(areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + + @Override + public final int compareTo(IEMDefinition o) { + if (getClassType() == o.getClassType()) { + int oID = ((EMPrimitiveTemplate) o).ID; + return Integer.compare(ID, oID); + } + return compareClassID(o); + } + + @Override + public final int hashCode() { + return ID; + } + + public String getName() { + return name; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java new file mode 100644 index 0000000000..06bfc61737 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java @@ -0,0 +1,85 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +/** + * Created by danie_000 on 11.11.2016. + */ +public interface IEMDefinition extends Comparable,Cloneable {//IMMUTABLE + double STABLE_RAW_LIFE_TIME =1.5e36D; + double NO_DECAY_RAW_LIFE_TIME =-1D; + long DEFAULT_ENERGY_LEVEL =0; + double DEFAULT_ENERGY_REQUIREMENT =25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels + //add text based creators for recipe formula input? + + //Nomenclature + String getLocalizedName(); + + String getSymbol(); + + String getShortSymbol(); + + void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); + + void addScanResults(ArrayList lines, int capabilities, long energyLevel); + + byte getMatterType(); + + byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + + //Not dynamically changing stuff + IEMDefinition getAnti();//gives new anti particle def + + EMDecay[] getDecayArray();//possible decays + + EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick + + EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay + + boolean usesSpecialEnergeticDecayHandling(); + + boolean usesMultipleDecayCalls(long energyLevel); + + boolean decayMakesEnergy(long energyLevel); + + boolean fusionMakesEnergy(long energyLevel); + + double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative + + double getMass();//mass... MeV/c^2 + + int getCharge();//charge 1/3 electron charge + + //dynamically changing stuff + byte getColor();//-1 nope cannot 0 it can but undefined + + double getRawTimeSpan(long currentEnergy);//defined in static fields or generated + + boolean isTimeSpanHalfLife(); + + EMConstantStackMap getSubParticles();//contents... null if none + + EMFluidDequantizationInfo someAmountIntoFluidStack(); + + EMItemDequantizationInfo someAmountIntoItemsStack(); + + EMOredictDequantizationInfo someAmountIntoOredictStack(); + + NBTTagCompound toNBT(); + + EMDefinitionStack getStackForm(double amount); + + IEMDefinition clone(); + + default int compareClassID(IEMDefinition obj) { + return (int) getClassType() - obj.getClassType(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java index d9297436a0..e6cfa7d03e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import java.util.Collections; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java index 45ce50d5c7..78bb8d740a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import java.util.NavigableMap; 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 c15142787f..69dc53f83d 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 @@ -4,7 +4,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayRe 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.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; 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 4c798499b5..795ac3d3bf 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import java.util.NavigableMap; import java.util.TreeMap; 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 392d06f5cf..1322566914 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 @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -136,8 +136,8 @@ public interface IEMMapRead extends Comparable NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", size()); int i = 0; - for (T stack : values()) { - nbt.setTag(Integer.toString(i++), stack.toNBT()); + for (Map.Entry entry : entrySet()) { + nbt.setTag(Integer.toString(i++), entry.getValue().toNBT()); } return nbt; } @@ -161,6 +161,39 @@ public interface IEMMapRead extends Comparable return 0; } + /** + * use only for nested operations! + * @param o + * @return + */ + default int compareWithAmountsInternal(IEMMapRead o) { + if (o == null) { + return 1; + } + + int lenDiff = size() - o.size(); + if (lenDiff != 0) { + return lenDiff; + } + + Iterator> iterator = entrySet().iterator(); + Iterator> iteratorO = o.entrySet().iterator(); + + while (iterator.hasNext()) { + T first = iterator.next().getValue(); + IEMStack second = iteratorO.next().getValue(); + int result = first.compareTo(second); + if (result != 0) { + return result; + } + result=Double.compare(first.getAmount(),second.getAmount()); + if (result != 0) { + return result; + } + } + return 0; + } + default double getMass(){ double mass=0; for (Map.Entry entry : entrySet()) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java index cc22267474..f13e82fb26 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; import java.util.Map; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java index 7b8853a2f4..167ec8451d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import java.util.Map; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java index fe0c73e795..f868dbe0ad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; @@ -50,7 +50,7 @@ public final class EMDefinitionStack implements IEMStack { public static EMDefinitionStack fromNBT(NBTTagCompound nbt) { return new EMDefinitionStack( - EMComplex.fromNBT(nbt.getCompoundTag("d")), + EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), nbt.getLong("q")+nbt.getDouble("Q")); } 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 b73bd21f02..6347cd2144 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 @@ -1,12 +1,12 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; 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.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; @@ -558,9 +558,8 @@ public final class EMInstanceStack implements IEMStack { } public static EMInstanceStack fromNBT(NBTTagCompound nbt) { - NBTTagCompound definition = nbt.getCompoundTag("d"); EMInstanceStack instance = new EMInstanceStack( - EMComplex.fromNBT(definition), + EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), nbt.getLong("q") + nbt.getDouble("Q"), nbt.getFloat("m") + nbt.getDouble("M"), nbt.getLong("a") + nbt.getDouble("A"), diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java index 94c76634d9..5672b31c04 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; /** diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java deleted file mode 100644 index 7fc074bded..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 23.01.2017. - */ -public abstract class EMComplex implements IEMDefinition { - //Nothing array - public static final IEMDefinition[] nothing = new EMPrimitive[0]; - - //add text based creators for recipe formula input? - private static final Map nbtCreationBind = new HashMap<>();//creator methods in subclasses - private static final HashSet classSet = new HashSet<>(); - - protected static void addCreatorFromNBT(byte shortcutNBT, Method constructorFromNBT,byte classID) { - if(nbtCreationBind.put(shortcutNBT, constructorFromNBT)!=null) { - throw new Error("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); - } - if(!classSet.add(classID)) { - throw new Error("Duplicate Class ID! " + classID + " used for class comparison"); - } - } - - public static Map getBindsComplex(){ - return nbtCreationBind; - } - - @Override - public final EMComplex clone() { - return this;//IMMUTABLE - } - - public static IEMDefinition fromNBT(NBTTagCompound nbt) { - try { - return (IEMDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__; - } - } - - @Override - public int compareTo(IEMDefinition o) { - int classCompare = compareClassID(o); - if (classCompare != 0) { - return classCompare; - } - - //only of the internal def stacks!!! - //that allows neat check if the same thing and - //top hierarchy amount can be used to store amount info - return compareInnerContentsWithAmounts(getSubParticles().valuesToArray(), o.getSubParticles().valuesToArray()); - } - - //use only for nested operations! - private static int compareInnerContentsWithAmounts(EMDefinitionStack[] tc, EMDefinitionStack[] sc) { - if (tc == null) { - if (sc == null) { - return 0; - } else { - return -1; - } - } - if (sc == null) { - return 1; - } - - int lenDiff = tc.length - sc.length; - if (lenDiff != 0) { - return lenDiff; - } - - for (int i = 0; i < tc.length; i++) { - int cn = tc[i].getDefinition().compareTo(sc[i].getDefinition()); - if (cn != 0) { - return cn; - } - - if (tc[i].getAmount() > sc[i].getAmount()) { - return 1; - } - if (tc[i].getAmount() < sc[i].getAmount()) { - return -1; - } - } - return 0; - } - - @Override - public final EMDefinitionStack getStackForm(double amount) { - return new EMDefinitionStack(this, amount); - } - - @Override - public final boolean equals(Object obj) { - if(this==obj) { - return true; - } - if (obj instanceof IEMDefinition) { - return compareTo((IEMDefinition) obj) == 0; - } - if (obj instanceof IEMStack) { - return compareTo(((IEMStack) obj).getDefinition()) == 0; - } - return false; - } - - @Override - public int hashCode() {//Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 4); - for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { - int amount=(int) stack.getAmount(); - hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); - } - return hash; - } - - @Override - public String toString() { - return getLocalizedName()+ '\n' + getSymbol(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java deleted file mode 100644 index 587affd0f1..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java +++ /dev/null @@ -1,283 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import net.minecraft.client.Minecraft; -import net.minecraft.crash.CrashReport; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; - -import static com.github.technus.tectech.util.Util.areBitsSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; - -/** - * Created by danie_000 on 22.10.2016. - * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) - */ -public abstract class EMPrimitive extends EMComplex { - public static final byte nbtType = (byte) 'p'; - - private static final Map bindsBO = new HashMap<>(); - - public static Map getBindsPrimitive() { - return bindsBO; - } - - private final String name; - private final String symbol; - //float-mass in eV/c^2 - private final double mass; - //int -electric charge in 1/3rds of electron charge for optimization - private final int charge; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private final byte color; - //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - private final byte type; - - private EMPrimitive anti;//IMMUTABLE - private EMDecay[] elementalDecays; - private byte naturalDecayInstant; - private byte energeticDecayInstant; - private double rawLifeTime; - - private final int ID; - - //no _ at end - normal particle - // _ at end - anti particle - // __ at end - self is antiparticle - - protected EMPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { - this.name = name; - this.symbol = symbol; - this.type = (byte) type; - this.mass = mass; - this.charge = charge; - this.color = (byte) color; - this.ID = ID; - if (bindsBO.put(ID, this) != null) { - Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new EMException("Duplicate ID"))); - } - STACKS_REGISTERED.add(this); - } - - // - protected void init(EMPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { - anti = antiParticle; - this.rawLifeTime = rawLifeTime; - naturalDecayInstant = (byte) naturalInstant; - energeticDecayInstant = (byte) energeticInstant; - elementalDecays =elementalDecaysArray; - } - - @Override - public String getLocalizedName() { - return "Undefined: " + getName(); - } - - @Override - public String getSymbol() { - return symbol; - } - - @Override - public String getShortSymbol() { - return getSymbol(); - } - - @Override - public IEMDefinition getAnti() { - return anti;//no need for copy - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public byte getColor() { - return color; - } - - @Override - public double getMass() { - return mass; - } - - @Override - public EMDecay[] getNaturalDecayInstant() { - if (naturalDecayInstant < 0) { - return elementalDecays; - }else if (naturalDecayInstant>=elementalDecays.length){ - return EMDecay.NO_PRODUCT; - } - return new EMDecay[]{elementalDecays[naturalDecayInstant]}; - } - - @Override - public EMDecay[] getEnergyInducedDecay(long energyLevel) { - if (energeticDecayInstant < 0) { - return elementalDecays; - }else if (energeticDecayInstant>=elementalDecays.length){ - return EMDecay.NO_PRODUCT; - } - return new EMDecay[]{elementalDecays[energeticDecayInstant]}; - } - - @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public EMDecay[] getDecayArray() { - return elementalDecays; - } - - @Override - public double getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public final EMConstantStackMap getSubParticles() { - return null; - } - - @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public byte getType() { - return type; - } - - @Override - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - nbt.setInteger("c", getID()); - return nbt; - } - - public static EMPrimitive fromNBT(NBTTagCompound content) { - EMPrimitive primitive = bindsBO.get(content.getInteger("c")); - return primitive == null ? null__ : primitive; - } - - @Override - public final byte getClassType() { - return -128; - } - - public static byte getClassTypeStatic(){ - return -128; - } - - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+ getLocalizedName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if(areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" "+"At current energy level"); - } - } - - public static void run() { - try { - EMComplex.addCreatorFromNBT(nbtType, EMPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Primitive " + nbtType + ' ' + -128); - } - } - - @Override - public final int compareTo(IEMDefinition o) { - if (getClassType() == o.getClassType()) { - int oID = ((EMPrimitive) o).getID(); - return Integer.compare(getID(), oID); - } - return compareClassID(o); - } - - @Override - public final int hashCode() { - return getID(); - } - - public String getName() { - return name; - } - - public int getID() { - return ID; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java deleted file mode 100644 index 7ae6d0395c..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -/** - * Created by danie_000 on 11.11.2016. - */ -public interface IEMDefinition extends Comparable,Cloneable {//IMMUTABLE - double STABLE_RAW_LIFE_TIME =1.5e36D; - double NO_DECAY_RAW_LIFE_TIME=-1D; - long DEFAULT_ENERGY_LEVEL=0; - double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels - - //Nomenclature - String getLocalizedName(); - - String getSymbol(); - - String getShortSymbol(); - - void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); - - void addScanResults(ArrayList lines, int capabilities, long energyLevel); - - byte getType(); - - byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - - //Not dynamically changing stuff - IEMDefinition getAnti();//gives new anti particle def - - EMDecay[] getDecayArray();//possible decays - - EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick - - EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay - - boolean usesSpecialEnergeticDecayHandling(); - - boolean usesMultipleDecayCalls(long energyLevel); - - boolean decayMakesEnergy(long energyLevel); - - boolean fusionMakesEnergy(long energyLevel); - - double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative - - double getMass();//mass... MeV/c^2 - - int getCharge();//charge 1/3 electron charge - - //dynamically changing stuff - byte getColor();//-1 nope cannot 0 it can but undefined - - double getRawTimeSpan(long currentEnergy);//defined in static fields or generated - - boolean isTimeSpanHalfLife(); - - EMConstantStackMap getSubParticles();//contents... null if none - - EMFluidDequantizationInfo someAmountIntoFluidStack(); - - EMItemDequantizationInfo someAmountIntoItemsStack(); - - EMOredictDequantizationInfo someAmountIntoOredictStack(); - - NBTTagCompound toNBT(); - - EMDefinitionStack getStackForm(double amount); - - IEMDefinition clone(); - - default int compareClassID(IEMDefinition obj) { - return (int) getClassType() - obj.getClassType(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java index fca79b0b6f..d6f6731aec 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java @@ -1,7 +1,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.item.ItemStack; @@ -12,7 +13,6 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; import static java.lang.Math.pow; /** @@ -72,15 +72,13 @@ public class EMTransformationInfo { public void addFluid(IEMStack em, FluidStack fluidStack){ getFluidQuantization().put(fluidStack.getFluidID(),new EMFluidQuantizationInfo(fluidStack,em)); getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluidStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addFluid(IEMStack em, Fluid fluid, int fluidAmount){ getFluidQuantization().put(fluid.getID(),new EMFluidQuantizationInfo(fluid,fluidAmount,em)); getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluid,fluidAmount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } private void addItemQuantization(EMItemQuantizationInfo aIQI){ @@ -90,36 +88,31 @@ public class EMTransformationInfo { public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT){ addItemQuantization(new EMItemQuantizationInfo(itemStack,skipNBT,em)); getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,itemStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ addItemQuantization(new EMItemQuantizationInfo(prefix,material,amount,skipNBT,em)); getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,prefix,material,amount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addOredict(IEMStack em, String name, int qty){ getOredictQuantization().put(OreDictionary.getOreID(name),new EMOredictQuantizationInfo(name,qty,em)); getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,name,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty){ getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + material.mName),new EMOredictQuantizationInfo(prefix,material,qty,em)); getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,material,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty){ getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + materialName),new EMOredictQuantizationInfo(prefix,materialName,qty,em)); getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,materialName,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); + EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); } public Map getFluidQuantization() { 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 77ac6c46c4..666249f408 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 @@ -3,13 +3,14 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; @@ -25,7 +26,6 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.*; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; @@ -37,7 +37,7 @@ import static gregtech.api.enums.OrePrefixes.dust; /** * Created by danie_000 on 18.11.2016. */ -public final class EMAtomDefinition extends EMComplex { +public final class EMAtomDefinition extends EMComplexTemplate { public static final long ATOM_COMPLEXITY_LIMIT=65536L; private static final byte BYTE_OFFSET=32; @@ -118,10 +118,10 @@ public final class EMAtomDefinition extends EMComplex { throw new ArithmeticException("Amount cannot be safely converted to int!"); } mass += stack.getMass(); - if (def.getType() < 0) { + if (def.getMatterType() < 0) { containsAnti = true; } - type = Math.max(type, Math.abs(def.getType())); + type = Math.max(type, Math.abs(def.getMatterType())); if (def instanceof EMLeptonDefinition) { cLeptons += stack.getCharge(); @@ -307,7 +307,7 @@ public final class EMAtomDefinition extends EMComplex { } @Override - public byte getType() { + public byte getMatterType() { return type; } @@ -340,7 +340,7 @@ public final class EMAtomDefinition extends EMComplex { int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { - if (Math.abs(getType()) != 1) { + if (Math.abs(getMatterType()) != 1) { return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; } return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; @@ -408,7 +408,7 @@ public final class EMAtomDefinition extends EMComplex { } private EMDecay[] getDecayArray(ArrayList decaysList, int decayMode, boolean tryAnti) {//todo? - if (getType() == 1) { + if (getMatterType() == 1) { switch (decayMode) { case -2: if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { @@ -446,7 +446,7 @@ public final class EMAtomDefinition extends EMComplex { } } return EMDecay.NO_DECAY; - }else if(getType() ==-1){ + }else if(getMatterType() ==-1){ EMAtomDefinition anti =getAnti(); if(anti!=null) { return anti.getDecayArray(decaysList, decayMode, false); @@ -1264,7 +1264,7 @@ public final class EMAtomDefinition extends EMComplex { //disembody ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { - if (elementalStack.getDefinition().getType() == 1 || elementalStack.getDefinition().getType() == -1) { + if (elementalStack.getDefinition().getMatterType() == 1 || elementalStack.getDefinition().getMatterType() == -1) { //covers both quarks and antiquarks decaysInto.add(elementalStack); } else { @@ -1344,8 +1344,8 @@ public final class EMAtomDefinition extends EMComplex { } @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, elementalStacks); + protected int getIndirectTagValue() { + return nbtType; } public static EMAtomDefinition fromNBT(NBTTagCompound nbt) { @@ -1465,14 +1465,14 @@ public final class EMAtomDefinition extends EMComplex { } try { - EMComplex.addCreatorFromNBT(nbtType, EMAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); + EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMAtomDefinition::fromNBT,EMAtomDefinition.class,getClassTypeStatic()); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64); + TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); } } @@ -1644,7 +1644,7 @@ public final class EMAtomDefinition extends EMComplex { @Override public byte getClassType() { - return 64; + return getClassTypeStatic(); } public static byte getClassTypeStatic(){ 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 384087770f..a901f5c8fc 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 @@ -1,17 +1,20 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.*; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import com.github.technus.tectech.util.Util; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -22,7 +25,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; @@ -33,7 +35,7 @@ import static gregtech.api.enums.OrePrefixes.dust; /** * Created by danie_000 on 17.11.2016. */ -public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o +public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o private final int hash; private static final byte nbtType = (byte) 'h'; @@ -90,8 +92,8 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o } mass += quarkStack.getMass(); charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.getDefinition().getType()), type); - if (quarkStack.getDefinition().getType() < 0) { + type = Math.max(Math.abs(quarkStack.getDefinition().getMatterType()), type); + if (quarkStack.getDefinition().getMatterType() < 0) { containsAnti = true; } } @@ -212,12 +214,12 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o @Override public EMDecay[] getNaturalDecayInstant() { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { return EMDecay.NO_PRODUCT; } ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack quarks : quarkStacks) { - if (quarks.getDefinition().getType() == 1 || quarks.getDefinition().getType() == -1) { + if (quarks.getDefinition().getMatterType() == 1 || quarks.getDefinition().getMatterType() == -1) { //covers both quarks and antiquarks decaysInto.add(quarks); } else { @@ -234,7 +236,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { return EMDecay.NO_PRODUCT; } return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks @@ -270,7 +272,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && - quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) { + quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { return EMDecay.NO_PRODUCT; } else if (getAmount() != 3) { return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks @@ -286,7 +288,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o EMQuarkDefinition lastQuark = newBaryon.remove(2); EMDefinitionStack[] decay; - if (Math.abs(lastQuark.getType()) > 1) { + if (Math.abs(lastQuark.getMatterType()) > 1) { decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); } else { decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); @@ -334,7 +336,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o } @Override - public byte getType() { + public byte getMatterType() { return type; } @@ -385,8 +387,8 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o } @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, quarkStacks); + protected int getIndirectTagValue() { + return nbtType; } public static EMHadronDefinition fromNBT(NBTTagCompound nbt) { @@ -412,22 +414,22 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); SYMBOL_MAP.put(hadron_p,"p"); NAME_MAP.put(hadron_p,"Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p); hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); SYMBOL_MAP.put(hadron_p_,"~p"); NAME_MAP.put(hadron_p_,"Anti Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p_); hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.getMass(); //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); NAME_MAP.put(hadron_n, "Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n); hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); SYMBOL_MAP.put(hadron_n_,"~n"); NAME_MAP.put(hadron_n_,"Anti Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_); + EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n_); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -444,14 +446,14 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o hadron_p5 = new EMDefinitionStack(hadron_p, 5D); try { - EMComplex.addCreatorFromNBT(nbtType, EMHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); + EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMHadronDefinition::fromNBT,EMHadronDefinition.class,getClassTypeStatic()); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + -64); + TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + getClassTypeStatic()); } } @@ -467,7 +469,7 @@ public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o @Override public byte getClassType() { - return -64; + return getClassTypeStatic(); } public static byte getClassTypeStatic(){ 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 9a22f54941..bd34733cb6 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 @@ -7,7 +7,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.TreeMap; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.util.Util.splitButDifferent; public final class EMNuclideIAEA { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index e3efa3b7e6..5f14eefcdb 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; @@ -11,7 +11,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p /** * Created by danie_000 on 22.10.2016. */ -public final class EMBosonDefinition extends EMPrimitive { +public final class EMBosonDefinition extends EMPrimitiveTemplate { public static final EMBosonDefinition boson_Y__ = new EMBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), boson_H__ = new EMBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index 98bdf7ca5c..0f9898775f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; @@ -11,7 +11,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p /** * Created by danie_000 on 22.10.2016. */ -public final class EMLeptonDefinition extends EMPrimitive { +public final class EMLeptonDefinition extends EMPrimitiveTemplate { public static final EMLeptonDefinition lepton_e = new EMLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), lepton_m = new EMLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index e77c74ed89..ac06a80728 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -2,14 +2,14 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; /** * Created by danie_000 on 22.10.2016. */ -public final class EMNeutrinoDefinition extends EMPrimitive { +public final class EMNeutrinoDefinition extends EMPrimitiveTemplate { public static final EMNeutrinoDefinition lepton_Ve = new EMNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), lepton_Vm = new EMNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index 68591cc4e6..e4a92fbae1 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -1,17 +1,17 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; /** * Created by danie_000 on 22.10.2016. */ -public final class EMPrimitiveDefinition extends EMPrimitive { +public final class EMPrimitiveDefinition extends EMPrimitiveTemplate { public static final EMPrimitiveDefinition - nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), - null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), - space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), + nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, 0), + null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MIN_VALUE), + space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, Integer.MIN_VALUE+1), magic = new EMPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), magic_ = new EMPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index b0a5c419e1..9afa04d243 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; @@ -9,7 +9,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p /** * Created by danie_000 on 22.10.2016. */ -public final class EMQuarkDefinition extends EMPrimitive { +public final class EMQuarkDefinition extends EMPrimitiveTemplate { public static final EMQuarkDefinition quark_u = new EMQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), quark_c = new EMQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index f5cfad22f3..b7310485a2 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.recipe; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.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.mechanics.elementalMatter.core.maps.IEMMapRead; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; @@ -262,7 +262,7 @@ public class TT_recipe extends GT_Recipe { return null; } try { - return mRecipeMap.get(EMComplex.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); + return mRecipeMap.get(EMDefinitionsRegistry.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); }catch (Exception e){ if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index c72bf0ab9e..97cd4a6ea6 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; 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.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; 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 107cb97103..2062173cfd 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 @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.item; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstance import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; @@ -26,7 +27,6 @@ import net.minecraft.world.World; import java.util.Collections; import java.util.List; -import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @@ -39,7 +39,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by Tec on 15.03.2017. */ public final class DebugElementalInstanceContainer_EM extends Item implements IElementalItem { - public static final TreeSet STACKS_REGISTERED =new TreeSet<>(); public static DebugElementalInstanceContainer_EM INSTANCE; @@ -141,7 +140,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(IEMDefinition definition: STACKS_REGISTERED){ + for(IEMDefinition definition: EMDefinitionsRegistry.getStacksRegisteredForDisplay()){ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT)))); list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 144 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_144)))); list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1000 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 4a0bb55784..3015d024c7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -8,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayRe import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; @@ -108,7 +108,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }); registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMPrimitive.getClassTypeStatic()); + registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { @Override @@ -135,7 +135,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return 2; } }); - FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { @Override public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { try { @@ -162,9 +162,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }); registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(EMPrimitive.getClassTypeStatic()); + registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); - FUSE_HANDLERS.put((EMPrimitive.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() { + FUSE_HANDLERS.put((EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { @Override public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 466f82071b..e769d3e480 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -26,7 +26,7 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 630569a25d..64949fe402 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 @@ -29,8 +29,8 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.DEFAULT_ENERGY_LEVEL; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.DEFAULT_ENERGY_LEVEL; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; -- cgit From 436fdbfdaacbadbb776251fd04b75e5acbe84f4c Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 18 Jan 2022 22:25:23 +0100 Subject: Cleanup some Locale (cherry picked from commit 975bf105794ac48b1415d4e78946449fbb68bcaf) --- .../tectech/loader/recipe/RecipeLoader.java | 2 +- .../core/definitions/EMPrimitiveTemplate.java | 11 +++++----- .../definitions/complex/EMAtomDefinition.java | 7 +++--- .../definitions/complex/EMHadronDefinition.java | 25 +++++++++++----------- .../definitions/primitive/EMBosonDefinition.java | 3 ++- .../definitions/primitive/EMLeptonDefinition.java | 3 ++- .../primitive/EMNeutrinoDefinition.java | 3 ++- .../primitive/EMPrimitiveDefinition.java | 3 ++- .../definitions/primitive/EMQuarkDefinition.java | 3 ++- 9 files changed, 34 insertions(+), 26 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java index 7cd5a25f4a..2a572d87de 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java @@ -35,7 +35,7 @@ public class RecipeLoader implements Runnable { @Override public void run() { - EMAtomDefinition.setTransformation(); + EMAtomDefinition.setTransformations(); EMHadronDefinition.setTransformations(); // =================================================================================================== 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 f3ce34dd1d..b529b79cc0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; @@ -61,11 +62,6 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { EMDefinitionsRegistry.registerForDisplay(this); } - @Override - public String getLocalizedName() { - return "Undefined: " + getName(); - } - @Override public String getSymbol() { return symbol; @@ -183,6 +179,11 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { return nbt; } + @Override + protected final int getIndirectTagValue() { + throw new EMException("This class should only be used directly!"); + } + @Override public final byte getClassType() { return getClassTypeStatic(); 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 666249f408..878c2a6627 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 @@ -33,6 +33,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.OrePrefixes.dust; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 18.11.2016. @@ -348,7 +349,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { if (DEBUG_MODE) { e.printStackTrace(); } - return (negative ? "Element: ~" : "Element: ") + element; + return translateToLocal("tt.keyword.Element")+(negative ? ": ~" : ": ") + element; } } @@ -1476,7 +1477,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { } } - public static void setTransformation(){ + public static void setTransformations(){ /*----STABLE ATOMS----**/ refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; @@ -1666,7 +1667,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); + lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); } if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+ getLocalizedName()); 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 a901f5c8fc..70092aa735 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 @@ -31,6 +31,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.core.transfor import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.11.2016. @@ -141,7 +142,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize public String getLocalizedName() { StringBuilder name= new StringBuilder(getSimpleName()); name.append(':'); - String sym= NAME_MAP.get(this); + String sym= translateToLocal(NAME_MAP.get(this)); if(sym!=null){ name.append(' ').append(sym); }else { @@ -155,17 +156,17 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize private String getSimpleName() { switch (getAmount()) { case 2: - return "Meson"; + return translateToLocal("tt.keyword.Meson"); case 3: - return "Baryon"; + return translateToLocal("tt.keyword.Baryon"); case 4: - return "Tetraquark"; + return translateToLocal("tt.keyword.Tetraquark"); case 5: - return "Pentaquark"; + return translateToLocal("tt.keyword.Pentaquark"); case 6: - return "Hexaquark"; + return translateToLocal("tt.keyword.Hexaquark"); default: - return "Hadron"; + return translateToLocal("tt.keyword.Hadron"); } } @@ -413,22 +414,22 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize //redefine the proton with proper lifetime (the lifetime is based on mass comparison) hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); SYMBOL_MAP.put(hadron_p,"p"); - NAME_MAP.put(hadron_p,"Proton"); + NAME_MAP.put(hadron_p,translateToLocal("tt.keyword.Proton")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p); hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); SYMBOL_MAP.put(hadron_p_,"~p"); - NAME_MAP.put(hadron_p_,"Anti Proton"); + NAME_MAP.put(hadron_p_,translateToLocal("tt.keyword.AntiProton")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p_); hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.getMass(); //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); - NAME_MAP.put(hadron_n, "Neutron"); + NAME_MAP.put(hadron_n,translateToLocal("tt.keyword.Neutron")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n); hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); SYMBOL_MAP.put(hadron_n_,"~n"); - NAME_MAP.put(hadron_n_,"Anti Neutron"); + NAME_MAP.put(hadron_n_,translateToLocal("tt.keyword.AntiNeutron")); EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n_); } catch (EMException e) { if (DEBUG_MODE) { @@ -491,7 +492,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); + lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); } if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+getSimpleName()); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index 5f14eefcdb..f20f872a6e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMP import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -35,7 +36,7 @@ public final class EMBosonDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Boson: " + getName(); + return translateToLocal("tt.keyword.Boson")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index 0f9898775f..38e537ec59 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMP import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -59,7 +60,7 @@ public final class EMLeptonDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Lepton: " + getName(); + return translateToLocal("tt.keyword.Lepton")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index ac06a80728..9af7b97cb4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefini import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -49,7 +50,7 @@ public final class EMNeutrinoDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Lepton: " + getName(); + return translateToLocal("tt.keyword.Neutrino")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index e4a92fbae1..41da06567d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -29,7 +30,7 @@ public final class EMPrimitiveDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Primitive: " + getName(); + return translateToLocal("tt.keyword.Primitive")+": " + getName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index 9afa04d243..3f19205aeb 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMP import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -96,7 +97,7 @@ public final class EMQuarkDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return "Quark: " + getName(); + return translateToLocal("tt.keyword.Quark")+": " + getName(); } @Override -- cgit From bfc503b010c652be703fc6da016cede6d5b41465 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 18 Jan 2022 22:33:13 +0100 Subject: Minor fixes (cherry picked from commit 62021d238a0c38401b50211d59e72e169399f444) --- .../elementalMatter/definitions/EMComplexAspectDefinition.java | 2 +- .../mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java | 2 +- .../elementalMatter/definitions/complex/EMHadronDefinition.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') 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 e56e31f166..a062fa0dab 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 @@ -48,7 +48,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { private EMComplexAspectDefinition(boolean check, EMConstantStackMap aspects) throws EMException { if (check && !canTheyBeTogether(aspects)) { - throw new EMException("Hadron Definition error"); + throw new EMException("Complex Aspect Definition error"); } aspectStacks = aspects; float mass = 0; 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 878c2a6627..37ecb861f8 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 @@ -72,7 +72,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { private final int charge; //int -electric charge in 1/3rds of electron charge for optimization private final int chargeLeptons; - private double rawLifeTime; + private final double rawLifeTime; //generation max present inside - minus if contains any anti quark private final byte type; 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 70092aa735..c1db8e4460 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 @@ -101,7 +101,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize this.amount = amount; this.charge = charge; this.type = containsAnti ? (byte) -type : (byte) type; - long mult = this.getAmount() * this.getAmount() * (this.getAmount() - 1); + long mult = (long) this.getAmount() * this.getAmount() * (this.getAmount() - 1); mass = mass * 5.543D * mult;//yes it becomes heavier if (mass == protonMass && this.getAmount() == 3) { -- cgit From 967353ed74d8f177ef641261899327b9fabb2ecc Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 22 Jan 2022 23:33:56 +0100 Subject: cherry pick Rework API, add locale --- .../java/com/github/technus/tectech/TecTech.java | 19 +- .../dreamcraft/DreamCraftRecipeLoader.java | 8 +- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 76 +- .../blocks/turretbases/TurretBaseEM.java | 2 +- .../blocks/turretheads/TurretHeadEM.java | 2 +- .../entity/projectiles/projectileEM.java | 4 +- .../tileentity/turret/TileTurretHeadEM.java | 6 +- .../spartakcore/SpartakCoreRecipeLoader.java | 9 +- .../definitions/EMComplexAspectDefinition.java | 78 +- .../definitions/EMPrimalAspectDefinition.java | 41 +- .../transformations/AspectDefinitionCompat.java | 7 +- .../AspectDefinitionCompatEnabled.java | 11 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 8 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 4 +- .../technus/tectech/loader/ElementalLoader.java | 29 +- .../github/technus/tectech/loader/MainLoader.java | 37 +- .../tectech/loader/gui/CreativeTabTecTech.java | 2 - .../tectech/loader/recipe/BaseRecipeLoader.java | 124 ++ .../tectech/loader/recipe/BloodyRecipeLoader.java | 6 +- .../tectech/loader/recipe/RecipeLoader.java | 120 -- .../tectech/loader/thing/MachineLoader.java | 15 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 14 +- .../elementalMatter/core/EMException.java | 3 - .../elementalMatter/core/commands/EMGive.java | 118 +- .../elementalMatter/core/commands/EMList.java | 56 +- .../core/definitions/EMComplexTemplate.java | 20 +- .../core/definitions/EMDefinitionsRegistry.java | 110 -- .../core/definitions/EMPrimitiveTemplate.java | 67 +- .../core/definitions/IEMDefinition.java | 32 +- .../registry/EMDefinitionsRegistry.java | 189 ++++ .../core/definitions/registry/EMIndirectType.java | 37 + .../core/definitions/registry/EMType.java | 63 ++ .../core/maps/EMConstantStackMap.java | 5 +- .../core/maps/EMDefinitionStackMap.java | 5 +- .../core/maps/EMInstanceStackMap.java | 32 +- .../elementalMatter/core/maps/IEMMapRead.java | 20 +- .../elementalMatter/core/maps/IEMMapWrite.java | 12 +- .../core/maps/IEMMapWriteExact.java | 6 +- .../core/stacks/EMDefinitionStack.java | 10 +- .../core/stacks/EMInstanceStack.java | 61 +- .../elementalMatter/core/stacks/IEMStack.java | 33 +- .../core/transformations/EMDequantizationInfo.java | 56 + .../transformations/EMFluidDequantizationInfo.java | 43 - .../transformations/EMFluidQuantizationInfo.java | 4 +- .../transformations/EMItemDequantizationInfo.java | 45 - .../transformations/EMItemQuantizationInfo.java | 4 +- .../EMOredictDequantizationInfo.java | 60 - .../transformations/EMOredictQuantizationInfo.java | 41 +- .../core/transformations/EMTransformationInfo.java | 165 --- .../transformations/EMTransformationRegistry.java | 134 +++ .../core/transformations/IEMExchangeInfo.java | 11 - .../core/transformations/OreDictionaryStack.java | 19 + .../definitions/complex/EMAtomDefinition.java | 1187 ++++++++++---------- .../definitions/complex/EMHadronDefinition.java | 229 ++-- .../definitions/primitive/EMBosonDefinition.java | 38 +- .../definitions/primitive/EMFermionDefinition.java | 16 + .../primitive/EMGaugeBosonDefinition.java | 83 ++ .../definitions/primitive/EMLeptonDefinition.java | 43 +- .../primitive/EMNeutrinoDefinition.java | 41 +- .../primitive/EMPrimitiveDefinition.java | 50 +- .../definitions/primitive/EMQuarkDefinition.java | 87 +- .../primitive/EMScalarBosonDefinition.java | 46 + .../github/technus/tectech/recipe/TT_recipe.java | 19 +- .../tectech/thing/block/QuantumGlassBlock.java | 2 +- .../tectech/thing/casing/GT_Block_CasingsNH.java | 2 +- .../tectech/thing/casing/GT_Block_CasingsTT.java | 2 +- .../tectech/thing/casing/GT_Block_HintTT.java | 2 +- .../technus/tectech/thing/item/AvrProgrammer.java | 2 +- .../thing/item/ConstructableTriggerItem.java | 2 +- .../item/DebugElementalInstanceContainer_EM.java | 32 +- .../item/ElementalDefinitionContainer_EM.java | 11 +- .../item/ElementalDefinitionScanStorage_EM.java | 2 +- .../technus/tectech/thing/item/EuMeterGT.java | 2 +- .../thing/item/FrontRotationTriggerItem.java | 2 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 2 +- .../tectech/thing/metaTileEntity/Textures.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 8 +- .../multi/GT_MetaTileEntity_EM_collider.java | 717 ------------ .../multi/GT_MetaTileEntity_EM_decay.java | 4 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 49 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 11 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 10 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 +- .../em_collider/GT_MetaTileEntity_EM_collider.java | 709 ++++++++++++ .../multi/em_collider/IColliderHandler.java | 5 + .../em_collider/IPrimitiveColliderHandler.java | 8 + .../multi/em_machine/Behaviour_Centrifuge.java | 7 +- .../Behaviour_ElectromagneticSeparator.java | 9 +- .../github/technus/tectech/util/DoubleCount.java | 6 + .../java/com/github/technus/tectech/util/Util.java | 12 + src/main/resources/assets/tectech/lang/en_US.lang | 103 +- 91 files changed, 2933 insertions(+), 2716 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index ef5e146bfa..d730d64a65 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -2,6 +2,7 @@ package com.github.technus.tectech; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; +import com.github.technus.tectech.loader.gui.CreativeTabTecTech; import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler; import com.github.technus.tectech.mechanics.anomaly.CancerCommand; import com.github.technus.tectech.mechanics.anomaly.ChargeCommand; @@ -11,6 +12,8 @@ import com.github.technus.tectech.mechanics.data.ChunkDataHandler; import com.github.technus.tectech.mechanics.data.PlayerPersistence; import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMGive; import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.proxy.CommonProxy; import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.FMLCommonHandler; @@ -41,7 +44,8 @@ public class TecTech { public static TecTech instance; public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; - public static final LogHelper LOGGER = new LogHelper(Reference.MODID); + public static final LogHelper LOGGER = new LogHelper(Reference.MODID); + public static CreativeTabTecTech creativeTabTecTech; private static IngameErrorLog moduleAdminErrorLogs; public static TecTechConfig configTecTech; @@ -50,6 +54,9 @@ public class TecTech { public static AnomalyHandler anomalyHandler; public static PlayerPersistence playerPersistence; + public static final EMDefinitionsRegistry definitionsRegistry =new EMDefinitionsRegistry(); + public static final EMTransformationRegistry transformationInfo =new EMTransformationRegistry(); + /** * For Loader.isModLoaded checks during the runtime */ @@ -106,7 +113,7 @@ public class TecTech { Field field= GT_Proxy.class.getDeclaredField("mEvents"); field.setAccessible(true); modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL ); - field.set(GT_Mod.gregtechproxy, new Collection() { + field.set(GT_Mod.gregtechproxy, new Collection() { @Override public int size() { return 0; @@ -123,8 +130,8 @@ public class TecTech { } @Override - public Iterator iterator() { - return new Iterator() { + public Iterator iterator() { + return new Iterator() { @Override public boolean hasNext() { return false; @@ -188,13 +195,13 @@ public class TecTech { } - MainLoader.load(); + MainLoader.load(definitionsRegistry); MainLoader.addAfterGregTechPostLoadRunner(); } @Mod.EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { - MainLoader.postLoad(); + MainLoader.postLoad(definitionsRegistry,transformationInfo); chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler=new AnomalyHandler()); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 5abd11a86d..f520885f9e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.dreamcraft; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -23,12 +24,12 @@ import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault; +import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault; /** * Created by Tec on 06.08.2017. */ -public class DreamCraftRecipeLoader implements Runnable { +public class DreamCraftRecipeLoader { //region reflect a bit @SuppressWarnings("rawtypes") private Class CUSTOM_ITEM_LIST; @@ -48,8 +49,7 @@ public class DreamCraftRecipeLoader implements Runnable { } //endregion - @Override - public void run() { + public void run(EMTransformationRegistry transformationInfo) { //region reflect a bit try { CUSTOM_ITEM_LIST = Class.forName("com.dreammaster.gthandler.CustomItemList"); diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index 73d2955548..67a363fc6c 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -1,18 +1,19 @@ package com.github.technus.tectech.compatibility.gtpp; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getBestUnstableIsotope; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getFirstStableIsotope; -public class GtppAtomLoader implements Runnable{ +public class GtppAtomLoader { //region reflect a bit - private Class ELEMENT; + private Class ELEMENT; private Object ELEMENT_INSTANCE; private Method getUnlocalizedName,getFluid,generate; @@ -41,16 +42,7 @@ public class GtppAtomLoader implements Runnable{ } //endregion - private static Method getMethodWithReplacements(Class owner, String name1, String name2, Class... arguments) throws ReflectiveOperationException { - try { - return owner.getMethod(name1, arguments); - } catch (ReflectiveOperationException e) { - return owner.getMethod(name2, arguments); - } - } - - @Override - public void run() { + public void setTransformations(EMTransformationRegistry transformationInfo) { //region reflect a bit try{ ELEMENT=Class.forName("gtPlusPlus.core.material.ELEMENT"); @@ -58,7 +50,7 @@ public class GtppAtomLoader implements Runnable{ Class clazz=Class.forName("gtPlusPlus.core.material.Material"); getUnlocalizedName=clazz.getMethod("getUnlocalizedName"); - getFluid=getMethodWithReplacements(clazz,"getFluidStack", "getFluid", int.class); + getFluid=clazz.getMethod("getFluid", int.class); clazz=Class.forName("gtPlusPlus.core.material.MaterialGenerator"); generate=clazz.getMethod("generate", Class.forName("gtPlusPlus.core.material.Material"), boolean.class, boolean.class); @@ -67,34 +59,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144)); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("NEON",144)); generate("GERMANIUM",true,true); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("BROMINE",144)); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("KRYPTON",144)); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),getFluid("XENON",144)); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java index 9da3b82b40..654b4e37a6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java @@ -10,7 +10,7 @@ import net.minecraft.world.World; import openmodularturrets.blocks.turretbases.BlockAbstractTurretBase; import openmodularturrets.handler.ConfigHandler; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by Tec on 27/07/2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java index 7b7167b915..da212d4853 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java @@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import openmodularturrets.tileentity.turretbase.TurretBase; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by Tec on 27/07/2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index 785b59f093..54bd3aaea5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -52,10 +52,10 @@ public class projectileEM extends LaserProjectile { charge=projectileContent.getCharge(); massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass()); - if(projectileContent.getDefinition().getMatterType()>1 || projectileContent.getDefinition().getMatterType()<-1) { + if(projectileContent.getDefinition().getGeneration()>1 || projectileContent.getDefinition().getGeneration()<-1) { strange = true; } - if(projectileContent.getDefinition().getMatterType()<0) { + if(projectileContent.getDefinition().getGeneration()<0) { antiMatter = true; } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 6dc5c4f60a..742232d8c6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -14,7 +14,7 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; /** * Created by Bass on 27/07/2017. @@ -71,8 +71,8 @@ public class TileTurretHeadEM extends TurretHead{ return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null); } EMInstanceStack stack = hatchContentPointer.getRandom(); - double amount = Math.min(AVOGADRO_CONSTANT, stack.getAmount()); - hatchContentPointer.removeAmount(stack.getDefinition(),AVOGADRO_CONSTANT); + double amount = Math.min(EM_COUNT_PER_MATERIAL_AMOUNT, stack.getAmount()); + hatchContentPointer.removeAmount(stack.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT); stack=stack.clone(); stack.setAmount(amount); return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack); diff --git a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java index 3fabfd67b2..b2050bbac5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.spartakcore; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -19,15 +20,13 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault; +import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault; /** * Created by Spartak1997 on 28.07.2019. */ -public class SpartakCoreRecipeLoader implements Runnable { - - @Override - public void run() { +public class SpartakCoreRecipeLoader { + public void run(EMTransformationRegistry transformationInfo) { //Quantum Glass GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ 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 a062fa0dab..40419604e4 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 @@ -2,24 +2,21 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defi import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -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.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; -import net.minecraft.nbt.NBTTagCompound; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.util.Util; import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static net.minecraft.util.StatCollector.translateToLocal; @@ -30,7 +27,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { private final int hash; private final double mass; - private static final byte nbtType = (byte) 'c'; + private static final String nbtType = "`"; private final EMConstantStackMap aspectStacks; @@ -76,7 +73,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { @Override public String getLocalizedName() { - String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this); + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); if (name != null) { name = name.substring(0, 1).toUpperCase() + name.substring(1); } else { @@ -124,25 +121,10 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { } @Override - protected int getIndirectTagValue() { + protected String getIndirectTagValue() { return nbtType; } - public static EMComplexAspectDefinition fromNBT(NBTTagCompound nbt) { - EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new EMComplexAspectDefinition(stacks); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - @Override public double getRawTimeSpan(long currentEnergy) { return -1; @@ -159,12 +141,12 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { } @Override - public byte getMatterType() { + public int getGeneration() { return 0; } @Override - public byte getColor() { + public int getMaxColors() { return -1; } @@ -175,7 +157,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { - return new EMDecay[]{new EMDecay(0.75F, aspectStacks), EMBosonDefinition.deadEnd}; + return new EMDecay[]{new EMDecay(0.75F, aspectStacks), deadEnd}; } @Override @@ -218,45 +200,25 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { return mass; } - @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - @Override public IEMDefinition getAnti() { return null; } - public static void run() { - try { - EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMComplexAspectDefinition::fromNBT,EMComplexAspectDefinition.class, getClassTypeStatic()); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt)-> + new EMComplexAspectDefinition(EMConstantStackMap.fromNBT(definitionsRegistry,nbt)), EMComplexAspectDefinition.class, "tt.keyword.Aspect")); if (DEBUG_MODE) { TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + getClassTypeStatic()); } } @Override - public byte getClassType() { + public int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic() { + public static int getClassTypeStatic() { return -96; } @@ -275,7 +237,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType()); + lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getMatterMassType()); } if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { lines.add(translateToLocal("tt.keyword.NAME") + " = " + getLocalizedName()); @@ -285,7 +247,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); } if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); + lines.add(hasColor() ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); } if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java index e62c2e5278..885a71ef28 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -1,6 +1,9 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; import static net.minecraft.util.StatCollector.translateToLocal; @@ -10,29 +13,35 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { public static final EMPrimalAspectDefinition - magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), - magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), - magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), - magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), - magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), - magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); + magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 45,"a`"), + magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 44,"e`"), + magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 43,"f`"), + magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 42,"w`"), + magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 40,"o`"), + magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Chaos"), "c`", 1e5D, 41,"c`"); - private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID) { - super(name, symbol, 0, mass, 0, -1, ID); + private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID,String bind) { + super(name, symbol, 0, mass, 0, -1, ID,bind); } - public static void run() { - magic_air.init(null, -1F, -1, -1, NO_DECAY); - magic_earth.init(null, -1F, -1, -1, NO_DECAY); - magic_fire.init(null, -1F, -1, -1, NO_DECAY); - magic_water.init(null, -1F, -1, -1, NO_DECAY); - magic_order.init(null, -1F, -1, -1, NO_DECAY); - magic_entropy.init(null, -1F, -1, -1, NO_DECAY); + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMPrimalAspectDefinition.class,"tt.keyword.Primal")); + magic_air.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_earth.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_fire.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_water.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_order.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_entropy.init(registry,null, -1F, -1, -1, NO_DECAY); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Primal") + ": " + getName(); + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); + if (name != null) { + return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName()+" ("+name+")"; + } else { + return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName(); + } } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java index a4328d2e03..c1c6c6dcb2 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import java.util.HashMap; @@ -13,12 +14,16 @@ public class AspectDefinitionCompat { private final HashMap defToAspect = new HashMap<>(); private final HashMap aspectToDef = new HashMap<>(); - public void run(){} + public void run(EMDefinitionsRegistry registry){} public String getAspectTag(IEMDefinition definition){ return null; } + public String getAspectLocalizedName(IEMDefinition definition){ + return null; + } + public IEMDefinition getDefinition(String aspect){ return null; } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java index ead8a5fdef..ccccff7c3d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -2,20 +2,20 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry.STACKS_REGISTERED; /** * Created by Tec on 21.05.2017. */ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { @Override - public void run(){ + public void run(EMDefinitionsRegistry registry){ getDefToAspect().put(magic_air,"aer"); getDefToAspect().put(magic_earth,"terra"); getDefToAspect().put(magic_fire,"ignis"); @@ -51,6 +51,7 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } getAspectToDef().put(aspect.getTag(),newAspect); getDefToAspect().put(newAspect,aspect.getTag()); + registry.registerForDisplay(newAspect); }catch (EMException e) { /**/ }finally { @@ -60,7 +61,6 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat } } } - STACKS_REGISTERED.addAll(getDefToAspect().keySet()); } @Override @@ -68,6 +68,11 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat return getDefToAspect().get(definition); } + public String getAspectLocalizedName(IEMDefinition definition){ + Aspect aspect = Aspect.aspects.get(getAspectTag(definition)); + return aspect != null ? aspect.getName() : null; + } + @Override public IEMDefinition getDefinition(String aspect) { return getAspectToDef().get(aspect); diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index dbcbe7d86b..267af79784 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -26,8 +26,8 @@ import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED; +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_ITEM_DIMINISHED; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -100,7 +100,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } EMInstanceStack stack = inputHatchContainer.getRandom(); - if (stack.getAmount() < AVOGADRO_CONSTANT_DIMINISHED) { + if (stack.getAmount() < EM_COUNT_PER_ITEM_DIMINISHED) { cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[6]; } else { @@ -111,7 +111,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); mEUt = (int) -V[7]; } else { - inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(AVOGADRO_CONSTANT)); + inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(EM_COUNT_PER_MATERIAL_AMOUNT)); if (aspect.isPrimal()) { mEUt = (int) -V[8]; } else { diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 5fe8c973fe..a381a37f89 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -25,7 +25,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -90,7 +90,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu mEfficiencyIncrease = 10000; eAmpereFlow = 1; outputEM = new EMInstanceStackMap[]{ - new EMInstanceStackMap(new EMInstanceStack(definition,AVOGADRO_CONSTANT)) + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)) }; if (definition instanceof EMPrimalAspectDefinition) { mEUt = (int) -V[8]; diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index 61989e7b13..773361bd0f 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -2,36 +2,33 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMNuclideIAEA; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*; /** * Created by danie_000 on 16.11.2016. */ -public class ElementalLoader implements Runnable { - @Override - public void run() { +public class ElementalLoader { + public void run(EMDefinitionsRegistry registry) { // =================================================================================================== // Definition init // =================================================================================================== - EMPrimitiveDefinition.run(); + EMPrimitiveDefinition.run(registry); - EMQuarkDefinition.run(); - EMLeptonDefinition.run(); - EMNeutrinoDefinition.run(); - EMBosonDefinition.run(); + EMQuarkDefinition.run(registry); + EMLeptonDefinition.run(registry); + EMNeutrinoDefinition.run(registry); + EMGaugeBosonDefinition.run(registry); + EMScalarBosonDefinition.run(registry); - EMHadronDefinition.run(); + EMHadronDefinition.run(registry); - EMNuclideIAEA.run(); + EMAtomDefinition.run(registry); - EMAtomDefinition.run(); - - EMPrimalAspectDefinition.run(); - - EMComplexAspectDefinition.run(); + EMPrimalAspectDefinition.run(registry); + EMComplexAspectDefinition.run(registry); } } diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 02fae0e194..e2f1e2882f 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -8,14 +8,16 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.loader.recipe.RecipeLoader; +import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; import com.github.technus.tectech.loader.thing.ComponentLoader; import com.github.technus.tectech.loader.thing.CoverLoader; import com.github.technus.tectech.loader.thing.MachineLoader; import com.github.technus.tectech.loader.thing.ThingsLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.Textures; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_collider; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.common.network.NetworkRegistry; @@ -43,7 +45,7 @@ import static com.github.technus.tectech.TecTech.*; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static gregtech.api.enums.GT_Values.W; public final class MainLoader { @@ -65,17 +67,17 @@ public final class MainLoader { //set expanded texture arrays for tiers try { - new Textures(); + Textures.run(); }catch (Throwable t){ LOGGER.error("Loading textures...",t); } } - public static void load() { + public static void load(EMDefinitionsRegistry registry) { ProgressManager.ProgressBar progressBarLoad = ProgressManager.push("TecTech Loader", 9); progressBarLoad.step("Elemental Things"); - new ElementalLoader().run(); + new ElementalLoader().run(registry); LOGGER.info("Elemental Init Done"); progressBarLoad.step("Thaumcraft Compatibility"); @@ -120,8 +122,8 @@ public final class MainLoader { ProgressManager.pop(progressBarLoad); } - public static void postLoad() { - ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 5); + public static void postLoad(EMDefinitionsRegistry registry, EMTransformationRegistry transformationInfo) { + ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 6); progressBarPostLoad.step("Dreamcraft Compatibility"); if(Loader.isModLoaded(Reference.DREAMCRAFT)){ @@ -138,21 +140,16 @@ public final class MainLoader { } progressBarPostLoad.step("Thaumcraft Compatibility"); - if (Loader.isModLoaded(Reference.THAUMCRAFT)) { - aspectDefinitionCompat = new AspectDefinitionCompatEnabled(); - aspectDefinitionCompat.run(); - } else { - aspectDefinitionCompat = new AspectDefinitionCompat(); - } + aspectDefinitionCompat = Loader.isModLoaded(Reference.THAUMCRAFT) ? new AspectDefinitionCompatEnabled() : new AspectDefinitionCompat(); + aspectDefinitionCompat.run(registry); progressBarPostLoad.step("Recipes"); - new RecipeLoader().run(); + new BaseRecipeLoader().run(transformationInfo); TecTech.LOGGER.info("Recipe Init Done"); - //Hazmat moved to GT5U - //progressBarPostLoad.step("Register Extra Hazmat Suits"); - //registerExtraHazmats(); - //TecTech.LOGGER.info("Hazmat additions done"); + progressBarPostLoad.step("Register Extra Hazmat Suits"); + registerExtraHazmats(); + TecTech.LOGGER.info("Hazmat additions done"); if (!configTecTech.DISABLE_BLOCK_HARDNESS_NERF) { progressBarPostLoad.step("Nerf blocks blast resistance"); @@ -170,7 +167,7 @@ public final class MainLoader { ProgressManager.pop(progressBarPostLoad); } - private static void registerExtraHazmats() { //Hazmat moved to GT5U + private static void registerExtraHazmats() { ItemStack EMT_iqC=GT_ModHandler.getModItem("EMT","itemArmorQuantumChestplate",1,W); ItemStack GRAVI_gC=GT_ModHandler.getModItem("GraviSuite","graviChestPlate",1,W); ItemStack GRAVI_anC=GT_ModHandler.getModItem("GraviSuite", "advNanoChestPlate", 1, W); diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java index d360162fb6..e5b9fea395 100644 --- a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java @@ -11,8 +11,6 @@ import net.minecraft.item.Item; import java.util.List; public class CreativeTabTecTech extends CreativeTabs { - public static CreativeTabTecTech creativeTabTecTech; - public CreativeTabTecTech(String name) { super(name); } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java new file mode 100644 index 0000000000..5dc4d09b1a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java @@ -0,0 +1,124 @@ +package com.github.technus.tectech.loader.recipe; + +import com.github.technus.tectech.Reference; +import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; +import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; +import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.thing.CustomItemList; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.item.ConstructableTriggerItem; +import com.github.technus.tectech.thing.item.EuMeterGT; +import com.github.technus.tectech.thing.item.FrontRotationTriggerItem; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import static gregtech.api.enums.GT_Values.RA; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class BaseRecipeLoader { + public static Materials getOrDefault(String name,Materials def){ + Materials mat=Materials.get(name); + return mat == Materials._NULL || mat == null ? def : mat; + } + + public void run(EMTransformationRegistry transformationInfo) { + EMAtomDefinition.setTransformations(transformationInfo); + EMHadronDefinition.setTransformations(transformationInfo); + if (Loader.isModLoaded(Reference.GTPLUSPLUS)) { + new GtppAtomLoader().setTransformations(transformationInfo); + } + + // =================================================================================================== + // Recipes init - common goes here rest goes into methods below + // =================================================================================================== + + for(int i=0;i<=15;i++) { + RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, Materials.Aluminium.getMolten(864), new ItemStack(TT_Container_Casings.sHintCasingsTT, 1, i), 32, 120); + } + + //Scrench + GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"fPR", " RP", "S h", + 'P', OrePrefixes.plate.get(Materials.Cobalt), + 'R', OrePrefixes.stick.get(Materials.Cobalt), + 'S', OrePrefixes.stick.get(Materials.Wood),}); + + //BLUEprint + /*GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); + */ + //GT EU reader + GT_ModHandler.addCraftingRecipe(new ItemStack(EuMeterGT.INSTANCE,1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"PGW", "SCW", "BRN", + 'P', OrePrefixes.plateDouble.get(Materials.Steel), + 'G', OrePrefixes.plate.get(Materials.Glass), + 'W', OrePrefixes.cableGt01.get(Materials.Copper), + 'S', OrePrefixes.stick.get(Materials.Brass), + 'C', ItemList.Casing_Coil_Cupronickel.get(1), + 'B', Dyes.dyeBlue, + 'R', Dyes.dyeRed, + 'N', Dyes.dyeBlack,}); + + //Owner detector + GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_OwnerDetector.get(1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"PPP","GEG","PPP", + 'P', OrePrefixes.plate.get(Materials.IronMagnetic), + 'G', OrePrefixes.plate.get(Materials.Glass), + 'E', OrePrefixes.gem.get(Materials.EnderPearl)}); + + //Data reader + GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_DataReader.get(1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"BdB","GES","PwP", + 'B', OrePrefixes.screw.get(Materials.Iridium), + 'P', OrePrefixes.plate.get(Materials.Iridium), + 'G', ItemList.Cover_Screen, + 'S', OrePrefixes.circuit.get(Materials.Elite), + 'E', ItemList.Hull_IV}); + + //Data Bank + RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new Object[]{ + CustomItemList.Machine_Multi_Switch.get(1), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, + ItemList.Tool_DataOrb.get(1), + ItemList.Cover_Screen.get(1), + }, new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Hydrogen.getGas(1000), + }, CustomItemList.Machine_Multi_DataBank.get(1), 12000, 14000); + + //Bucks + //RA.addAssemblerRecipe(CustomItemList.) + + //recipe for ass line data hatches + RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataIn_Hatch.get(1), CustomItemList.dataInAss_Hatch.get(1), 2048, 12000); + RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataOut_Hatch.get(1), CustomItemList.dataOutAss_Hatch.get(1), 2048, 12000); + + if (Loader.isModLoaded(Reference.DREAMCRAFT)) { + new DreamCraftRecipeLoader().run(transformationInfo);//init recipes for GTNH version + } else if (Loader.isModLoaded(Reference.SPARTAKCORE)) { + new SpartakCoreRecipeLoader().run(transformationInfo);//init recipes for SpartakCore version + } else { + new BloodyRecipeLoader().run(transformationInfo);//init recipes for NON-GTNH version + } + } +} + diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java index 7b8cc14f4d..a57f268d4e 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.loader.recipe; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -22,9 +23,8 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 06.08.2017. */ -public class BloodyRecipeLoader implements Runnable { - @Override - public void run() { +public class BloodyRecipeLoader { + public void run(EMTransformationRegistry transformationInfo) { //Quantum Glass GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.eM_Containment.get(1), diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java deleted file mode 100644 index 2a572d87de..0000000000 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.github.technus.tectech.loader.recipe; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; -import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.EuMeterGT; -import com.github.technus.tectech.thing.item.FrontRotationTriggerItem; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import static gregtech.api.enums.GT_Values.RA; - -/** - * Created by danie_000 on 16.11.2016. - */ -public class RecipeLoader implements Runnable { - public static Materials getOrDefault(String name,Materials def){ - Materials mat=Materials.get(name); - return mat == Materials._NULL || mat == null ? def : mat; - } - - @Override - public void run() { - EMAtomDefinition.setTransformations(); - EMHadronDefinition.setTransformations(); - - // =================================================================================================== - // Recipes init - common goes here rest goes into methods below - // =================================================================================================== - - for(int i=0;i<=15;i++) { - RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, Materials.Aluminium.getMolten(864), new ItemStack(TT_Container_Casings.sHintCasingsTT, 1, i), 32, 120); - } - - //Scrench - GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"fPR", " RP", "S h", - 'P', OrePrefixes.plate.get(Materials.Cobalt), - 'R', OrePrefixes.stick.get(Materials.Cobalt), - 'S', OrePrefixes.stick.get(Materials.Wood),}); - - //BLUEprint - /*GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); - */ - //GT EU reader - GT_ModHandler.addCraftingRecipe(new ItemStack(EuMeterGT.INSTANCE,1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"PGW", "SCW", "BRN", - 'P', OrePrefixes.plateDouble.get(Materials.Steel), - 'G', OrePrefixes.plate.get(Materials.Glass), - 'W', OrePrefixes.cableGt01.get(Materials.Copper), - 'S', OrePrefixes.stick.get(Materials.Brass), - 'C', ItemList.Casing_Coil_Cupronickel.get(1), - 'B', Dyes.dyeBlue, - 'R', Dyes.dyeRed, - 'N', Dyes.dyeBlack,}); - - //Owner detector - GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_OwnerDetector.get(1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"PPP","GEG","PPP", - 'P', OrePrefixes.plate.get(Materials.IronMagnetic), - 'G', OrePrefixes.plate.get(Materials.Glass), - 'E', OrePrefixes.gem.get(Materials.EnderPearl)}); - - //Data reader - GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_DataReader.get(1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"BdB","GES","PwP", - 'B', OrePrefixes.screw.get(Materials.Iridium), - 'P', OrePrefixes.plate.get(Materials.Iridium), - 'G', ItemList.Cover_Screen, - 'S', OrePrefixes.circuit.get(Materials.Elite), - 'E', ItemList.Hull_IV}); - - //Data Bank - RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new Object[]{ - CustomItemList.Machine_Multi_Switch.get(1), - new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, - ItemList.Tool_DataOrb.get(1), - ItemList.Cover_Screen.get(1), - }, new FluidStack[]{ - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), - Materials.Hydrogen.getGas(1000), - }, CustomItemList.Machine_Multi_DataBank.get(1), 12000, 14000); - - //Bucks - //RA.addAssemblerRecipe(CustomItemList.) - - //recipe for ass line data hatches - RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataIn_Hatch.get(1), CustomItemList.dataInAss_Hatch.get(1), 2048, 12000); - RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataOut_Hatch.get(1), CustomItemList.dataOutAss_Hatch.get(1), 2048, 12000); - - if (Loader.isModLoaded(Reference.DREAMCRAFT)) { - new DreamCraftRecipeLoader().run();//init recipes for GTNH version - } else if (Loader.isModLoaded(Reference.SPARTAKCORE)) { - new SpartakCoreRecipeLoader().run();//init recipes for SpartakCore version - } else { - new BloodyRecipeLoader().run();//init recipes for NON-GTNH version - } - } -} - diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index b3df7483f5..4dd9d3422d 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaQuantizer; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; @@ -15,7 +16,7 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; @@ -74,22 +75,22 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f*AVOGADRO_CONSTANT).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); // =================================================================================================== 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 c6ac34b66d..84f8a5e9d6 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 @@ -31,18 +31,18 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +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; public class AnomalyHandler implements IChunkMetaDataHandler { - private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later... + private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;//can be const as it is computed later... private static final int COUNT_DIV=32; private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge"; private static final int MEAN_DELAY =50; - private static final double CANCER_EFFECTIVENESS = 1/AVOGADRO_CONSTANT; - private static final double CHARGE_EFFECTIVENESS = 10/AVOGADRO_CONSTANT; - private static final double CHARGE_EXPLOSIVENESS = 5/AVOGADRO_CONSTANT; + private static final double CANCER_EFFECTIVENESS = 1/ EM_COUNT_PER_MATERIAL_AMOUNT; + private static final double CHARGE_EFFECTIVENESS = 10/ EM_COUNT_PER_MATERIAL_AMOUNT; + private static final double CHARGE_EXPLOSIVENESS = 5/ EM_COUNT_PER_MATERIAL_AMOUNT; private boolean fixMe=false; private final ArrayList playersWithCharge = new ArrayList<>(); @@ -133,7 +133,7 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } private void swapSomething(Chunk a,Chunk b,double mass) { - float explosionPower=(float) Math.log(mass/AVOGADRO_CONSTANT); + float explosionPower=(float) Math.log(mass/ EM_COUNT_PER_MATERIAL_AMOUNT); for (int i = 0; i < Math.min((int)explosionPower,64); i++) { int x = TecTech.RANDOM.nextInt(16); int y = TecTech.RANDOM.nextInt(a.worldObj.getActualHeight()); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java index e00e72446d..d607dfad73 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java @@ -19,7 +19,4 @@ public final class EMException extends RuntimeException { public EMException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } - - public EMException() { - } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java index af4caf854b..18f2f76498 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -1,36 +1,31 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.definitions.EMPrimitiveTemplate; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; /** * Created by danie_000 on 30.12.2017. */ public class EMGive implements ICommand { - ArrayList aliases=new ArrayList<>(); + ArrayList aliases = new ArrayList<>(); - public EMGive(){ + public EMGive() { aliases.add("em_give"); aliases.add("give_em"); aliases.add("gib_em"); @@ -39,27 +34,24 @@ public class EMGive implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) { if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - if(args.length < 3) { + if (args.length < 3) { sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - }else{ - TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args)); + } else { + TecTech.LOGGER.info("Spawninig EM for " + ((EntityPlayerMP) sender).getDisplayName() + " - " + Arrays.toString(args)); - ArrayList list = new ArrayList<>(Arrays.asList(args)); - String energy=list.remove(0); + ArrayList list = new ArrayList<>(Arrays.asList(args)); + String energy = list.remove(0); - EMDefinitionStack def = getDefinitionStack(list); - if(def!=null) { - EMInstanceStack instanceStack = new EMInstanceStack(def, 1D, 0D, Long.parseLong(energy)); + EMDefinitionStack def = getDefinitionStack(TecTech.definitionsRegistry, list); + if (def != null) { + EMInstanceStack instanceStack = new EMInstanceStack(def, 1, 0, Long.parseLong(energy)); sender.addChatMessage(new ChatComponentText(instanceStack.getDefinition().getSymbol() + " - " + instanceStack.getDefinition().getLocalizedName())); EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack); ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); - NBTTagCompound contents = new NBTTagCompound(); - contents.setTag("info", instanceMap.getInfoNBT()); - contents.setTag("content", instanceMap.toNBT()); - itemStack.setTagCompound(contents); + DebugElementalInstanceContainer_EM.INSTANCE.setContent(itemStack, instanceMap); ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); } @@ -67,40 +59,45 @@ public class EMGive implements ICommand { } } - private EMDefinitionStack getDefinitionStack(ArrayList args){ - if(args.get(0).equals("<")){ - args.remove(0); + private EMDefinitionStack getDefinitionStack(EMDefinitionsRegistry registry, ArrayList args) { + double amount; + if (args.size() == 0) { return null; } - double amount=Double.parseDouble(args.remove(0)); - try{ - int id=Integer.parseInt(args.get(0)); - args.remove(0); - IEMDefinition primitive = IEMDefinition.getBindsPrimitive().get(id); - return new EMDefinitionStack(primitive,amount); - }catch (NumberFormatException e){ - byte clazz = (byte) args.remove(0).charAt(0); - Method constructor = IEMDefinition.getBindsComplex().get(clazz); - - EMDefinitionStackMap stacks =new EMDefinitionStackMap(); - while(args.size()>0){ - EMDefinitionStack tempStack =getDefinitionStack(args); - if(tempStack==null) { - break; - }else { - stacks.putUnifyExact(tempStack); - } + String defTag = args.remove(0); + if ("<".equals(defTag)) { + return null; + } + try { + amount = Double.parseDouble(defTag); + if (args.size() == 0) { + return null; } - - try { - return ((IEMDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount); - } catch (Exception e1) { - if (DEBUG_MODE) { - e.printStackTrace(); + defTag = args.remove(0); + if ("<".equals(defTag)) { + return null; + } + } catch (Exception e) { + amount = 1; + } + IEMDefinition definition = registry.getDirectBinds().get(defTag); + if (definition != null) { + return definition.getStackForm(amount); + } + EMIndirectType emIndirectType = registry.getIndirectBinds().get(defTag); + if (emIndirectType != null) { + EMDefinitionStackMap stacks = new EMDefinitionStackMap(); + while (args.size() > 0) { + EMDefinitionStack definitionStack = getDefinitionStack(registry, args); + if (definitionStack == null) { + break; + } else { + stacks.putUnifyExact(definitionStack); } - return nbtE__.getStackForm(amount); } + return emIndirectType.create(registry, stacks.toNBT(registry)).getStackForm(amount); } + return null; } @Override @@ -120,33 +117,20 @@ public class EMGive implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==2){ - return completionsForClassOrID(); + if (args.length > 1 && args.length % 2 == 0) { + return new ArrayList<>(TecTech.definitionsRegistry.getBinds().keySet()); } return null; } - private List completionsForClassOrID(){ - ArrayList strings=new ArrayList<>(8); - Map binds= IEMDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())); - } - Map bindsBO = IEMDefinition.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - strings.add(String.valueOf(e.getKey().byteValue())); - } - return strings; - } - @Override public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_give Energy Count ClassOrId (Count ClassOrId ... <)"; + return "em_give Energy Count ClassOrId ( (Count ClassOrId ... <) ...<)"; } @Override public int compareTo(Object o) { - if(o instanceof ICommand){ + if (o instanceof ICommand) { return getCommandName().compareTo(((ICommand) o).getCommandName()); } return 0; 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 13531dbf85..90eddf1e23 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 @@ -1,15 +1,15 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +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 net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import java.util.Map; +import java.util.stream.Collectors; /** * Created by danie_000 on 30.12.2017. @@ -26,27 +26,32 @@ public class EMList implements ICommand { public void processCommand(ICommandSender sender, String[] args) { if (!sender.getEntityWorld().isRemote) { if(args.length == 0) { - sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); - Map binds= IEMDefinition.getBindsComplex(); - for (Map.Entry e:binds.entrySet()) { - sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); - } - }else if(args.length==1){ - sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); - if(args[0].equals(String.valueOf((char) EMPrimitiveTemplate.nbtType))){ - Map bindsBO = IEMDefinition.getBindsPrimitive(); - for (Map.Entry e:bindsBO.entrySet()) { - sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName())); - } - }else{ - sender.addChatMessage(new ChatComponentText("Complex definition - needs contents")); - } - }else{ - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + listClasses(sender); + }else { + listDefinitions(sender, Util.getConcated(args," ")); } } } + private void listDefinitions(ICommandSender sender, String arg) { + sender.addChatMessage(new ChatComponentText(" Available Direct: tag - name symbol")); + for (EMType directType : TecTech.definitionsRegistry.getDirectTypes().values()) { + if ("*".equals(arg) || arg.equalsIgnoreCase(directType.getLocalizedName())) { + directType.getDefinitions().forEach((bind, definition) -> + sender.addChatMessage(new ChatComponentText(bind + " - " + definition.getLocalizedName() + " " + definition.getSymbol()))); + } + } + } + + private void listClasses(ICommandSender sender) { + sender.addChatMessage(new ChatComponentText(" Available Direct: name (use name as parameter to learn more")); + TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) -> + sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName()))); + sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name")); + TecTech.definitionsRegistry.getIndirectBinds().forEach((bind, emIndirectType) -> + sender.addChatMessage(new ChatComponentText(bind+" - "+emIndirectType.getLocalizedName()))); + } + @Override public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { return false; @@ -65,19 +70,14 @@ public class EMList implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { if(args.length==0){ - Map binds= IEMDefinition.getBindsComplex(); - ArrayList strings=new ArrayList<>(binds.size()); - for (Map.Entry e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); - } - return strings; + return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).collect(Collectors.toList()); } return null; } @Override public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_list (optional class tag)"; + return "em_list (optional Direct Name or *)"; } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java index 94a50ce322..13838cf443 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import net.minecraft.nbt.NBTTagCompound; @@ -29,11 +30,6 @@ public abstract class EMComplexTemplate implements IEMDefinition { return getSubParticles().compareWithAmountsInternal(o.getSubParticles()); } - @Override - public final EMDefinitionStack getStackForm(double amount) { - return new EMDefinitionStack(this, amount); - } - @Override public final boolean equals(Object obj) { if(this==obj) { @@ -50,24 +46,22 @@ public abstract class EMComplexTemplate implements IEMDefinition { @Override public int hashCode() {//Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 4); + int hash = -(getSubParticles().size() << 16); for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { int amount=(int) stack.getAmount(); - hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode(); + hash += ((amount & 0x1) == 0 ? -amount : amount) * (stack.getDefinition().hashCode()<<4); } return hash; } @Override public String toString() { - return getLocalizedName()+ '\n' + getSymbol(); + return getLocalizedName()+ " " + getSymbol(); } - public NBTTagCompound toNBT() { - NBTTagCompound nbtTagCompound = getSubParticles().toNBT(); - nbtTagCompound.setInteger(EMDefinitionsRegistry.getIndirectTagName(), getIndirectTagValue()); - return nbtTagCompound; + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + return registry.indirectToNBT(getIndirectTagValue(),getSubParticles()); } - protected abstract int getIndirectTagValue(); + protected abstract String getIndirectTagValue(); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java deleted file mode 100644 index c0f9df32f2..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; -import java.util.function.Function; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; - -public class EMDefinitionsRegistry { - private static final NavigableSet STACKS_REGISTERED = new TreeSet<>(); - private static final Map DIRECT_BINDS = new HashMap<>(); - private static final Map> CLASS_BINDS = new HashMap<>();//creator methods in subclasses - private static final Map> CLASSES = new HashMap<>(); - private static final Map, Integer> CLASS_TYPES = new HashMap<>(); - private static final String INDIRECT_TAG = "t"; - private static final String DIRECT_TAG = "c"; - - private EMDefinitionsRegistry() { - } - - static { - CLASS_BINDS.put(0, EMDefinitionsRegistry::getDefinitionDirect); - CLASS_BINDS.put((int) 'p', EMDefinitionsRegistry::getDefinitionDirect); - } - - private static IEMDefinition getDefinitionDirect(NBTTagCompound nbt) { - return DIRECT_BINDS.get(nbt.getInteger(getDirectTagName())); - } - - public static IEMDefinition fromNBT(NBTTagCompound nbt) { - IEMDefinition apply; - try { - apply = CLASS_BINDS.get(nbt.getInteger(getIndirectTagName())).apply(nbt); - } catch (Exception e) { - EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); - if (DEBUG_MODE) { - emException.printStackTrace(); - return nbtE__; - } else { - throw emException; - } - } - if (!DEBUG_MODE) { - if (apply == nbtE__) { - throw new EMException("Deserialized to NBT ERROR!"); - } else if (apply == null__ || apply == null) { - throw new EMException("Deserialized to NULL POINTER!"); - } - } - if (apply == null) { - return null__; - } - return apply; - } - - public static void registerDefinitionClass(int shortcutNBT, Function creator, Class clazz, int classID) { - if (CLASS_BINDS.put(shortcutNBT, creator) != null) { - EMException e = new EMException("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - if (CLASSES.put(classID, clazz) != null) { - EMException e = new EMException("Duplicate Class ID! " + classID + " used for class comparison"); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - CLASS_TYPES.put(clazz, classID); - } - - public static void registerDirectDefinition(IEMDefinition definition, int id) { - IEMDefinition old = DIRECT_BINDS.put(id, definition); - if (old != null) { - EMException e = new EMException("Duplicate primitive EM ID: " + id + - " for " + definition.getLocalizedName() + - " and " + old.getLocalizedName()); - if (DEBUG_MODE) { - e.printStackTrace(); - } else { - throw e; - } - } - } - - public static NavigableSet getStacksRegisteredForDisplay() { - return STACKS_REGISTERED; - } - - public static void registerForDisplay(IEMDefinition definition){ - STACKS_REGISTERED.add(definition); - STACKS_REGISTERED.add(definition.getAnti()); - } - - public static String getIndirectTagName() { - return INDIRECT_TAG; - } - - public static String getDirectTagName() { - return DIRECT_TAG; - } -} 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 b529b79cc0..0f25d73704 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 @@ -2,10 +2,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; @@ -25,41 +23,43 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { //int -electric charge in 1/3rds of electron charge for optimization private final int charge; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private final byte color; + private final int color; //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - private final byte type; + private final int generation; - private EMPrimitiveTemplate anti;//IMMUTABLE + private IEMDefinition anti;//IMMUTABLE private EMDecay[] elementalDecays; private byte naturalDecayInstant; private byte energeticDecayInstant; private double rawLifeTime; private final int ID; + private final String bind; //no _ at end - normal particle // _ at end - anti particle // __ at end - self is antiparticle - protected EMPrimitiveTemplate(String name, String symbol, int type, double mass, int charge, int color, int ID) { + protected EMPrimitiveTemplate(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { this.name = name; this.symbol = symbol; - this.type = (byte) type; + this.generation = generation; this.mass = mass; this.charge = charge; - this.color = (byte) color; + this.color = color; this.ID = ID; - EMDefinitionsRegistry.registerDirectDefinition(this,ID); + this.bind=bind; } // - protected void init(EMPrimitiveTemplate antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { + protected void init(EMDefinitionsRegistry registry,IEMDefinition antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { anti = antiParticle; this.rawLifeTime = rawLifeTime; naturalDecayInstant = (byte) naturalInstant; energeticDecayInstant = (byte) energeticInstant; elementalDecays =elementalDecaysArray; - EMDefinitionsRegistry.registerForDisplay(this); + registry.registerForDisplay(this); + registry.registerDirectDefinition(bind,this); } @Override @@ -83,7 +83,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { } @Override - public byte getColor() { + public int getMaxColors() { return color; } @@ -153,44 +153,27 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { } @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public byte getMatterType() { - return type; + public int getGeneration() { + return generation; } @Override - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger(EMDefinitionsRegistry.getDirectTagName(), ID); - return nbt; + public final NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + return registry.directToNBT(bind); } @Override - protected final int getIndirectTagValue() { + protected final String getIndirectTagValue() { throw new EMException("This class should only be used directly!"); } @Override - public final byte getClassType() { + public final int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic(){ - return -128; + public static int getClassTypeStatic(){ + return Short.MIN_VALUE; } @Override @@ -203,7 +186,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + EMDefinitionsRegistry.getDirectTagName() + ' ' + getClassType()); + lines.add("DIRECT = " + bind + ' ' + getMatterMassType()); } if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+ getLocalizedName()); @@ -213,7 +196,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } if(areBitsSet(SCAN_GET_MASS,capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); @@ -226,7 +209,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { @Override public final int compareTo(IEMDefinition o) { - if (getClassType() == o.getClassType()) { + if (getMatterMassType() == o.getMatterMassType()) { int oID = ((EMPrimitiveTemplate) o).ID; return Integer.compare(ID, oID); } @@ -238,7 +221,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { return ID; } - public String getName() { + public String getUnlocalizedName() { return name; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java index 06bfc61737..8125812dc6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java @@ -1,11 +1,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; @@ -31,9 +29,9 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM void addScanResults(ArrayList lines, int capabilities, long energyLevel); - byte getMatterType(); + int getMatterMassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + int getGeneration(); //Not dynamically changing stuff IEMDefinition getAnti();//gives new anti particle def @@ -59,7 +57,11 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM int getCharge();//charge 1/3 electron charge //dynamically changing stuff - byte getColor();//-1 nope cannot 0 it can but undefined + int getMaxColors(); + + default boolean hasColor(){ + return getMaxColors()>0; + } double getRawTimeSpan(long currentEnergy);//defined in static fields or generated @@ -67,19 +69,17 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM EMConstantStackMap getSubParticles();//contents... null if none - EMFluidDequantizationInfo someAmountIntoFluidStack(); - - EMItemDequantizationInfo someAmountIntoItemsStack(); - - EMOredictDequantizationInfo someAmountIntoOredictStack(); + NBTTagCompound toNBT(EMDefinitionsRegistry registry); - NBTTagCompound toNBT(); - - EMDefinitionStack getStackForm(double amount); + default EMDefinitionStack getStackForm(double amount){ + return new EMDefinitionStack(this,amount); + } - IEMDefinition clone(); + default IEMDefinition clone(){ + return this; + } default int compareClassID(IEMDefinition obj) { - return (int) getClassType() - obj.getClassType(); + return getMatterMassType() - obj.getMatterMassType(); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java new file mode 100644 index 0000000000..458965da66 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java @@ -0,0 +1,189 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +public class EMDefinitionsRegistry { + private static final String TAG_NAME = "EM"; + + private final NavigableSet stacksRegistered = new TreeSet<>(); + + private final Map hashMap = new HashMap<>(); + private final Map hashMapR = Collections.unmodifiableMap(hashMap); + + private final Map, EMType> types = new HashMap<>(); + private final Map, EMType> typesR = Collections.unmodifiableMap(types); + private final Map, EMType> directTypes = new HashMap<>(); + private final Map, EMType> directTypesR = Collections.unmodifiableMap(directTypes); + private final Map, EMIndirectType> indirectTypes = new HashMap<>(); + private final Map, EMIndirectType> indirectTypesR = Collections.unmodifiableMap(indirectTypes); + + private final Map binds = new HashMap<>(); + private final Map bindsR = Collections.unmodifiableMap(binds); + private final Map directBinds = new HashMap<>(); + private final Map directBindsR = Collections.unmodifiableMap(directBinds); + private final Map indirectBinds = new HashMap<>(); + private final Map indirectBindsR = Collections.unmodifiableMap(indirectBinds); + + public NBTTagCompound directToNBT(String bind) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setString(TAG_NAME, bind); + return nbt; + } + + public NBTTagCompound indirectToNBT(String bind, IEMMapRead content) { + NBTTagCompound nbt = content.toNBT(this); + nbt.setString(TAG_NAME, bind); + return nbt; + } + + public IEMDefinition fromNBT(NBTTagCompound nbt) { + IEMDefinition definition; + try { + String bind = nbt.getString(TAG_NAME); + definition = directBinds.get(bind); + if (definition == null) { + definition = indirectBinds.get(bind).create(this, nbt); + } + } catch (Exception e) { + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + if (!DEBUG_MODE) { + if (definition == nbtE__) { + throw new EMException("Deserialized to NBT ERROR!"); + } else if (definition == null) { + throw new EMException("Deserialized to NULL POINTER!"); + } else if (definition == null__) { + throw new EMException("Deserialized to NULL!"); + } + } + if (definition == null) { + return null__; + } + return definition; + } + + public boolean isOccupied(String bind) { + return binds.containsKey(bind); + } + + protected void addType(EMType emType) { + if (types.put(emType.getClazz(), emType) != null) { + EMException e = new EMException("Class collision! " + emType.getClazz().getName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + protected void bindType(String bind, EMType emType) { + if (binds.put(bind, emType) != null) { + EMException e = new EMException("NBT Bind collision! " + bind); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public void registerDefinitionClass(String bind, EMIndirectType emIndirectType) { + addType(emIndirectType); + indirectTypes.put(emIndirectType.getClazz(), emIndirectType); + bindType(bind, emIndirectType); + indirectBinds.put(bind, emIndirectType); + } + + public void registerDefinitionClass(EMType emDirectType) { + addType(emDirectType); + } + + public void registerDirectDefinition(String bind, IEMDefinition definition) { + if (hashMap.put(definition.hashCode(), definition) != null) { + EMException e = new EMException("Hash collision! " + definition.hashCode()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + EMType emType = directTypes.get(definition.getClass()); + if (emType == null) { + emType = types.get(definition.getClass()); + if (emType != null) { + directTypes.put(definition.getClass(), emType); + } else { + EMException e = new EMException("Direct Type bind missing! " + definition.getClass().getName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + if (emType != null) { + directTypes.put(definition.getClass(), emType); + bindType(bind, emType); + emType.addDefinition(bind, definition); + directBinds.put(bind, definition); + } + } + + public void registerForDisplay(IEMDefinition definition) { + stacksRegistered.add(definition); + IEMDefinition anti = definition.getAnti(); + if (anti != null) { + stacksRegistered.add(anti); + } + } + + @Deprecated + public Map getHashMapping() { + return hashMapR; + } + + public NavigableSet getStacksRegisteredForDisplay() { + return stacksRegistered; + } + + public Map getBinds() { + return bindsR; + } + + public Map getDirectBinds() { + return directBindsR; + } + + public Map getIndirectBinds() { + return indirectBindsR; + } + + public Map, EMType> getTypes() { + return typesR; + } + + public Map, EMType> getDirectTypes() { + return directTypesR; + } + + public Map, EMIndirectType> getIndirectTypes() { + return indirectTypesR; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java new file mode 100644 index 0000000000..680dd029a4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.function.BiFunction; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +public class EMIndirectType extends EMType { + private final BiFunction creator; + + public EMIndirectType(BiFunction creator, Class clazz, String unlocalizedName) { + super(clazz, unlocalizedName); + this.creator = creator; + } + + protected BiFunction getCreator() { + return creator; + } + + public IEMDefinition create(EMDefinitionsRegistry registry,NBTTagCompound nbt){ + try { + return creator.apply(registry, nbt); + }catch (Exception e){ + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java new file mode 100644 index 0000000000..73097db663 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java @@ -0,0 +1,63 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static net.minecraft.util.StatCollector.translateToLocal; + +public class EMType { + private final Map definitions = new HashMap<>(); + private final Map definitionsR = Collections.unmodifiableMap(definitions); + private final Class clazz; + private final String unlocalizedName; + + public EMType(Class clazz, String unlocalizedName) { + this.clazz = clazz; + this.unlocalizedName = unlocalizedName; + } + + public Class getClazz() { + return clazz; + } + + public String getUnlocalizedName() { + return unlocalizedName; + } + + public String getLocalizedName() { + return translateToLocal(getUnlocalizedName()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + return clazz==((EMType) o).clazz; + } + + @Override + public int hashCode() { + return clazz.hashCode(); + } + + public void addDefinition(String bind, IEMDefinition definition) { + if (definitions.put(bind, definition) != null) { + EMException e = new EMException("NBT Bind collision on Direct bind!"); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public Map getDefinitions() { + return definitionsR; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java index e6cfa7d03e..f6bef9910e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; @@ -45,10 +46,10 @@ public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap(getBackingMap())); } - public static EMConstantStackMap fromNBT(NBTTagCompound nbt) throws EMException { + public static EMConstantStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); if (defStacks[i].getDefinition().equals(nbtE__)) { throw new EMException("Something went Wrong"); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java index 78bb8d740a..57b8f7bf1c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; @@ -43,10 +44,10 @@ public final class EMDefinitionStackMap extends EMStackMap im return new EMConstantStackMap(getBackingMap()); } - public static EMDefinitionStackMap fromNBT(NBTTagCompound nbt) throws EMException { + public static EMDefinitionStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); if (defStacks[i].getDefinition().equals(nbtE__)) { throw new EMException("Something went Wrong"); } 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 69dc53f83d..64ff7063e8 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 @@ -1,10 +1,12 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -13,9 +15,10 @@ import java.util.Map; import java.util.NavigableMap; import java.util.TreeMap; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.util.DoubleCount.add; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.01.2017. @@ -91,7 +94,7 @@ 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) +" mol"+ 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())); } @@ -120,16 +123,15 @@ public final class EMInstanceStackMap extends EMStackMap implem } public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ - cleanUp(); + //cleanUp(); double diff=0; - for (EMInstanceStack instance : valuesToArray()) { + for (EMInstanceStack instance : takeAllToArray()) { instance.setAge(instance.getAge() + seconds); EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize); if (newInstances == null) { - instance.nextColor(); + putUnify(instance); } else { diff=add(diff,newInstances.getMassDiff()); - removeAmount(instance);//todo check maybe this should be removeKey putUnifyAll(newInstances.getOutput()); } } @@ -157,10 +159,10 @@ public final class EMInstanceStackMap extends EMStackMap implem return nbt; } - public static EMInstanceStackMap fromNBT(NBTTagCompound nbt) throws EMException { + public static EMInstanceStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { EMInstanceStack[] instances = new EMInstanceStack[nbt.getInteger("i")]; for (int i = 0; i < instances.length; i++) { - instances[i] = EMInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + instances[i] = EMInstanceStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); if (instances[i].getDefinition().equals(nbtE__)) { throw new EMException("Something went Wrong"); } @@ -188,6 +190,12 @@ public final class EMInstanceStackMap extends EMStackMap implem return build.toString(); } + public EMInstanceStack[] takeAllToArray(){ + EMInstanceStack[] newStack = valuesToArray();//just in case to uncouple The map + this.getBackingMap().clear(); + return newStack; + } + public EMInstanceStackMap takeAll(){ EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map this.getBackingMap().clear(); @@ -212,7 +220,7 @@ public final class EMInstanceStackMap extends EMStackMap implem return stack; } double newAmount = add(target.getAmount(), stack.getAmount()); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=target.unifyIntoThis(stack); putReplace(stack); return stack; @@ -230,7 +238,7 @@ public final class EMInstanceStackMap extends EMStackMap implem return stack; } double newAmount = target.getAmount()+stack.getAmount(); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=target.unifyIntoThis(stack); putReplace(stack); return stack; 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 1322566914..c0420fa2b2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; @@ -9,18 +10,11 @@ import net.minecraft.util.EnumChatFormatting; import java.lang.reflect.Array; import java.util.*; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static com.github.technus.tectech.util.DoubleCount.ulpSigned; +import static net.minecraft.util.StatCollector.translateToLocal; public interface IEMMapRead extends Comparable>, Cloneable { - static boolean isValidAmount(double amount){ - return amount>=AVOGADRO_CONSTANT_UNCERTAINTY; - } - - static boolean isInvalidAmount(double amount){ - return amount getBackingMap(); IEMMapRead clone(); @@ -105,7 +99,7 @@ public interface IEMMapRead extends Comparable for (T defStack : values()) { info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getLocalizedName(); info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT; + info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT+" "+translateToLocal("tt.keyword.mol"); i += 3; } return info; @@ -132,12 +126,12 @@ public interface IEMMapRead extends Comparable return nbt; } - default NBTTagCompound toNBT() { + default NBTTagCompound toNBT(EMDefinitionsRegistry registry) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", size()); int i = 0; for (Map.Entry entry : entrySet()) { - nbt.setTag(Integer.toString(i++), entry.getValue().toNBT()); + nbt.setTag(Integer.toString(i++), entry.getValue().toNBT(registry)); } return nbt; } @@ -265,7 +259,7 @@ public interface IEMMapRead extends Comparable } default boolean containsAmount(IEMDefinition def, double amountToConsume) { - double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + double amountRequired=amountToConsume- EM_COUNT_EPSILON; if(amountRequired==amountToConsume){ amountRequired-=ulpSigned(amountRequired); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java index f13e82fb26..15815f2ee0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -2,11 +2,11 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import java.util.Map; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_EPSILON; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_EPSILON; import static com.github.technus.tectech.util.DoubleCount.*; public interface IEMMapWrite extends IEMMapWriteExact { @@ -15,11 +15,11 @@ public interface IEMMapWrite extends IEMMapWriteExact { /** * Consumes amount from map * @param def def to consume - * @param amountToConsume should be comparable to {@link EMTransformationInfo#AVOGADRO_CONSTANT} + * @param amountToConsume should be comparable to {@link EMTransformationRegistry#EM_COUNT_PER_MATERIAL_AMOUNT} * @return consumed successfully */ default boolean removeAmount(IEMDefinition def, double amountToConsume){ - double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON; + double amountRequired=amountToConsume- EM_COUNT_EPSILON; if(amountRequired==amountToConsume){ amountRequired-=ulpSigned(amountRequired); } @@ -31,7 +31,7 @@ public interface IEMMapWrite extends IEMMapWriteExact { if(current!=null){ if(current.getAmount()>=amountRequired){ double newAmount=sub(current.getAmount(),amountToConsume); - if(IEMMapRead.isValidAmount(current.getAmount())){ + if(IEMStack.isValidAmount(newAmount)){ current=(T)current.mutateAmount(newAmount); getBackingMap().put(current.getDefinition(),current); }else { @@ -88,7 +88,7 @@ public interface IEMMapWrite extends IEMMapWriteExact { return stack; } double newAmount = add(target.getAmount(), stack.getAmount()); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=(T) target.mutateAmount(newAmount); putReplace(stack); return stack; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java index 167ec8451d..9da971944c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -7,7 +7,7 @@ import java.util.Map; public interface IEMMapWriteExact extends IEMMapRead { default void cleanUp(){ - entrySet().removeIf(entry -> IEMMapRead.isInvalidAmount(entry.getValue().getAmount())); + entrySet().removeIf(entry -> entry.getValue().isInvalidAmount()); } default void clear() { @@ -95,7 +95,7 @@ public interface IEMMapWriteExact extends IEMMapRead { if(current!=null){ double newAmount=current.getAmount()-amountToConsume; if(newAmount>=0){ - if(IEMMapRead.isValidAmount(current.getAmount())){ + if(current.isValidAmount()){ current=(T)current.mutateAmount(newAmount); getBackingMap().put(current.getDefinition(),current); } else { @@ -142,7 +142,7 @@ public interface IEMMapWriteExact extends IEMMapRead { return stack; } double newAmount = target.getAmount()+stack.getAmount(); - if (IEMMapRead.isValidAmount(newAmount)) { + if (IEMStack.isValidAmount(newAmount)) { stack=(T) target.mutateAmount(newAmount); putReplace(stack); return stack; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java index f868dbe0ad..c1e6a729f8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import net.minecraft.nbt.NBTTagCompound; @@ -41,16 +41,16 @@ public final class EMDefinitionStack implements IEMStack { return amount; } - public NBTTagCompound toNBT() { + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", getDefinition().toNBT()); + nbt.setTag("d", getDefinition().toNBT(registry)); nbt.setDouble("Q", getAmount()); return nbt; } - public static EMDefinitionStack fromNBT(NBTTagCompound nbt) { + public static EMDefinitionStack fromNBT(EMDefinitionsRegistry registry,NBTTagCompound nbt) { return new EMDefinitionStack( - EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), + registry.fromNBT(nbt.getCompoundTag("d")), nbt.getLong("q")+nbt.getDouble("Q")); } 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 6347cd2144..b67d2ce121 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 @@ -1,12 +1,12 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; @@ -14,19 +14,22 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.DoubleCount.*; -import static java.lang.Math.*; +import static java.lang.Math.max; +import static java.lang.Math.min; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ public final class EMInstanceStack implements IEMStack { public static int MIN_MULTIPLE_DECAY_CALLS = 4, MAX_MULTIPLE_DECAY_CALLS = 16; - public static double DECAY_CALL_PER = AVOGADRO_CONSTANT;//todo + public static double DECAY_CALL_PER = EM_COUNT_PER_MATERIAL_AMOUNT;//todo private final IEMDefinition definition; private double amount; @@ -35,7 +38,7 @@ public final class EMInstanceStack implements IEMStack { //energy - if positive then particle should try to decay private long energy; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private byte color; + private int color; private double lifeTime; private double lifeTimeMult; @@ -53,11 +56,10 @@ public final class EMInstanceStack implements IEMStack { public EMInstanceStack(IEMDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { definition = defSafe == null ? null__ : defSafe; - byte bColor = getDefinition().getColor(); - if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color - this.color = bColor; - } else { - this.color = (byte) TecTech.RANDOM.nextInt(3); + if (getDefinition().hasColor()) { + this.color = (byte) TecTech.RANDOM.nextInt(getDefinition().getMaxColors()); + } else {//transforms colorable??? into proper color + this.color = getDefinition().getMaxColors(); } this.lifeTimeMult = lifeTimeMult; lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult; @@ -119,11 +121,11 @@ public final class EMInstanceStack implements IEMStack { return definition; } - public byte getColor() { + public int getColor() { return color; } - public void setColor(byte color) {//does not allow changing magic element + public void setColor(int color) {//does not allow changing magic element if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { return; } @@ -131,10 +133,9 @@ public final class EMInstanceStack implements IEMStack { } public void nextColor() {//does not allow changing magic element - if (color < 0 || color > 2) { - return; + if (definition.hasColor()) { + color = (byte) TecTech.RANDOM.nextInt(definition.getMaxColors()); } - color = (byte) TecTech.RANDOM.nextInt(3); } public double getLifeTime() { @@ -524,7 +525,7 @@ public final class EMInstanceStack implements IEMStack { lines.add("ENERGY = " + energy); } if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { - lines.add("AMOUNT = " + getAmount() / AVOGADRO_CONSTANT + " mol"); + lines.add("AMOUNT = " + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")); } scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); } @@ -546,25 +547,25 @@ public final class EMInstanceStack implements IEMStack { } } - public NBTTagCompound toNBT() { + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", getDefinition().toNBT()); + nbt.setTag("d", getDefinition().toNBT(registry)); nbt.setDouble("Q", getAmount()); - nbt.setLong("e", energy); - nbt.setByte("c", color); - nbt.setDouble("A", getAge()); nbt.setDouble("M", lifeTimeMult); + nbt.setDouble("A", getAge()); + nbt.setLong("e", energy); + nbt.setInteger("c", color); return nbt; } - public static EMInstanceStack fromNBT(NBTTagCompound nbt) { + public static EMInstanceStack fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) { EMInstanceStack instance = new EMInstanceStack( - EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")), - nbt.getLong("q") + nbt.getDouble("Q"), - nbt.getFloat("m") + nbt.getDouble("M"), - nbt.getLong("a") + nbt.getDouble("A"), + registry.fromNBT(nbt.getCompoundTag("d")), + nbt.getDouble("Q"), + nbt.getDouble("M"), + nbt.getDouble("A"), nbt.getLong("e")); - instance.setColor(nbt.getByte("c")); + instance.setColor(nbt.getInteger("c")); return instance; } @@ -587,7 +588,7 @@ public final class EMInstanceStack implements IEMStack { @Override public String toString() { - return getDefinition().toString() + '\n' + getAmount() / AVOGADRO_CONSTANT + " mol\n" + getMass(); + return getDefinition().toString() + ' ' + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")+" " + getMass()+" eV/c^2"; } public void setAmount(double amount) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java index 5672b31c04..e5cfab9752 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java @@ -1,37 +1,56 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import net.minecraft.nbt.NBTTagCompound; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_MINIMUM; + /** * Created by danie_000 on 30.01.2017. */ -public interface IEMStack extends Comparable,Cloneable { +public interface IEMStack extends Comparable, Cloneable { + static boolean isValidAmount(double amount) { + return amount >= EM_COUNT_MINIMUM; + } + + static boolean isInvalidAmount(double amount) { + return amount < EM_COUNT_MINIMUM; + } + default boolean isValidAmount() { + return isValidAmount(getAmount()); + } + + default boolean isInvalidAmount() { + return isInvalidAmount(getAmount()); + } + IEMDefinition getDefinition(); double getAmount(); - default double getCharge(){ - return getDefinition().getCharge()*getAmount(); + default double getCharge() { + return getDefinition().getCharge() * getAmount(); } - default double getMass(){ - return getDefinition().getMass()*getAmount(); + default double getMass() { + return getDefinition().getMass() * getAmount(); } IEMStack clone(); /** * Will return stack with mutated amount, it might be a new object! + * * @param newAmount new amount * @return new stack (or previous one if was mutable) */ IEMStack mutateAmount(double newAmount); - NBTTagCompound toNBT(); + NBTTagCompound toNBT(EMDefinitionsRegistry registry); @Override - default int compareTo(IEMStack o){ + default int compareTo(IEMStack o) { return getDefinition().compareTo(o.getDefinition()); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java new file mode 100644 index 0000000000..855be96797 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class EMDequantizationInfo { + private final IEMStack definition; + private Object stack; + + public EMDequantizationInfo(IEMStack definition) { + this.definition = definition; + } + + public IEMStack getInput() { + return definition; + } + + public FluidStack getFluid() { + return ((FluidStack) stack).copy(); + } + + public void setFluid(FluidStack fluid) { + this.stack = fluid; + } + + public ItemStack getItem() { + return ((ItemStack) stack).copy(); + } + + public void setItem(ItemStack item) { + this.stack = item; + } + + public OreDictionaryStack getOre() { + return (OreDictionaryStack) stack; + } + + public void setOre(OreDictionaryStack ore) { + this.stack = ore; + } + + public Object getStack() { + return stack; + } + + @Override + public boolean equals(Object o) { + return o instanceof EMDequantizationInfo && definition.equals(((EMDequantizationInfo) o).definition); + } + + @Override + public int hashCode() { + return definition.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java deleted file mode 100644 index d74c36170e..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class EMFluidDequantizationInfo implements IEMExchangeInfo { - private final IEMStack in; - private final FluidStack out; - - public EMFluidDequantizationInfo(IEMStack emIn, FluidStack fluidStackOut){ - in=emIn; - out=fluidStackOut; - } - - public EMFluidDequantizationInfo(IEMStack emIn, Fluid fluid, int fluidAmount){ - in=emIn; - out=new FluidStack(fluid,fluidAmount); - } - - @Override - public IEMStack input() { - return in.clone();//MEH! - } - - @Override - public FluidStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMFluidDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java index 43fb5550aa..cf0cc6218c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 23.05.2017. */ -public class EMFluidQuantizationInfo implements IEMExchangeInfo { +public class EMFluidQuantizationInfo { private final FluidStack in; private final IEMStack out; @@ -21,12 +21,10 @@ public class EMFluidQuantizationInfo implements IEMExchangeInfo { - private final IEMStack in; - private final ItemStack out; - - public EMItemDequantizationInfo(IEMStack emIn, ItemStack itemStackOut){ - in=emIn; - out=itemStackOut; - } - - public EMItemDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int amount) { - in = emIn; - out = GT_OreDictUnificator.get(prefix, material, amount); - } - - @Override - public IEMStack input() { - return in.clone(); - } - - @Override - public ItemStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMItemDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java index 553e806d38..c5db63b3ad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java @@ -11,7 +11,7 @@ import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class EMItemQuantizationInfo implements IEMExchangeInfo { +public class EMItemQuantizationInfo { private final ItemStack in; private final boolean skipNBT; private final IEMStack out; @@ -28,12 +28,10 @@ public class EMItemQuantizationInfo implements IEMExchangeInfo { - private final IEMStack in; - private final String out; - private final int amount; - - public EMOredictDequantizationInfo(IEMStack emIn, String name, int qty) { - in = emIn; - out =name; - amount = qty; - } - - public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int qty) { - in = emIn; - out = prefix.name() + material.mName; - amount = qty; - } - - public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, String materialName, int qty) { - in = emIn; - out = prefix.name() + materialName; - amount = qty; - } - - @Override - public IEMStack input() { - return in.clone();//MEH! - } - - @Override - public String output() { - return getOut(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof EMOredictDequantizationInfo && hashCode() == obj.hashCode(); - } - - public String getOut() { - return out; - } - - public int getAmount() { - return amount; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java index 0ca0415b0d..3c54dd86ac 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java @@ -3,46 +3,41 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class EMOredictQuantizationInfo implements IEMExchangeInfo { - private final String in; +public class EMOredictQuantizationInfo { + private final int id; private final int amount; private final IEMStack out; - public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut){ - in=name; - amount=qty; - out=emOut; + public EMOredictQuantizationInfo(int id, int amount, IEMStack out) { + this.id = id; + this.amount = amount; + this.out = out; } - public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut){ - in=prefix.name() + material.mName; - amount=qty; - out=emOut; + public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut) { + this(OreDictionary.getOreID(name),qty,emOut); } - public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut){ - in=prefix.name() + materialName; - amount=qty; - out=emOut; + public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut) { + this(prefix, material.mName, qty,emOut); } - @Override - public String input() { - return getIn(); + public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut) { + this(OreDictionary.getOreID(prefix.name() + materialName),qty,emOut); } - @Override - public IEMStack output() { - return out.clone(); + public IEMStack getOut() { + return out; } @Override public int hashCode() { - return getIn().hashCode(); + return getId(); } @Override @@ -50,8 +45,8 @@ public class EMOredictQuantizationInfo implements IEMExchangeInfo fluidQuantization; - private Map itemQuantization; - private Map oredictQuantization; - - private Map fluidDequantization; - private Map itemDequantization; - private Map oredictDequantization; - - private EMTransformationInfo() { - this( - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), - new HashMap<>(16), new HashMap<>(16), new HashMap<>(64) - ); - } - - public EMTransformationInfo( - Map fluidQuantization, - Map itemQuantization, - Map oredictQuantization, - Map fluidDequantization, - Map itemDequantization, - Map oredictDequantization) { - this.setFluidQuantization(fluidQuantization); - this.setItemQuantization(itemQuantization); - this.setOredictQuantization(oredictQuantization); - this.setFluidDequantization(fluidDequantization); - this.setItemDequantization(itemDequantization); - this.setOredictDequantization(oredictDequantization); - } - - public void addFluid(IEMStack em, FluidStack fluidStack){ - getFluidQuantization().put(fluidStack.getFluidID(),new EMFluidQuantizationInfo(fluidStack,em)); - getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluidStack)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addFluid(IEMStack em, Fluid fluid, int fluidAmount){ - getFluidQuantization().put(fluid.getID(),new EMFluidQuantizationInfo(fluid,fluidAmount,em)); - getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluid,fluidAmount)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - private void addItemQuantization(EMItemQuantizationInfo aIQI){ - getItemQuantization().put(aIQI,aIQI); - } - - public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT){ - addItemQuantization(new EMItemQuantizationInfo(itemStack,skipNBT,em)); - getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,itemStack)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ - addItemQuantization(new EMItemQuantizationInfo(prefix,material,amount,skipNBT,em)); - getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,prefix,material,amount)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addOredict(IEMStack em, String name, int qty){ - getOredictQuantization().put(OreDictionary.getOreID(name),new EMOredictQuantizationInfo(name,qty,em)); - getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,name,qty)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty){ - getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + material.mName),new EMOredictQuantizationInfo(prefix,material,qty,em)); - getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,material,qty)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty){ - getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + materialName),new EMOredictQuantizationInfo(prefix,materialName,qty,em)); - getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,materialName,qty)); - EMDefinitionsRegistry.registerForDisplay(em.getDefinition()); - } - - public Map getFluidQuantization() { - return fluidQuantization; - } - - public void setFluidQuantization(Map fluidQuantization) { - this.fluidQuantization = fluidQuantization; - } - - public Map getItemQuantization() { - return itemQuantization; - } - - public void setItemQuantization(Map itemQuantization) { - this.itemQuantization = itemQuantization; - } - - public Map getOredictQuantization() { - return oredictQuantization; - } - - public void setOredictQuantization(Map oredictQuantization) { - this.oredictQuantization = oredictQuantization; - } - - public Map getFluidDequantization() { - return fluidDequantization; - } - - public void setFluidDequantization(Map fluidDequantization) { - this.fluidDequantization = fluidDequantization; - } - - public Map getItemDequantization() { - return itemDequantization; - } - - public void setItemDequantization(Map itemDequantization) { - this.itemDequantization = itemDequantization; - } - - public Map getOredictDequantization() { - return oredictDequantization; - } - - public void setOredictDequantization(Map oredictDequantization) { - this.oredictDequantization = oredictDequantization; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java new file mode 100644 index 0000000000..5e41beb9fd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java @@ -0,0 +1,134 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +import static java.lang.Math.pow; + +/** + * Created by Tec on 26.05.2017. + */ +public class EMTransformationRegistry { + /** + * Atom count per Mol + */ + public static final double AVOGADRO_CONSTANT = 6.02214076e23D; + /** + * Scale to 1m^3 of C-12 + */ + public static final double EM_COUNT_PER_CUBE = AVOGADRO_CONSTANT * 1650_000D / 0.012; + public static final double EM_COUNT_PER_MATERIAL_AMOUNT = EM_COUNT_PER_CUBE / 144 / 9; + public static final double EM_COUNT_PER_ITEM = EM_COUNT_PER_CUBE * 9; + public static final double EM_COUNT_PER_1k = EM_COUNT_PER_MATERIAL_AMOUNT * 1000; + + public static final double EM_COUNT_MINIMUM = 1 / EM_COUNT_PER_CUBE; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double EM_COUNT_EPSILON = EM_COUNT_PER_CUBE / pow(2, 40); + + public static final double EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT - EM_COUNT_EPSILON; + public static final double EM_COUNT_PER_CUBE_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144 * 9; + public static final double EM_COUNT_PER_ITEM_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144; + public static final double EM_COUNT_PER_1k_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 1000; + + private final Map fluidQuantization; + private final Map itemQuantization; + private final Map oredictQuantization; + + private final Map infoMap; + private final Function creator; + + public EMTransformationRegistry() { + this(EMDequantizationInfo::new); + } + + public EMTransformationRegistry(Function creator) { + this(creator, + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(256) + ); + } + + public EMTransformationRegistry(Function creator, + Map fluidQuantization, + Map itemQuantization, + Map oredictQuantization, + Map infoMap) { + this.creator = creator; + this.fluidQuantization = fluidQuantization; + this.itemQuantization = itemQuantization; + this.oredictQuantization = oredictQuantization; + this.infoMap = infoMap; + } + + protected EMDequantizationInfo compute(IEMStack em) { + return infoMap.computeIfAbsent(em.getDefinition(), stack -> creator.apply(em)); + } + + public void addFluid(IEMStack em, FluidStack fluidStack) { + getFluidQuantization().put(fluidStack.getFluidID(), new EMFluidQuantizationInfo(fluidStack, em)); + compute(em).setFluid(fluidStack); + } + + public void addFluid(IEMStack em, Fluid fluid, int fluidAmount) { + addFluid(em, new FluidStack(fluid, fluidAmount)); + } + + protected void addItemQuantization(EMItemQuantizationInfo aIQI) { + getItemQuantization().put(aIQI, aIQI); + } + + public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT) { + addItemQuantization(new EMItemQuantizationInfo(itemStack, skipNBT, em)); + compute(em).setItem(itemStack); + } + + public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT) { + addItem(em, GT_OreDictUnificator.get(prefix, material, amount), skipNBT); + } + + public void addOredict(IEMStack em, int id, int qty) { + getOredictQuantization().put(id, new EMOredictQuantizationInfo(id, qty, em)); + compute(em).setOre(new OreDictionaryStack(qty, id)); + } + + public void addOredict(IEMStack em, String name, int qty) { + addOredict(em, OreDictionary.getOreID(name), qty); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty) { + addOredict(em, prefix, material.mName, qty); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty) { + addOredict(em, OreDictionary.getOreID(prefix.name() + materialName), qty); + } + + public Map getFluidQuantization() { + return fluidQuantization; + } + + public Map getItemQuantization() { + return itemQuantization; + } + + public Map getOredictQuantization() { + return oredictQuantization; + } + + public Map getInfoMap() { + return infoMap; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java deleted file mode 100644 index e20b0af3b5..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -/** - * Created by Tec on 23.05.2017. - */ -public interface IEMExchangeInfo { - OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. - //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) - - IN input();//same as above but for input -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java new file mode 100644 index 0000000000..f5d8d42061 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +public class OreDictionaryStack { + private final int amount; + private final int id; + + public OreDictionaryStack(int amount, int id) { + this.amount = amount; + this.id = id; + } + + public int getAmount() { + return amount; + } + + public int getOreId() { + return id; + } +} 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 37ecb861f8..76f4457e94 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 @@ -1,69 +1,65 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; -import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; +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.XSTR; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Materials; -import net.minecraft.nbt.NBTTagCompound; import java.util.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; +import static gregtech.api.enums.Materials.*; import static gregtech.api.enums.OrePrefixes.dust; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 18.11.2016. */ -public final class EMAtomDefinition extends EMComplexTemplate { - public static final long ATOM_COMPLEXITY_LIMIT=65536L; - private static final byte BYTE_OFFSET=32; +public class EMAtomDefinition extends EMComplexTemplate { + public static final long ATOM_COMPLEXITY_LIMIT = 65536L; + private static final byte BYTE_OFFSET = 32; - private final int hash; + private final int hash; public static double refMass, refUnstableMass; - private static final byte nbtType = (byte) 'a'; + private static final String nbtType = "a"; private static final Random xstr = new XSTR();//NEEDS SEPARATE! private static Map> stableIsotopes = new HashMap<>(); private static final Map stableAtoms = new HashMap<>(); private static Map> mostStableUnstableIsotopes = new HashMap<>(); private static final Map unstableAtoms = new HashMap<>(); - private static EMDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; - private static final HashMap lifetimeOverrides = new HashMap<>(); + private static EMDefinitionStack alpha, deuterium, tritium, helium_3, beryllium_8, carbon_14, neon_24, silicon_34, uranium_238, uranium_235, plutonium_239, plutonium_241; + private static final HashMap lifetimeOverrides = new HashMap<>(); private final EMNuclideIAEA iaea; private static EMAtomDefinition somethingHeavy; + public static EMAtomDefinition getSomethingHeavy() { return somethingHeavy; } private static final ArrayList overrides = new ArrayList<>(); - public static void addOverride(EMAtomDefinition atom, double rawLifeTime){ - lifetimeOverrides.put(atom,rawLifeTime); + + public static void addOverride(EMAtomDefinition atom, double rawLifeTime) { + lifetimeOverrides.put(atom, rawLifeTime); } //float-mass in eV/c^2 @@ -106,23 +102,23 @@ public final class EMAtomDefinition extends EMComplexTemplate { } elementalStacks = things; - double mass = 0; - int cLeptons = 0; - int cNucleus = 0; - int neutralCount = 0, element = 0; - int type = 0; + double mass = 0; + int cLeptons = 0; + int cNucleus = 0; + int neutralCount = 0, element = 0; + int type = 0; boolean containsAnti = false; for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { IEMDefinition def = stack.getDefinition(); int amount = (int) stack.getAmount(); - if((int) stack.getAmount() != stack.getAmount()){ + if ((int) stack.getAmount() != stack.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } mass += stack.getMass(); - if (def.getMatterType() < 0) { + if (def.getGeneration() < 0) { containsAnti = true; } - type = Math.max(type, Math.abs(def.getMatterType())); + type = Math.max(type, Math.abs(def.getGeneration())); if (def instanceof EMLeptonDefinition) { cLeptons += stack.getCharge(); @@ -148,57 +144,57 @@ public final class EMAtomDefinition extends EMComplexTemplate { //stability curve int StableIsotope = stableIzoCurve(element); - int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiff = neutralCount - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); xstr.setSeed((element + 1L) * (neutralCount + 100L)); - iaea = EMNuclideIAEA.get(element,neutralCount); - if(getIaea() !=null){ - if(Double.isNaN(getIaea().getMass())) { + iaea = EMNuclideIAEA.get(element, neutralCount); + if (getIaea() != null) { + if (Double.isNaN(getIaea().getMass())) { this.mass = mass; } else { this.mass = getIaea().getMass(); } - if(Double.isNaN(getIaea().getHalfTime())) { - Double overriddenLifeTime= lifetimeOverrides.get(this); + if (Double.isNaN(getIaea().getHalfTime())) { + Double overriddenLifeTime = lifetimeOverrides.get(this); double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { + if (overriddenLifeTime != null) { rawLifeTimeTemp = overriddenLifeTime; } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - }else { + } else { rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : getIaea().getHalfTime(); } - iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length>1; - }else{ - this.mass=mass; + iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length > 1; + } else { + this.mass = mass; - Double overriddenLifeTime= lifetimeOverrides.get(this); + Double overriddenLifeTime = lifetimeOverrides.get(this); double rawLifeTimeTemp; - if(overriddenLifeTime!=null) { + if (overriddenLifeTime != null) { rawLifeTimeTemp = overriddenLifeTime; } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); - iaeaDefinitionExistsAndHasEnergyLevels =false; + iaeaDefinitionExistsAndHasEnergyLevels = false; } - if(getIaea() ==null || getIaea().getEnergeticStatesArray()[0].energy!=0) { + if (getIaea() == null || getIaea().getEnergeticStatesArray()[0].energy != 0) { if (izoDiff == 0) { decayMode = 0; } else { decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); } - }else{ - decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); + } else { + decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); } //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - hash=super.hashCode(); + hash = super.hashCode(); } private static int stableIzoCurve(int element) { @@ -267,7 +263,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { private static boolean canTheyBeTogether(EMConstantStackMap stacks) { boolean nuclei = false; - long qty=0; + long qty = 0; for (EMDefinitionStack stack : stacks.valuesToArray()) { if (stack.getDefinition() instanceof EMHadronDefinition) { if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) { @@ -277,12 +273,12 @@ public final class EMAtomDefinition extends EMComplexTemplate { } else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) { return false; } - if((int) stack.getAmount() != stack.getAmount()){ + if ((int) stack.getAmount() != stack.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } - qty+= stack.getAmount(); + qty += stack.getAmount(); } - return nuclei && qty= getIaea().getEnergeticStatesArray().length){ - return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].Thalf/(currentEnergy- getIaea().getEnergeticStatesArray().length+1); + if (iaeaDefinitionExistsAndHasEnergyLevels) { + if (currentEnergy >= getIaea().getEnergeticStatesArray().length) { + return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].Thalf / (currentEnergy - getIaea().getEnergeticStatesArray().length + 1); } - return getIaea().getEnergeticStatesArray()[(int)currentEnergy].Thalf; + return getIaea().getEnergeticStatesArray()[(int) currentEnergy].Thalf; } - return rawLifeTime/(currentEnergy+1); + return rawLifeTime / (currentEnergy + 1); } @Override @@ -332,16 +328,16 @@ public final class EMAtomDefinition extends EMComplexTemplate { } @Override - public byte getColor() { + public int getMaxColors() { return -10; } @Override public String getLocalizedName() { - int element = Math.abs(this.getElement()); + int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { - if (Math.abs(getMatterType()) != 1) { + if (Math.abs(getGeneration()) != 1) { return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; } return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; @@ -349,35 +345,35 @@ public final class EMAtomDefinition extends EMComplexTemplate { if (DEBUG_MODE) { e.printStackTrace(); } - return translateToLocal("tt.keyword.Element")+(negative ? ": ~" : ": ") + element; + return translateToLocal("tt.keyword.Element") + (negative ? ": ~" : ": ") + element; } } @Override public String getSymbol() { - int element = Math.abs(this.getElement()); + int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } try { int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } catch (Exception E) { if (DEBUG_MODE) { e.printStackTrace(); } - return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge(); + return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } } } @Override public String getShortSymbol() { - int element = Math.abs(this.getElement()); + int element = Math.abs(this.getElement()); boolean negative = this.getElement() < 0; try { return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; @@ -404,69 +400,69 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public EMDecay[] getDecayArray() { - ArrayList decaysList =new ArrayList<>(4); - return getDecayArray(decaysList, getDecayMode(),true); + ArrayList decaysList = new ArrayList<>(4); + return getDecayArray(decaysList, getDecayMode(), true); } private EMDecay[] getDecayArray(ArrayList decaysList, int decayMode, boolean tryAnti) {//todo? - if (getMatterType() == 1) { + if (getGeneration() == 1) { switch (decayMode) { case -2: - if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { + if (TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); - } else if(PbetaDecay(decaysList)) { + } else if (PbetaDecay(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case -1: - if(Emmision(decaysList, EMHadronDefinition.hadron_p1)) { + if (Emmision(decaysList, EMHadronDefinition.hadron_p1)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case 0: - if(alphaDecay(decaysList)) { + if (alphaDecay(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case 1: - if(Emmision(decaysList, EMHadronDefinition.hadron_n1)) { + if (Emmision(decaysList, EMHadronDefinition.hadron_n1)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; case 2: - if(MbetaDecay(decaysList)) { + if (MbetaDecay(decaysList)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } break; default: - if(decayMode>8){ - if(iaeaDecay(decaysList,0)) { + if (decayMode > 8) { + if (iaeaDecay(decaysList, 0)) { return decaysList.toArray(EMDecay.NO_PRODUCT); } - return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); + return getDecayArray(decaysList, decayMode - BYTE_OFFSET, false); } } return EMDecay.NO_DECAY; - }else if(getMatterType() ==-1){ - EMAtomDefinition anti =getAnti(); - if(anti!=null) { + } else if (getGeneration() == -1) { + EMAtomDefinition anti = getAnti(); + if (anti != null) { return anti.getDecayArray(decaysList, decayMode, false); } } return getNaturalDecayInstant(); } - private boolean iaeaDecay(ArrayList decaysList, long energy){ + private boolean iaeaDecay(ArrayList decaysList, long energy) { EMNuclideIAEA.energeticState state; - if(energy> getIaea().getEnergeticStatesArray().length) { + if (energy > getIaea().getEnergeticStatesArray().length) { state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; - } else if(energy<=0) { + } else if (energy <= 0) { state = getIaea().getEnergeticStatesArray()[0]; } else { state = getIaea().getEnergeticStatesArray()[(int) energy]; } - for (int i=0;i decaysList, EMNuclideIAEA.iaeaDecay decay, long energy){ - EMDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new EMDefinitionStackMap(); - switch (decay.decayName){ + private boolean getDecayFromIaea(ArrayList decaysList, EMNuclideIAEA.iaeaDecay decay, long energy) { + EMDefinitionStackMap withThis = elementalStacks.toMutable(), newStuff = new EMDefinitionStackMap(); + switch (decay.decayName) { case "D": { - if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())) { withThis.putReplace(deuterium); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "3H": { - if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())) { withThis.putReplace(tritium); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "3HE": { - if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())) { withThis.putReplace(helium_3); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "8BE": { - if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())) { withThis.putReplace(beryllium_8); - decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } - } break; + } + break; case "14C": { - if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())) { newStuff.putReplace(carbon_14); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "24NE": { - if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())) { newStuff.putReplace(neon_24); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "34SI": { - if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())){ + if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())) { newStuff.putReplace(silicon_34); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "A": case "A?": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)){ + } + break; + case "A": + case "A?": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)) { newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_2); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2B-": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p2); newStuff.putReplace(EMLeptonDefinition.lepton_e2); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "EC": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2EC": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "B++EC": case "EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + } + break; + case "B++EC": + case "EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+A": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B+2P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-A": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(EMHadronDefinition.hadron_n1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-2N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(EMHadronDefinition.hadron_n2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "B-P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "ECA": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) { newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "ECP": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "EC2P": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMHadronDefinition.hadron_p2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "ECP+EC2P": {//todo look at branching ratios - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(EMHadronDefinition.hadron_p3); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { newStuff.putReplace(EMHadronDefinition.hadron_n1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2N": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { newStuff.putReplace(EMHadronDefinition.hadron_n2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { newStuff.putReplace(EMHadronDefinition.hadron_p1); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "2P": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { newStuff.putReplace(EMHadronDefinition.hadron_p2); - try{ + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "SF": { if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - } break; + } + break; case "B-F": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_p1); newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "ECF": case "ECSF": case "EC(+SF)": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){ + } + break; + case "ECF": + case "ECSF": + case "EC(+SF)": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "SF(+EC+B+)": case "SF+EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + } + break; + case "SF(+EC+B+)": + case "SF+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "SF+EC+B-": { - if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)){ + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)) { newStuff.putReplace(EMLeptonDefinition.lepton_e1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { return true; } - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; - case "IT": case "IT?": case "G": { - if(energy>0){ + } + break; + case "IT": + case "IT?": + case "G": { + if (energy > 0) { decaysList.add(new EMDecay(decay.chance, this, boson_Y__)); - }else{ - if(DEBUG_MODE) { + } else { + if (DEBUG_MODE) { TecTech.LOGGER.info("Tried to emit Gamma from ground state"); } decaysList.add(new EMDecay(decay.chance, this)); @@ -986,28 +1024,30 @@ public final class EMAtomDefinition extends EMComplexTemplate { return true; } //break; case "IT+EC+B+": { - if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){ + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { withThis.putUnifyExact(EMHadronDefinition.hadron_n2); newStuff.putReplace(EMLeptonDefinition.lepton_e_1); newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(EMBosonDefinition.boson_Y__1); - try{ + newStuff.putReplace(EMGaugeBosonDefinition.boson_Y__1); + try { newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; - }catch (Exception e){ - if(DEBUG_MODE) { + } catch (Exception e) { + if (DEBUG_MODE) { e.printStackTrace(); } } } - } break; + } + break; case "DEAD_END": decaysList.add(deadEnd); return true; - default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); + default: + throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); } - if(DEBUG_MODE) { + if (DEBUG_MODE) { TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName); } return false; @@ -1093,48 +1133,48 @@ public final class EMAtomDefinition extends EMComplexTemplate { private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { EMDefinitionStackMap heavy = new EMDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(Math.abs(getElement())<=97); + double[] liquidDrop = liquidDropFunction(Math.abs(getElement()) <= 97); - for(EMDefinitionStack stack: fissile.valuesToArray()){ - if(spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && - (stack.getAmount() <=80 || stack.getAmount() <90 && XSTR_INSTANCE.nextInt(10)< stack.getAmount() -80)) { + for (EMDefinitionStack stack : fissile.valuesToArray()) { + if (spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && + (stack.getAmount() <= 80 || stack.getAmount() < 90 && XSTR_INSTANCE.nextInt(10) < stack.getAmount() - 80)) { return false; } - if(stack.getDefinition().getCharge()==0){ + if (stack.getDefinition().getCharge() == 0) { //if(stack.definition instanceof dHadronDefinition){ - double neutrals= stack.getAmount() *liquidDrop[2]; - int neutrals_cnt=(int)Math.floor(neutrals); - neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0; - particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); - - int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[1]); - while(heavy_cnt+neutrals_cnt> stack.getAmount()) { - heavy_cnt--; - } - fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(),heavy_cnt+neutrals_cnt)); - heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); + double neutrals = stack.getAmount() * liquidDrop[2]; + int neutrals_cnt = (int) Math.floor(neutrals); + neutrals_cnt += neutrals - neutrals_cnt > XSTR_INSTANCE.nextDouble() ? 1 : 0; + particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); + + int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[1]); + while (heavy_cnt + neutrals_cnt > stack.getAmount()) { + heavy_cnt--; + } + fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(), heavy_cnt + neutrals_cnt)); + heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); //}else{ // particles.add(stack); // light.remove(stack.definition); //} - }else{ - int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[0]); - if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { + } else { + int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[0]); + if (heavy_cnt % 2 == 1 && XSTR_INSTANCE.nextDouble() > 0.05D) { heavy_cnt--; } - EMDefinitionStack new_stack =new EMDefinitionStack(stack.getDefinition(), heavy_cnt); + EMDefinitionStack new_stack = new EMDefinitionStack(stack.getDefinition(), heavy_cnt); fissile.removeAmountExact(new_stack); heavy.putReplace(new_stack); } } try { - particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); - particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1)); + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1)); + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1)); decaysList.add(new EMDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); return true; } catch (Exception e) { - if(DEBUG_MODE) { + if (DEBUG_MODE) { e.printStackTrace(); } } @@ -1181,51 +1221,51 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { if (iaeaDefinitionExistsAndHasEnergyLevels) { - ArrayList decays =new ArrayList<>(4); - if(iaeaDecay(decays,energyLevel)){ + ArrayList decays = new ArrayList<>(4); + if (iaeaDecay(decays, energyLevel)) { return decays.toArray(EMDecay.NO_PRODUCT); } } - if(energyLevel< Math.abs(getCharge())/3+ getNeutralCount()) { + if (energyLevel < Math.abs(getCharge()) / 3 + getNeutralCount()) { return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; } return getNaturalDecayInstant(); } @Override - public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { - if(iaeaDefinitionExistsAndHasEnergyLevels){ - double result=0; - boolean backwards=newEnergyLevel= getIaea().getEnergeticStatesArray().length){ - if(currentEnergyLevel>= getIaea().getEnergeticStatesArray().length) { + if (newEnergyLevel >= getIaea().getEnergeticStatesArray().length) { + if (currentEnergyLevel >= getIaea().getEnergeticStatesArray().length) { return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } else { result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - getIaea().getEnergeticStatesArray().length + 1); } - result+= getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].energy; - }else { + result += getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].energy; + } else { result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy; } - return backwards?-result:result; + return backwards ? -result : result; } - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } @Override @@ -1235,17 +1275,17 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public boolean usesMultipleDecayCalls(long energyLevel) { - if(!iaeaDefinitionExistsAndHasEnergyLevels) return false; + if (!iaeaDefinitionExistsAndHasEnergyLevels) return false; EMNuclideIAEA.energeticState state; - if(energyLevel> getIaea().getEnergeticStatesArray().length) { + if (energyLevel > getIaea().getEnergeticStatesArray().length) { state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; - } else if(energyLevel<=0) { + } else if (energyLevel <= 0) { state = getIaea().getEnergeticStatesArray()[0]; } else { state = getIaea().getEnergeticStatesArray()[(int) energyLevel]; } - for (EMNuclideIAEA.iaeaDecay decay:state.decaymodes){ - if(decay.decayName.contains("F")) return true;//if is fissile + for (EMNuclideIAEA.iaeaDecay decay : state.decaymodes) { + if (decay.decayName.contains("F")) return true;//if is fissile } return false; } @@ -1257,7 +1297,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { @Override public boolean fusionMakesEnergy(long energyLevel) { - return getIaea() !=null || iaeaDefinitionExistsAndHasEnergyLevels; + return getIaea() != null || iaeaDefinitionExistsAndHasEnergyLevels; } @Override @@ -1265,7 +1305,7 @@ public final class EMAtomDefinition extends EMComplexTemplate { //disembody ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { - if (elementalStack.getDefinition().getMatterType() == 1 || elementalStack.getDefinition().getMatterType() == -1) { + if (elementalStack.getDefinition().getGeneration() == 1 || elementalStack.getDefinition().getGeneration() == -1) { //covers both quarks and antiquarks decaysInto.add(elementalStack); } else { @@ -1278,10 +1318,10 @@ public final class EMAtomDefinition extends EMComplexTemplate { //@Override //public iElementalDefinition getAnti() { - // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); - // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // EMDefinitionStack[] stacks = this.elementalStacks.values(); + // EMDefinitionStack[] antiElements = new EMDefinitionStack[stacks.length]; // for (int i = 0; i < antiElements.length; i++) { - // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // antiElements[i] = new EMDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); // } // try { // return new dAtomDefinition(false, antiElements); @@ -1307,21 +1347,6 @@ public final class EMAtomDefinition extends EMComplexTemplate { } } - @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return EMTransformationInfo.TRANSFORMATION_INFO.getFluidDequantization().get(this); - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return EMTransformationInfo.TRANSFORMATION_INFO.getItemDequantization().get(this); - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return EMTransformationInfo.TRANSFORMATION_INFO.getOredictDequantization().get(this); - } - public EMNuclideIAEA getIaea() { return iaea; } @@ -1339,55 +1364,43 @@ public final class EMAtomDefinition extends EMComplexTemplate { } private static final class Nomenclature { - private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; } @Override - protected int getIndirectTagValue() { + protected String getIndirectTagValue() { return nbtType; } - public static EMAtomDefinition fromNBT(NBTTagCompound nbt) { - EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new EMAtomDefinition(stacks); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) -> + new EMAtomDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMAtomDefinition.class, "tt.keyword.Element")); + EMNuclideIAEA.run(); - public static void run() { for (Runnable r : overrides) { r.run(); } - for(Map.Entry entry:lifetimeOverrides.entrySet()){ + for (Map.Entry entry : lifetimeOverrides.entrySet()) { try { lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); - }catch (EMException e){ + } catch (EMException e) { e.printStackTrace(); //Impossible } } //populate stable isotopes - for (int element = 1; element < 83; element++)//Up to Bismuth exclusive - { + for (int element = 1; element < 83; element++) {//Up to Bismuth exclusive for (int isotope = 0; isotope < 130; isotope++) { xstr.setSeed((long) (element + 1) * (isotope + 100)); //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); + int StableIsotope = stableIzoCurve(element); + int izoDiff = isotope - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { TreeSet isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); isotopes.add(isotope); @@ -1396,16 +1409,16 @@ public final class EMAtomDefinition extends EMComplexTemplate { } //populate unstable isotopes - for (int element = 83; element < 150; element++) { + for (int element = 1; element < 150; element++) { for (int isotope = 100; isotope < 180; isotope++) { xstr.setSeed((long) (element + 1) * (isotope + 100)); //stability curve - int Isotope = stableIzoCurve(element); - int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); - double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); - isotopes.put(rawLifeTime, isotope); + int Isotope = stableIzoCurve(element); + int izoDiff = isotope - Isotope; + int izoDiffAbs = Math.abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); + isotopes.put(rawLifeTime, isotope);//todo dont add stable ones } } @@ -1428,213 +1441,221 @@ public final class EMAtomDefinition extends EMComplexTemplate { TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); } } - deuterium=new EMAtomDefinition( + + deuterium = new EMAtomDefinition( EMHadronDefinition.hadron_p1, EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1).getStackForm(1); - tritium=new EMAtomDefinition( + registry.registerForDisplay(deuterium.getDefinition()); + + tritium = new EMAtomDefinition( EMHadronDefinition.hadron_p1, EMHadronDefinition.hadron_n2, EMLeptonDefinition.lepton_e1).getStackForm(1); - helium_3=new EMAtomDefinition( + registry.registerForDisplay(tritium.getDefinition()); + + helium_3 = new EMAtomDefinition( EMHadronDefinition.hadron_p2, EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e2).getStackForm(1); + registry.registerForDisplay(helium_3.getDefinition()); + alpha = new EMAtomDefinition( EMHadronDefinition.hadron_p2, EMHadronDefinition.hadron_n2).getStackForm(1); - beryllium_8=new EMAtomDefinition( + registry.registerForDisplay(alpha.getDefinition()); + + beryllium_8 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 4), new EMDefinitionStack(EMHadronDefinition.hadron_n, 4), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 4)).getStackForm(1); - carbon_14=new EMAtomDefinition( + registry.registerForDisplay(beryllium_8.getDefinition()); + + carbon_14 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 6), new EMDefinitionStack(EMHadronDefinition.hadron_n, 8), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 6)).getStackForm(1); - neon_24=new EMAtomDefinition( + registry.registerForDisplay(carbon_14.getDefinition()); + + neon_24 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 10), new EMDefinitionStack(EMHadronDefinition.hadron_n, 14), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 10)).getStackForm(1); - silicon_34=new EMAtomDefinition( + registry.registerForDisplay(neon_24.getDefinition()); + + silicon_34 = new EMAtomDefinition( new EMDefinitionStack(EMHadronDefinition.hadron_p, 14), new EMDefinitionStack(EMHadronDefinition.hadron_n, 20), new EMDefinitionStack(EMLeptonDefinition.lepton_e, 14)).getStackForm(1); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - try { - EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMAtomDefinition::fromNBT,EMAtomDefinition.class,getClassTypeStatic()); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); - } - } - - public static void setTransformations(){ - /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; - - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1); - - /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; - - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); - //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); - - try { - EMAtomDefinition temp; - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(deuterium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(tritium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); + registry.registerForDisplay(silicon_34.getDefinition()); - EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(helium_3.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); - - temp=new EMAtomDefinition( + uranium_238 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 146) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); - - double tempMass=temp.getMass(); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 146)).getStackForm(1); + registry.registerForDisplay(uranium_238.getDefinition()); - temp=new EMAtomDefinition( + uranium_235 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 143) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 143)).getStackForm(1); + registry.registerForDisplay(uranium_235.getDefinition()); - TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); + TecTech.LOGGER.info("Diff Mass U : " + (uranium_238.getDefinition().getMass() - uranium_235.getDefinition().getMass())); - temp=new EMAtomDefinition( + plutonium_239 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 145) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 145)).getStackForm(1); + registry.registerForDisplay(plutonium_239.getDefinition()); - somethingHeavy=new EMAtomDefinition( + plutonium_241 = new EMAtomDefinition( new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), - new EMDefinitionStack(EMHadronDefinition.hadron_n, 147) - ); - EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); + new EMDefinitionStack(EMHadronDefinition.hadron_n, 147)).getStackForm(1); + registry.registerForDisplay(plutonium_241.getDefinition()); - TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); + TecTech.LOGGER.info("Diff Mass Pu: " + (plutonium_241.getDefinition().getMass() - plutonium_239.getDefinition().getMass())); - TecTech.LOGGER.info("Neutron Mass: "+ EMHadronDefinition.hadron_n.getMass()); + somethingHeavy=(EMAtomDefinition) plutonium_241.getDefinition(); - } catch (EMException e) { + } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); } } - if(Loader.isModLoaded(Reference.GTPLUSPLUS)) { - new GtppAtomLoader().run(); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); + } + + for (int i = 1; i <= 118; i++) { + EMAtomDefinition firstStableIsotope = getFirstStableIsotope(i); + if(firstStableIsotope==null){ + firstStableIsotope = getBestUnstableIsotope(i); + if(firstStableIsotope==null){ + continue; + } + } + registry.registerForDisplay(firstStableIsotope); } } + public static void setTransformations(EMTransformationRegistry transformationInfo) { + /*----STABLE ATOMS----**/ + refMass = getFirstStableIsotope(1).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; + + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Hydrogen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium.mGas, 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lithium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Beryllium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Boron, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Carbon, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Nitrogen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Oxygen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Fluorine.mGas, 144); + //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Neon.mGas.getID(), 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sodium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Magnesium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Aluminium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silicon, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Phosphorus, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sulfur, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Argon.mGas, 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Potassium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Calcium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Scandium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Titanium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Vanadium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Chrome, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Manganese, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iron, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cobalt, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Nickel, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Copper, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Zinc, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gallium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),dust, Germanium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Arsenic, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),dust, Selenium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),dust, Bromine,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),dust, Krypton,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Rubidium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Strontium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Yttrium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),dust, Zirconium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Niobium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Molybdenum, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),dust, Technetium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),dust, Ruthenium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),dust, Rhodium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Palladium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silver, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cadmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Indium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tin, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Antimony, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tellurium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),dust, Iodine,1); + //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Xenon.mGas.getID(), 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Caesium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Barium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lanthanum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cerium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Praseodymium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Neodymium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Samarium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Europium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gadolinium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Terbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Dysprosium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Holmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Erbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thulium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Ytterbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lutetium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),dust, Hafnum,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tantalum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tungsten, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),dust, Rhenium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Osmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iridium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Platinum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gold, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Mercury.mFluid, 144); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),dust, Thallium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lead, 1); + + /*----UNSTABLE ATOMS----**/ + refUnstableMass = getFirstStableIsotope(82).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; + + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(61), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Promethium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Bismuth, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),dust, Polonium,1); + //transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Astatine.mPlasma.getID(), 144); + transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Radon.mGas, 144); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),dust, Francium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),dust, Radium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),dust, Actinium,1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thorium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),dust, Protactinium,1); + ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Uranium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),dust, Neptunium,1); + ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Plutonium,1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Americium, 1); + + + transformationInfo.addFluid(new EMDefinitionStack(deuterium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Deuterium.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(tritium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Tritium.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(helium_3.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium_3.mGas, 144); + + transformationInfo.addOredict(new EMDefinitionStack(uranium_238.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium/*238*/, 1); + transformationInfo.addOredict(new EMDefinitionStack(uranium_235.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium235, 1); + + transformationInfo.addOredict(new EMDefinitionStack(plutonium_239.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium/*239*/, 1); + transformationInfo.addOredict(new EMDefinitionStack(plutonium_241.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium241, 1); + } + public static EMAtomDefinition getFirstStableIsotope(int element) { return stableAtoms.get(element); } @@ -1644,11 +1665,11 @@ public final class EMAtomDefinition extends EMComplexTemplate { } @Override - public byte getClassType() { + public int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic(){ + public static int getClassTypeStatic() { return 64; } @@ -1659,36 +1680,36 @@ public final 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 (Util.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)) { - lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); + if (Util.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)) { - lines.add("NAME = "+ getLocalizedName()); - lines.add("SYMBOL = "+getSymbol()); + if (Util.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 (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { lines.add("CHARGE = " + getCharge() / 3D + " e"); } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); } - if(iaeaDefinitionExistsAndHasEnergyLevels && Util.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 (iaeaDefinitionExistsAndHasEnergyLevels && Util.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)){ - lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); + if (Util.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 c1db8e4460..aedb11ac05 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 @@ -4,21 +4,20 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition; +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 gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; @@ -26,29 +25,28 @@ import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static gregtech.api.enums.OrePrefixes.dust; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.11.2016. */ -public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o +public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o private final int hash; - private static final byte nbtType = (byte) 'h'; + private static final String nbtType = "h"; //Helpers - public static final Map SYMBOL_MAP =new HashMap<>(); - public static final Map NAME_MAP =new HashMap<>(); - public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; + public static final Map SYMBOL_MAP = new HashMap<>(); + public static final Map UNLOCALIZED_NAME_MAP = new HashMap<>(); + public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; public static EMDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; - private static double protonMass = 0D; - private static double neutronMass = 0D; - private static final double actualProtonMass=938272081.3D; - private static final double actualNeutronMass=939565413.3D; + private static double protonMass = 0D; + private static double neutronMass = 0D; + private static final double actualProtonMass = 938272081.3D; + private static final double actualNeutronMass = 939565413.3D; //float-mass in eV/c^2 private final double mass; @@ -81,20 +79,20 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } quarkStacks = quarks; - int amount = 0; - int charge = 0; - int type = 0; + int amount = 0; + int charge = 0; + int type = 0; boolean containsAnti = false; - double mass = 0; + double mass = 0; for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) { amount += quarkStack.getAmount(); - if((int) quarkStack.getAmount() != quarkStack.getAmount()){ + if ((int) quarkStack.getAmount() != quarkStack.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } mass += quarkStack.getMass(); charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.getDefinition().getMatterType()), type); - if (quarkStack.getDefinition().getMatterType() < 0) { + type = Math.max(Math.abs(quarkStack.getDefinition().getGeneration()), type); + if (quarkStack.getDefinition().getGeneration() < 0) { containsAnti = true; } } @@ -106,10 +104,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize if (mass == protonMass && this.getAmount() == 3) { rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME; - mass=actualProtonMass; + mass = actualProtonMass; } else if (mass == neutronMass && this.getAmount() == 3) { rawLifeTime = 882D; - mass=actualNeutronMass; + mass = actualNeutronMass; } else { if (this.getAmount() == 3) { rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); @@ -119,8 +117,8 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); } } - this.mass=mass; - hash=super.hashCode(); + this.mass = mass; + hash = super.hashCode(); } //public but u can just try{}catch(){} the constructor it still calls this method @@ -130,7 +128,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) { return false; } - if((int) quarks.getAmount() != quarks.getAmount()){ + if ((int) quarks.getAmount() != quarks.getAmount()) { throw new ArithmeticException("Amount cannot be safely converted to int!"); } amount += quarks.getAmount(); @@ -140,12 +138,12 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public String getLocalizedName() { - StringBuilder name= new StringBuilder(getSimpleName()); + StringBuilder name = new StringBuilder(getSimpleName()); name.append(':'); - String sym= translateToLocal(NAME_MAP.get(this)); - if(sym!=null){ + String sym = translateToLocal(UNLOCALIZED_NAME_MAP.get(this)); + if (sym != null) { name.append(' ').append(sym); - }else { + } else { for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount()); } @@ -172,10 +170,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public String getSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ + String sym = SYMBOL_MAP.get(this); + if (sym != null) { return sym; - }else { + } else { StringBuilder symbol = new StringBuilder(8); for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.getAmount(); i++) { @@ -188,10 +186,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public String getShortSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ + String sym = SYMBOL_MAP.get(this); + if (sym != null) { return sym; - }else { + } else { StringBuilder symbol = new StringBuilder(8); for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { for (int i = 0; i < quark.getAmount(); i++) { @@ -203,7 +201,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } @Override - public byte getColor() { + public int getMaxColors() { return -7; } @@ -215,12 +213,12 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @Override public EMDecay[] getNaturalDecayInstant() { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { return EMDecay.NO_PRODUCT; } ArrayList decaysInto = new ArrayList<>(); for (EMDefinitionStack quarks : quarkStacks) { - if (quarks.getDefinition().getMatterType() == 1 || quarks.getDefinition().getMatterType() == -1) { + if (quarks.getDefinition().getGeneration() == 1 || quarks.getDefinition().getGeneration() == -1) { //covers both quarks and antiquarks decaysInto.add(quarks); } else { @@ -230,22 +228,22 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } return new EMDecay[]{ new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), - EMBosonDefinition.deadEnd + deadEnd }; } @Override public EMDecay[] getEnergyInducedDecay(long energyLevel) { EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); - if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { return EMDecay.NO_PRODUCT; } - return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + return new EMDecay[]{new EMDecay(0.75D, quarkStacks), deadEnd}; //decay into quarks } @Override public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } @Override @@ -273,10 +271,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && - quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) { + quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { return EMDecay.NO_PRODUCT; } else if (getAmount() != 3) { - return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks + return new EMDecay[]{new EMDecay(0.95D, quarkStacks), deadEnd}; //decay into quarks } else { ArrayList newBaryon = new ArrayList<>(); IEMDefinition[] Particles = new IEMDefinition[2]; @@ -289,7 +287,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize EMQuarkDefinition lastQuark = newBaryon.remove(2); EMDefinitionStack[] decay; - if (Math.abs(lastQuark.getMatterType()) > 1) { + if (Math.abs(lastQuark.getGeneration()) > 1) { decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); } else { decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); @@ -299,19 +297,19 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize Particles[1] = decay[2].getDefinition(); EMDefinitionStack[] contentOfBaryon = newBaryon.stream() - .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition,1)) + .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition, 1)) .toArray(EMDefinitionStack[]::new); try { return new EMDecay[]{ new EMDecay(0.001D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), new EMDecay(0.99D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), - EMBosonDefinition.deadEnd}; + deadEnd}; } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } - return new EMDecay[]{EMBosonDefinition.deadEnd}; + return new EMDecay[]{deadEnd}; } } } @@ -337,7 +335,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } @Override - public byte getMatterType() { + public int getGeneration() { return type; } @@ -373,64 +371,48 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize } @Override - public EMFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public EMItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public EMOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - protected int getIndirectTagValue() { + protected String getIndirectTagValue() { return nbtType; } - public static EMHadronDefinition fromNBT(NBTTagCompound nbt) { - EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new EMHadronDefinition(stacks); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) -> + new EMHadronDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMHadronDefinition.class, "tt.keyword.Hadron")); try { hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); protonMass = hadron_p.getMass(); //redefine the proton with proper lifetime (the lifetime is based on mass comparison) hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); - SYMBOL_MAP.put(hadron_p,"p"); - NAME_MAP.put(hadron_p,translateToLocal("tt.keyword.Proton")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p); + SYMBOL_MAP.put(hadron_p, "p"); + UNLOCALIZED_NAME_MAP.put(hadron_p, "tt.keyword.Proton"); + registry.registerForDisplay(hadron_p); + registry.registerDirectDefinition("p",hadron_p); + hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); - SYMBOL_MAP.put(hadron_p_,"~p"); - NAME_MAP.put(hadron_p_,translateToLocal("tt.keyword.AntiProton")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p_); + SYMBOL_MAP.put(hadron_p_, "~p"); + UNLOCALIZED_NAME_MAP.put(hadron_p_, "tt.keyword.AntiProton"); + registry.registerForDisplay(hadron_p_); + registry.registerDirectDefinition("~p",hadron_p_); + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.getMass(); //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); SYMBOL_MAP.put(hadron_n, "n"); - NAME_MAP.put(hadron_n,translateToLocal("tt.keyword.Neutron")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n); + UNLOCALIZED_NAME_MAP.put(hadron_n, "tt.keyword.Neutron"); + registry.registerForDisplay(hadron_n); + registry.registerDirectDefinition("n",hadron_n); + hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); - SYMBOL_MAP.put(hadron_n_,"~n"); - NAME_MAP.put(hadron_n_,translateToLocal("tt.keyword.AntiNeutron")); - EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n_); + SYMBOL_MAP.put(hadron_n_, "~n"); + UNLOCALIZED_NAME_MAP.put(hadron_n_, "tt.keyword.AntiNeutron"); + registry.registerForDisplay(hadron_n_); + registry.registerDirectDefinition("~n",hadron_n_); + + TecTech.LOGGER.info("Old Neutron Mass: " + neutronMass); + TecTech.LOGGER.info("Old Proton Mass: " + protonMass); + TecTech.LOGGER.info("New Neutron Mass: " + EMHadronDefinition.hadron_n.getMass()); + TecTech.LOGGER.info("New Proton Mass: " + EMHadronDefinition.hadron_p.getMass()); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -446,34 +428,29 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize hadron_n3 = new EMDefinitionStack(hadron_n, 3D); hadron_p5 = new EMDefinitionStack(hadron_p, 5D); - try { - EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMHadronDefinition::fromNBT,EMHadronDefinition.class,getClassTypeStatic()); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { + if (DEBUG_MODE) { TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + getClassTypeStatic()); } } - public static void setTransformations(){ + public static void setTransformations(EMTransformationRegistry transformationInfo) {//Todo use Neutronium atom? //Added to atom map, but should be in its own - EMDefinitionStack neutrons =new EMDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); - TRANSFORMATION_INFO.getOredictDequantization().put(neutrons.getDefinition(),new EMOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); - TRANSFORMATION_INFO.getOredictQuantization().put( - OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), - new EMOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) + EMDefinitionStack neutrons = new EMDefinitionStack(hadron_n, 1000 * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED); + EMDequantizationInfo emDequantizationInfo = new EMDequantizationInfo(neutrons); + emDequantizationInfo.setOre(new OreDictionaryStack(1,OreDictionary.getOreID(OrePrefixes.dust.name() + Materials.Neutronium.mName)));//todo shitty looking, but works... + transformationInfo.getInfoMap().put(neutrons.getDefinition(), emDequantizationInfo); + transformationInfo.getOredictQuantization().put( + OreDictionary.getOreID(OrePrefixes.ingotHot.name() + Materials.Neutronium.mName), + new EMOredictQuantizationInfo(OrePrefixes.ingotHot, Materials.Neutronium, 1, neutrons) ); } @Override - public byte getClassType() { + public int getMatterMassType() { return getClassTypeStatic(); } - public static byte getClassTypeStatic(){ + public static int getClassTypeStatic() { return -64; } @@ -484,32 +461,32 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize @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 (Util.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)) { - lines.add("CLASS = " + getIndirectTagValue() + ' ' + getClassType()); + if (Util.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)) { - lines.add("NAME = "+getSimpleName()); + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = " + getSimpleName()); //lines.add("SYMBOL = "+getSymbol()); } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { + if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { lines.add("CHARGE = " + getCharge() / 3D + " e"); } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); } - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" "+"At current energy level"); + if (Util.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/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index f20f872a6e..9b77a6cab8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -1,46 +1,16 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; import static net.minecraft.util.StatCollector.translateToLocal; -/** - * Created by danie_000 on 22.10.2016. - */ -public final class EMBosonDefinition extends EMPrimitiveTemplate { - public static final EMBosonDefinition - boson_Y__ = new EMBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), - boson_H__ = new EMBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); - //deadEnd - public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); - public static final EMDecay deadEndHalf = new EMDecay(boson_Y__); - public static final EMDefinitionStack boson_Y__1 =new EMDefinitionStack(boson_Y__,1); - - private EMBosonDefinition(String name, String symbol, double mass, int color, int ID) { - super(name, symbol, 0, mass, 0, color, ID); - } - - public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - boson_H__.init(null, 1.56e-22D, 2, 2, - new EMDecay(0.01D, quark_b, quark_b_), - new EMDecay(0.02D, lepton_t, lepton_t_), - new EMDecay(0.96D, new EMDefinitionStack(boson_Y__, 4)), - deadEnd); +public abstract class EMBosonDefinition extends EMPrimitiveTemplate { + protected EMBosonDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, generation, mass, charge, color, ID, bind); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Boson")+": " + getName(); - } - - @Override - public boolean isTimeSpanHalfLife() { - return this==boson_H__; + return translateToLocal("tt.keyword.Boson")+": " + translateToLocal(getUnlocalizedName()); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java new file mode 100644 index 0000000000..f8f05b80ee --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; + +import static net.minecraft.util.StatCollector.translateToLocal; + +public abstract class EMFermionDefinition extends EMPrimitiveTemplate { + protected EMFermionDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, generation, mass, charge, color, ID, bind); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.Fermion")+": " + translateToLocal(getUnlocalizedName()); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java new file mode 100644 index 0000000000..fb8128c3a5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java @@ -0,0 +1,83 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMGaugeBosonDefinition extends EMBosonDefinition { + public static final EMGaugeBosonDefinition + boson_g__ = new EMGaugeBosonDefinition("tt.keyword.Gluon", "g", 0, 0, 8, 27, "g"), + boson_Y__ = new EMGaugeBosonDefinition("tt.keyword.Photon", "\u03b3", 1e-18D, 0, -1, 28, "Y"), + boson_Z = new EMGaugeBosonDefinition("tt.keyword.Weak0", "Z0", 91.1876e9, 0, -1, 29, "Z0"), + boson_W_ = new EMGaugeBosonDefinition("tt.keyword.WeakPlus", "W+", 80.379e9, 3, -1, 30, "W+"), + boson_W = new EMGaugeBosonDefinition("tt.keyword.WeakMinus", "W-", 80.379e9, -3, -1, 31, "W-"); + //deadEnd + public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); + public static final EMDefinitionStack boson_Y__1 = new EMDefinitionStack(boson_Y__, 1); + public static final EMDecay deadEndHalf = new EMDecay(boson_Y__1); + + protected EMGaugeBosonDefinition(String name, String symbol, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, 0, mass, charge, color, ID, bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMGaugeBosonDefinition.class, "tt.keyword.GaugeBoson")); + boson_g__.init(registry, boson_g__, 3e-50, 0, 0, deadEndHalf); + boson_Y__.init(registry, boson_Y__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + boson_Z.init(registry, boson_Z, 3e-25, 11, 11, + new EMDecay(0.03363, lepton_e, lepton_e_), + new EMDecay(0.03366, lepton_m, lepton_m_), + new EMDecay(0.03367, lepton_t, lepton_t_), + new EMDecay(0.068333, lepton_Ve, lepton_Ve_), + new EMDecay(0.068333, lepton_Vm, lepton_Vm_), + new EMDecay(0.068333, lepton_Vt, lepton_Vt_), + new EMDecay(0.118, quark_u, quark_u_), + new EMDecay(0.118, quark_c, quark_c_), + new EMDecay(0.152, quark_d, quark_d_), + new EMDecay(0.152, quark_s, quark_s_), + new EMDecay(0.152, quark_b, quark_b_), + deadEnd); + boson_W.init(registry, boson_W_, 3e-25, 9, 9, + new EMDecay(0.108, lepton_e, lepton_Ve_), + new EMDecay(0.108, lepton_m, lepton_Vm_), + new EMDecay(0.108, lepton_t, lepton_Vt_), + new EMDecay(0.112666, quark_u_, quark_d), + new EMDecay(0.112666, quark_u_, quark_s), + new EMDecay(0.112666, quark_u_, quark_b), + new EMDecay(0.112666, quark_c_, quark_d), + new EMDecay(0.112666, quark_c_, quark_s), + new EMDecay(0.112666, quark_c_, quark_b), + deadEnd); + boson_W_.init(registry, boson_W, 3e-25, 9, 9, + new EMDecay(0.108, lepton_e_, lepton_Ve), + new EMDecay(0.108, lepton_m_, lepton_Vm), + new EMDecay(0.108, lepton_t_, lepton_Vt), + new EMDecay(0.112666, quark_u, quark_d_), + new EMDecay(0.112666, quark_u, quark_s_), + new EMDecay(0.112666, quark_u, quark_b_), + new EMDecay(0.112666, quark_c, quark_d_), + new EMDecay(0.112666, quark_c, quark_s_), + new EMDecay(0.112666, quark_c, quark_b_), + deadEnd); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.GaugeBoson") + ": " + translateToLocal(getUnlocalizedName()); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index 38e537ec59..c665bf23b4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -1,57 +1,60 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMScalarBosonDefinition.boson_H__; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMLeptonDefinition extends EMPrimitiveTemplate { +public class EMLeptonDefinition extends EMFermionDefinition { public static final EMLeptonDefinition - lepton_e = new EMLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), - lepton_m = new EMLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), - lepton_t = new EMLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), - lepton_e_ = new EMLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), - lepton_m_ = new EMLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), - lepton_t_ = new EMLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); + lepton_e = new EMLeptonDefinition("tt.keyword.Electron", "\u03b2-", 1, 0.511e6D, -3, 15,"e-"), + lepton_m = new EMLeptonDefinition("tt.keyword.Muon", "\u03bc-", 2, 105.658e6D, -3, 17,"m-"), + lepton_t = new EMLeptonDefinition("tt.keyword.Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19,"t-"), + lepton_e_ = new EMLeptonDefinition("tt.keyword.Positron", "\u03b2+", -1, 0.511e6D, 3, 16,"e+"), + lepton_m_ = new EMLeptonDefinition("tt.keyword.Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18,"m+"), + lepton_t_ = new EMLeptonDefinition("tt.keyword.Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20,"t+"); public static final EMDefinitionStack lepton_e1 = new EMDefinitionStack(lepton_e, 1); public static final EMDefinitionStack lepton_e2 = new EMDefinitionStack(lepton_e, 2); public static final EMDefinitionStack lepton_e_1 = new EMDefinitionStack(lepton_e_, 1); public static final EMDefinitionStack lepton_e_2 = new EMDefinitionStack(lepton_e_, 2); - private EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, -1, ID); + protected EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) { + super(name, symbol, type, mass, charge, -1, ID,bind); //this.itemThing=null; //this.fluidThing=null; } - public static void run() { - lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMLeptonDefinition.class,"tt.keyword.Lepton")); + lepton_e.init(registry,lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, deadEnd, new EMDecay(lepton_e,boson_Y__)); - lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, + lepton_m.init(registry,lepton_m_, 2.197019e-6D, 0, 1, new EMDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), deadEnd);//makes photons and don't care - lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, + lepton_t.init(registry,lepton_t_, 2.903e-13D, 1, 3, new EMDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), new EMDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), new EMDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), deadEnd);//makes photons and don't care - lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, + lepton_e_.init(registry,lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, deadEnd, new EMDecay(lepton_e,boson_Y__)); - lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, + lepton_m_.init(registry,lepton_m, 2.197019e-6F, 0, 1, new EMDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), deadEnd);//makes photons and don't care - lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, + lepton_t_.init(registry,lepton_t, 2.903e-13F, 1, 3, new EMDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), new EMDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), new EMDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), @@ -60,7 +63,7 @@ public final class EMLeptonDefinition extends EMPrimitiveTemplate { @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Lepton")+": " + getName(); + return translateToLocal("tt.keyword.Lepton")+": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index 9af7b97cb4..9ef04e8c7e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -1,56 +1,59 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEndHalf; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMNeutrinoDefinition extends EMPrimitiveTemplate { +public class EMNeutrinoDefinition extends EMLeptonDefinition { public static final EMNeutrinoDefinition - lepton_Ve = new EMNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), - lepton_Vm = new EMNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), - lepton_Vt = new EMNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), - lepton_Ve_ = new EMNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), - lepton_Vm_ = new EMNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), - lepton_Vt_ = new EMNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); + lepton_Ve = new EMNeutrinoDefinition("tt.keyword.ElectronNeutrino", "\u03bd\u03b2", 1, 2e0D, 21,"Ve-"), + lepton_Vm = new EMNeutrinoDefinition("tt.keyword.MuonNeutrino", "\u03bd\u03bc", 2, 0.15e6D, 23,"Vm-"), + lepton_Vt = new EMNeutrinoDefinition("tt.keyword.TauonNeutrino", "\u03bd\u03c4", 3, 15e6D, 25,"Vt-"), + lepton_Ve_ = new EMNeutrinoDefinition("tt.keyword.PositronNeutrino", "~\u03bd\u03b2", -1, 2e0D, 22,"Ve+"), + lepton_Vm_ = new EMNeutrinoDefinition("tt.keyword.AntimuonNeutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24,"Vm+"), + lepton_Vt_ = new EMNeutrinoDefinition("tt.keyword.AntitauonNeutrino", "~\u03bd\u03c4", -3, 15e6D, 26,"Vt+"); public static final EMDefinitionStack lepton_Ve1 = new EMDefinitionStack(lepton_Ve, 1); public static final EMDefinitionStack lepton_Ve2 = new EMDefinitionStack(lepton_Ve, 2); public static final EMDefinitionStack lepton_Ve_1 = new EMDefinitionStack(lepton_Ve_, 1); public static final EMDefinitionStack lepton_Ve_2 = new EMDefinitionStack(lepton_Ve_, 2); - private EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { - super(name, symbol, type, mass, 0, -1, ID); + protected EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID,String bind) { + super(name, symbol, type, mass, 0, ID,bind); } - public static void run() { - lepton_Ve.init(lepton_Ve_, 1D, -1, -1, + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMNeutrinoDefinition.class,"tt.keyword.Neutrino")); + lepton_Ve.init(registry,lepton_Ve_, 1D, -1, -1, EMDecay.NO_PRODUCT); - lepton_Vm.init(lepton_Vm_, 1D, 1, 0, + lepton_Vm.init(registry,lepton_Vm_, 1D, 1, 0, new EMDecay(0.825D, nothing), deadEndHalf); - lepton_Vt.init(lepton_Vt_, 1, 1, 0, + lepton_Vt.init(registry,lepton_Vt_, 1, 1, 0, new EMDecay(0.75F, nothing), deadEnd); - lepton_Ve_.init(lepton_Ve, 1, -1, -1, + lepton_Ve_.init(registry,lepton_Ve, 1, -1, -1, EMDecay.NO_PRODUCT); - lepton_Vm_.init(lepton_Vm, 1, 1, 0, + lepton_Vm_.init(registry,lepton_Vm, 1, 1, 0, new EMDecay(0.825F, nothing), deadEndHalf); - lepton_Vt_.init(lepton_Vt, 1, 1, 0, + lepton_Vt_.init(registry,lepton_Vt, 1, 1, 0, new EMDecay(0.75F, nothing), deadEnd); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Neutrino")+": " + getName(); + return translateToLocal("tt.keyword.Neutrino")+": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index 41da06567d..60f87ac83b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -1,6 +1,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; import static net.minecraft.util.StatCollector.translateToLocal; @@ -8,29 +10,45 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMPrimitiveDefinition extends EMPrimitiveTemplate { +public class EMPrimitiveDefinition extends EMPrimitiveTemplate { public static final EMPrimitiveDefinition - nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, 0), - null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MIN_VALUE), - space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, Integer.MIN_VALUE+1), - magic = new EMPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), - magic_ = new EMPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); - - private EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { - super(name, symbol, type, mass, 0, color, ID); + nbtE__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNBTERROR" , "!" , 0 , 0D , -1 , Integer.MIN_VALUE , "!" ), + null__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNULLPOINTER" , "." , 0 , 0D , -3 , Integer.MIN_VALUE+1 , "." ), + space = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveSpace" , "_" , 0 , 0D , -4 , Integer.MIN_VALUE + 2 , "_" ), + space_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitivePresence" , "~_" , 0 , 0D , -4 , Integer.MIN_VALUE + 3 , "~_" ), + mass = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMass" , "#" , 0 , 1 , -4 , Integer.MIN_VALUE + 4 , "#" ), + mass_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkMass" , "~#" , 0 , 1 , -4 , Integer.MIN_VALUE + 5 , "~#" ), + energy = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveEnergy" , "E" , 4 , 0D , -4 , Integer.MIN_VALUE + 6 , "E" ), + energy_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkEnergy" , "~E" , -4 , 0 , -4 , Integer.MIN_VALUE + 7 , "~E" ), + magic = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMagic" , "Ma" , 5 , 1e5D , 0 , Integer.MIN_VALUE + 8 , "Ma" ), + magic_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveAntimagic" , "~Ma" , -5 , 1e5D , 0 , Integer.MIN_VALUE + 9 , "~Ma" ); + + + protected EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID, String bind) { + super(name, symbol, type, mass, 0, color, ID, bind); } - public static void run() { - nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); - magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMPrimitiveDefinition.class, "tt.keyword.Primitive")); + nbtE__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + null__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + space.init(registry, space_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + space_.init(registry, space, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + mass.init(registry, mass_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + mass_.init(registry, mass, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + energy.init(registry, energy_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + energy_.init(registry, energy, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + magic.init(registry, magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + magic_.init(registry, magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Primitive")+": " + getName(); + return translateToLocal("tt.keyword.Primitive") + ": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index 3f19205aeb..19162bf90d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -1,8 +1,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; import static net.minecraft.util.StatCollector.translateToLocal; @@ -10,94 +12,95 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. */ -public final class EMQuarkDefinition extends EMPrimitiveTemplate { +public class EMQuarkDefinition extends EMFermionDefinition { public static final EMQuarkDefinition - quark_u = new EMQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), - quark_c = new EMQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), - quark_t = new EMQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), - quark_d = new EMQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), - quark_s = new EMQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), - quark_b = new EMQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), - quark_u_ = new EMQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), - quark_c_ = new EMQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), - quark_t_ = new EMQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), - quark_d_ = new EMQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), - quark_s_ = new EMQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), - quark_b_ = new EMQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); + quark_u = new EMQuarkDefinition("tt.keyword.QuarkUp", "u", 1, 2.3e6D, 2, 3,"u"), + quark_c = new EMQuarkDefinition("tt.keyword.QuarkCharm", "c", 2, 1.29e9D, 2, 9,"c"), + quark_t = new EMQuarkDefinition("tt.keyword.QuarkTop", "t", 3, 172.44e9D, 2, 13,"t"), + quark_d = new EMQuarkDefinition("tt.keyword.QuarkDown", "d", 1, 4.8e6D, -1, 5,"d"), + quark_s = new EMQuarkDefinition("tt.keyword.QuarkStrange", "s", 2, 95e6D, -1, 7,"s"), + quark_b = new EMQuarkDefinition("tt.keyword.QuarkBottom", "b", 3, 4.65e9D, -1, 11,"b"), + quark_u_ = new EMQuarkDefinition("tt.keyword.QuarkAntiUp", "~u", -1, 2.3e6D, -2, 4,"~u"), + quark_c_ = new EMQuarkDefinition("tt.keyword.QuarkAntiCharm", "~c", -2, 1.29e9D, -2, 10,"~c"), + quark_t_ = new EMQuarkDefinition("tt.keyword.QuarkAntiTop", "~t", -3, 172.44e9D, -2, 14,"~t"), + quark_d_ = new EMQuarkDefinition("tt.keyword.QuarkAntiDown", "~d", -1, 4.8e6D, 1, 6,"~d"), + quark_s_ = new EMQuarkDefinition("tt.keyword.QuarkAntiStrange", "~s", -2, 95e6D, 1, 8,"~s"), + quark_b_ = new EMQuarkDefinition("tt.keyword.QuarkAntiBottom", "~b", -3, 4.65e9D, 1, 12,"~b"); - private EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { - super(name, symbol, type, mass, charge, 0, ID); + protected EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) { + super(name, symbol, type, mass, charge, 0, ID,bind); } - public static void run() { - quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMQuarkDefinition.class,"tt.keyword.Quark")); + quark_u.init(registry,quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), new EMDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), new EMDecay(0.9D, quark_d, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_c.init(quark_c_, 0.5e-13D, 1, -1, + deadEnd);//makes photons and don't care + quark_c.init(registry,quark_c_, 0.5e-13D, 1, -1, new EMDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), new EMDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), new EMDecay(0.9D, quark_s, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26D, 0, -1, + deadEnd);//makes photons and don't care + quark_t.init(registry,quark_t_, 2.5e-26D, 0, -1, new EMDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), new EMDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), new EMDecay(0.9D, quark_b, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care - quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, + quark_d.init(registry,quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), new EMDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), new EMDecay(0.9D, quark_u, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_s.init(quark_s_, 0.6e-9D, 1, -1, + deadEnd);//makes photons and don't care + quark_s.init(registry,quark_s_, 0.6e-9D, 1, -1, new EMDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), new EMDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), new EMDecay(0.9D, quark_c, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13D, 0, -1, + deadEnd);//makes photons and don't care + quark_b.init(registry,quark_b_, 0.7e-13D, 0, -1, new EMDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), new EMDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), new EMDecay(0.9D, quark_t, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care - quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, + quark_u_.init(registry,quark_u, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), new EMDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), new EMDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_c_.init(quark_c, 0.5e-13D, 1, -1, + deadEnd);//makes photons and don't care + quark_c_.init(registry,quark_c, 0.5e-13D, 1, -1, new EMDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), new EMDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), new EMDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 0, -1, + deadEnd);//makes photons and don't care + quark_t_.init(registry,quark_t, 2.5e-26F, 0, -1, new EMDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), new EMDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), new EMDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care - quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, + quark_d_.init(registry,quark_d, STABLE_RAW_LIFE_TIME, 3, -1, new EMDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), new EMDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), new EMDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_s_.init(quark_s, 0.6e-9F, 1, -1, + deadEnd);//makes photons and don't care + quark_s_.init(registry,quark_s, 0.6e-9F, 1, -1, new EMDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), new EMDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), new EMDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 0, -1, + deadEnd);//makes photons and don't care + quark_b_.init(registry,quark_b, 0.7e-13F, 0, -1, new EMDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), new EMDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), new EMDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), - EMBosonDefinition.deadEnd);//makes photons and don't care + deadEnd);//makes photons and don't care } @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Quark")+": " + getName(); + return translateToLocal("tt.keyword.Quark")+": " + translateToLocal(getUnlocalizedName()); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java new file mode 100644 index 0000000000..5070954847 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java @@ -0,0 +1,46 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMScalarBosonDefinition extends EMBosonDefinition { + public static final EMScalarBosonDefinition + boson_H__ = new EMScalarBosonDefinition("tt.keyword.Higgs", "H0", 125.09e9D, -2, 32,"H0"); + + private EMScalarBosonDefinition(String name, String symbol, double mass, int color, int ID,String bind) { + super(name, symbol, 0, mass, 0, color, ID,bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMScalarBosonDefinition.class,"tt.keyword.ScalarBoson")); + boson_H__.init(registry,boson_H__, 1.56e-22D, 8, 8, + new EMDecay ( 0.0002171 , lepton_m , lepton_m_ ), + new EMDecay ( 0.001541 , boson_Z, boson_Y__ ), + new EMDecay ( 0.02641 , boson_Z, boson_Z), + new EMDecay ( 0.02884 , quark_c , quark_c_ ), + new EMDecay ( 0.06256 , lepton_t , lepton_t_ ), + new EMDecay ( 0.0818 , boson_g__ , boson_g__ ), + new EMDecay ( 0.2152 , boson_W_, boson_W), + new EMDecay ( 0.5809 , quark_b , quark_b_ ), + deadEnd); + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.ScalarBoson")+": " + translateToLocal(getUnlocalizedName()); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index b7310485a2..68607ae737 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,11 +1,10 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; 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.mechanics.elementalMatter.core.maps.IEMMapRead; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; @@ -16,8 +15,6 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; - public class TT_recipe extends GT_Recipe { public static final String E_RECIPE_ID = "eRecipeID"; public final EMConstantStackMap[] input; @@ -257,20 +254,6 @@ public class TT_recipe extends GT_Recipe { return mRecipeMap.get(stack); } - public T findRecipe(ItemStack dataHandler){ - if(dataHandler==null || dataHandler.stackTagCompound==null) { - return null; - } - try { - return mRecipeMap.get(EMDefinitionsRegistry.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); - }catch (Exception e){ - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - public void add(T recipe){ mRecipeMap.put(recipe.mResearchEM,recipe); } diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java index d34d12c754..42fb14f55d 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java @@ -13,7 +13,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 17.12.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java index bac2dfb9ac..2a8bb37a0b 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java @@ -10,7 +10,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; /** diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java index eb590ab2e2..f3574007f2 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java @@ -18,7 +18,7 @@ import net.minecraft.world.IBlockAccess; import java.util.List; import static com.github.technus.tectech.TecTech.tectechTexturePage1; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 03.10.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java index c65870eeb7..9648e41d8d 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java @@ -16,7 +16,7 @@ import net.minecraft.world.IBlockAccess; import java.util.List; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 03.10.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java index 90f3312342..cc071d2326 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java +++ b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java @@ -28,7 +28,7 @@ import java.io.OutputStream; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; @Optional.InterfaceList( diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 81fec52ebd..082c0458c0 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 2062173cfd..d909054196 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 @@ -1,15 +1,15 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +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 cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -30,8 +30,8 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -61,7 +61,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { - content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -75,7 +75,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } else if (content.hasStacks()) { ((IEMContainer) metaTE).purgeOverflow(); tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); + tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols", content.getShortSymbolsNBT()); content.clear(); } @@ -94,7 +94,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } if (tNBT.hasKey("content")) { try { - content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -106,7 +106,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE tNBT.removeTag("symbols"); } else if (content.hasStacks()) { tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); + tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols", content.getShortSymbolsNBT()); content.clear(); } @@ -140,10 +140,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(IEMDefinition definition: EMDefinitionsRegistry.getStacksRegisteredForDisplay()){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 144 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1000 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_1000)))); + for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){ + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); } } 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 2cca6474f4..f0f59e0e86 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.item; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; @@ -20,7 +21,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -48,7 +49,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -56,7 +57,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem } } tNBT.setTag("info", definitions.getInfoNBT()); - tNBT.setTag("content", definitions.toNBT()); + tNBT.setTag("content", definitions.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols",definitions.getShortSymbolsNBT()); return oldMap; } @@ -71,7 +72,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } try { - return EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + return EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -91,7 +92,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content")); + oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); 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 e517fe5f2a..8b8133a1e2 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 @@ -25,7 +25,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java index f4531a248b..4fca682268 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java +++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index 39193fd598..749249d768 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 1d1da74a7a..7f9e0f0a4a 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 @@ -25,7 +25,7 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.thing.CustomItemList.parametrizerMemory; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java index 69ff06e9e7..bc853334d2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java @@ -193,7 +193,7 @@ public class Textures { public static ITexture TESLA_TRANSCEIVER_TOP_BA = new GT_RenderedTexture(TESLA_TRANSCEIVER_TOP); - public Textures(){ + public static void run(){ for (byte i = 0; i < MACHINE_CASINGS_TT.length; i++) { for (byte j = 0; j < MACHINE_CASINGS_TT[i].length; j++) { MACHINE_CASINGS_TT[i][j] = new GT_SidedTexture(MACHINECASINGS_BOTTOM_TT[i], MACHINECASINGS_TOP_TT[i], MACHINECASINGS_SIDE_TT[i], Dyes.getModulation(j - 1, MACHINE_METAL.mRGBa)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 0950a173ab..84f18ad2bf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -24,7 +24,7 @@ import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; @@ -83,7 +83,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta //aNBT.setFloat("lifeTimeMult",lifeTimeMult); aNBT.setDouble("OverflowMatter", overflowMatter); content.cleanUp(); - aNBT.setTag("eM_Stacks", content.toNBT()); + aNBT.setTag("eM_Stacks", content.toNBT(TecTech.definitionsRegistry)); aNBT.setShort("eID", id); } @@ -95,7 +95,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); id = aNBT.getShort("eID"); try { - content = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); + content = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eM_Stacks")); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -210,7 +210,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public double getMaxStackSize() { - return mTier * (mTier - 7) * 64D * AVOGADRO_CONSTANT_144; + return mTier * (mTier - 7) * 64D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java deleted file mode 100644 index 3015d024c7..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ /dev/null @@ -1,717 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.HashMap; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; -import static com.github.technus.tectech.util.DoubleCount.add; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - private static Textures.BlockIcons.CustomIcon ScreenON_Slave; - private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; - - protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; - private static double MASS_TO_EU_INSTANT; - private static int STARTUP_COST, KEEPUP_COST; - - protected byte eTier = 0; - protected EMInstanceStack stack; - private long plasmaEnergy; - - protected boolean started = false; - //endregion - - //region collision handlers - public static final HashMap FUSE_HANDLERS = new HashMap<>(); - public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); - - public interface IPrimitiveColliderHandler { - void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); - } - - public interface IColliderHandler extends IPrimitiveColliderHandler { - byte getRequiredTier(); - } - - static { - FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); - EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); - - FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); - EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); - - FUSE_HANDLERS.put((EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); - if (collisionHandler != null) { - collisionHandler.collide(in2, in1, out); - } else { - out.putUnifyAll(in1, in2); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyExact(in1.getDefinition().getStackForm(1)); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - }); - PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> { - if (fuseAspects(in1, in2, out)) return; - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - }); - } - - private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyExact(in1.getDefinition().getStackForm(1)); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return true; - } - return false; - } - - private static void registerSimpleAspectFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - if (fuseAspects(in1, in2, out)) return; - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - - private static void registerSimpleAtomFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { - @Override - public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { - try { - EMDefinitionStackMap defs = new EMDefinitionStackMap(); - defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); - defs.putUnifyExact(in2.getDefinition().getStackForm(1)); - EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); - out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.getAmount() > in2.getAmount()) { - out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); - } else if (in2.getAmount() > in1.getAmount()) { - out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - //endregion - - //region parameters - protected Parameters.Group.ParameterIn mode; - private static final IStatusFunction MODE_STATUS = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE || mode == COLLIDE_MODE) { - return STATUS_OK; - } else if (mode > 1) { - return STATUS_TOO_HIGH; - } else if (mode < 0) { - return STATUS_TOO_LOW; - } - return STATUS_WRONG; - } - return STATUS_OK; - }; - private static final INameFunction MODE_NAME = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.0");//Mode: Fuse - } else if (mode == COLLIDE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.1");//Mode: Collide - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.2");//Mode: Undefined - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.3");//Currently Slaves... - }; - //endregion - - //region structure - //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition - .builder() - .addShapeOldApi("main", new String[][]{ - {"I0A0A0", "I00000", "I0A0A0",}, - {"H0000000", "G001111100", "H0000000",}, - {"F22223332222", "F41155555114", "F22223332222",}, - {"E2000000000002", "E4155111115514", "E2000000000002",}, - {"D20000E00002", "D41511E11514", "D20000E00002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0030O0300", "0151O1510", "0030O0300",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, - {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, - {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, - }) - .addElement('0', ofBlock(sBlockCasingsTT, 4)) - .addElement('1', ofBlock(sBlockCasingsTT, 7)) - .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) - .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) - .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), - error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) - .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, - textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, - textureOffset + 4, 2, sBlockCasingsTT, 4)) - .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, - textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, - textureOffset + 4, 4, sBlockCasingsTT, 4)) - .build(); - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"),//2 - Elemental Input Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.2"),//3 - Elemental Output Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction - }; - - @Override - public IStructureDefinition getStructure_EM() { - return STRUCTURE_DEFINITION; - } - - //endregion - - public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_collider(String aName) { - super(aName); - } - - public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* AVOGADRO_CONSTANT);//mass diff - MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; - STARTUP_COST = -heliumPlasmaValue * 10000; - KEEPUP_COST = -heliumPlasmaValue; - } - - protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU - if (partner.stack != null && stack != null) {//todo add single event mode as an option - boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) && - partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); - - EMInstanceStack stack2 = partner.stack; - double preMass = add(stack2.getMass(),stack.getMass()); - //System.out.println("preMass = " + preMass); - - EMInstanceStackMap map = new EMInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - for (EMInstanceStack newStack : map.valuesToArray()) { - check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); - } - //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new EMInstanceStackMap[]{map}; - - partner.stack = stack = null; - //System.out.println("check = " + check); - //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return check ? preMass - map.getMass() : Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! - if (partner.stack != null && stack != null) {//todo add single event mode as an option - EMInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); - //System.out.println("preMass = " + preMass); - - EMInstanceStackMap map = new EMInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new EMInstanceStackMap[]{map}; - - partner.stack = stack = null; - //System.out.println("check = " + check); - //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { - if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { - colliderHandler.collide(stack2, stack, map); - } else { - map.putUnifyAll(stack, stack2); - outputEM = new EMInstanceStackMap[]{map}; - return true; - } - return false; - } - - protected GT_MetaTileEntity_EM_collider getPartner() { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); - if (gregTechBaseTileEntity != null) { - IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); - return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && - ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && - gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? - (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; - } - return null; - } - - protected final boolean isMaster() { - return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; - } - - private void makeEU(double massDiff) { - plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; - if (DEBUG_MODE) { - System.out.println("plasmaEnergy = " + plasmaEnergy); - } - } - - private EMInstanceStackMap tickStack() { - if (stack == null) { - return null; - } - stack.setAge(stack.getAge() + 1); - EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); - if (newInstances == null) { - stack.nextColor(); - return null; - } else { - stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); - return newInstances.getOutput(); - } - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_collider(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 2; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 2; - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { - eTier = 0; - return false; - } - - if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 8) { - eTier = 1; - } else if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 9) { - eTier = 2; - } else { - eTier = 0; - return false; - } - if (structureCheck_EM("main", 11, 1, 18)) { - return true; - } - eTier = 0; - return false; - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - return false; - } - mEfficiencyIncrease = 10000; - if (started) { - if (stack == null) { - for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - EMInstanceStackMap container = inputElemental.getContentHandler(); - if (container.isEmpty()) { - continue; - } - stack = container.removeKey(container.getFirst().getDefinition()); - long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; - if (eut < Integer.MIN_VALUE + 7) { - return false; - } - mMaxProgresstime = 20; - mEUt = (int) eut; - eAmpereFlow = 5; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 1; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 2; - } else { - started = true; - mMaxProgresstime = 20; - mEUt = STARTUP_COST; - eAmpereFlow = 10; - } - return true; - } - - @Override - public void outputAfterRecipe_EM() { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - return; - } - if (isMaster()) { - switch ((int) mode.get()) { - case FUSE_MODE: - makeEU(fuse(partner)); - break; - case COLLIDE_MODE: - collide(partner);//todo - break; - default: { - outputEM = new EMInstanceStackMap[2]; - outputEM[1] = tickStack(); - if (outputEM[1] == null) { - outputEM[1] = partner.tickStack(); - } else { - EMInstanceStackMap map = partner.tickStack(); - if (map != null) { - outputEM[1].putUnifyAll(map); - } - } - } - } - if (outputEM != null) { - for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { - if (outputEM[i] != null) { - eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); - outputEM[i] = null; - } - } - } - } - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - translateToLocal("gt.blockmachines.multimachine.em.collider.desc.0"),//Collide matter at extreme velocities. - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.1")//Faster than light*!!! - }; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); - ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); - ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aFacing % 2 == 0) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; - } else { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; - } - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; - } - - @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0); - mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); - } - - @Override - public void parametersStatusesWrite_EM(boolean machineBusy) { - if (isMaster()) { - super.parametersStatusesWrite_EM(machineBusy); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("eTier", eTier);//collider tier - aNBT.setBoolean("eStarted", started); - if (stack != null) { - aNBT.setTag("eStack", stack.toNBT()); - } - aNBT.setLong("ePlasmaEnergy", plasmaEnergy); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - eTier = aNBT.getByte("eTier");//collider tier - started = aNBT.getBoolean("eStarted"); - if (aNBT.hasKey("eStack")) { - stack = EMInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); - } - plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); - } - - @Override - public void stopMachine() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - super.stopMachine(); - } - - @Override - protected void afterRecipeCheckFailed() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - getBaseMetaTileEntity().disableWorking(); - super.afterRecipeCheckFailed(); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (!aBaseMetaTileEntity.isAllowedToWork()) { - started = false; - } - super.onPreTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } - structureBuild_EM("main", 11, 1, 18, hintsOnly, stackSize); - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return description; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 84dafb8db2..1978d2acfc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -50,7 +50,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT; + public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* EM_COUNT_PER_MATERIAL_AMOUNT; private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index e769d3e480..7d5961f219 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -100,38 +100,21 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { EMInstanceStackMap map = in.getContentHandler(); for (EMInstanceStack stack : map.valuesToArray()) { - { - EMFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); - if (info != null) { - if (map.removeAllAmounts(info.input())) { - mOutputFluids = new FluidStack[]{info.output()}; - startRecipe(info.input(), stack.getEnergy()); - return true; - } - } - } - { - EMItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); - if (info != null) { - if (map.removeAllAmounts(info.input())) { - mOutputItems = new ItemStack[]{info.output()}; - startRecipe(info.input(), stack.getEnergy()); - return true; - } - } - } - { - EMOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); - if (info != null) { - if (map.removeAllAmounts(info.input())) { - ArrayList items = OreDictionary.getOres(info.getOut()); - if (items != null && !items.isEmpty()) { - mOutputItems = new ItemStack[]{items.get(0)}; - startRecipe(info.input(), stack.getEnergy()); - return true; - } + EMDequantizationInfo emDequantizationInfo = TecTech.transformationInfo.getInfoMap().get(stack.getDefinition()); + if(emDequantizationInfo!=null && emDequantizationInfo.getStack()!=null && map.removeAllAmounts(emDequantizationInfo.getInput())){ + Object out=emDequantizationInfo.getStack(); + if(out instanceof ItemStack){ + mOutputItems=new ItemStack[]{emDequantizationInfo.getItem()}; + }else if(out instanceof FluidStack){ + mOutputFluids=new FluidStack[]{emDequantizationInfo.getFluid()}; + }else if(out instanceof OreDictionaryStack){ + ArrayList items = OreDictionary.getOres(OreDictionary.getOreName(emDequantizationInfo.getOre().getOreId())); + if (items != null && !items.isEmpty()) { + mOutputItems = new ItemStack[]{items.get(0)}; } } + startRecipe(emDequantizationInfo.getInput(), stack.getEnergy()); + return true; } } } 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 64949fe402..be036050be 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 @@ -31,7 +31,6 @@ import java.util.ArrayList; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.DEFAULT_ENERGY_LEVEL; import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.mechanics.structure.Structure.adders; @@ -98,9 +97,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - EMItemQuantizationInfo aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null)); + EMItemQuantizationInfo aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -109,11 +108,11 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - EMOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.getOredictQuantization().get(ID); + EMOredictQuantizationInfo aOQI = TecTech.transformationInfo.getOredictQuantization().get(ID); if (aOQI == null) { continue; } - IEMStack into = aOQI.output(); + IEMStack into = aOQI.getOut(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -136,7 +135,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - EMFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.getFluidQuantization().get(fs.getFluid().getID()); + EMFluidQuantizationInfo aFQI = TecTech.transformationInfo.getFluidQuantization().get(fs.getFluid().getID()); if (aFQI == null) { continue; } 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 74bb817142..89255b331a 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 @@ -309,7 +309,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa NBTTagCompound tNBT = mInventory[1].getTagCompound();//code above makes it not null tNBT.setString("eMachineType", machineType); - tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT()); + tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT(TecTech.definitionsRegistry)); tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator"); } else if (objectsScanned != null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)) { ElementalDefinitionScanStorage_EM.setContent(mInventory[1], objectsScanned, scanComplexity); @@ -387,7 +387,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa aNBT.setLong("eComputationRemaining", computationRemaining); aNBT.setLong("eComputationRequired", computationRequired); if (objectResearched != null) { - aNBT.setTag("eObject", objectResearched.toNBT()); + aNBT.setTag("eObject", objectResearched.toNBT(TecTech.definitionsRegistry)); } else { aNBT.removeTag("eObject"); } @@ -397,7 +397,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa aNBT.removeTag("eScanComplexity"); } if (objectsScanned != null) { - aNBT.setTag("eScanObjects", objectsScanned.toNBT()); + aNBT.setTag("eScanObjects", objectsScanned.toNBT(TecTech.definitionsRegistry)); } else { aNBT.removeTag("eScanObjects"); } @@ -409,7 +409,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa computationRemaining = aNBT.getLong("eComputationRemaining"); computationRequired = aNBT.getLong("eComputationRequired"); if (aNBT.hasKey("eObject")) { - objectResearched = EMDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); + objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eObject")); if (objectResearched.getDefinition() == nbtE__) { objectResearched = null; } @@ -423,7 +423,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } try { if (aNBT.hasKey("eScanObjects")) { - objectsScanned = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); + objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eScanObjects")); } } catch (EMException e) { objectsScanned = new EMInstanceStackMap(); 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 9a6f99bed8..2fe43cb8e1 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 @@ -757,7 +757,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt NBTTagCompound output = new NBTTagCompound(); for (int i = 0; i < outputEM.length; i++) { if (outputEM[i] != null) { - output.setTag(Integer.toString(i), outputEM[i].toNBT()); + output.setTag(Integer.toString(i), outputEM[i].toNBT(TecTech.definitionsRegistry)); } } aNBT.setTag("outputEM", output); @@ -847,7 +847,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (int i = 0; i < outputEM.length; i++) { if (compound.hasKey(Integer.toString(i))) { try { - outputEM[i] = EMInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i))); + outputEM[i] = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,compound.getCompoundTag(Integer.toString(i))); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java new file mode 100644 index 0000000000..cf8f26ff02 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java @@ -0,0 +1,709 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.HashMap; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.DoubleCount.add; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private static Textures.BlockIcons.CustomIcon ScreenON_Slave; + private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; + + protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; + private static double MASS_TO_EU_INSTANT; + private static int STARTUP_COST, KEEPUP_COST; + + protected byte eTier = 0; + protected EMInstanceStack stack; + private long plasmaEnergy; + + protected boolean started = false; + //endregion + + //region collision handlers + public static final HashMap FUSE_HANDLERS = new HashMap<>(); + public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); + + static { + FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); + + FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + + registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); + + FUSE_HANDLERS.put(((long) EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); + if (collisionHandler != null) { + collisionHandler.collide(in2, in1, out); + } else { + out.putUnifyAll(in1, in2); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + + PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + }); + PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> { + if (fuseAspects(in1, in2, out)) return; + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + }); + } + + private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return true; + } + return false; + } + + private static void registerSimpleAspectFuse(int classTypeStatic) { + FUSE_HANDLERS.put(((long) EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + if (fuseAspects(in1, in2, out)) return; + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + } + + private static void registerSimpleAtomFuse(int classTypeStatic) { + FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + } + //endregion + + //region parameters + protected Parameters.Group.ParameterIn mode; + private static final IStatusFunction MODE_STATUS = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); + if (mode == FUSE_MODE || mode == COLLIDE_MODE) { + return STATUS_OK; + } else if (mode > 1) { + return STATUS_TOO_HIGH; + } else if (mode < 0) { + return STATUS_TOO_LOW; + } + return STATUS_WRONG; + } + return STATUS_OK; + }; + private static final INameFunction MODE_NAME = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); + if (mode == FUSE_MODE) { + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.0");//Mode: Fuse + } else if (mode == COLLIDE_MODE) { + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.1");//Mode: Collide + } + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.2");//Mode: Undefined + } + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.3");//Currently Slaves... + }; + //endregion + + //region structure + //use multi A energy inputs, use less power the longer it runs + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + .builder() + .addShapeOldApi("main", new String[][]{ + {"I0A0A0", "I00000", "I0A0A0",}, + {"H0000000", "G001111100", "H0000000",}, + {"F22223332222", "F41155555114", "F22223332222",}, + {"E2000000000002", "E4155111115514", "E2000000000002",}, + {"D20000E00002", "D41511E11514", "D20000E00002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0030O0300", "0151O1510", "0030O0300",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, + {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, + {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT, 4)) + .addElement('1', ofBlock(sBlockCasingsTT, 7)) + .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) + .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) + .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, + textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, + textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, + textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, + textureOffset + 4, 4, sBlockCasingsTT, 4)) + .build(); + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"),//2 - Elemental Input Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.2"),//3 - Elemental Output Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction + }; + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + + //endregion + + public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_collider(String aName) { + super(aName); + } + + public static void setValues(int heliumPlasmaValue) { + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff + MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; + STARTUP_COST = -heliumPlasmaValue * 10000; + KEEPUP_COST = -heliumPlasmaValue; + } + + protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU + if (partner.stack != null && stack != null) {//todo add single event mode as an option + boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) && + partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); + + EMInstanceStack stack2 = partner.stack; + double preMass = add(stack2.getMass(),stack.getMass()); + //System.out.println("preMass = " + preMass); + + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } else { + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + for (EMInstanceStack newStack : map.valuesToArray()) { + check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); + } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new EMInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return check ? preMass - map.getMass() : Math.min(preMass - map.getMass(), 0); + } + return 0; + } + + protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! + if (partner.stack != null && stack != null) {//todo add single event mode as an option + EMInstanceStack stack2 = partner.stack; + double preMass = stack2.getMass() + stack.getMass(); + //System.out.println("preMass = " + preMass); + + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } else { + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new EMInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return Math.min(preMass - map.getMass(), 0); + } + return 0; + } + + private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { + if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { + colliderHandler.collide(stack2, stack, map); + } else { + map.putUnifyAll(stack, stack2); + outputEM = new EMInstanceStackMap[]{map}; + return true; + } + return false; + } + + protected GT_MetaTileEntity_EM_collider getPartner() { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); + if (gregTechBaseTileEntity != null) { + IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); + return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && + ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && + gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? + (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; + } + return null; + } + + protected final boolean isMaster() { + return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; + } + + private void makeEU(double massDiff) { + plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; + if (DEBUG_MODE) { + System.out.println("plasmaEnergy = " + plasmaEnergy); + } + } + + private EMInstanceStackMap tickStack() { + if (stack == null) { + return null; + } + stack.setAge(stack.getAge() + 1); + EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); + if (newInstances == null) { + stack.nextColor(); + return null; + } else { + stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); + return newInstances.getOutput(); + } + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_collider(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 2; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 2; + if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { + eTier = 0; + return false; + } + + if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 8) { + eTier = 1; + } else if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 9) { + eTier = 2; + } else { + eTier = 0; + return false; + } + if (structureCheck_EM("main", 11, 1, 18)) { + return true; + } + eTier = 0; + return false; + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { + return false; + } + mEfficiencyIncrease = 10000; + if (started) { + if (stack == null) { + for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { + EMInstanceStackMap container = inputElemental.getContentHandler(); + if (container.isEmpty()) { + continue; + } + stack = container.removeKey(container.getFirst().getDefinition()); + long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; + if (eut < Integer.MIN_VALUE + 7) { + return false; + } + mMaxProgresstime = 20; + mEUt = (int) eut; + eAmpereFlow = 5; + return true; + } + mMaxProgresstime = 20; + mEUt = KEEPUP_COST; + eAmpereFlow = 1; + return true; + } + mMaxProgresstime = 20; + mEUt = KEEPUP_COST; + eAmpereFlow = 2; + } else { + started = true; + mMaxProgresstime = 20; + mEUt = STARTUP_COST; + eAmpereFlow = 10; + } + return true; + } + + @Override + public void outputAfterRecipe_EM() { + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + return; + } + if (isMaster()) { + switch ((int) mode.get()) { + case FUSE_MODE: + makeEU(fuse(partner)); + break; + case COLLIDE_MODE: + collide(partner);//todo + break; + default: { + outputEM = new EMInstanceStackMap[2]; + outputEM[1] = tickStack(); + if (outputEM[1] == null) { + outputEM[1] = partner.tickStack(); + } else { + EMInstanceStackMap map = partner.tickStack(); + if (map != null) { + outputEM[1].putUnifyAll(map); + } + } + } + } + if (outputEM != null) { + for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { + if (outputEM[i] != null) { + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); + outputEM[i] = null; + } + } + } + } + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.0"),//Collide matter at extreme velocities. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.1")//Faster than light*!!! + }; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); + ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); + ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + if (aFacing % 2 == 0) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; + } else { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; + } + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; + } + + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0 = parametrization.getGroup(0); + mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); + } + + @Override + public void parametersStatusesWrite_EM(boolean machineBusy) { + if (isMaster()) { + super.parametersStatusesWrite_EM(machineBusy); + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setByte("eTier", eTier);//collider tier + aNBT.setBoolean("eStarted", started); + if (stack != null) { + aNBT.setTag("eStack", stack.toNBT(TecTech.definitionsRegistry)); + } + aNBT.setLong("ePlasmaEnergy", plasmaEnergy); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + eTier = aNBT.getByte("eTier");//collider tier + started = aNBT.getBoolean("eStarted"); + if (aNBT.hasKey("eStack")) { + stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eStack")); + } + plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); + } + + @Override + public void stopMachine() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + super.stopMachine(); + } + + @Override + protected void afterRecipeCheckFailed() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + getBaseMetaTileEntity().disableWorking(); + super.afterRecipeCheckFailed(); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (!aBaseMetaTileEntity.isAllowedToWork()) { + started = false; + } + super.onPreTick(aBaseMetaTileEntity, aTick); + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + if (hintsOnly) { + TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + TT_Container_Casings.sHintCasingsTT, 12); + } + structureBuild_EM("main", 11, 1, 18, hintsOnly, stackSize); + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return description; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java new file mode 100644 index 0000000000..0114ac847b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java @@ -0,0 +1,5 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +public interface IColliderHandler extends IPrimitiveColliderHandler { + byte getRequiredTier(); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java new file mode 100644 index 0000000000..3c4438b5e1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; + +public interface IPrimitiveColliderHandler { + void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index d1eafa22fc..e6e618a31c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -12,8 +12,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.DoubleCount.*; @@ -77,7 +76,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); double maxSafeMass = EMAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g - maxCapacity = maxSafeMass * AVOGADRO_CONSTANT_144 * radius;// eV/c^2 + maxCapacity = maxSafeMass * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * radius;// eV/c^2 } private double getRCF(double RPM) { @@ -128,7 +127,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap - if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) { + if (randomStack.isInvalidAmount()) { input.removeKey(randomStack.getDefinition()); stacks = input.valuesToArray(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 70d93b36ed..3d1259f808 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -9,10 +9,9 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; -import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.DoubleCount.mul; import static com.github.technus.tectech.util.DoubleCount.sub; @@ -89,7 +88,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; ticks =Math.max(20,(1<<(12-desiredTier))*20); - maxCapacity= EMAtomDefinition.getSomethingHeavy().getMass()*(2<=separator.length()){ + stringBuilder.setLength(length -separator.length()); + } + return stringBuilder.toString(); + } } diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index adec911faa..07c06fd323 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -798,20 +798,17 @@ gt.blockmachines.debug.tt.writer.desc.2=ABC axises aligned to machine front tt.keyword.ID=ID #Example: 32EU at 1A tt.keyword.at=at -#These are Thaumcraft aspects -tt.keyword.Air=Air -tt.keyword.Earth=Earth -tt.keyword.Fire=Fire -tt.keyword.Water=Water -tt.keyword.Order=Order -tt.keyword.Entropy=Entropy -tt.keyword.Primal=Primal -tt.keyword.Aspect=Aspect +#EM scan result tt.keyword.CLASS=CLASS tt.keyword.NAME=NAME tt.keyword.CHARGE=CHARGE tt.keyword.COLORLESS=COLORLESS tt.keyword.MASS=MASS +tt.keyphrase.LIFE_TIME=LIFE TIME +tt.keyphrase.CARRIES_COLOR=CARRIES COLOR +tt.keyphrase.Hint_Details=Hint Details +tt.keyphrase.At_current_energy_level=At current energy level +#debug boom tt.keyword.BOOM=BOOM! tt.keyword.Destination=Destination tt.keyword.Weight=Weight @@ -834,10 +831,6 @@ tt.keyword.Status=Status tt.keyword.Content=Content tt.keyword.PacketHistory=PacketHistory -tt.keyphrase.LIFE_TIME=LIFE TIME -tt.keyphrase.CARRIES_COLOR=CARRIES COLOR -tt.keyphrase.Hint_Details=Hint Details -tt.keyphrase.At_current_energy_level=At current energy level #Used when 0 Elemental Matter Stacks tt.keyphrase.No_Stacks=No Stacks tt.keyphrase.Contains_EM=Contains EM @@ -875,3 +868,87 @@ tt.keyphrase.Side_capabilities=Side capabilities #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret tile.turretBaseEM.name=Elemental Turret Base + +tt.keyword.mol=mol +tt.keyword.itemMols=items +tt.keyword.mbMols=mb +#EM types +tt.keyword.Primitive=Primitive +tt.keyword.Element=Element +tt.keyword.Atom=Atom +tt.keyword.Isotope=Isotope +tt.keyword.Boson=Boson +tt.keyword.Fermion=Fermion +tt.keyword.GaugeBoson=Gauge boson +tt.keyword.Meson=Meson +tt.keyword.Baryon=Baryon +tt.keyword.Tetraquark=Tetraquark +tt.keyword.Pentaquark=Pentaquark +tt.keyword.Hexaquark=Hexaquark +tt.keyword.Hadron=Hadron +tt.keyword.Neutrino=Neutrino +tt.keyword.Quark=Quark +tt.keyword.ScalarBoson=Scalar boson +#em definitions +tt.keyword.PrimitiveNBTERROR=NBT ERROR +tt.keyword.PrimitiveNULLPOINTER=NULL POINTER +tt.keyword.PrimitiveSpace=Space +tt.keyword.PrimitivePresence=Presence +tt.keyword.PrimitiveMass=Mass +tt.keyword.PrimitiveDarkMass=DarkMass +tt.keyword.PrimitiveEnergy=Energy +tt.keyword.PrimitiveDarkEnergy=DarkEnergy +tt.keyword.PrimitiveMagic=Magic +tt.keyword.PrimitiveAntimagic=Antimagic +tt.keyword.Gluon=Gluon +tt.keyword.Photon=Photon +tt.keyword.Weak0=Weak +tt.keyword.WeakPlus=Weak+ +tt.keyword.WeakMinus=Weak- +tt.keyword.Proton=Proton +tt.keyword.AntiProton=Antiproton +tt.keyword.Neutron=Neutron +tt.keyword.AntiNeutron=Antineutron +tt.keyword.Lepton=Lepton +tt.keyword.Electron=Electron +tt.keyword.Muon=Muon +tt.keyword.Tauon=Tauon +tt.keyword.Positron=Positron +tt.keyword.Antimuon=Antimuon +tt.keyword.Antitauon=Antitauon +tt.keyword.ElectronNeutrino=Electron neutrino +tt.keyword.MuonNeutrino=Muon neutrino +tt.keyword.TauonNeutrino=Tauon neutrino +tt.keyword.PositronNeutrino=Positron neutrino +tt.keyword.AntimuonNeutrino=Antimuon neutrino +tt.keyword.AntitauonNeutrino=Antitauon neutrino +tt.keyword.QuarkUp=Up +tt.keyword.QuarkCharm=Charm +tt.keyword.QuarkTop=Top +tt.keyword.QuarkDown=Down +tt.keyword.QuarkStrange=Strange +tt.keyword.QuarkBottom=Bottom +tt.keyword.QuarkAntiUp=Antiup +tt.keyword.QuarkAntiCharm=Anticharm +tt.keyword.QuarkAntiTop=Antitop +tt.keyword.QuarkAntiDown=Antidown +tt.keyword.QuarkAntiStrange=Antistrange +tt.keyword.QuarkAntiBottom=Antibottom +tt.keyword.Higgs=Higgs +#These are Thaumcraft aspects +tt.keyword.Air=Air +tt.keyword.Earth=Earth +tt.keyword.Fire=Fire +tt.keyword.Water=Water +tt.keyword.Order=Order +tt.keyword.Entropy=Entropy +tt.keyword.Chaos=Chaos + +tt.keyword.Primal=Primal +tt.keyword.Aspect=Aspect + + + + + + -- cgit From ab9e1f082243953f982e07e8e95b97b2aa4fabb8 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 23 Jan 2022 13:44:18 +0100 Subject: Fix autocompletion for EM commands (cherry picked from commit e37d21d8141e82eee9d87d4bb137c44977db8625) --- .../mechanics/elementalMatter/core/commands/EMGive.java | 2 +- .../mechanics/elementalMatter/core/commands/EMList.java | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java index 18f2f76498..4824053668 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -117,7 +117,7 @@ public class EMGive implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if (args.length > 1 && args.length % 2 == 0) { + if (args.length > 2 && args.length % 2 == 1) { return new ArrayList<>(TecTech.definitionsRegistry.getBinds().keySet()); } return null; 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 90eddf1e23..fe542abbde 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 @@ -28,15 +28,16 @@ public class EMList implements ICommand { if(args.length == 0) { listClasses(sender); }else { - listDefinitions(sender, Util.getConcated(args," ")); + String concated = Util.getConcated(args, " "); + listDefinitions(sender,concated, concated.replaceAll(" ","_"),concated.replaceAll("_"," ")); } } } - private void listDefinitions(ICommandSender sender, String arg) { + private void listDefinitions(ICommandSender sender,String raw, String unlocalized,String localized) { sender.addChatMessage(new ChatComponentText(" Available Direct: tag - name symbol")); for (EMType directType : TecTech.definitionsRegistry.getDirectTypes().values()) { - if ("*".equals(arg) || arg.equalsIgnoreCase(directType.getLocalizedName())) { + if ("*".equals(raw) || localized.equalsIgnoreCase(directType.getLocalizedName()) || unlocalized.equalsIgnoreCase(directType.getUnlocalizedName())) { directType.getDefinitions().forEach((bind, definition) -> sender.addChatMessage(new ChatComponentText(bind + " - " + definition.getLocalizedName() + " " + definition.getSymbol()))); } @@ -44,7 +45,7 @@ public class EMList implements ICommand { } private void listClasses(ICommandSender sender) { - sender.addChatMessage(new ChatComponentText(" Available Direct: name (use name as parameter to learn more")); + sender.addChatMessage(new ChatComponentText(" Available Direct: name (use as parameter to learn more")); TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) -> sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName()))); sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name")); @@ -69,8 +70,8 @@ public class EMList implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==0){ - return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).collect(Collectors.toList()); + if(args.length==1){ + return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).map(s->s.replaceAll(" ","_")).collect(Collectors.toList()); } return null; } -- cgit From ad188c2a0680d0af56076bd2097e9aa95ecfe900 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 23 Jan 2022 14:47:42 +0100 Subject: Separate EM to new tab (cherry picked from commit caff4351909ce59637348c6be94271cf1d1c0a9c) --- src/main/java/com/github/technus/tectech/TecTech.java | 4 +++- .../com/github/technus/tectech/loader/MainLoader.java | 2 ++ .../technus/tectech/loader/gui/CreativeTabEM.java | 19 +++++++++++++++++++ .../technus/tectech/mechanics/elementalMatter/README | 5 ++++- .../elementalMatter/core/maps/EMInstanceStackMap.java | 5 ----- .../item/DebugElementalInstanceContainer_EM.java | 4 ++-- .../thing/item/ElementalDefinitionContainer_EM.java | 10 +++++----- .../thing/item/ElementalDefinitionScanStorage_EM.java | 4 ++-- .../GT_MetaTileEntity_Hatch_ElementalContainer.java | 4 ++-- src/main/resources/assets/tectech/lang/en_US.lang | 1 + 10 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index d730d64a65..10b8f69b1a 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -3,6 +3,7 @@ package com.github.technus.tectech; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler; import com.github.technus.tectech.mechanics.anomaly.CancerCommand; import com.github.technus.tectech.mechanics.anomaly.ChargeCommand; @@ -45,7 +46,8 @@ public class TecTech { public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; public static final LogHelper LOGGER = new LogHelper(Reference.MODID); - public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabEM creativeTabEM; private static IngameErrorLog moduleAdminErrorLogs; public static TecTechConfig configTecTech; diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index e2f1e2882f..b9d737f98a 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.trans import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; import com.github.technus.tectech.loader.thing.ComponentLoader; @@ -64,6 +65,7 @@ public final class MainLoader { public static void preLoad(){ creativeTabTecTech =new CreativeTabTecTech("TecTech"); + creativeTabEM =new CreativeTabEM("EM"); //set expanded texture arrays for tiers try { diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java new file mode 100644 index 0000000000..cd73d1e420 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.loader.gui; + +import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class CreativeTabEM extends CreativeTabs { + public CreativeTabEM(String name) { + super(name); + } + + @SideOnly(Side.CLIENT) + @Override + public Item getTabIconItem() { + return ElementalDefinitionContainer_EM.INSTANCE; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README index f6c0b35e5f..c774b126c8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README @@ -41,4 +41,7 @@ Trees: InstanceStack - inst stack |||||multiple to 1 - InstanceStackTree - inst container - real things go here \ No newline at end of file + InstanceStackTree - inst container - real things go here + + Preset for world: + 2;7,16x22,16x35:11,16x35:3,16x35;0; \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java index 64ff7063e8..265d219168 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java @@ -117,11 +117,6 @@ public final class EMInstanceStackMap extends EMStackMap implem return list; } - //Tick Content - public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { - return tickContent(lifeTimeMult,postEnergize,1D); - } - public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ //cleanUp(); double diff=0; diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index d909054196..ecebc6afcd 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -29,8 +29,8 @@ import java.util.Collections; import java.util.List; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,7 +46,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE setMaxStackSize(1); setUnlocalizedName("em.debugContainer"); setTextureName(MODID + ":itemDebugContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index f0f59e0e86..0de8bb007a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.FontRenderer; @@ -20,8 +20,8 @@ import java.util.Collections; import java.util.List; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -35,7 +35,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem setMaxStackSize(1); setUnlocalizedName("em.definitionContainer"); setTextureName(MODID + ":itemDefinitionContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } //return previous thing diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java index 8b8133a1e2..1cb6de1df6 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 84f18ad2bf..6cb83f5d46 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -112,7 +112,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { purgeOverflow(); - content.tickContentByOneSecond(1, postEnergize);//Hatches don't life time mult things + content.tickContent(1, postEnergize,1);//Hatches don't life time mult things purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { @@ -206,7 +206,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public int getMaxStacksCount() { - return mTier * 128; + return mTier * mTier >> 4; } public double getMaxStackSize() { diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 07c06fd323..3142d87d16 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -1,5 +1,6 @@ #Creative Tab Name itemGroup.TecTech=TecTech Interdimensional +itemGroup.EM=TecTech Elemental Matter #Blocks tile.quantumStuff.name=Quantum Stuff -- cgit From a3286688012b742015e97b78420e9768e24a8299 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 27 Jan 2022 22:09:30 +0100 Subject: Cleanup Atoms Localization, and FontRenderer (cherry picked from commit 7adcaf6d9b4a8628711a01ce2467f13582cea7d5) --- .../technus/tectech/font/TecTechFontRender.java | 240 ++++++++++++------ .../definitions/complex/EMAtomDefinition.java | 113 ++++----- .../item/DebugElementalInstanceContainer_EM.java | 9 +- src/main/resources/META-INF/tectech_at.cfg | 17 +- src/main/resources/assets/tectech/lang/en_US.lang | 268 ++++++++++++++++++++- 5 files changed, 498 insertions(+), 149 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java index 4aea8bce92..fbbc12fe36 100644 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java @@ -1,85 +1,182 @@ package com.github.technus.tectech.font; +import com.ibm.icu.text.ArabicShaping; +import com.ibm.icu.text.ArabicShapingException; +import com.ibm.icu.text.Bidi; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.settings.GameSettings; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - @SideOnly(Side.CLIENT) public class TecTechFontRender extends FontRenderer { public static final TecTechFontRender INSTANCE = new TecTechFontRender(); - private static float DISTANCE_L = .125F; - private static float DISTANCE_L2 = DISTANCE_L *2F; + private static float DISTANCE_L = .125F; + private static float DISTANCE_L2 = DISTANCE_L * 2F; - private static float DISTANCE_M = 0.06F; - private static float DISTANCE_M2 = DISTANCE_M *2F; + private static float DISTANCE_M = 0.06F; + private static float DISTANCE_M2 = DISTANCE_M * 2F; - private static float DISTANCE_A = 0.06F; - private static float DISTANCE_A2 = DISTANCE_A *2F; + private static float DISTANCE_A = 0.06F; + private static float DISTANCE_A2 = DISTANCE_A * 2F; - private static final Method reset; - private static final Method render; - private final GameSettings gameSettings; + private TecTechFontRender() { + super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); + } - static { - Method resetMethod,renderMethod; - try { - resetMethod =FontRenderer.class.getDeclaredMethod("resetStyles"); - renderMethod=FontRenderer.class.getDeclaredMethod("renderString", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException e) { - try { - resetMethod =FontRenderer.class.getDeclaredMethod("func_78265_b"); - renderMethod=FontRenderer.class.getDeclaredMethod("func_78258_a", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException ex) { - throw new RuntimeException("Cannot get methods!",ex); - } - } - resetMethod.setAccessible(true); - renderMethod.setAccessible(true); - reset=resetMethod; - render=renderMethod; + private void resetStyles() { + this.randomStyle = false; + this.boldStyle = false; + this.italicStyle = false; + this.underlineStyle = false; + this.strikethroughStyle = false; } - private TecTechFontRender() { - super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); - gameSettings = Minecraft.getMinecraft().gameSettings; + private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_) { + if (p_78258_1_ == null) { + return 0; + } else { + if (this.bidiFlag) { + p_78258_1_ = this.bidiReorder(p_78258_1_); + } + + if ((p_78258_4_ & -67108864) == 0) { + p_78258_4_ |= -16777216; + } + + if (p_78258_5_) { + p_78258_4_ = (p_78258_4_ & 16579836) >> 2 | p_78258_4_ & -16777216; + } + + this.red = (float)(p_78258_4_ >> 16 & 255) / 255.0F; + this.blue = (float)(p_78258_4_ >> 8 & 255) / 255.0F; + this.green = (float)(p_78258_4_ & 255) / 255.0F; + this.alpha = (float)(p_78258_4_ >> 24 & 255) / 255.0F; + this.setColor(this.red, this.blue, this.green, this.alpha); + this.posX = (float)p_78258_2_; + this.posY = (float)p_78258_3_; + this.renderStringAtPos(p_78258_1_, p_78258_5_); + return (int)this.posX; + } } - private void resetStyles2(){ + private String bidiReorder(String p_147647_1_) { try { - reset.invoke(this); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method resetStyles!",e); + Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127); + bidi.setReorderingMode(0); + return bidi.writeReordered(2); + } catch (ArabicShapingException var3) { + return p_147647_1_; } } - private int renderString2(String str, int x, int y, int color, boolean dropShadow){ - try { - return (int)render.invoke(this,str,x,y,color,dropShadow); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method renderString!",e); + private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) { + for(int i = 0; i < p_78255_1_.length(); ++i) { + char c0 = p_78255_1_.charAt(i); + int j; + int k; + if (c0 == 167 && i + 1 < p_78255_1_.length()) { + j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1)); + if (j < 16) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + if (j < 0 || j > 15) { + j = 15; + } + + if (p_78255_2_) { + j += 16; + } + + k = this.colorCode[j]; + this.textColor = k; + this.setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + } else if (j == 16) { + this.randomStyle = true; + } else if (j == 17) { + this.boldStyle = true; + } else if (j == 18) { + this.strikethroughStyle = true; + } else if (j == 19) { + this.underlineStyle = true; + } else if (j == 20) { + this.italicStyle = true; + } else if (j == 21) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + this.setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; + } else { + j = "ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(c0); + if (this.randomStyle && j != -1) { + do { + k = this.fontRandom.nextInt(this.charWidth.length); + } while(this.charWidth[j] != this.charWidth[k]); + + j = k; + } + + float f1 = this.unicodeFlag ? 0.5F : 1.0F; + boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + float f = this.renderCharAtPos(j, c0, this.italicStyle); + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + if (this.boldStyle) { + this.posX += f1; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + this.renderCharAtPos(j, c0, this.italicStyle); + this.posX -= f1; + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + ++f; + } + + this.doDraw(f); + } } + } + private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) { + return p_78278_2_ == ' ' ? 4.0F : ("ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); + } @Override public int drawString(String str, int x, int y, int color, boolean dropShadow) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_A, DISTANCE_A, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_A2, 0, 0F); @@ -106,8 +203,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_M, DISTANCE_M, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_M2, 0, 0F); @@ -132,8 +228,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_L, DISTANCE_L, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_L2, 0, 0F); @@ -159,7 +254,7 @@ public class TecTechFontRender extends FontRenderer { @Override public void drawSplitString(String str, int x, int y, int maxWidth, int color) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; @@ -213,50 +308,40 @@ public class TecTechFontRender extends FontRenderer { private int drawStringFront(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); } private int drawStringBack(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); } @Override - public int getStringWidth(String p_78256_1_) - { - if(gameSettings.guiScale==1){ + public int getStringWidth(String p_78256_1_) { + if (Minecraft.getMinecraft().gameSettings.guiScale == 1) { return Minecraft.getMinecraft().fontRenderer.getStringWidth(p_78256_1_); } - if (p_78256_1_ == null) - { + if (p_78256_1_ == null) { return 0; - } - else - { - int i = 0; + } else { + int i = 0; boolean flag = false; - for (int j = 0; j < p_78256_1_.length(); ++j) - { + for (int j = 0; j < p_78256_1_.length(); ++j) { char c0 = p_78256_1_.charAt(j); - int k = this.getCharWidth(c0); + int k = this.getCharWidth(c0); - if (k < 0 && j < p_78256_1_.length() - 1) - { + if (k < 0 && j < p_78256_1_.length() - 1) { ++j; c0 = p_78256_1_.charAt(j); - if (c0 != 108 && c0 != 76) - { - if (c0 == 114 || c0 == 82) - { + if (c0 != 108 && c0 != 76) { + if (c0 == 114 || c0 == 82) { flag = false; } - } - else - { + } else { flag = true; } @@ -265,8 +350,7 @@ public class TecTechFontRender extends FontRenderer { i += k; - if (flag && k > 0) - { + if (flag && k > 0) { ++i; } } @@ -274,4 +358,6 @@ public class TecTechFontRender extends FontRenderer { return i; } } + + } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java index 76f4457e94..49fd8b5b54 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -5,8 +5,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; @@ -27,12 +27,17 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.Materials.*; import static gregtech.api.enums.OrePrefixes.dust; +import static java.lang.Math.abs; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 18.11.2016. */ public class EMAtomDefinition extends EMComplexTemplate { + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + public static final long ATOM_COMPLEXITY_LIMIT = 65536L; private static final byte BYTE_OFFSET = 32; @@ -118,7 +123,7 @@ public class EMAtomDefinition extends EMComplexTemplate { if (def.getGeneration() < 0) { containsAnti = true; } - type = Math.max(type, Math.abs(def.getGeneration())); + type = Math.max(type, abs(def.getGeneration())); if (def instanceof EMLeptonDefinition) { cLeptons += stack.getCharge(); @@ -140,12 +145,12 @@ public class EMAtomDefinition extends EMComplexTemplate { this.neutralCount = neutralCount; this.element = element; - element = Math.abs(element); + element = abs(element); //stability curve int StableIsotope = stableIzoCurve(element); int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); xstr.setSeed((element + 1L) * (neutralCount + 100L)); iaea = EMNuclideIAEA.get(element, neutralCount); @@ -215,7 +220,7 @@ public class EMAtomDefinition extends EMComplexTemplate { if (element == 0) { return 1e-35D; } else if (element == 1) { - unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; + unstabilityEXP = 1.743D - abs(izoDiff - 1) * 9.743D; } else if (element == 2) { switch (isotope) { case 4: @@ -234,9 +239,9 @@ public class EMAtomDefinition extends EMComplexTemplate { } else if (element <= 83 || isotope <= 127 && element <= 120) { double elementPow4 = Math.pow(element, 4); - unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - abs(izoDiff) * (3D - element / 13D + element * element / 1600D); } else { return -1; } @@ -334,63 +339,51 @@ public class EMAtomDefinition extends EMComplexTemplate { @Override public String getLocalizedName() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - if (Math.abs(getGeneration()) != 1) { - return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; - } - return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); + int element = abs(this.getElement()); + boolean anti = this.getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=NAME.length){ + StringBuilder s = new StringBuilder(); + if(anti){ + s.append(translateToLocal("tt.IUPAC.Anti")); + do { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } while (element > 0); + }else { + while (element >= 10) { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element + 10])); } - return translateToLocal("tt.keyword.Element") + (negative ? ": ~" : ": ") + element; + s.append(weird?translateToLocal("tt.keyword.Weird"):""); + return s.toString(); } + return translateToLocal("tt.element."+(anti?"Anti":"")+NAME[element])+(weird?translateToLocal("tt.keyword.Weird"):""); } @Override public String getSymbol() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } - } + return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } @Override public String getShortSymbol() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "?"; - } + int element = abs(this.getElement()); + boolean anti = this.getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=SYMBOL.length){ + StringBuilder s = new StringBuilder(anti?"~":""); + while (element >= 10) { + s.append(SYMBOL_IUPAC[element % 10]); + element = element / 10; + } + s.append(SYMBOL_IUPAC[element + 10]); + s.append(weird?translateToLocal("tt.keyword.Weird"):""); + return s.toString(); } + return (anti?"~":"")+SYMBOL[element]+(weird?translateToLocal("tt.keyword.Weird"):""); } @Override @@ -1133,7 +1126,7 @@ public class EMAtomDefinition extends EMComplexTemplate { private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { EMDefinitionStackMap heavy = new EMDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(Math.abs(getElement()) <= 97); + double[] liquidDrop = liquidDropFunction(abs(getElement()) <= 97); for (EMDefinitionStack stack : fissile.valuesToArray()) { if (spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && @@ -1226,7 +1219,7 @@ public class EMAtomDefinition extends EMComplexTemplate { return decays.toArray(EMDecay.NO_PRODUCT); } } - if (energyLevel < Math.abs(getCharge()) / 3 + getNeutralCount()) { + if (energyLevel < abs(getCharge()) / 3 + getNeutralCount()) { return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; } return getNaturalDecayInstant(); @@ -1363,12 +1356,6 @@ public class EMAtomDefinition extends EMComplexTemplate { return element; } - private static final class Nomenclature { - private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; - } - @Override protected String getIndirectTagValue() { return nbtType; @@ -1398,7 +1385,7 @@ public class EMAtomDefinition extends EMComplexTemplate { //stability curve int StableIsotope = stableIzoCurve(element); int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { @@ -1415,7 +1402,7 @@ public class EMAtomDefinition extends EMComplexTemplate { //stability curve int Isotope = stableIzoCurve(element); int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); isotopes.put(rawLifeTime, isotope);//todo dont add stable ones diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index ecebc6afcd..b8ce40b180 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -141,9 +141,12 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE that.setTagCompound(new NBTTagCompound()); list.add(that); for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); } } diff --git a/src/main/resources/META-INF/tectech_at.cfg b/src/main/resources/META-INF/tectech_at.cfg index e09e575a7d..fa76d13c1f 100644 --- a/src/main/resources/META-INF/tectech_at.cfg +++ b/src/main/resources/META-INF/tectech_at.cfg @@ -1,2 +1,17 @@ public net.minecraft.block.Block field_149781_w #blockResistance -public net.minecraft.block.Block field_149782_v #blockHardness \ No newline at end of file +public net.minecraft.block.Block field_149782_v #blockHardness +protected net.minecraft.client.gui.FontRenderer field_111274_c #unicodePageLocations +protected net.minecraft.client.gui.FontRenderer field_78285_g #colorCode +protected net.minecraft.client.gui.FontRenderer field_78298_i #renderEngine +protected net.minecraft.client.gui.FontRenderer field_78293_l #unicodeFlag +protected net.minecraft.client.gui.FontRenderer field_78294_m #bidiFlag +protected net.minecraft.client.gui.FontRenderer field_78291_n #red +protected net.minecraft.client.gui.FontRenderer field_78292_o #blue +protected net.minecraft.client.gui.FontRenderer field_78306_p #green +protected net.minecraft.client.gui.FontRenderer field_78305_q #alpha +protected net.minecraft.client.gui.FontRenderer field_78304_r #textColor +protected net.minecraft.client.gui.FontRenderer field_78303_s #randomStyle +protected net.minecraft.client.gui.FontRenderer field_78302_t #boldStyle +protected net.minecraft.client.gui.FontRenderer field_78301_u #italicStyle +protected net.minecraft.client.gui.FontRenderer field_78300_v #underlineStyle +protected net.minecraft.client.gui.FontRenderer field_78299_w #strikethroughStyle diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 3142d87d16..79c46b07a2 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -948,8 +948,266 @@ tt.keyword.Chaos=Chaos tt.keyword.Primal=Primal tt.keyword.Aspect=Aspect - - - - - +tt.element.Neutronium=Neutronium +tt.element.Hydrogen=Hydrogen +tt.element.Helium=Helium +tt.element.Lithium=Lithium +tt.element.Beryllium=Beryllium +tt.element.Boron=Boron +tt.element.Carbon=Carbon +tt.element.Nitrogen=Nitrogen +tt.element.Oxygen=Oxygen +tt.element.Fluorine=Fluorine +tt.element.Neon=Neon +tt.element.Sodium=Sodium +tt.element.Magnesium=Magnesium +tt.element.Aluminium=Aluminium +tt.element.Silicon=Silicon +tt.element.Phosphorus=Phosphorus +tt.element.Sulfur=Sulfur +tt.element.Chlorine=Chlorine +tt.element.Argon=Argon +tt.element.Potassium=Potassium +tt.element.Calcium=Calcium +tt.element.Scandium=Scandium +tt.element.Titanium=Titanium +tt.element.Vanadium=Vanadium +tt.element.Chromium=Chromium +tt.element.Manganese=Manganese +tt.element.Iron=Iron +tt.element.Cobalt=Cobalt +tt.element.Nickel=Nickel +tt.element.Copper=Copper +tt.element.Zinc=Zinc +tt.element.Gallium=Gallium +tt.element.Germanium=Germanium +tt.element.Arsenic=Arsenic +tt.element.Selenium=Selenium +tt.element.Bromine=Bromine +tt.element.Krypton=Krypton +tt.element.Rubidium=Rubidium +tt.element.Strontium=Strontium +tt.element.Yttrium=Yttrium +tt.element.Zirconium=Zirconium +tt.element.Niobium=Niobium +tt.element.Molybdenum=Molybdenum +tt.element.Technetium=Technetium +tt.element.Ruthenium=Ruthenium +tt.element.Rhodium=Rhodium +tt.element.Palladium=Palladium +tt.element.Silver=Silver +tt.element.Cadmium=Cadmium +tt.element.Indium=Indium +tt.element.Tin=Tin +tt.element.Antimony=Antimony +tt.element.Tellurium=Tellurium +tt.element.Iodine=Iodine +tt.element.Xenon=Xenon +tt.element.Caesium=Caesium +tt.element.Barium=Barium +tt.element.Lanthanum=Lanthanum +tt.element.Cerium=Cerium +tt.element.Praseodymium=Praseodymium +tt.element.Neodymium=Neodymium +tt.element.Promethium=Promethium +tt.element.Samarium=Samarium +tt.element.Europium=Europium +tt.element.Gadolinium=Gadolinium +tt.element.Terbium=Terbium +tt.element.Dysprosium=Dysprosium +tt.element.Holmium=Holmium +tt.element.Erbium=Erbium +tt.element.Thulium=Thulium +tt.element.Ytterbium=Ytterbium +tt.element.Lutetium=Lutetium +tt.element.Hafnium=Hafnium +tt.element.Tantalum=Tantalum +tt.element.Tungsten=Tungsten +tt.element.Rhenium=Rhenium +tt.element.Osmium=Osmium +tt.element.Iridium=Iridium +tt.element.Platinum=Platinum +tt.element.Gold=Gold +tt.element.Mercury=Mercury +tt.element.Thallium=Thallium +tt.element.Lead=Lead +tt.element.Bismuth=Bismuth +tt.element.Polonium=Polonium +tt.element.Astatine=Astatine +tt.element.Radon=Radon +tt.element.Francium=Francium +tt.element.Radium=Radium +tt.element.Actinium=Actinium +tt.element.Thorium=Thorium +tt.element.Protactinium=Protactinium +tt.element.Uranium=Uranium +tt.element.Neptunium=Neptunium +tt.element.Plutonium=Plutonium +tt.element.Americium=Americium +tt.element.Curium=Curium +tt.element.Berkelium=Berkelium +tt.element.Californium=Californium +tt.element.Einsteinium=Einsteinium +tt.element.Fermium=Fermium +tt.element.Mendelevium=Mendelevium +tt.element.Nobelium=Nobelium +tt.element.Lawrencium=Lawrencium +tt.element.Rutherfordium=Rutherfordium +tt.element.Dubnium=Dubnium +tt.element.Seaborgium=Seaborgium +tt.element.Bohrium=Bohrium +tt.element.Hassium=Hassium +tt.element.Meitnerium=Meitnerium +tt.element.Darmstadtium=Darmstadtium +tt.element.Roentgenium=Roentgenium +tt.element.Copernicium=Copernicium +tt.element.Nihonium=Nihonium +tt.element.Flerovium=Flerovium +tt.element.Moscovium=Moscovium +tt.element.Livermorium=Livermorium +tt.element.Tennessine=Tennessine +tt.element.Oganesson=Oganesson + +tt.element.AntiNeutronium=Antineutronium +tt.element.AntiHydrogen=Antihydrogen +tt.element.AntiHelium=Antihelium +tt.element.AntiLithium=Antilithium +tt.element.AntiBeryllium=Antiberyllium +tt.element.AntiBoron=Antiboron +tt.element.AntiCarbon=Anticarbon +tt.element.AntiNitrogen=Antinitrogen +tt.element.AntiOxygen=Antioxygen +tt.element.AntiFluorine=Antifluorine +tt.element.AntiNeon=Antineon +tt.element.AntiSodium=Antisodium +tt.element.AntiMagnesium=Antimagnesium +tt.element.AntiAluminium=Antialuminium +tt.element.AntiSilicon=Antisilicon +tt.element.AntiPhosphorus=Antiphosphorus +tt.element.AntiSulfur=Antisulfur +tt.element.AntiChlorine=Antichlorine +tt.element.AntiArgon=Antiargon +tt.element.AntiPotassium=Antipotassium +tt.element.AntiCalcium=Anticalcium +tt.element.AntiScandium=Antiscandium +tt.element.AntiTitanium=Antititanium +tt.element.AntiVanadium=Antivanadium +tt.element.AntiChromium=Antichromium +tt.element.AntiManganese=Antimanganese +tt.element.AntiIron=Antiiron +tt.element.AntiCobalt=Anticobalt +tt.element.AntiNickel=Antinickel +tt.element.AntiCopper=Anticopper +tt.element.AntiZinc=Antizinc +tt.element.AntiGallium=Antigallium +tt.element.AntiGermanium=Antigermanium +tt.element.AntiArsenic=Antiarsenic +tt.element.AntiSelenium=Antiselenium +tt.element.AntiBromine=Antibromine +tt.element.AntiKrypton=Antikrypton +tt.element.AntiRubidium=Antirubidium +tt.element.AntiStrontium=Antistrontium +tt.element.AntiYttrium=Antiyttrium +tt.element.AntiZirconium=Antizirconium +tt.element.AntiNiobium=Antiniobium +tt.element.AntiMolybdenum=Antimolybdenum +tt.element.AntiTechnetium=Antitechnetium +tt.element.AntiRuthenium=Antiruthenium +tt.element.AntiRhodium=Antirhodium +tt.element.AntiPalladium=Antipalladium +tt.element.AntiSilver=Antisilver +tt.element.AntiCadmium=Anticadmium +tt.element.AntiIndium=Antiindium +tt.element.AntiTin=Antitin +tt.element.AntiAntimony=Antiantimony +tt.element.AntiTellurium=Antitellurium +tt.element.AntiIodine=Antiiodine +tt.element.AntiXenon=Antixenon +tt.element.AntiCaesium=Anticaesium +tt.element.AntiBarium=Antibarium +tt.element.AntiLanthanum=Antilanthanum +tt.element.AntiCerium=Anticerium +tt.element.AntiPraseodymium=Antipraseodymium +tt.element.AntiNeodymium=Antineodymium +tt.element.AntiPromethium=Antipromethium +tt.element.AntiSamarium=Antisamarium +tt.element.AntiEuropium=Antieuropium +tt.element.AntiGadolinium=Antigadolinium +tt.element.AntiTerbium=Antiterbium +tt.element.AntiDysprosium=Antidysprosium +tt.element.AntiHolmium=Antiholmium +tt.element.AntiErbium=Antierbium +tt.element.AntiThulium=Antithulium +tt.element.AntiYtterbium=Antiytterbium +tt.element.AntiLutetium=Antilutetium +tt.element.AntiHafnium=Antihafnium +tt.element.AntiTantalum=Antitantalum +tt.element.AntiTungsten=Antitungsten +tt.element.AntiRhenium=Antirhenium +tt.element.AntiOsmium=Antiosmium +tt.element.AntiIridium=Antiiridium +tt.element.AntiPlatinum=Antiplatinum +tt.element.AntiGold=Antigold +tt.element.AntiMercury=Antimercury +tt.element.AntiThallium=Antithallium +tt.element.AntiLead=Antilead +tt.element.AntiBismuth=Antibismuth +tt.element.AntiPolonium=Antipolonium +tt.element.AntiAstatine=Antiastatine +tt.element.AntiRadon=Antiradon +tt.element.AntiFrancium=Antifrancium +tt.element.AntiRadium=Antiradium +tt.element.AntiActinium=Antiactinium +tt.element.AntiThorium=Antithorium +tt.element.AntiProtactinium=Antiprotactinium +tt.element.AntiUranium=Antiuranium +tt.element.AntiNeptunium=Antineptunium +tt.element.AntiPlutonium=Antiplutonium +tt.element.AntiAmericium=Antiamericium +tt.element.AntiCurium=Anticurium +tt.element.AntiBerkelium=Antiberkelium +tt.element.AntiCalifornium=Antibalifornium +tt.element.AntiEinsteinium=Antieinsteinium +tt.element.AntiFermium=Antifermium +tt.element.AntiMendelevium=Antimendelevium +tt.element.AntiNobelium=Antinobelium +tt.element.AntiLawrencium=Antilawrencium +tt.element.AntiRutherfordium=Antirutherfordium +tt.element.AntiDubnium=Antidubnium +tt.element.AntiSeaborgium=Antiseaborgium +tt.element.AntiBohrium=Antibohrium +tt.element.AntiHassium=Antihassium +tt.element.AntiMeitnerium=Antimeitnerium +tt.element.AntiDarmstadtium=Antidarmstadtium +tt.element.AntiRoentgenium=Antiroentgenium +tt.element.AntiCopernicium=Anticopernicium +tt.element.AntiNihonium=Antinihonium +tt.element.AntiFlerovium=Antiflerovium +tt.element.AntiMoscovium=Antimoscovium +tt.element.AntiLivermorium=Antilivermorium +tt.element.AntiTennessine=Antitennessine +tt.element.AntiOganesson=Antioganesson + +tt.IUPAC.n=nil +tt.IUPAC.u=un +tt.IUPAC.b=bi +tt.IUPAC.t=tri +tt.IUPAC.q=quad +tt.IUPAC.p=pent +tt.IUPAC.h=hex +tt.IUPAC.s=sept +tt.IUPAC.o=oct +tt.IUPAC.e=enn +tt.IUPAC.N=Nil +tt.IUPAC.U=Un +tt.IUPAC.B=Bi +tt.IUPAC.T=Tri +tt.IUPAC.Q=Quad +tt.IUPAC.P=Pent +tt.IUPAC.H=Hex +tt.IUPAC.S=Sept +tt.IUPAC.O=Oct +tt.IUPAC.E=Enn +tt.IUPAC.ium=ium +tt.IUPAC.Anti=Anti +tt.keyword.Weird=* \ No newline at end of file -- cgit From 5caa75d6f753d876dee72daf20a462c90b4e03f0 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 27 Jan 2022 22:09:30 +0100 Subject: Cleanup Atoms Localization, and FontRenderer (cherry picked from commit ac8311109c91731598466dbd9068f8c995b1d760) --- .../elementalMatter/definitions/complex/EMAtomDefinition.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main') 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 49fd8b5b54..03aae39578 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 @@ -357,7 +357,9 @@ public class EMAtomDefinition extends EMComplexTemplate { } s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element + 10])); } - s.append(weird?translateToLocal("tt.keyword.Weird"):""); + if(weird){ + s.append(translateToLocal("tt.keyword.Weird")); + } return s.toString(); } return translateToLocal("tt.element."+(anti?"Anti":"")+NAME[element])+(weird?translateToLocal("tt.keyword.Weird"):""); @@ -380,7 +382,9 @@ public class EMAtomDefinition extends EMComplexTemplate { element = element / 10; } s.append(SYMBOL_IUPAC[element + 10]); - s.append(weird?translateToLocal("tt.keyword.Weird"):""); + if(weird){ + s.append(translateToLocal("tt.keyword.Weird")); + } return s.toString(); } return (anti?"~":"")+SYMBOL[element]+(weird?translateToLocal("tt.keyword.Weird"):""); -- cgit From 95614e658c1e5e00b002fd9f4e33fce49f1394fd Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 27 Jan 2022 22:09:30 +0100 Subject: Cleanup Atoms Localization, and FontRenderer --- .../definitions/EMComplexAspectDefinition.java | 12 +++++++---- .../definitions/EMPrimalAspectDefinition.java | 25 +++++++++++----------- .../core/definitions/EMPrimitiveTemplate.java | 6 ++++++ .../core/definitions/IEMDefinition.java | 10 +++++++-- .../definitions/complex/EMAtomDefinition.java | 25 +++++++++++++++------- .../definitions/complex/EMHadronDefinition.java | 10 ++++----- .../definitions/primitive/EMBosonDefinition.java | 4 ++-- .../definitions/primitive/EMFermionDefinition.java | 4 ++-- .../primitive/EMGaugeBosonDefinition.java | 4 ++-- .../definitions/primitive/EMLeptonDefinition.java | 2 +- .../primitive/EMNeutrinoDefinition.java | 4 ++-- .../primitive/EMPrimitiveDefinition.java | 4 ++-- .../definitions/primitive/EMQuarkDefinition.java | 4 ++-- .../primitive/EMScalarBosonDefinition.java | 4 ++-- 14 files changed, 72 insertions(+), 46 deletions(-) (limited to 'src/main') 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 40419604e4..8c90dc939c 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 @@ -72,14 +72,18 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { } @Override - public String getLocalizedName() { + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Aspect"); + } + + @Override + public String getShortLocalizedName() { String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); if (name != null) { - name = name.substring(0, 1).toUpperCase() + name.substring(1); + return name.substring(0, 1).toUpperCase() + name.substring(1); } else { - name = getSymbol(); + return getSymbol(); } - return translateToLocal("tt.keyword.Aspect") + ": " + name; } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java index 885a71ef28..6fa709ef3e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -13,12 +13,12 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { public static final EMPrimalAspectDefinition - magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 45,"a`"), - magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 44,"e`"), - magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 43,"f`"), - magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 42,"w`"), - magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 40,"o`"), - magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Chaos"), "c`", 1e5D, 41,"c`"); + magic_air = new EMPrimalAspectDefinition("tt.keyword.Air", "a`", 1e1D, 45,"a`"), + magic_earth = new EMPrimalAspectDefinition("tt.keyword.Earth", "e`", 1e9D, 44,"e`"), + magic_fire = new EMPrimalAspectDefinition("tt.keyword.Fire", "f`", 1e3D, 43,"f`"), + magic_water = new EMPrimalAspectDefinition("tt.keyword.Water", "w`", 1e7D, 42,"w`"), + magic_order = new EMPrimalAspectDefinition("tt.keyword.Order", "o`", 1e5D, 40,"o`"), + magic_entropy = new EMPrimalAspectDefinition("tt.keyword.Chaos", "c`", 1e5D, 41,"c`"); private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID,String bind) { super(name, symbol, 0, mass, 0, -1, ID,bind); @@ -35,13 +35,14 @@ public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { + public String getShortLocalizedName() { String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); - if (name != null) { - return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName()+" ("+name+")"; - } else { - return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName(); - } + return name != null ? super.getShortLocalizedName() + " (" + name + ")" : super.getShortLocalizedName(); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Primal"); } @Override 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 0f25d73704..a1f606c3c2 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 @@ -10,6 +10,7 @@ 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 net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -72,6 +73,11 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { return getSymbol(); } + @Override + public String getShortLocalizedName() { + return translateToLocal(getUnlocalizedName()); + } + @Override public IEMDefinition getAnti() { return anti;//no need for copy diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java index 8125812dc6..aae5a8caca 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java @@ -19,12 +19,18 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM //add text based creators for recipe formula input? //Nomenclature - String getLocalizedName(); + String getLocalizedTypeName(); - String getSymbol(); + String getShortLocalizedName(); + + default String getLocalizedName(){ + return getLocalizedTypeName()+": "+getShortLocalizedName(); + } String getShortSymbol(); + String getSymbol(); + void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); void addScanResults(ArrayList lines, int capabilities, long energyLevel); 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 49fd8b5b54..0eced7bd3c 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 @@ -338,9 +338,14 @@ public class EMAtomDefinition extends EMComplexTemplate { } @Override - public String getLocalizedName() { - int element = abs(this.getElement()); - boolean anti = this.getElement() < 0; + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Element"); + } + + @Override + public String getShortLocalizedName() { + int element = abs(getElement()); + boolean anti = getElement() < 0; boolean weird = abs(getGeneration()) != 1; if(element>=NAME.length){ StringBuilder s = new StringBuilder(); @@ -357,7 +362,9 @@ public class EMAtomDefinition extends EMComplexTemplate { } s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element + 10])); } - s.append(weird?translateToLocal("tt.keyword.Weird"):""); + if(weird){ + s.append(translateToLocal("tt.keyword.Weird")); + } return s.toString(); } return translateToLocal("tt.element."+(anti?"Anti":"")+NAME[element])+(weird?translateToLocal("tt.keyword.Weird"):""); @@ -365,13 +372,13 @@ public class EMAtomDefinition extends EMComplexTemplate { @Override public String getSymbol() { - return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); + return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + getElement()) + " C:" + getCharge(); } @Override public String getShortSymbol() { - int element = abs(this.getElement()); - boolean anti = this.getElement() < 0; + int element = abs(getElement()); + boolean anti = getElement() < 0; boolean weird = abs(getGeneration()) != 1; if(element>=SYMBOL.length){ StringBuilder s = new StringBuilder(anti?"~":""); @@ -380,7 +387,9 @@ public class EMAtomDefinition extends EMComplexTemplate { element = element / 10; } s.append(SYMBOL_IUPAC[element + 10]); - s.append(weird?translateToLocal("tt.keyword.Weird"):""); + if(weird){ + s.append(translateToLocal("tt.keyword.Weird")); + } return s.toString(); } return (anti?"~":"")+SYMBOL[element]+(weird?translateToLocal("tt.keyword.Weird"):""); 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 aedb11ac05..19208fbf4a 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 @@ -137,9 +137,8 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i } @Override - public String getLocalizedName() { - StringBuilder name = new StringBuilder(getSimpleName()); - name.append(':'); + public String getShortLocalizedName() { + StringBuilder name = new StringBuilder(); String sym = translateToLocal(UNLOCALIZED_NAME_MAP.get(this)); if (sym != null) { name.append(' ').append(sym); @@ -151,7 +150,8 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i return name.toString(); } - private String getSimpleName() { + @Override + public String getLocalizedTypeName() { switch (getAmount()) { case 2: return translateToLocal("tt.keyword.Meson"); @@ -472,7 +472,7 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); } if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = " + getSimpleName()); + lines.add("NAME = " + getLocalizedTypeName()); //lines.add("SYMBOL = "+getSymbol()); } if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index 9b77a6cab8..affebf91a2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -10,7 +10,7 @@ public abstract class EMBosonDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Boson")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Boson"); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java index f8f05b80ee..4c0e1d28bc 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java @@ -10,7 +10,7 @@ public abstract class EMFermionDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Fermion")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Fermion"); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java index fb8128c3a5..cf59c1fffd 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java @@ -72,8 +72,8 @@ public class EMGaugeBosonDefinition extends EMBosonDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.GaugeBoson") + ": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.GaugeBoson"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index c665bf23b4..324d790de6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -63,7 +63,7 @@ public class EMLeptonDefinition extends EMFermionDefinition { @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Lepton")+": " + translateToLocal(getUnlocalizedName()); + return translateToLocal("tt.keyword.Lepton")+": " + getShortLocalizedName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index 9ef04e8c7e..9bb05d2cbf 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -52,8 +52,8 @@ public class EMNeutrinoDefinition extends EMLeptonDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Neutrino")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Neutrino"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index 60f87ac83b..785d426a0b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -47,8 +47,8 @@ public class EMPrimitiveDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Primitive") + ": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Primitive"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index 19162bf90d..a93b16ca0d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -99,8 +99,8 @@ public class EMQuarkDefinition extends EMFermionDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Quark")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Quark"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java index 5070954847..760ce48068 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java @@ -35,8 +35,8 @@ public class EMScalarBosonDefinition extends EMBosonDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.ScalarBoson")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.ScalarBoson"); } @Override -- cgit From 32c91825fa6c15ca55591d08bece00c6dd9d2077 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 27 Jan 2022 22:09:30 +0100 Subject: Cleanup Atoms Localization, and FontRenderer (cherry picked from commit 95614e658c1e5e00b002fd9f4e33fce49f1394fd) --- .../definitions/EMComplexAspectDefinition.java | 12 +++++++---- .../definitions/EMPrimalAspectDefinition.java | 25 +++++++++++----------- .../core/definitions/EMPrimitiveTemplate.java | 6 ++++++ .../core/definitions/IEMDefinition.java | 10 +++++++-- .../definitions/complex/EMAtomDefinition.java | 17 +++++++++------ .../definitions/complex/EMHadronDefinition.java | 10 ++++----- .../definitions/primitive/EMBosonDefinition.java | 4 ++-- .../definitions/primitive/EMFermionDefinition.java | 4 ++-- .../primitive/EMGaugeBosonDefinition.java | 4 ++-- .../definitions/primitive/EMLeptonDefinition.java | 2 +- .../primitive/EMNeutrinoDefinition.java | 4 ++-- .../primitive/EMPrimitiveDefinition.java | 4 ++-- .../definitions/primitive/EMQuarkDefinition.java | 4 ++-- .../primitive/EMScalarBosonDefinition.java | 4 ++-- 14 files changed, 66 insertions(+), 44 deletions(-) (limited to 'src/main') 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 40419604e4..8c90dc939c 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 @@ -72,14 +72,18 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { } @Override - public String getLocalizedName() { + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Aspect"); + } + + @Override + public String getShortLocalizedName() { String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); if (name != null) { - name = name.substring(0, 1).toUpperCase() + name.substring(1); + return name.substring(0, 1).toUpperCase() + name.substring(1); } else { - name = getSymbol(); + return getSymbol(); } - return translateToLocal("tt.keyword.Aspect") + ": " + name; } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java index 885a71ef28..6fa709ef3e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -13,12 +13,12 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { public static final EMPrimalAspectDefinition - magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 45,"a`"), - magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 44,"e`"), - magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 43,"f`"), - magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 42,"w`"), - magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 40,"o`"), - magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Chaos"), "c`", 1e5D, 41,"c`"); + magic_air = new EMPrimalAspectDefinition("tt.keyword.Air", "a`", 1e1D, 45,"a`"), + magic_earth = new EMPrimalAspectDefinition("tt.keyword.Earth", "e`", 1e9D, 44,"e`"), + magic_fire = new EMPrimalAspectDefinition("tt.keyword.Fire", "f`", 1e3D, 43,"f`"), + magic_water = new EMPrimalAspectDefinition("tt.keyword.Water", "w`", 1e7D, 42,"w`"), + magic_order = new EMPrimalAspectDefinition("tt.keyword.Order", "o`", 1e5D, 40,"o`"), + magic_entropy = new EMPrimalAspectDefinition("tt.keyword.Chaos", "c`", 1e5D, 41,"c`"); private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID,String bind) { super(name, symbol, 0, mass, 0, -1, ID,bind); @@ -35,13 +35,14 @@ public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { + public String getShortLocalizedName() { String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); - if (name != null) { - return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName()+" ("+name+")"; - } else { - return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName(); - } + return name != null ? super.getShortLocalizedName() + " (" + name + ")" : super.getShortLocalizedName(); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Primal"); } @Override 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 0f25d73704..a1f606c3c2 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 @@ -10,6 +10,7 @@ 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 net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 22.10.2016. @@ -72,6 +73,11 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { return getSymbol(); } + @Override + public String getShortLocalizedName() { + return translateToLocal(getUnlocalizedName()); + } + @Override public IEMDefinition getAnti() { return anti;//no need for copy diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java index 8125812dc6..aae5a8caca 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java @@ -19,12 +19,18 @@ public interface IEMDefinition extends Comparable,Cloneable {//IM //add text based creators for recipe formula input? //Nomenclature - String getLocalizedName(); + String getLocalizedTypeName(); - String getSymbol(); + String getShortLocalizedName(); + + default String getLocalizedName(){ + return getLocalizedTypeName()+": "+getShortLocalizedName(); + } String getShortSymbol(); + String getSymbol(); + void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); void addScanResults(ArrayList lines, int capabilities, long energyLevel); 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 03aae39578..0eced7bd3c 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 @@ -338,9 +338,14 @@ public class EMAtomDefinition extends EMComplexTemplate { } @Override - public String getLocalizedName() { - int element = abs(this.getElement()); - boolean anti = this.getElement() < 0; + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Element"); + } + + @Override + public String getShortLocalizedName() { + int element = abs(getElement()); + boolean anti = getElement() < 0; boolean weird = abs(getGeneration()) != 1; if(element>=NAME.length){ StringBuilder s = new StringBuilder(); @@ -367,13 +372,13 @@ public class EMAtomDefinition extends EMComplexTemplate { @Override public String getSymbol() { - return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); + return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + getElement()) + " C:" + getCharge(); } @Override public String getShortSymbol() { - int element = abs(this.getElement()); - boolean anti = this.getElement() < 0; + int element = abs(getElement()); + boolean anti = getElement() < 0; boolean weird = abs(getGeneration()) != 1; if(element>=SYMBOL.length){ StringBuilder s = new StringBuilder(anti?"~":""); 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 aedb11ac05..19208fbf4a 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 @@ -137,9 +137,8 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i } @Override - public String getLocalizedName() { - StringBuilder name = new StringBuilder(getSimpleName()); - name.append(':'); + public String getShortLocalizedName() { + StringBuilder name = new StringBuilder(); String sym = translateToLocal(UNLOCALIZED_NAME_MAP.get(this)); if (sym != null) { name.append(' ').append(sym); @@ -151,7 +150,8 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i return name.toString(); } - private String getSimpleName() { + @Override + public String getLocalizedTypeName() { switch (getAmount()) { case 2: return translateToLocal("tt.keyword.Meson"); @@ -472,7 +472,7 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); } if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = " + getSimpleName()); + lines.add("NAME = " + getLocalizedTypeName()); //lines.add("SYMBOL = "+getSymbol()); } if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java index 9b77a6cab8..affebf91a2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -10,7 +10,7 @@ public abstract class EMBosonDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Boson")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Boson"); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java index f8f05b80ee..4c0e1d28bc 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java @@ -10,7 +10,7 @@ public abstract class EMFermionDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Fermion")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Fermion"); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java index fb8128c3a5..cf59c1fffd 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java @@ -72,8 +72,8 @@ public class EMGaugeBosonDefinition extends EMBosonDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.GaugeBoson") + ": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.GaugeBoson"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java index c665bf23b4..324d790de6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -63,7 +63,7 @@ public class EMLeptonDefinition extends EMFermionDefinition { @Override public String getLocalizedName() { - return translateToLocal("tt.keyword.Lepton")+": " + translateToLocal(getUnlocalizedName()); + return translateToLocal("tt.keyword.Lepton")+": " + getShortLocalizedName(); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java index 9ef04e8c7e..9bb05d2cbf 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -52,8 +52,8 @@ public class EMNeutrinoDefinition extends EMLeptonDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Neutrino")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Neutrino"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java index 60f87ac83b..785d426a0b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -47,8 +47,8 @@ public class EMPrimitiveDefinition extends EMPrimitiveTemplate { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Primitive") + ": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Primitive"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java index 19162bf90d..a93b16ca0d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -99,8 +99,8 @@ public class EMQuarkDefinition extends EMFermionDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.Quark")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Quark"); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java index 5070954847..760ce48068 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java @@ -35,8 +35,8 @@ public class EMScalarBosonDefinition extends EMBosonDefinition { } @Override - public String getLocalizedName() { - return translateToLocal("tt.keyword.ScalarBoson")+": " + translateToLocal(getUnlocalizedName()); + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.ScalarBoson"); } @Override -- cgit From f45f36a47d911383b2604e14dcc4638076b0329f Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 30 Jan 2022 19:44:59 +0100 Subject: Merge branch 'GTNH/Upstream' # Conflicts: # build.gradle.kts --- .gitignore | 61 +- .gitmodules | 3 - build.gradle | 605 +++++++++ build.gradle.kts | 290 ---- dependencies.gradle | 27 + .../OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar | Bin 0 -> 988221 bytes draw_io_graph.png | Bin 0 -> 113460 bytes gradle.properties | 68 +- gradle/wrapper/gradle-wrapper.jar | Bin 54417 -> 55616 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 22 +- gradlew.bat | 18 +- libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar | Bin 1213993 -> 0 bytes libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar | Bin 4458558 -> 0 bytes .../OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar | Bin 988221 -> 0 bytes real.gradle.properties | 18 - repositories.gradle | 30 + .../java/com/github/technus/tectech/TecTech.java | 2 +- .../dreamcraft/DreamCraftRecipeLoader.java | 255 +++- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 6 +- .../thing/metaTileEntity/multi/EssentiaCompat.java | 4 +- .../multi/EssentiaCompatEnabled.java | 7 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 76 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 60 +- .../technus/tectech/entity/fx/BlockHint.java | 133 -- .../tectech/loader/ConstructableLoader.java | 57 - .../github/technus/tectech/loader/MainLoader.java | 6 +- .../technus/tectech/loader/NetworkDispatcher.java | 6 +- .../tectech/loader/recipe/BaseRecipeLoader.java | 27 +- .../technus/tectech/loader/thing/ThingsLoader.java | 4 - .../mechanics/alignment/AlignmentLimits.java | 183 --- .../mechanics/alignment/AlignmentMessage.java | 140 -- .../mechanics/alignment/AlignmentUtility.java | 45 - .../tectech/mechanics/alignment/IAlignment.java | 187 --- .../mechanics/alignment/IAlignmentLimits.java | 19 - .../mechanics/alignment/IAlignmentProvider.java | 5 - .../mechanics/alignment/IntegerAxisSwap.java | 84 -- .../mechanics/alignment/enumerable/Direction.java | 34 - .../alignment/enumerable/ExtendedFacing.java | 358 ----- .../mechanics/alignment/enumerable/Flip.java | 76 -- .../mechanics/alignment/enumerable/Rotation.java | 76 -- .../constructable/ConstructableUtility.java | 114 -- .../mechanics/constructable/IConstructable.java | 16 - .../constructable/IMultiblockInfoContainer.java | 39 - .../mechanics/dataTransport/DataPacket.java | 2 +- .../mechanics/dataTransport/QuantumDataPacket.java | 2 +- .../tectech/mechanics/spark/ThaumSpark.java | 3 +- .../mechanics/structure/IBlockPosConsumer.java | 7 - .../mechanics/structure/ICustomBlockSetting.java | 17 - .../mechanics/structure/IStructureDefinition.java | 167 --- .../mechanics/structure/IStructureElement.java | 43 - .../structure/IStructureElementChain.java | 41 - .../structure/IStructureElementCheckOnly.java | 16 - .../structure/IStructureElementDeferred.java | 7 - .../structure/IStructureElementNoPlacement.java | 11 - .../mechanics/structure/IStructureNavigate.java | 28 - .../tectech/mechanics/structure/Structure.java | 262 ---- .../mechanics/structure/StructureDefinition.java | 288 ---- .../mechanics/structure/StructureUtility.java | 1395 -------------------- .../mechanics/structure/adders/IBlockAdder.java | 14 - .../mechanics/structure/adders/IHatchAdder.java | 14 - .../mechanics/structure/adders/ITileAdder.java | 12 - .../mechanics/tesla/ITeslaConnectableSimple.java | 2 +- .../mechanics/tesla/TeslaCoverConnection.java | 7 +- .../tectech/nei/TT_NEI_ResearchHandler.java | 12 +- .../technus/tectech/nei/TT_NEI_ScannerHandler.java | 12 +- .../github/technus/tectech/proxy/ClientProxy.java | 40 - .../technus/tectech/recipe/TT_recipeAdder.java | 67 +- .../technus/tectech/thing/CustomItemList.java | 2 +- .../tectech/thing/casing/GT_Block_HintTT.java | 106 -- .../tectech/thing/casing/TT_Container_Casings.java | 2 +- .../thing/cover/GT_Cover_TM_EnderFluidLink.java | 10 +- .../thing/item/ConstructableTriggerItem.java | 49 - .../thing/item/FrontRotationTriggerItem.java | 48 - .../tectech/thing/item/PowerPassUpgradeCover.java | 10 +- .../GT_MetaTileEntity_Hatch_DataConnector.java | 5 +- .../GT_MetaTileEntity_Hatch_DynamoTunnel.java | 3 +- .../hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java | 4 +- .../GT_MetaTileEntity_Hatch_EnergyTunnel.java | 4 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 12 +- .../multi/GT_MetaTileEntity_EM_annihilation.java | 71 +- .../multi/GT_MetaTileEntity_EM_bhg.java | 183 +-- .../multi/GT_MetaTileEntity_EM_computer.java | 88 +- .../multi/GT_MetaTileEntity_EM_crafting.java | 60 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 46 +- .../multi/GT_MetaTileEntity_EM_decay.java | 53 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 46 +- .../multi/GT_MetaTileEntity_EM_infuser.java | 46 +- .../multi/GT_MetaTileEntity_EM_junction.java | 68 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 54 +- .../multi/GT_MetaTileEntity_EM_research.java | 102 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 84 +- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 53 +- .../multi/GT_MetaTileEntity_EM_switch.java | 50 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 14 +- .../multi/GT_MetaTileEntity_EM_wormhole.java | 64 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 49 +- .../GT_MetaTileEntity_TM_proccessingStack.java | 38 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 93 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 58 +- .../render/TT_RenderedExtendedFacingTexture.java | 4 +- .../em_collider/GT_MetaTileEntity_EM_collider.java | 94 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 48 +- .../single/GT_MetaTileEntity_DataReader.java | 8 +- .../GT_MetaTileEntity_DebugStructureWriter.java | 34 +- .../single/GT_MetaTileEntity_TeslaCoil.java | 6 +- .../com/github/technus/tectech/util/Vec3Impl.java | 146 -- src/main/resources/assets/tectech/lang/en_US.lang | 8 +- src/main/resources/assets/tectech/lang/zh_CN.lang | 10 +- src/main/resources/mcmod.info | 8 +- 110 files changed, 2012 insertions(+), 5561 deletions(-) delete mode 100644 .gitmodules create mode 100644 build.gradle delete mode 100644 build.gradle.kts create mode 100644 dependencies.gradle create mode 100644 dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar create mode 100644 draw_io_graph.png delete mode 100644 libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar delete mode 100644 libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar delete mode 100644 libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar delete mode 100644 real.gradle.properties create mode 100644 repositories.gradle delete mode 100644 src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java delete mode 100644 src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java delete mode 100644 src/main/java/com/github/technus/tectech/util/Vec3Impl.java (limited to 'src/main') diff --git a/.gitignore b/.gitignore index 3d66b81105..40fb5e4a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,29 @@ -.gradle/ -run/ -.settings/ +.gradle +.settings +/.idea/ +/run/ +/build/ +/eclipse/ .classpath .project -bin/ -out/ -libs/gregtech* -CREDITS-fml.txt -LICENSE-fml.txt -MinecraftForge-Credits.txt -MinecraftForge-License.txt -CoreMod.iml -CoreMod.ipr -CoreMod.iws -Idea.bat -SetupDevWorkspaces.bat +/bin/ +/config/ +/crash-reports/ +/logs/ +options.txt +/saves/ +usernamecache.json +banned-ips.json +banned-players.json +eula.txt +ops.json +server.properties +servers.dat +usercache.json +whitelist.json +/out/ *.iml *.ipr *.iws +src/main/resources/mixins.*.json *.bat -.idea/workspace.xml -*.db -*.log -.idea/ -\.directory -asm/ -config/ -saves/ -usernamecache.json -PlayerCache.dat -GregTech.cfg -options.txt -GregTech.lang -mods/ -classes/ -logs/ -libs/AsieLib-1.7.10-0.4.9-deobf.jar -libs/Computronics-1.7.10-1.6.6-deobf.jar -libs/Galacticraft-API-1.7-3.0.12.504.jar -libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar -libs/MicdoodleCore-1.7-3.0.12.504.jar -libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar -eclipse/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 58eebb4aa5..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "AVRcore"] - path = AVRcore - url = https://github.com/Technus/AVRcore diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..f15607a826 --- /dev/null +++ b/build.gradle @@ -0,0 +1,605 @@ +//version: 1642484596 +/* +DO NOT CHANGE THIS FILE! + +Also, you may replace this file at any time if there is an update available. +Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. + */ + + +import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +import java.util.concurrent.TimeUnit + +buildscript { + repositories { + maven { + name = "forge" + url = "https://maven.minecraftforge.net" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + name = "Scala CI dependencies" + url = "https://repo1.maven.org/maven2/" + } + maven { + name = "jitpack" + url = "https://jitpack.io" + } + } + dependencies { + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5' + } +} + +plugins { + id 'idea' + id 'scala' + id("org.ajoberstar.grgit") version("3.1.1") + id("com.github.johnrengelman.shadow") version("4.0.4") + id("com.palantir.git-version") version("0.12.3") + id("maven-publish") +} + +apply plugin: 'forge' + +def projectJavaVersion = JavaLanguageVersion.of(8) + +java { + toolchain { + languageVersion.set(projectJavaVersion) + } +} + +javadoc.options.encoding = 'UTF-8' +tasks.withType(Javadoc) { + options.encoding = 'UTF-8' +} +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} +tasks.withType(Test) { + systemProperty("file.encoding", "UTF-8") +} + +idea { + module { + inheritOutputDirs = true + downloadJavadoc = true + downloadSources = true + } +} + +if(JavaVersion.current() != JavaVersion.VERSION_1_8) { + throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) +} + +checkPropertyExists("modName") +checkPropertyExists("modId") +checkPropertyExists("modGroup") +checkPropertyExists("autoUpdateBuildScript") +checkPropertyExists("minecraftVersion") +checkPropertyExists("forgeVersion") +checkPropertyExists("replaceGradleTokenInFile") +checkPropertyExists("gradleTokenModId") +checkPropertyExists("gradleTokenModName") +checkPropertyExists("gradleTokenVersion") +checkPropertyExists("gradleTokenGroupName") +checkPropertyExists("apiPackage") +checkPropertyExists("accessTransformersFile") +checkPropertyExists("usesMixins") +checkPropertyExists("mixinPlugin") +checkPropertyExists("mixinsPackage") +checkPropertyExists("coreModClass") +checkPropertyExists("containsMixinsAndOrCoreModOnly") +checkPropertyExists("usesShadowedDependencies") +checkPropertyExists("developmentEnvironmentUserName") + +boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false + +String javaSourceDir = "src/main/java/" +String scalaSourceDir = "src/main/scala/" + +String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") +String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") +if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +} + +if(apiPackage) { + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } +} + +if(accessTransformersFile) { + String targetFile = "src/main/resources/META-INF/" + accessTransformersFile + if(getFile(targetFile).exists() == false) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + } +} + +if(usesMixins.toBoolean()) { + if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { + throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") + } + + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } + + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +if(coreModClass) { + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) + + // Make sure GregTech build won't time out + System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) + System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) +} + +// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version +'git config core.fileMode false'.execute() + +// Pulls version first from the VERSION env and then git tag +String identifiedVersion +try { + String versionOverride = System.getenv("VERSION") ?: null + identifiedVersion = versionOverride == null ? gitVersion() : versionOverride + version = minecraftVersion + "-" + identifiedVersion +} +catch (Exception e) { + throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!"); +} + +group = modGroup +if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { + archivesBaseName = customArchiveBaseName +} +else { + archivesBaseName = modId +} + +minecraft { + version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion + runDir = "run" + + if (replaceGradleTokenInFile) { + replaceIn replaceGradleTokenInFile + if(gradleTokenModId) { + replace gradleTokenModId, modId + } + if(gradleTokenModName) { + replace gradleTokenModName, modName + } + if(gradleTokenVersion) { + replace gradleTokenVersion, versionDetails().lastTag + } + if(gradleTokenGroupName) { + replace gradleTokenGroupName, modGroup + } + } +} + +if(file("addon.gradle").exists()) { + apply from: "addon.gradle" +} + +apply from: 'repositories.gradle' + +configurations { + implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored + implementation.extendsFrom(shadowCompile) + implementation.extendsFrom(shadeCompile) +} + +repositories { + maven { + name = "Overmind forge repo mirror" + url = "https://gregtech.overminddl1.com/" + } + if(usesMixins.toBoolean()) { + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + url = "https://jitpack.io" + } + } +} + +dependencies { + if(usesMixins.toBoolean()) { + annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") + annotationProcessor("com.google.guava:guava:24.1.1-jre") + annotationProcessor("com.google.code.gson:gson:2.8.6") + annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + // using 0.8 to workaround a issue in 0.7 which fails mixin application + compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") { + // Mixin includes a lot of dependencies that are too up-to-date + exclude module: "launchwrapper" + exclude module: "guava" + exclude module: "gson" + exclude module: "commons-io" + exclude module: "log4j-core" + } + compile("com.github.GTNewHorizons:SpongeMixins:1.5.0") + } +} + +apply from: 'dependencies.gradle' + +def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" + +task generateAssets { + if(usesMixins.toBoolean()) { + getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + "required": true, + "minVersion": "0.7.11", + "package": "${modGroup}.${mixinsPackage}", + "plugin": "${modGroup}.${mixinPlugin}", + "refmap": "${mixingConfigRefMap}", + "target": "@env(DEFAULT)", + "compatibilityLevel": "JAVA_8" +} + +""" + } +} + +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" +} + +shadowJar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] + dependsOn(relocateShadowJar) +} + +jar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } +} + +reobf { + if(usesMixins.toBoolean()) { + addExtraSrgFile mixinSrg + } +} + +afterEvaluate { + if(usesMixins.toBoolean()) { + tasks.compileJava { + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" + ] + } + } +} + +runClient { + def arguments = [] + + if(usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + if(developmentEnvironmentUserName) { + arguments += [ + "--username", + developmentEnvironmentUserName + ] + } + + args(arguments) +} + +runServer { + def arguments = [] + + if (usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + args(arguments) +} + +tasks.withType(JavaExec).configureEach { + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } + ) +} + +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} + +def getManifestAttributes() { + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] + } + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + return manifestAttributes +} + +task sourcesJar(type: Jar) { + from (sourceSets.main.allJava) + from (file("$projectDir/LICENSE")) + getArchiveClassifier().set('sources') +} + +task shadowDevJar(type: ShadowJar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] +} + +task relocateShadowDevJar(type: ConfigureShadowRelocation) { + target = tasks.shadowDevJar + prefix = modGroup + ".shadow" +} + +task circularResolverJar(type: Jar) { + dependsOn(relocateShadowDevJar) + dependsOn(shadowDevJar) + enabled = false +} + +task devJar(type: Jar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(circularResolverJar) + enabled = false + } +} + +task apiJar(type: Jar) { + from (sourceSets.main.allJava) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.output) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.resources.srcDirs) { + include("LICENSE") + } + + getArchiveClassifier().set('api') +} + +artifacts { + if(!noPublishedSources) { + archives sourcesJar + } + archives devJar + if(apiPackage) { + archives apiJar + } +} + +// publishing +publishing { + publications { + maven(MavenPublication) { + artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: "" + if(!noPublishedSources) { + artifact source: sourcesJar, classifier: "src" + } + artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" + if (apiPackage) { + artifact source: apiJar, classifier: "api" + } + + groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons" + artifactId = System.getenv("ARTIFACT_ID") ?: project.name + // Using the identified version, not project.version as it has the prepended 1.7.10 + version = System.getenv("RELEASE_VERSION") ?: identifiedVersion + } + } + + repositories { + maven { + url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" + credentials { + username = System.getenv("MAVEN_USER") ?: "NONE" + password = System.getenv("MAVEN_PASSWORD") ?: "NONE" + } + } + } +} + +// Updating +task updateBuildScript { + doLast { + if (performBuildScriptUpdate(projectDir.toString())) return + + print("Build script already up-to-date!") + } +} + +if (isNewBuildScriptVersionAvailable(projectDir.toString())) { + if (autoUpdateBuildScript.toBoolean()) { + performBuildScriptUpdate(projectDir.toString()) + } else { + println("Build script update available! Run 'gradle updateBuildScript'") + } +} + +static URL availableBuildScriptUrl() { + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle") +} + +boolean performBuildScriptUpdate(String projectDir) { + if (isNewBuildScriptVersionAvailable(projectDir)) { + def buildscriptFile = getFile("build.gradle") + availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + return true + } + return false +} + +boolean isNewBuildScriptVersionAvailable(String projectDir) { + Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] + + String currentBuildScript = getFile("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) + + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate +} + +static String getVersionHash(String buildScriptContent) { + String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") + if(versionLine != null) { + return versionLine.split(": ").last() + } + return "" +} + +configure(updateBuildScript) { + group = 'forgegradle' + description = 'Updates the build script to the latest version' +} + +// Helper methods + +def checkPropertyExists(String propertyName) { + if (project.hasProperty(propertyName) == false) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") + } +} + +def getFile(String relativePath) { + return new File(projectDir, relativePath) +} diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index bf388c9e64..0000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,290 +0,0 @@ -import net.minecraftforge.gradle.user.UserExtension -import java.io.FileInputStream -import java.util.* -import java.io.* - -buildscript { - repositories { - mavenCentral() - maven("http://files.minecraftforge.net/maven") - maven("https://jitpack.io") - } - dependencies { - classpath("com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT"){ - isChanging = true - } - } -} - -plugins { - idea - java - signing -} - -apply(plugin = "forge") - -//Downloads Javadocs and sources by default -idea { - module { - this.isDownloadJavadoc = true - this.isDownloadSources = true - } -} - -//Set Java to version 1.8 -java { - this.sourceCompatibility = JavaVersion.VERSION_1_8 - this.targetCompatibility = JavaVersion.VERSION_1_8 -} - -//Set standard encoding -tasks.withType { - options.encoding = "UTF-8" -} - -//Add extra sources here -sourceSets.getByName("main") { - java.srcDir("src/main/java") - java.srcDir("AVRcore/src") -} - -//Load Minecraft Version -val Project.minecraft: UserExtension - get() = extensions.getByName("minecraft") - -//TODO Delete this! This exists to load the configs from the real properties file, which is needed for Jenkins to build -//Gradle will load gradle.properties from it's home, it's install, and the project folder. Clearly whoever setup the -//Jenkins jar signing needs to be reminded of this! -val prop = Properties() -prop.load(FileInputStream("real.gradle.properties")) -val propSign = Properties() -propSign.load(FileInputStream("gradle.properties")) - -//TODO Delete -val projectVersion: String = prop.getProperty("projectVersion") -//TODO Uncomment -//val projectVersion: String by project - -//Generates a hash for each new commit to differentiate versions -var commitHash = Runtime - .getRuntime() - .exec("git rev-parse --short HEAD") - .let { process -> - process.waitFor() - val output = process.inputStream.use { - it.bufferedReader().use(BufferedReader::readText) - } - process.destroy() - output.trim() - } - -minecraft.version = "1.7.10-10.13.4.1614-1.7.10" -version = "$projectVersion-$commitHash" -group = "com.github.technus" - -//Minecraft Block -configure { - //Replaces version inside the mod - this.includes.addAll( - arrayOf( - "Reference.java" - ) - ) - this.replacements.putAll( - mapOf( - Pair("GRADLETOKEN_VERSION", project.version) - ) - ) - - //This is sometimes called 'eclipse' instead - this.runDir = "run" -} - -repositories { - mavenLocal() - maven("https://gregtech.overminddl1.com/") { this.name = "GT6Maven" } - maven("http://maven.ic2.player.to/") { this.name = "ic2" } - maven("http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/") { this.name = "UsrvDE/GTNH" } - ivy { - this.name = "gtnh_download_source_underscores" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]") - } - ivy { - this.name = "gtnh_download_source" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]") - } - ivy { - this.name = "BuildCraft" - this.artifactPattern("http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision](-[classifier]).[ext]") - } - maven("http://maven.cil.li/") { this.name = "OpenComputers" } - maven("http://default.mobiusstrip.eu/maven") { this.name = "Jabba" } - maven("http://chickenbones.net/maven/") { this.name = "CodeChicken" } - maven("http://www.ryanliptak.com/maven/") { this.name = "appleCore" } - maven("https://jitpack.io") -} - -dependencies { - //Local Libraries - compile(fileTree("libs") { this.include("*.jar") }) - - //TODO Uncomment - //Versions from properties - //val ic2Version: String by project - //val gt5uVersion: String by project - //val yamcoreVersion: String by project - //val opencomputersVersion: String by project - //val computercraftVersion: String by project - //val baublesVersion: String by project - //val thaumcraftVersion: String by project - //val codechickenlibVersion: String by project - //val codechickencoreVersion: String by project - //val neiVersion: String by project - //val wailaVersion: String by project - //val galacticraftVersion: String by project - //val galacticGregVersion: String by project - //val buildcraftVersion: String by project - //val forestryVersion: String by project - //val enderioVersion: String by project - //val enderCoreVersion: String by project - - //TODO Delete - val ic2Version: String = prop.getProperty("ic2Version") - val gt5uVersion: String = prop.getProperty("gt5uVersion") - val yamcoreVersion: String = prop.getProperty("yamcoreVersion") - val opencomputersVersion: String = prop.getProperty("opencomputersVersion") - val computercraftVersion: String = prop.getProperty("computercraftVersion") - val baublesVersion: String = prop.getProperty("baublesVersion") - val thaumcraftVersion: String = prop.getProperty("thaumcraftVersion") - val codechickenlibVersion: String = prop.getProperty("codechickenlibVersion") - val codechickencoreVersion: String = prop.getProperty("codechickencoreVersion") - val neiVersion: String = prop.getProperty("neiVersion") - val wailaVersion: String = prop.getProperty("wailaVersion") - val galacticraftVersion: String = prop.getProperty("galacticraftVersion") - val galacticGregVersion: String = prop.getProperty("galacticGregVersion") - val buildcraftVersion: String = prop.getProperty("buildcraftVersion") - val forestryVersion: String = prop.getProperty("forestryVersion") - val enderioVersion: String = prop.getProperty("enderioVersion") - val enderCoreVersion: String = prop.getProperty("enderCoreVersion") - - //Hard Dependencies - compile("net.industrial-craft:industrialcraft-2:$ic2Version:dev") - compile("com.github.GTNewHorizons:GT5-Unofficial:$gt5uVersion:dev"){ - exclude("net.industrial-craft", "industrialcraft-2") - isChanging = true - } - compile("eu.usrv:YAMCore:$yamcoreVersion:deobf") - - //Compile Dependencies - compileOnly("li.cil.oc:OpenComputers:$opencomputersVersion:dev") - compileOnly("dan200.computercraft:ComputerCraft:$computercraftVersion") - compile("com.azanor.baubles:Baubles:$baublesVersion:deobf") - compile("thaumcraft:Thaumcraft:$thaumcraftVersion:dev") - compile("codechicken:CodeChickenLib:$codechickenlibVersion:dev") - compile("codechicken:CodeChickenCore:$codechickencoreVersion:dev") - compile("codechicken:NotEnoughItems:$neiVersion:dev") - - //Optional Libraries for Testing - runtimeOnly("mcp.mobius.waila:Waila:$wailaVersion") - - //runtimeOnly("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev") - //runtimeOnly("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev") - //runtimeOnly("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev") - //runtimeOnly("com.github.GTNewHorizons:GalacticGregGT5:$galacticGregVersion") - //runtimeOnly("com.mod-buildcraft:buildcraft:$buildcraftVersion:dev") - //runtimeOnly("net.sengir.forestry:forestry_1.7.10:$forestryVersion:dev") - //runtimeOnly("com.enderio.core:EnderCore:$enderCoreVersion:dev") - //runtimeOnly("com.enderio:EnderIO:$enderioVersion:dev"){ - // exclude("com.enderio.core", "EnderCore") - // exclude("mcp.mobius.waila", "Waila") - //} - - configurations.all { - resolutionStrategy.cacheDynamicVersionsFor(30, "seconds") - } -} - - - - -tasks.withType { - //Mark as outdated if versions change - this.inputs.properties += "version" to project.version - this.inputs.properties += "mcversion" to project.minecraft.version - this.archiveBaseName.set("TecTech-${project.minecraft.version}") - - //Replace versions in mcmod.info - this.filesMatching("/mcmod.info") { - this.expand( - mapOf( - "version" to project.version, - "mcversion" to project.minecraft.version - ) - ) - } -} - -//Load AVRcore -val submodulesUpdate by tasks.creating(Exec::class) { - this.description = "Updates (and inits) git submodules" - this.group = "Build Setup" - this.commandLine("git", "submodule", "update", "--init", "--recursive", "--remote") -} -tasks.named("setupCIWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("setupDevWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("setupDecompWorkspace") { - dependsOn(":submodulesUpdate") -} -tasks.named("compileJava") { - dependsOn(":submodulesUpdate") -} -tasks.named("sourceMainJava") { - dependsOn(":submodulesUpdate") -} - -tasks.jar { - //Needed for access transformer which allows nerfing hardness of blocks - this.manifest.attributes( - mapOf( - Pair("FMLAT", "tectech_at.cfg") - ) - ) -} - -val sourcesJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().allSource) - this.archiveClassifier.set("sources") -} - -val devJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().output) - this.archiveClassifier.set("dev") -} - -artifacts { - this.archives(sourcesJar) - this.archives(devJar) -} - -tasks.register("signJar") { - dependsOn("reobf") -} - -//TODO Fix, but technically it was never fully implemented -//signing { -// sign(tasks["jar"]) -//} -// -//tasks.named("signJar") { -// allprojects { -// extra["signing.keyId"] = propSign.getProperty("keyStoreAlias") -// extra["signing.secretKeyRingFile"] = propSign.getProperty("keyStore") -// extra["signing.password"] = propSign.getProperty("keyStorePass") -// } -// dependsOn(":reobf") -//} \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000000..73d58c8479 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,27 @@ +// Add your dependencies here + +dependencies { + shadowImplementation("com.github.GTNewHorizons:AVRcore:master-SNAPSHOT") + + compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.18:dev") + compile("com.github.GTNewHorizons:Yamcl:0.5.82:dev") + compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") + compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") + compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev") + compile("com.github.GTNewHorizons:StructureLib:1.0.14:dev") + compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") + + compile("com.github.GTNewHorizons:GTplusplus:1.7.24:dev") + + compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-70-GTNH:dev") { + transitive = false + } + + compile("dan200.computercraft:ComputerCraft:1.75") + compile("li.cil.oc:OpenComputers:MC1.7.10-1.7.5.1356:dev") + compile("curse.maven:cofh-core-69162:2388751") + compile("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") + compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev") + + compile files("dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar") +} diff --git a/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar b/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar new file mode 100644 index 0000000000..e854bf7df9 Binary files /dev/null and b/dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar differ diff --git a/draw_io_graph.png b/draw_io_graph.png new file mode 100644 index 0000000000..241c41d604 Binary files /dev/null and b/draw_io_graph.png differ diff --git a/gradle.properties b/gradle.properties index 83dd93b556..3d49d30e98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,64 @@ -#Dummy File, replaced in Jenkins -keyStoreAlias=w -keyStore=w -keyStorePass=w \ No newline at end of file +modName = TecTech - Tec Technology! + +# This is a case-sensitive string to identify your mod. Convention is to use lower case. +modId = tectech + +modGroup = com.github.technus.tectech + +# WHY is there no version field? +# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the +# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ + +# Will update your build.gradle automatically whenever an update is available +autoUpdateBuildScript = false + +minecraftVersion = 1.7.10 +forgeVersion = 10.13.4.1614 + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you +# restart Minecraft in development. Choose this dependent on your mod: +# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name +# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +developmentEnvironmentUserName = "Developer" + +# Define a source file of your project with: +# public static final String VERSION = "GRADLETOKEN_VERSION"; +# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's +# version in @Mod([...], version = VERSION, [...]) +# Leave these properties empty to skip individual token replacements +replaceGradleTokenInFile = Reference.java +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = GRADLETOKEN_VERSION +gradleTokenGroupName = + +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can +# leave this property empty. +# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +apiPackage = + +# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ +# Example value: mymodid_at.cfg +accessTransformersFile = tectech_at.cfg + +# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! +usesMixins = false +# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. +mixinPlugin = +# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +mixinsPackage = +# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! +# This parameter is for legacy compatability only +# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +coreModClass = +# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class +# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! +containsMixinsAndOrCoreModOnly = false + +# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# responsibility check the licence and request permission for distribution, if required. +usesShadowedDependencies = true + +# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older +# projects. New projects should not use this parameter. +customArchiveBaseName = TecTech diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 758de960ec..5c2d1cf016 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28f8e..3ab0b725ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d517..83f2acfdc3 100644 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/gradlew.bat b/gradlew.bat index f9553162f1..9618d8d960 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar b/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar deleted file mode 100644 index 7a53464d53..0000000000 Binary files a/libs/CoFHCore-[1.7.10]3.1.4-329-dev.jar and /dev/null differ diff --git a/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar b/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar deleted file mode 100644 index 181475fc38..0000000000 Binary files a/libs/GT-PlusPlus-1.7.0-prerelease-8-final.jar and /dev/null differ diff --git a/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar b/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar deleted file mode 100644 index e854bf7df9..0000000000 Binary files a/libs/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar and /dev/null differ diff --git a/real.gradle.properties b/real.gradle.properties deleted file mode 100644 index ed62eeefe5..0000000000 --- a/real.gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -projectVersion=4.10.4 -ic2Version=2.2.828-experimental -gt5uVersion=experimental-SNAPSHOT -yamcoreVersion=1.7.10-0.5.79 -opencomputersVersion=MC1.7.10-1.7.5.1291 -computercraftVersion=1.75 -baublesVersion=1.7.10-1.0.1.10 -thaumcraftVersion=1.7.10-4.2.3.5 -codechickenlibVersion=1.7.10-1.1.3.140 -codechickencoreVersion=1.7.10-1.0.7.47 -neiVersion=1.7.10-1.0.5.120 -wailaVersion=1.5.10_1.7.10 -galacticraftVersion=1.7-3.0.12.504 -galacticGregVersion=master-SNAPSHOT -buildcraftVersion=7.1.23 -forestryVersion=4.2.16.64 -enderioVersion=1.7.10-2.3.0.429_beta -enderCoreVersion=1.7.10-0.2.0.39_beta \ No newline at end of file diff --git a/repositories.gradle b/repositories.gradle new file mode 100644 index 0000000000..a161653e0f --- /dev/null +++ b/repositories.gradle @@ -0,0 +1,30 @@ +// Add any additional repositories for your dependencies here + +repositories { + maven { + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + } + maven { + name "OpenComputers Repo" + url = "http://maven.cil.li/" + } + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url "https://cursemaven.com" + } + maven { + url = "https://jitpack.io" + } +} diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 10b8f69b1a..03701668ef 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -36,7 +36,7 @@ import java.util.Iterator; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" - + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;") + + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;" + "required-after:structurelib;") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) public static CommonProxy proxy; diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 4ebe84147f..f520885f9e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -170,6 +170,23 @@ public class DreamCraftRecipeLoader { getOrDefault("Trinium", Materials.Osmium).getMolten(1296), }, CustomItemList.eM_Coil.get(4), 800, 2000000); + //infinite oil rig + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.OilDrill3.get(1), + 16777216, 2048, 2000000, 4, new ItemStack[]{ + ItemList.OilDrill3.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 4), + ItemList.Electric_Motor_UHV.get(4), + ItemList.Electric_Pump_UHV.get(4), + GT_OreDictUnificator.get(OrePrefixes.gearGt, Materials.Neutronium, 4), + ItemList.Sensor_UHV.get(3), + ItemList.Field_Generator_UHV.get(3), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 12) + }, new FluidStack[]{ + Materials.SolderingAlloy.getMolten(1296), + Materials.Neutronium.getMolten(576) + }, ItemList.OilDrillInfinite.get(1), 6000, 2000000); + //Tesla Base GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NickelZincFerrite, 6), @@ -260,9 +277,9 @@ public class DreamCraftRecipeLoader { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_dynamoMulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_dynamoMulti64_UEV.get(1), 400, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Dynamo_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_dynamoMulti4_UIV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Dynamo_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(9216), CustomItemList.eM_dynamoMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(9216), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(9216), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); //Energy Hatches IV-UIV GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); @@ -289,9 +306,9 @@ public class DreamCraftRecipeLoader { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_energyMulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_energyMulti64_UEV.get(1), 400, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(9216), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(9216), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(9216), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); //Buck Converter IV-UIV if (Loader.isModLoaded("bartworks")) { @@ -445,7 +462,7 @@ public class DreamCraftRecipeLoader { ItemList.Emitter_ZPM.get(8), ItemList.Robot_Arm_ZPM.get(1), ItemList.Electric_Motor_ZPM.get(2), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 1)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 2)}, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Naquadah, 16)}, CustomItemList.DATApipe.get(2), @@ -576,7 +593,7 @@ public class DreamCraftRecipeLoader { //Quantum Computer GT_Values.RA.addAssemblylineRecipe(ItemList.Tool_DataOrb.get(1), 20000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 2}, ItemList.Tool_DataOrb.get(1), ItemList.Cover_Screen.get(1), new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUV, 8)}, @@ -592,7 +609,7 @@ public class DreamCraftRecipeLoader { GT_Values.RA.addAssemblylineRecipe(getItemContainer("ScannerZPM").get(1), 80000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), ItemList.Sensor_ZPM.get(8), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 4)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 4}, ItemList.Field_Generator_ZPM.get(1), ItemList.Electric_Motor_ZPM.get(2), new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 4)}, @@ -711,7 +728,7 @@ public class DreamCraftRecipeLoader { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), }, CustomItemList.Machine_Multi_Infuser.get(1), 8000, 2000000); - //Motor UV-UHV + //Motor UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Motor_UV.get(1L), 24000, 32, 100000, 4, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.SamariumMagnetic, 4L), @@ -750,14 +767,14 @@ public class DreamCraftRecipeLoader { Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Motor_UEV.get(1L), 2000, 800000); - //Pumps UV-UHV + //Pumps UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Pump_UV.get(1L), - 24000, 32, 100000, 4, new ItemStack[]{ + 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Neutronium, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 4L), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 16L), - GT_OreDictUnificator.get(OrePrefixes.ring, Materials.AnySyntheticRubber, 32L), + new Object[]{OrePrefixes.ring.get(Materials.AnySyntheticRubber), 32L}, GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.CosmicNeutronium, 4L), GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L)}, new FluidStack[]{ Materials.Naquadria.getMolten(2592), @@ -765,44 +782,45 @@ public class DreamCraftRecipeLoader { Materials.Lubricant.getFluid(4000)}, ItemList.Electric_Pump_UHV.get(1), 1000, 200000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Pump_UHV.get(1L), - 48000, 64, 200000, 8, new ItemStack[]{ + 48000, 64, 200000, 8, new Object[]{ ItemList.Electric_Motor_UEV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.NetherStar, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 4L), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Infinity, 16L), - GT_OreDictUnificator.get(OrePrefixes.ring, (Materials.AnySyntheticRubber), 64L), + new Object[]{OrePrefixes.ring.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.Infinity, 4L), GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L)}, new FluidStack[]{ Materials.Quantium.getMolten(2592), Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Pump_UEV.get(1), 2000, 800000); - //Conveyor Belt UV-UHV + //Conveyor Belt UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Conveyor_Module_UV.get(1L), - 24000, 32, 100000, 4, new ItemStack[]{ + 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 2L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.CosmicNeutronium, 8L), GT_OreDictUnificator.get(OrePrefixes.round, Materials.CosmicNeutronium, 64L), - GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L)}, new FluidStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L), + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 40L}}, new FluidStack[]{ Materials.Naquadria.getMolten(2592), Materials.SolderingAlloy.getMolten(2592), - Materials.Lubricant.getFluid(4000), - Materials.Silicone.getMolten(5760)}, ItemList.Conveyor_Module_UHV.get(1), 1000, 200000); + Materials.Lubricant.getFluid(4000)}, ItemList.Conveyor_Module_UHV.get(1), 1000, 200000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Conveyor_Module_UHV.get(1L), - 48000, 64, 200000, 8, new ItemStack[]{ + 48000, 64, 200000, 8, new Object[]{ ItemList.Electric_Motor_UEV.get(2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 2L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Infinity, 8L), GT_OreDictUnificator.get(OrePrefixes.round, Materials.Infinity, 64L), - GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L)}, new FluidStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L), + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 64L}, + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 16L}}, new FluidStack[]{ Materials.Quantium.getMolten(2592), Materials.SolderingAlloy.getMolten(5184), - Materials.Lubricant.getFluid(8000), - Materials.Silicone.getMolten(11520)}, ItemList.Conveyor_Module_UEV.get(1), 2000, 800000); + Materials.Lubricant.getFluid(8000)}, ItemList.Conveyor_Module_UEV.get(1), 2000, 800000); - //Piston UV-UHV + //Piston UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Piston_UV.get(1L), 24000, 32, 100000, 4, new ItemStack[]{ ItemList.Electric_Motor_UHV.get(1L), @@ -831,7 +849,7 @@ public class DreamCraftRecipeLoader { Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Piston_UEV.get(1), 2000, 800000); - //Robot Arm UV-UHV + //Robot Arm UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Robot_Arm_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.CosmicNeutronium, 8L), @@ -862,7 +880,7 @@ public class DreamCraftRecipeLoader { Materials.SolderingAlloy.getMolten(9216), Materials.Lubricant.getFluid(8000)}, ItemList.Robot_Arm_UEV.get(1L), 2000, 800000); - //Emitter UV-UHV + //Emitter UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Emitter_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -895,7 +913,7 @@ public class DreamCraftRecipeLoader { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Emitter_UEV.get(1L), 2000, 800000); - //Sensor UV-UHV + //Sensor UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Sensor_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -928,7 +946,7 @@ public class DreamCraftRecipeLoader { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Sensor_UEV.get(1L), 2000, 800000); - //Fieldgen UV and UHV + //Fieldgen UHV and UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Field_Generator_UV.get(1), 48000, 64, 200000, 8, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -971,7 +989,7 @@ public class DreamCraftRecipeLoader { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Field_Generator_UEV.get(1L), 4000, 800000); - //UHV Energy Hatch + //UHV-UMV Energy Hatch & Dynamo TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_UV.get(1L), 24000, 16, 50000, 2, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -992,7 +1010,7 @@ public class DreamCraftRecipeLoader { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000), Materials.SolderingAlloy.getMolten(5760), }, ItemList.Hatch_Energy_MAX.get(1L), 1000, 2000000); - + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_UV.get(1L), 48000, 32, 100000, 4, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -1014,9 +1032,129 @@ public class DreamCraftRecipeLoader { Materials.SolderingAlloy.getMolten(5760)}, ItemList.Hatch_Dynamo_MAX.get(1L), 1000, 2000000); + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_MAX.get(1L), + 48000, 32, 100000, 4, new Object[]{ + getItemContainer("Hull_UEV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 4L), + ItemList.Circuit_Chip_QPIC.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 2L}, + ItemList.UHV_Coil.get(4L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(1L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000), + Materials.SolderingAlloy.getMolten(11520), + Materials.UUMatter.getFluid(8000L)}, + getItemContainer("Hatch_Energy_UEV").get(1L), 1000, 8000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_MAX.get(1L), + 96000, 64, 200000, 8, new Object[]{ + getItemContainer("Hull_UEV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 16L), + ItemList.Circuit_Chip_QPIC.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 2L}, + ItemList.UHV_Coil.get(4L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(1L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000), + Materials.SolderingAlloy.getMolten(11520), + Materials.UUMatter.getFluid(8000L)}, + getItemContainer("Hatch_Dynamo_UEV").get(1L), 1000, 8000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UEV").get(1L), + 96000, 64, 200000, 8, new Object[]{ + getItemContainer("Hull_UIV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 8L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("NanoCircuit").get(2), + ItemList.UHV_Coil.get(8L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(2L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 64000), + Materials.SolderingAlloy.getMolten(23040), + Materials.UUMatter.getFluid(16000L)}, + getItemContainer("Hatch_Energy_UIV").get(1L), 1000, 16000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UEV").get(1L), + 192000, 128, 400000, 16, new Object[]{ + getItemContainer("Hull_UIV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 32L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("NanoCircuit").get(2), + ItemList.UHV_Coil.get(8L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(2L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 64000), + Materials.SolderingAlloy.getMolten(23040), + Materials.UUMatter.getFluid(16000L)}, + getItemContainer("Hatch_Dynamo_UIV").get(1L), 1000, 16000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UIV").get(1L), + 192000, 128, 400000, 16, new Object[]{ + getItemContainer("Hull_UMV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 16L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("QuantumCircuit").get(2), + ItemList.UHV_Coil.get(16L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(4L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 128000), + Materials.SolderingAlloy.getMolten(46080), + Materials.UUMatter.getFluid(32000L)}, + getItemContainer("Hatch_Energy_UMV").get(1L), 1000, 32000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UIV").get(1L), + 384000, 256, 800000, 32, new Object[]{ + getItemContainer("Hull_UMV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 64L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("QuantumCircuit").get(2), + ItemList.UHV_Coil.get(16L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(4L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 128000), + Materials.SolderingAlloy.getMolten(46080), + Materials.UUMatter.getFluid(32000L)}, + getItemContainer("Hatch_Dynamo_UMV").get(1L), 1000, 32000000); + //UHV Circuit TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Wetwaresupercomputer.get(1L), - 24000, 64, 50000, 4, new ItemStack[]{ + 24000, 64, 50000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 2), ItemList.Circuit_Wetwaresupercomputer.get(2L), ItemList.ZPM_Coil.get(16L), @@ -1026,7 +1164,7 @@ public class DreamCraftRecipeLoader { ItemList.Circuit_Parts_DiodeASMD.get(16L), ItemList.Circuit_Chip_Ram.get(48L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 64L), - GT_OreDictUnificator.get(OrePrefixes.foil, (Materials.AnySyntheticRubber), 64L), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880L), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 10000), @@ -1035,7 +1173,7 @@ public class DreamCraftRecipeLoader { //Bio Chips TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biowarecomputer.get(1L), - 48000, 128, 500000, 8, new ItemStack[]{ + 48000, 128, 500000, 8, new Object[]{ ItemList.Circuit_Board_Bio_Ultra.get(2L), ItemList.Circuit_Biowarecomputer.get(2L), ItemList.Circuit_Parts_TransistorASMD.get(16L), @@ -1045,7 +1183,7 @@ public class DreamCraftRecipeLoader { ItemList.Circuit_Chip_NOR.get(32L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.NiobiumTitanium, 32L), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 16L), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(1440L), Materials.BioMediumSterilized.getFluid(1440L), @@ -1054,7 +1192,7 @@ public class DreamCraftRecipeLoader { ItemList.Circuit_Biowaresupercomputer.get(1L), 4000, 500000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biowaresupercomputer.get(1L), - 96000, 256, 1000000, 16, new ItemStack[]{ + 96000, 256, 1000000, 16, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 4L), ItemList.Circuit_Biowaresupercomputer.get(2L), ItemList.UV_Coil.get(16L), @@ -1064,7 +1202,7 @@ public class DreamCraftRecipeLoader { ItemList.Circuit_Parts_DiodeASMD.get(24L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 64), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880L), @@ -1072,9 +1210,9 @@ public class DreamCraftRecipeLoader { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000) }, ItemList.Circuit_Biomainframe.get(1L), 6000, 2000000); - //GTNH Circuits + //GTNH UIV, UMV, UXV Circuits TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biomainframe.get(1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 192000, 512, 2000000, 32, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 8), ItemList.Circuit_Biomainframe.get(2L), ItemList.Circuit_Parts_CapacitorASMD.get(32L), @@ -1085,7 +1223,7 @@ public class DreamCraftRecipeLoader { ItemList.Circuit_Chip_NPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Draconium, 64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(3744L), @@ -1117,7 +1255,7 @@ public class DreamCraftRecipeLoader { TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("PikoCircuit").get(1L), 720000, 2048, 8000000, 128, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 16), - getItemContainer("PikoCircuit").get(8L), + getItemContainer("PikoCircuit").get(2L), ItemList.Circuit_Parts_CapacitorASMD.get(64L), ItemList.Circuit_Parts_DiodeASMD.get(64L), ItemList.Circuit_Parts_TransistorASMD.get(64L), @@ -1133,31 +1271,31 @@ public class DreamCraftRecipeLoader { Materials.Osmium.getMolten(2304L) }, getItemContainer("QuantumCircuit").get(1L), 20000, 32000000); - //Stargate Stuff + //Stargate Recipes if (Loader.isModLoaded("eternalsingularity") && Loader.isModLoaded("SGCraft")) { TT_recipeAdder.addResearchableAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Infinity, 1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 32000000, 8192, 128000000, 1, new ItemStack[]{ GT_ModHandler.getModItem("eternalsingularity", "eternal_singularity", 1L), - ItemList.Sensor_UV.get(16L), + ItemList.Sensor_UEV.get(16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.CosmicNeutronium, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), - getItemContainer("NanoCircuit").get(1L).splitStack(16) + getItemContainer("QuantumCircuit").get(1L).splitStack(16) }, new FluidStack[]{ Materials.Neutronium.getMolten(36864L), Materials.Tritanium.getMolten(36864L), - Materials.Tetranaquadahdiindiumhexaplatiumosminid.getMolten(36864L), + Materials.Longasssuperconductornameforuhvwire.getMolten(36864L), Materials.Silver.getPlasma(36864L) }, - getItemContainer("StargateShieldingFoil").get(1L), 72000, 2000000); + getItemContainer("StargateShieldingFoil").get(1L), 72000, 500000000); TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("StargateShieldingFoil").get(1L), - 192000, 512, 2000000, 32, new ItemStack[]{ - ItemList.Electric_Piston_UV.get(16L), - ItemList.Electric_Motor_UV.get(64L), + 32000000, 8192, 128000000, 1, new ItemStack[]{ + ItemList.Electric_Piston_UEV.get(16L), + ItemList.Electric_Motor_UEV.get(64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NetherStar, 64L), @@ -1166,18 +1304,18 @@ public class DreamCraftRecipeLoader { GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Ardite, 8L), GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Ruby, 16L), GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Jasper, 16L), - getItemContainer("NanoCircuit").get(1L).splitStack(32) + getItemContainer("QuantumCircuit").get(1L).splitStack(32) }, new FluidStack[]{ Materials.Neutronium.getMolten(9216L), Materials.Tritanium.getMolten(9216L), - Materials.Tetranaquadahdiindiumhexaplatiumosminid.getMolten(9216L), + Materials.Longasssuperconductornameforuhvwire.getMolten(9216L), Materials.Silver.getPlasma(9216L) }, - getItemContainer("StargateChevron").get(1L), 72000, 2000000); + getItemContainer("StargateChevron").get(1L), 72000, 500000000); TT_recipeAdder.addResearchableAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 32000000, 8192, 128000000, 1, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Infinity, 64L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.CosmicNeutronium, 64L), @@ -1189,7 +1327,7 @@ public class DreamCraftRecipeLoader { Materials.Tritanium.getMolten(73728L), Materials.Concrete.getMolten(73728L) }, - getItemContainer("StargateFramePart").get(1L), 72000, 2000000); + getItemContainer("StargateFramePart").get(1L), 72000, 500000000); } //endregion @@ -1263,7 +1401,7 @@ public class DreamCraftRecipeLoader { ItemList.Circuit_Parts_DiodeASMD.get(64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760), + Materials.SolderingAlloy.getMolten(4608), Materials.Naquadria.getMolten(9216), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) }, ItemList.ZPM3.get(1), 4000, 1600000); @@ -1712,6 +1850,11 @@ public class DreamCraftRecipeLoader { ItemList.Emitter_LuV.get(1), ItemList.Electric_Pump_LuV.get(1), }, Materials.Chrome.getMolten(288), CustomItemList.enderLinkFluidCover.getWithDamage(1, 0), 320, 30720); + //Power Pass Upgrade Cover + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_Utility.getIntegratedCircuit(1) + }, null, CustomItemList.powerPassUpgradeCover.getWithDamage(1, 0), 320, 30720); //endregion //region recycling diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java index 67a363fc6c..65219271f9 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java @@ -50,7 +50,11 @@ public class GtppAtomLoader { Class clazz=Class.forName("gtPlusPlus.core.material.Material"); getUnlocalizedName=clazz.getMethod("getUnlocalizedName"); - getFluid=clazz.getMethod("getFluid", int.class); + try{ + getFluid=clazz.getMethod("getFluidStack", int.class); + }catch (Exception e){ + getFluid=clazz.getMethod("getFluid", int.class); + } clazz=Class.forName("gtPlusPlus.core.material.MaterialGenerator"); generate=clazz.getMethod("generate", Class.forName("gtPlusPlus.core.material.Material"), boolean.class, boolean.class); diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index 35d3a1b91f..a335b81793 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -10,11 +10,11 @@ import net.minecraft.tileentity.TileEntity; public class EssentiaCompat { public static EssentiaCompat essentiaContainerCompat; - public boolean check(GT_MetaTileEntity_MultiblockBase_EM meta){ + public boolean check(T meta,TileEntity te){ return false; } - public TileEntity getContainer(GT_MetaTileEntity_MultiblockBase_EM meta){ + public TileEntity getContainer(T meta){ return null; } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index 37df2c48cc..bd20269944 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -16,13 +16,12 @@ import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatte */ public class EssentiaCompatEnabled extends EssentiaCompat { @Override - public boolean check(GT_MetaTileEntity_MultiblockBase_EM meta) { - TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing()); - return tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable; + public boolean check(T meta,TileEntity te) { + return te instanceof TileEssentiaReservoir || te instanceof TileJarFillable; } @Override - public TileEntity getContainer(GT_MetaTileEntity_MultiblockBase_EM meta) { + public TileEntity getContainer(T meta) { TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing()); return tile!=null && !tile.isInvalid() && tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable ?tile:null; } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 267af79784..b061281daa 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,21 +1,19 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -26,13 +24,13 @@ import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; -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_ITEM_DIMINISHED; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; 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 gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -41,22 +39,24 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"0A0", E, "0A0",}, - {"121", "232", "121",}, - {"\"\"\"", "\"2\"", "\"\"\"",}, - {"202", "0!0", "202",}, - }; - private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, - GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", new String[][]{ + {"&&&", "&~&", "&&&",}, + {"0 0", " * ", "0 0",}, + {"121", "232", "121",}, + {"$$$", "$2$", "$$$",}, + {"202", "0!0", "202",},}) + .addElement('0', ofBlockAnyMeta(QuantumGlassBlock.INSTANCE)) + .addElement('1', ofBlock(sBlockCasingsTT, 0)) + .addElement('2', ofBlock(sBlockCasingsTT, 4)) + .addElement('3', ofBlock(sBlockCasingsTT, 8)) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('*', ofTileAdder(essentiaContainerCompat::check, StructureLibAPI.getBlockHint(),12)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.0"),//1 - Classic Hatches or High Power Casing @@ -83,7 +83,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -130,12 +130,12 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ TileEntity container = essentiaContainerCompat.getContainer(this); if (container == null) { stopMachine(); - }else{ - if(!essentiaContainerCompat.putInContainer(container,outputEssentiaName)){ + } else { + if (!essentiaContainerCompat.putInContainer(container, outputEssentiaName)) { stopMachine(); } } - outputEssentiaName=null; + outputEssentiaName = null; } @Override @@ -156,21 +156,25 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; if (hintsOnly) { TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); + StructureLibAPI.getBlockHint(), 12); } else { if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); + iGregTechTileEntity.getWorld().setBlock( + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + StructureLibAPI.getBlockHint(), 12, 2); } } - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } @Override @@ -181,12 +185,12 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setString("eOutputEssentia",outputEssentiaName); + aNBT.setString("eOutputEssentia", outputEssentiaName); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - outputEssentiaName=aNBT.getString("eOutputEssentia"); + outputEssentiaName = aNBT.getString("eOutputEssentia"); } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index a381a37f89..6d315fa30a 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -2,22 +2,20 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -26,11 +24,11 @@ import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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 gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -39,22 +37,24 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"0A0", E, "0A0",}, - {"121", "232", "121",}, - {"\"\"\"", "\"1\"", "\"\"\"",}, - {"010", "1!1", "010",}, - }; - private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, - GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", new String[][]{ + {"&&&", "&~&", "&&&",}, + {"0 0", " * ", "0 0",}, + {"121", "232", "121",}, + {"$$$", "$1$", "$$$",}, + {"010", "1!1", "010",},}) + .addElement('0', ofBlockAnyMeta(QuantumGlassBlock.INSTANCE)) + .addElement('1', ofBlock(sBlockCasingsTT, 4)) + .addElement('2', ofBlock(sBlockCasingsTT, 0)) + .addElement('3', ofBlock(sBlockCasingsTT, 8)) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('*', ofTileAdder(essentiaContainerCompat::check, StructureLibAPI.getBlockHint(),12)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.0"),//1 - Classic Hatches or High Power Casing @@ -79,7 +79,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -138,13 +138,17 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); + StructureLibAPI.getBlockHint(), 12); } else { if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); + iGregTechTileEntity.getWorld().setBlock( + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + StructureLibAPI.getBlockHint(), 12, 2); } } - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java deleted file mode 100644 index dd5cd59ac7..0000000000 --- a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.github.technus.tectech.entity.fx; - -import com.github.technus.tectech.TecTech; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Dyes; -import net.minecraft.block.Block; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.init.Blocks; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class BlockHint extends EntityFX { - private IIcon[] icons = new IIcon[6]; - private short[] mRGBa = Dyes._NULL.mRGBa; - - public BlockHint(World world){ - this(world,0,0,0, Blocks.stone,0); - } - - /** - * - * @param world - * @param x - * @param y - * @param z - * @param icons DOWN, UP, NORTH, SOUTH, WEST, EAST - */ - public BlockHint(World world, int x, int y, int z, IIcon[] icons) { - super(world, x + .25, y + .5, z + .25); - particleGravity = 0; - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - noClip = true; - particleMaxAge = 2000 + TecTech.RANDOM.nextInt(200); - this.icons=icons; - } - - public BlockHint(World world, int x, int y, int z, Block block, int meta) { - super(world, x+.25, y+.5, z+.25); - particleGravity = 0; - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - noClip = true; - particleMaxAge = 2000 + TecTech.RANDOM.nextInt(200); - for (int i = 0; i < 6; i++) { - icons[i] = block.getIcon(i, meta); - } - } - - public BlockHint withColorTint(short[] coloure){ - this.mRGBa =coloure; - return this; - } - - @Override - public void renderParticle(Tessellator tes, float subTickTime, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) { - float size = .5f; - float X = (float) (prevPosX + (posX - prevPosX) * (double) subTickTime - EntityFX.interpPosX); - float Y = (float) (prevPosY + (posY - prevPosY) * (double) subTickTime - EntityFX.interpPosY) - size / 2; - float Z = (float) (prevPosZ + (posZ - prevPosZ) * (double) subTickTime - EntityFX.interpPosZ); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDepthMask(false); - tes.setColorRGBA((int) (mRGBa[0] * .9F), (int) (mRGBa[1] * .95F), (int) (mRGBa[2] * 1F), 192); - - //var8, var9 - X U - //var 10, var 11 - Y V - for(int i=0;i<6;i++){ - if(icons[i]==null) { - continue; - } - double u=icons[i].getMinU(); - double U=icons[i].getMaxU(); - double v=icons[i].getMinV(); - double V=icons[i].getMaxV(); - switch (i){//{DOWN, UP, NORTH, SOUTH, WEST, EAST} - case 0: - tes.addVertexWithUV(X, Y, Z + size, u, V); - tes.addVertexWithUV(X, Y, Z, u, v); - tes.addVertexWithUV(X + size, Y, Z, U, v); - tes.addVertexWithUV(X + size, Y, Z + size, U, V); - break; - case 1: - tes.addVertexWithUV(X, Y + size, Z, u, v); - tes.addVertexWithUV(X, Y + size, Z + size, u, V); - tes.addVertexWithUV(X + size, Y + size, Z + size, U, V); - tes.addVertexWithUV(X + size, Y + size, Z, U, v); - break; - case 2: - tes.addVertexWithUV(X, Y, Z, U, V); - tes.addVertexWithUV(X, Y + size, Z, U, v); - tes.addVertexWithUV(X + size, Y + size, Z, u, v); - tes.addVertexWithUV(X + size, Y, Z, u, V); - break; - case 3: - tes.addVertexWithUV(X + size, Y, Z + size, U, V); - tes.addVertexWithUV(X + size, Y + size, Z + size, U, v); - tes.addVertexWithUV(X, Y + size, Z + size, u, v); - tes.addVertexWithUV(X, Y, Z + size, u, V); - break; - case 4: - tes.addVertexWithUV(X, Y, Z + size, U, V); - tes.addVertexWithUV(X, Y + size, Z + size, U, v); - tes.addVertexWithUV(X, Y + size, Z, u, v); - tes.addVertexWithUV(X, Y, Z, u, V); - break; - case 5: - tes.addVertexWithUV(X + size, Y, Z, U, V); - tes.addVertexWithUV(X + size, Y + size, Z, U, v); - tes.addVertexWithUV(X + size, Y + size, Z + size, u, v); - tes.addVertexWithUV(X + size, Y, Z + size, u, V); - break; - } - } - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDepthMask(true); - } - - @Override - public int getFXLayer() { - return 1; - } - - @Override - public boolean shouldRenderInPass(int pass) { - return pass==2; - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java deleted file mode 100644 index dc282ec0b6..0000000000 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.github.technus.tectech.loader; - -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.registerMetaClass; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHint; -import static gregtech.api.GregTech_API.sBlockCasings1; - -public class ConstructableLoader implements Runnable { - - @Override - public void run() { - registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { - //region Structure - private final IStructureDefinition definition= - StructureDefinition.builder() - .addShapeOldApi("main",new String[][]{ - {"000","\"\"\"","\"\"\""," . ",}, - {"0!0","\"A\"","\"A\""," ",}, - {"000","\"\"\"","\"\"\""," ",}, - }) - .addElement('0', ofBlock(sBlockCasings1,11)) - .addElement('\"', ofHint(3)) - .addElement('!', ofHint(2)) - .addElement(' ', ofHint(1)) - .build(); - private final String[] desc=new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or Heat Proof Casing", - "2 - Muffler Hatch", - "3 - Coil blocks" - }; - //endregion - - @Override - public void construct(ItemStack stackSize, boolean hintsOnly, GT_MetaTileEntity_ElectricBlastFurnace tileEntity, ExtendedFacing aSide) { - IGregTechTileEntity base = tileEntity.getBaseMetaTileEntity(); - definition.buildOrHints(tileEntity, stackSize, "main", base.getWorld(), - aSide, base.getXCoord(), base.getYCoord(), - base.getZCoord(), 1, 3, 0, hintsOnly); - } - - @Override - public String[] getDescription(ItemStack stackSize) { - return desc; - } - }); - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index b9d737f98a..fd638aba6d 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -125,7 +125,7 @@ public final class MainLoader { } public static void postLoad(EMDefinitionsRegistry registry, EMTransformationRegistry transformationInfo) { - ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 6); + ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 5); progressBarPostLoad.step("Dreamcraft Compatibility"); if(Loader.isModLoaded(Reference.DREAMCRAFT)){ @@ -162,10 +162,6 @@ public final class MainLoader { TecTech.LOGGER.info("Blocks were not nerfed"); } - progressBarPostLoad.step("Constructable stuff"); - new ConstructableLoader().run(); - TecTech.LOGGER.info("Constructable initialized"); - ProgressManager.pop(progressBarPostLoad); } diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java index 1edd924587..8401af51ca 100644 --- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java +++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java @@ -3,10 +3,9 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import com.github.technus.tectech.mechanics.enderStorage.EnderLinkCoverMessage; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; import com.github.technus.tectech.mechanics.spark.RendererMessage; -import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; -import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; import static com.github.technus.tectech.Reference.MODID; @@ -24,9 +23,6 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher registerMessage(PipeActivityMessage.ServerHandler.class, PipeActivityMessage.PipeActivityQuery.class); registerMessage(PipeActivityMessage.ClientHandler.class, PipeActivityMessage.PipeActivityData.class); - registerMessage(AlignmentMessage.ServerHandler.class, AlignmentMessage.AlignmentQuery.class); - registerMessage(AlignmentMessage.ClientHandler.class, AlignmentMessage.AlignmentData.class); - registerMessage(ChunkDataMessage.ServerHandler.class, ChunkDataMessage.ChunkDataQuery.class); registerMessage(ChunkDataMessage.ClientHandler.class, ChunkDataMessage.ChunkDataData.class); diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java index d91d0e5900..c6c71ae630 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java @@ -8,10 +8,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.item.ConstructableTriggerItem; import com.github.technus.tectech.thing.item.EuMeterGT; -import com.github.technus.tectech.thing.item.FrontRotationTriggerItem; +import com.gtnewhorizon.structurelib.StructureLibAPI; import cpw.mods.fml.common.Loader; import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; @@ -47,22 +45,12 @@ public class BaseRecipeLoader { // =================================================================================================== for(int i=0;i<=15;i++) { - RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, Materials.Aluminium.getMolten(864), new ItemStack(TT_Container_Casings.sHintCasingsTT, 1, i), 32, 120); + RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, + Materials.Aluminium.getMolten(864), + new ItemStack(StructureLibAPI.getBlockHint(), 1, i), 32, 120); } - //Scrench - GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"fPR", " RP", "S h", - 'P', OrePrefixes.plate.get(Materials.Cobalt), - 'R', OrePrefixes.stick.get(Materials.Cobalt), - 'S', OrePrefixes.stick.get(Materials.Wood),}); - - //BLUEprint - GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); - //GT EU reader GT_ModHandler.addCraftingRecipe(new ItemStack(EuMeterGT.INSTANCE,1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, @@ -95,16 +83,15 @@ public class BaseRecipeLoader { 'E', ItemList.Hull_IV}); //Data Bank - RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new ItemStack[]{ + RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, ItemList.Tool_DataOrb.get(1), ItemList.Cover_Screen.get(1), }, new FluidStack[]{ new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), Materials.Hydrogen.getGas(1000), }, CustomItemList.Machine_Multi_DataBank.get(1), 12000, 14000); - //CustomItemList.Machine_Multi_DataBank //Bucks //RA.addAssemblerRecipe(CustomItemList.) diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index 4adeeec315..d144d74618 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -33,8 +33,6 @@ public class ThingsLoader implements Runnable { TecTech.LOGGER.info("Elemental Casing registered"); TT_Container_Casings.sBlockCasingsBA0 = new GT_Block_CasingsBA0(); TecTech.LOGGER.info("Nikolai's Casing registered"); - TT_Container_Casings.sHintCasingsTT = new GT_Block_HintTT(); - TecTech.LOGGER.info("Hint Blocks registered"); QuantumGlassBlock.run(); TecTech.LOGGER.info("Quantum Glass registered"); @@ -52,8 +50,6 @@ public class ThingsLoader implements Runnable { ReactorSimBlock.run(); TecTech.LOGGER.info("Reactor Simulator registered"); - ConstructableTriggerItem.run(); - FrontRotationTriggerItem.run(); ParametrizerMemoryCard.run(); ElementalDefinitionScanStorage_EM.run(); EuMeterGT.run(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java deleted file mode 100644 index 26a6d80dd8..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment; - -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; -import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Random; -import java.util.function.Function; - -import static com.github.technus.tectech.mechanics.alignment.IAlignment.STATES_COUNT; - -public class AlignmentLimits implements IAlignmentLimits { - - protected final boolean[] validStates=new boolean[STATES_COUNT]; - - public AlignmentLimits() { - allowAll(); - } - - AlignmentLimits allowAll(){ - Arrays.fill(validStates,true); - return this; - } - - AlignmentLimits denyAll(){ - Arrays.fill(validStates,false); - return this; - } - - AlignmentLimits randomAll(Random random){ - for (int i = 0; i < validStates.length; i++) { - validStates[i]=random.nextBoolean(); - } - return this; - } - - AlignmentLimits deny(ExtendedFacing... deny){ - if(deny!=null){ - for (ExtendedFacing extendedFacing : deny) { - validStates[extendedFacing.getIndex()]=false; - } - } - return this; - } - - AlignmentLimits allow(ExtendedFacing... allow){ - if(allow!=null){ - for (ExtendedFacing extendedFacing : allow) { - validStates[extendedFacing.getIndex()]=false; - } - } - return this; - } - - AlignmentLimits deny(ForgeDirection... deny){ - if(deny!=null){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - for (ForgeDirection direction : deny) { - if (value.getDirection() == direction) { - validStates[value.getIndex()] = false; - break; - } - } - } - } - return this; - } - - AlignmentLimits allow(ForgeDirection... allow){ - if(allow!=null){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - for (ForgeDirection direction : allow) { - if (value.getDirection() == direction) { - validStates[value.getIndex()] = true; - break; - } - } - } - } - return this; - } - - AlignmentLimits deny(Rotation... deny){ - if(deny!=null){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - for (Rotation rotation : deny) { - if (value.getRotation() == rotation) { - validStates[value.getIndex()] = false; - break; - } - } - } - } - return this; - } - - AlignmentLimits allow(Rotation... allow){ - if(allow!=null){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - for (Rotation rotation : allow) { - if (value.getRotation() == rotation) { - validStates[value.getIndex()] = true; - break; - } - } - } - } - return this; - } - - AlignmentLimits deny(Flip... deny){ - if(deny!=null){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - for (Flip flip : deny) { - if (value.getFlip() == flip) { - validStates[value.getIndex()] = false; - break; - } - } - } - } - return this; - } - - AlignmentLimits allow(Flip... allow){ - if(allow!=null){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - for (Flip flip : allow) { - if (value.getFlip() == flip) { - validStates[value.getIndex()] = true; - break; - } - } - } - } - return this; - } - - AlignmentLimits predicateApply(Function> predicate){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - predicate.apply(value).ifPresent(bool->validStates[value.getIndex()]=bool); - } - return this; - } - - AlignmentLimits ensureDuplicates(){ - for (ExtendedFacing value : ExtendedFacing.VALUES) { - if(validStates[value.getIndex()]){ - validStates[value.getDuplicate().getIndex()]=true; - } - } - return this; - } - - /** - * Prefers rotation over flip, so both flip will get translated to opposite rotation and no flip - * @param flip the preferred flip to be used Horizontal or vertical - * @return this - */ - AlignmentLimits ensureNoDuplicates(Flip flip){ - if(flip==Flip.BOTH||flip==Flip.NONE){ - throw new IllegalArgumentException("Preffered Flip must be Horizontal or Vertical"); - } - flip=flip.getOpposite(); - for (ExtendedFacing value : ExtendedFacing.VALUES) { - if(validStates[value.getIndex()]){ - if(value.getFlip()==Flip.BOTH || value.getFlip()==flip){ - validStates[value.getIndex()]=false; - validStates[value.getDuplicate().getIndex()]=true; - } - } - } - return this; - } - - @Override - public boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip) { - return validStates[IAlignment.getAlignmentIndex(direction,rotation,flip)]; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java deleted file mode 100644 index 07a3e02c1f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment; - -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; -import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; - -public class AlignmentMessage implements IMessage { - int mPosX; - int mPosY; - int mPosZ; - int mPosD; - int mAlign; - - public AlignmentMessage() { - } - - private AlignmentMessage(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - IGregTechTileEntity base=metaTile.getBaseMetaTileEntity(); - mPosX=base.getXCoord(); - mPosY=base.getYCoord(); - mPosZ=base.getZCoord(); - mPosD=base.getWorld().provider.dimensionId; - mAlign =metaTile.getExtendedFacing().getIndex(); - } - - private AlignmentMessage(World world, int x, int y, int z, IAlignment front) { - mPosX=x; - mPosY=y; - mPosZ=z; - mPosD=world.provider.dimensionId; - mAlign =front.getExtendedFacing().getIndex(); - } - - @Override - public void fromBytes(ByteBuf pBuffer) { - NBTTagCompound tTag = ByteBufUtils.readTag(pBuffer); - mPosX = tTag.getInteger("posx"); - mPosY = tTag.getInteger("posy"); - mPosZ = tTag.getInteger("posz"); - mPosD = tTag.getInteger("posd"); - mAlign = tTag.getInteger("rotf"); - } - - @Override - public void toBytes(ByteBuf pBuffer) { - NBTTagCompound tFXTag = new NBTTagCompound(); - tFXTag.setInteger("posx", mPosX); - tFXTag.setInteger("posy", mPosY); - tFXTag.setInteger("posz", mPosZ); - tFXTag.setInteger("posd", mPosD); - tFXTag.setInteger("rotf", mAlign); - - ByteBufUtils.writeTag(pBuffer, tFXTag); - } - - public static class AlignmentQuery extends AlignmentMessage { - public AlignmentQuery() { - } - - public AlignmentQuery(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - super(metaTile); - } - - public AlignmentQuery(World world, int x, int y, int z, IAlignment front) { - super(world,x,y,z,front); - } - } - - public static class AlignmentData extends AlignmentMessage { - public AlignmentData() { - } - - private AlignmentData(AlignmentQuery query){ - mPosX=query.mPosX; - mPosY=query.mPosY; - mPosZ=query.mPosZ; - mPosD=query.mPosD; - mAlign =query.mAlign; - } - - public AlignmentData(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - super(metaTile); - } - - public AlignmentData(World world, int x, int y, int z, IAlignment front) { - super(world,x,y,z,front); - } - } - - public static class ClientHandler extends AbstractClientMessageHandler { - @Override - public IMessage handleClientMessage(EntityPlayer pPlayer, AlignmentData pMessage, MessageContext pCtx) { - if(pPlayer.worldObj.provider.dimensionId==pMessage.mPosD){ - TileEntity te=pPlayer.worldObj.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ); - if(te instanceof IGregTechTileEntity){ - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if(meta instanceof IAlignment){ - ((IAlignment) meta).setExtendedFacing(ExtendedFacing.byIndex(pMessage.mAlign)); - } - }else if (te instanceof IAlignment){ - ((IAlignment) te).setExtendedFacing(ExtendedFacing.byIndex(pMessage.mAlign)); - } - } - return null; - } - } - - public static class ServerHandler extends AbstractServerMessageHandler { - @Override - public IMessage handleServerMessage(EntityPlayer pPlayer, AlignmentQuery pMessage, MessageContext pCtx) { - World world= DimensionManager.getWorld(pMessage.mPosD); - if(world!=null) { - TileEntity te = world.getTileEntity(pMessage.mPosX, pMessage.mPosY, pMessage.mPosZ); - if (te instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (meta instanceof IAlignment) { - pMessage.mAlign =((IAlignment) meta).getExtendedFacing().getIndex(); - return new AlignmentData(pMessage); - } - } else if (te instanceof IAlignment) { - pMessage.mAlign =((IAlignment) te).getExtendedFacing().getIndex(); - return new AlignmentData(pMessage); - } - } - return null; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java deleted file mode 100644 index 68e11b77af..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; - -public class AlignmentUtility { - private AlignmentUtility(){ - - } - - public static boolean handle(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ){ - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if(tTileEntity==null || aPlayer instanceof FakePlayer) { - return aPlayer instanceof EntityPlayerMP; - } - if (aPlayer instanceof EntityPlayerMP) { - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IAlignmentProvider) { - IAlignment alignment = ((IAlignmentProvider) metaTE).getAlignment(); - if(aPlayer.isSneaking()){ - alignment.toolSetFlip(null); - }else { - alignment.toolSetRotation(null); - } - return true; - } - } else if (tTileEntity instanceof IAlignmentProvider) { - IAlignment alignment = ((IAlignmentProvider) tTileEntity).getAlignment(); - if(aPlayer.isSneaking()){ - alignment.toolSetFlip(null); - }else { - alignment.toolSetRotation(null); - } - return true; - } - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java deleted file mode 100644 index a2a6301070..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment; - -import com.github.technus.tectech.mechanics.alignment.enumerable.Direction; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; -import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.Arrays; - -public interface IAlignment extends IAlignmentLimits,IAlignmentProvider { - int DIRECTIONS_COUNT= Direction.VALUES.length; - int ROTATIONS_COUNT= Rotation.VALUES.length; - int FLIPS_COUNT= Flip.VALUES.length; - int STATES_COUNT = ExtendedFacing.VALUES.length; - - ExtendedFacing getExtendedFacing(); - - void setExtendedFacing(ExtendedFacing alignment); - - IAlignmentLimits getAlignmentLimits(); - - void setAlignmentLimits(IAlignmentLimits limits); - - @Override - default IAlignment getAlignment(){ - return this; - } - - static int getAlignmentIndex(ForgeDirection direction, Rotation rotation, Flip flip){ - return (direction.ordinal()*ROTATIONS_COUNT+rotation.getIndex())*FLIPS_COUNT+flip.getIndex(); - } - - default ForgeDirection getDirection(){ - return getExtendedFacing().getDirection(); - } - - default void setDirection(ForgeDirection direction){ - setExtendedFacing(getExtendedFacing().with(direction)); - } - - default Rotation getRotation(){ - return getExtendedFacing().getRotation(); - } - - default void setRotation(Rotation rotation){ - setExtendedFacing(getExtendedFacing().with(rotation)); - } - - default Flip getFlip(){ - return getExtendedFacing().getFlip(); - } - - default void setFlip(Flip flip){ - setExtendedFacing(getExtendedFacing().with(flip)); - } - - default boolean toolSetDirection(ForgeDirection direction){ - if(direction==null || direction==ForgeDirection.UNKNOWN){ - for (int i = 0,j=getDirection().ordinal()+1, valuesLength = Direction.VALUES.length; i < valuesLength; i++) { - if(toolSetDirection(Direction.VALUES[j%valuesLength].getForgeDirection())){ - return true; - } - } - }else { - for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) { - if(checkedSetExtendedFacing(extendedFacing)){ - return true; - } - } - } - return false; - } - - default boolean checkedSetDirection(ForgeDirection direction){ - if (isNewDirectionValid(direction)){ - setDirection(direction); - return true; - } - return false; - } - - default boolean canSetToDirectionAny(ForgeDirection direction){ - for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) { - if(isNewExtendedFacingValid(extendedFacing)){ - return true; - } - } - return false; - } - - default boolean toolSetRotation(Rotation rotation) { - if(rotation==null){ - int flips = Flip.VALUES.length; - int rotations = Rotation.VALUES.length; - for (int ii = 0,jj=getFlip().ordinal(); ii < flips; ii++) { - for (int i = 0,j=getRotation().ordinal()+1; i < rotations; i++) { - if(checkedSetExtendedFacing(ExtendedFacing.of(getDirection(),Rotation.VALUES[j%rotations],Flip.VALUES[jj%flips]))){ - return true; - } - } - } - return false; - }else { - return checkedSetRotation(rotation); - } - } - - default boolean checkedSetRotation(Rotation rotation){ - if (isNewRotationValid(rotation)){ - setRotation(rotation); - return true; - } - return false; - } - - default boolean toolSetFlip(Flip flip){ - if(flip==null){ - for (int i = 0,j=getFlip().ordinal()+1, valuesLength = Flip.VALUES.length; i < valuesLength; i++) { - if(toolSetFlip(Flip.VALUES[j%valuesLength])){ - return true; - } - } - return false; - }else { - return checkedSetFlip(flip); - } - } - - default boolean checkedSetFlip(Flip flip){ - if (isNewFlipValid(flip)){ - setFlip(flip); - return true; - } - return false; - } - - default boolean toolSetExtendedFacing(ExtendedFacing extendedFacing){ - if(extendedFacing==null){ - for (int i = 0,j=getExtendedFacing().ordinal()+1, valuesLength = ExtendedFacing.VALUES.length; i < valuesLength; i++) { - if(toolSetExtendedFacing(ExtendedFacing.VALUES[j%valuesLength])){ - return true; - } - } - return false; - }else { - return checkedSetExtendedFacing(extendedFacing); - } - } - - default boolean checkedSetExtendedFacing(ExtendedFacing alignment){ - if (isNewExtendedFacingValid(alignment)){ - setExtendedFacing(alignment); - return true; - } - return false; - } - - default boolean isNewDirectionValid(ForgeDirection direction) { - return isNewExtendedFacingValid(direction,getRotation(),getFlip()); - } - - default boolean isNewRotationValid(Rotation rotation){ - return isNewExtendedFacingValid(getDirection(),rotation,getFlip()); - } - - default boolean isNewFlipValid(Flip flip){ - return isNewExtendedFacingValid(getDirection(),getRotation(),flip); - } - - default boolean isExtendedFacingValid() { - return isNewExtendedFacingValid(getDirection(),getRotation(),getFlip()); - } - - @Override - default boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip){ - return getAlignmentLimits().isNewExtendedFacingValid(direction, rotation, flip); - } - - @Override - default boolean isNewExtendedFacingValid(ExtendedFacing alignment){ - return getAlignmentLimits().isNewExtendedFacingValid( - alignment.getDirection(), - alignment.getRotation(), - alignment.getFlip()); - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java deleted file mode 100644 index 68b4d84dab..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; -import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; -import net.minecraftforge.common.util.ForgeDirection; - -public interface IAlignmentLimits { - - IAlignmentLimits UNLIMITED= (direction, rotation, flip) -> true; - - boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip); - - default boolean isNewExtendedFacingValid(ExtendedFacing alignment){ - return isNewExtendedFacingValid( - alignment.getDirection(), - alignment.getRotation(), - alignment.getFlip()); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java deleted file mode 100644 index 07dc972aac..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment; - -public interface IAlignmentProvider { - IAlignment getAlignment(); -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java deleted file mode 100644 index 1c44164731..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment; - -import com.github.technus.tectech.util.Vec3Impl; -import net.minecraft.util.Vec3; -import net.minecraftforge.common.util.ForgeDirection; - -import static com.github.technus.tectech.mechanics.alignment.enumerable.Direction.getAxisVector; -import static java.lang.Math.abs; - -public class IntegerAxisSwap { - private final Vec3Impl forFirstAxis; - private final Vec3Impl forSecondAxis; - private final Vec3Impl forThirdAxis; - - public IntegerAxisSwap(ForgeDirection forFirstAxis, ForgeDirection forSecondAxis, ForgeDirection forThirdAxis) { - this.forFirstAxis = getAxisVector(forFirstAxis); - this.forSecondAxis = getAxisVector(forSecondAxis); - this.forThirdAxis = getAxisVector(forThirdAxis); - if(abs(this.forFirstAxis.get0())+abs(this.forSecondAxis.get0())+abs(this.forThirdAxis.get0())!=1 || - abs(this.forFirstAxis.get1())+abs(this.forSecondAxis.get1())+abs(this.forThirdAxis.get1())!=1 || - abs(this.forFirstAxis.get2())+abs(this.forSecondAxis.get2())+abs(this.forThirdAxis.get2())!=1){ - throw new IllegalArgumentException("Axis are overlapping/missing! "+ - forFirstAxis.name()+" "+ - forSecondAxis.name()+" "+ - forThirdAxis.name()); - } - } - - public Vec3Impl translate(Vec3Impl point){ - return new Vec3Impl( - forFirstAxis.get0()*point.get0() +forFirstAxis.get1()*point.get1() +forFirstAxis.get2()*point.get2(), - forSecondAxis.get0()*point.get0()+forSecondAxis.get1()*point.get1()+forSecondAxis.get2()*point.get2(), - forThirdAxis.get0()*point.get0() +forThirdAxis.get1()*point.get1() +forThirdAxis.get2()*point.get2() - ); - } - - public Vec3Impl inverseTranslate(Vec3Impl point){ - return new Vec3Impl( - forFirstAxis.get0()*point.get0()+forSecondAxis.get0()*point.get1()+forThirdAxis.get0()*point.get2(), - forFirstAxis.get1()*point.get0()+forSecondAxis.get1()*point.get1()+forThirdAxis.get1()*point.get2(), - forFirstAxis.get2()*point.get0()+forSecondAxis.get2()*point.get1()+forThirdAxis.get2()*point.get2() - ); - } - - public Vec3 translate(Vec3 point){ - return Vec3.createVectorHelper( - forFirstAxis.get0()*point.xCoord +forFirstAxis.get1()*point.yCoord +forFirstAxis.get2()*point.zCoord, - forSecondAxis.get0()*point.xCoord+forSecondAxis.get1()*point.yCoord+forSecondAxis.get2()*point.zCoord, - forThirdAxis.get0()*point.xCoord +forThirdAxis.get1()*point.yCoord +forThirdAxis.get2()*point.zCoord - ); - } - - public Vec3 inverseTranslate(Vec3 point){ - return Vec3.createVectorHelper( - forFirstAxis.get0()*point.xCoord+forSecondAxis.get0()*point.yCoord+forThirdAxis.get0()*point.zCoord, - forFirstAxis.get1()*point.xCoord+forSecondAxis.get1()*point.yCoord+forThirdAxis.get1()*point.zCoord, - forFirstAxis.get2()*point.xCoord+forSecondAxis.get2()*point.yCoord+forThirdAxis.get2()*point.zCoord - ); - } - - public void translate(int[] point,int[] out){ - out[0]=forFirstAxis.get0()*point[0] +forFirstAxis.get1()*point[1] +forFirstAxis.get2()*point[2]; - out[1]=forSecondAxis.get0()*point[0]+forSecondAxis.get1()*point[1]+forSecondAxis.get2()*point[2]; - out[2]=forThirdAxis.get0()*point[0] +forThirdAxis.get1()*point[1] +forThirdAxis.get2()*point[2]; - } - - public void inverseTranslate(int[] point,int[] out){ - out[0]=forFirstAxis.get0()*point[0]+forSecondAxis.get0()*point[1]+forThirdAxis.get0()*point[2]; - out[1]=forFirstAxis.get1()*point[0]+forSecondAxis.get1()*point[1]+forThirdAxis.get1()*point[2]; - out[2]=forFirstAxis.get2()*point[0]+forSecondAxis.get2()*point[1]+forThirdAxis.get2()*point[2]; - } - - public void translate(double[] point,double[] out){ - out[0]=forFirstAxis.get0()*point[0] +forFirstAxis.get1()*point[1] +forFirstAxis.get2()*point[2]; - out[1]=forSecondAxis.get0()*point[0]+forSecondAxis.get1()*point[1]+forSecondAxis.get2()*point[2]; - out[2]=forThirdAxis.get0()*point[0] +forThirdAxis.get1()*point[1] +forThirdAxis.get2()*point[2]; - } - - public void inverseTranslate(double[] point,double[] out){ - out[0]=forFirstAxis.get0()*point[0]+forSecondAxis.get0()*point[1]+forThirdAxis.get0()*point[2]; - out[1]=forFirstAxis.get1()*point[0]+forSecondAxis.get1()*point[1]+forThirdAxis.get1()*point[2]; - out[2]=forFirstAxis.get2()*point[0]+forSecondAxis.get2()*point[1]+forThirdAxis.get2()*point[2]; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java deleted file mode 100644 index cc3971fedb..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment.enumerable; - -import com.github.technus.tectech.util.Vec3Impl; -import net.minecraftforge.common.util.ForgeDirection; - -public enum Direction { - DOWN(ForgeDirection.DOWN), - UP(ForgeDirection.UP), - NORTH(ForgeDirection.NORTH), - SOUTH(ForgeDirection.SOUTH), - WEST(ForgeDirection.WEST), - EAST(ForgeDirection.EAST); - - private final ForgeDirection forgeDirection; - private final Vec3Impl axisVector; - public static final Direction[] VALUES=values(); - - Direction(ForgeDirection forgeDirection) { - this.forgeDirection = forgeDirection; - axisVector=new Vec3Impl(forgeDirection.offsetX,forgeDirection.offsetY,forgeDirection.offsetZ); - } - - public ForgeDirection getForgeDirection() { - return forgeDirection; - } - - public Vec3Impl getAxisVector() { - return axisVector; - } - - public static Vec3Impl getAxisVector(ForgeDirection forgeDirection){ - return VALUES[forgeDirection.ordinal()].axisVector; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java deleted file mode 100644 index 5949b432df..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java +++ /dev/null @@ -1,358 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment.enumerable; - -import com.github.technus.tectech.mechanics.alignment.IAlignment; -import com.github.technus.tectech.mechanics.alignment.IntegerAxisSwap; -import com.github.technus.tectech.util.Vec3Impl; -import net.minecraft.util.Vec3; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.*; - -import static com.github.technus.tectech.mechanics.alignment.IAlignment.FLIPS_COUNT; -import static com.github.technus.tectech.mechanics.alignment.IAlignment.ROTATIONS_COUNT; -import static java.lang.Math.abs; -import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toMap; - -public enum ExtendedFacing { - DOWN_NORMAL_NONE("down normal none"), - DOWN_NORMAL_HORIZONTAL("down normal horizontal"), - DOWN_NORMAL_VERTICAL("down normal vertical"), - DOWN_NORMAL_BOTH("down normal both"), - DOWN_CLOCKWISE_NONE("down clockwise none"), - DOWN_CLOCKWISE_HORIZONTAL("down clockwise horizontal"), - DOWN_CLOCKWISE_VERTICAL("down clockwise vertical"), - DOWN_CLOCKWISE_BOTH("down clockwise both"), - DOWN_UPSIDE_DOWN_NONE("down upside down none"), - DOWN_UPSIDE_DOWN_HORIZONTAL("down upside down horizontal"), - DOWN_UPSIDE_DOWN_VERTICAL("down upside down vertical"), - DOWN_UPSIDE_DOWN_BOTH("down upside down both"), - DOWN_COUNTER_CLOCKWISE_NONE("down counter clockwise none"), - DOWN_COUNTER_CLOCKWISE_HORIZONTAL("down counter clockwise horizontal"), - DOWN_COUNTER_CLOCKWISE_VERTICAL("down counter clockwise vertical"), - DOWN_COUNTER_CLOCKWISE_BOTH("down counter clockwise both"), - UP_NORMAL_NONE("up normal none"), - UP_NORMAL_HORIZONTAL("up normal horizontal"), - UP_NORMAL_VERTICAL("up normal vertical"), - UP_NORMAL_BOTH("up normal both"), - UP_CLOCKWISE_NONE("up clockwise none"), - UP_CLOCKWISE_HORIZONTAL("up clockwise horizontal"), - UP_CLOCKWISE_VERTICAL("up clockwise vertical"), - UP_CLOCKWISE_BOTH("up clockwise both"), - UP_UPSIDE_DOWN_NONE("up upside down none"), - UP_UPSIDE_DOWN_HORIZONTAL("up upside down horizontal"), - UP_UPSIDE_DOWN_VERTICAL("up upside down vertical"), - UP_UPSIDE_DOWN_BOTH("up upside down both"), - UP_COUNTER_CLOCKWISE_NONE("up counter clockwise none"), - UP_COUNTER_CLOCKWISE_HORIZONTAL("up counter clockwise horizontal"), - UP_COUNTER_CLOCKWISE_VERTICAL("up counter clockwise vertical"), - UP_COUNTER_CLOCKWISE_BOTH("up counter clockwise both"), - NORTH_NORMAL_NONE("north normal none"), - NORTH_NORMAL_HORIZONTAL("north normal horizontal"), - NORTH_NORMAL_VERTICAL("north normal vertical"), - NORTH_NORMAL_BOTH("north normal both"), - NORTH_CLOCKWISE_NONE("north clockwise none"), - NORTH_CLOCKWISE_HORIZONTAL("north clockwise horizontal"), - NORTH_CLOCKWISE_VERTICAL("north clockwise vertical"), - NORTH_CLOCKWISE_BOTH("north clockwise both"), - NORTH_UPSIDE_DOWN_NONE("north upside down none"), - NORTH_UPSIDE_DOWN_HORIZONTAL("north upside down horizontal"), - NORTH_UPSIDE_DOWN_VERTICAL("north upside down vertical"), - NORTH_UPSIDE_DOWN_BOTH("north upside down both"), - NORTH_COUNTER_CLOCKWISE_NONE("north counter clockwise none"), - NORTH_COUNTER_CLOCKWISE_HORIZONTAL("north counter clockwise horizontal"), - NORTH_COUNTER_CLOCKWISE_VERTICAL("north counter clockwise vertical"), - NORTH_COUNTER_CLOCKWISE_BOTH("north counter clockwise both"), - SOUTH_NORMAL_NONE("south normal none"), - SOUTH_NORMAL_HORIZONTAL("south normal horizontal"), - SOUTH_NORMAL_VERTICAL("south normal vertical"), - SOUTH_NORMAL_BOTH("south normal both"), - SOUTH_CLOCKWISE_NONE("south clockwise none"), - SOUTH_CLOCKWISE_HORIZONTAL("south clockwise horizontal"), - SOUTH_CLOCKWISE_VERTICAL("south clockwise vertical"), - SOUTH_CLOCKWISE_BOTH("south clockwise both"), - SOUTH_UPSIDE_DOWN_NONE("south upside down none"), - SOUTH_UPSIDE_DOWN_HORIZONTAL("south upside down horizontal"), - SOUTH_UPSIDE_DOWN_VERTICAL("south upside down vertical"), - SOUTH_UPSIDE_DOWN_BOTH("south upside down both"), - SOUTH_COUNTER_CLOCKWISE_NONE("south counter clockwise none"), - SOUTH_COUNTER_CLOCKWISE_HORIZONTAL("south counter clockwise horizontal"), - SOUTH_COUNTER_CLOCKWISE_VERTICAL("south counter clockwise vertical"), - SOUTH_COUNTER_CLOCKWISE_BOTH("south counter clockwise both"), - WEST_NORMAL_NONE("west normal none"), - WEST_NORMAL_HORIZONTAL("west normal horizontal"), - WEST_NORMAL_VERTICAL("west normal vertical"), - WEST_NORMAL_BOTH("west normal both"), - WEST_CLOCKWISE_NONE("west clockwise none"), - WEST_CLOCKWISE_HORIZONTAL("west clockwise horizontal"), - WEST_CLOCKWISE_VERTICAL("west clockwise vertical"), - WEST_CLOCKWISE_BOTH("west clockwise both"), - WEST_UPSIDE_DOWN_NONE("west upside down none"), - WEST_UPSIDE_DOWN_HORIZONTAL("west upside down horizontal"), - WEST_UPSIDE_DOWN_VERTICAL("west upside down vertical"), - WEST_UPSIDE_DOWN_BOTH("west upside down both"), - WEST_COUNTER_CLOCKWISE_NONE("west counter clockwise none"), - WEST_COUNTER_CLOCKWISE_HORIZONTAL("west counter clockwise horizontal"), - WEST_COUNTER_CLOCKWISE_VERTICAL("west counter clockwise vertical"), - WEST_COUNTER_CLOCKWISE_BOTH("west counter clockwise both"), - EAST_NORMAL_NONE("east normal none"), - EAST_NORMAL_HORIZONTAL("east normal horizontal"), - EAST_NORMAL_VERTICAL("east normal vertical"), - EAST_NORMAL_BOTH("east normal both"), - EAST_CLOCKWISE_NONE("east clockwise none"), - EAST_CLOCKWISE_HORIZONTAL("east clockwise horizontal"), - EAST_CLOCKWISE_VERTICAL("east clockwise vertical"), - EAST_CLOCKWISE_BOTH("east clockwise both"), - EAST_UPSIDE_DOWN_NONE("east upside down none"), - EAST_UPSIDE_DOWN_HORIZONTAL("east upside down horizontal"), - EAST_UPSIDE_DOWN_VERTICAL("east upside down vertical"), - EAST_UPSIDE_DOWN_BOTH("east upside down both"), - EAST_COUNTER_CLOCKWISE_NONE("east counter clockwise none"), - EAST_COUNTER_CLOCKWISE_HORIZONTAL("east counter clockwise horizontal"), - EAST_COUNTER_CLOCKWISE_VERTICAL("east counter clockwise vertical"), - EAST_COUNTER_CLOCKWISE_BOTH("east counter clockwise both"); - - public static final ExtendedFacing DEFAULT=NORTH_NORMAL_NONE; - public static final ExtendedFacing[] VALUES = values(); - public static final Map> FOR_FACING=new HashMap<>(); - static { - stream(values()).forEach(extendedFacing -> - FOR_FACING.compute(extendedFacing.direction,((forgeDirection, extendedFacings) -> { - if(extendedFacings==null){ - extendedFacings = new ArrayList<>(); - } - extendedFacings.add(extendedFacing); - return extendedFacings; - }))); - } - private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(ExtendedFacing::getName2, (extendedFacing) -> extendedFacing)); - - private final ForgeDirection direction; - private final ForgeDirection a,b,c; - private final Rotation rotation; - private final Flip flip; - - private final String name; - private final IntegerAxisSwap integerAxisSwap; - - ExtendedFacing(String name) { - this.name = name; - direction= Direction.VALUES[ordinal()/(ROTATIONS_COUNT*FLIPS_COUNT)].getForgeDirection(); - rotation=Rotation.VALUES[ordinal()/FLIPS_COUNT-direction.ordinal()*ROTATIONS_COUNT]; - flip=Flip.VALUES[ordinal()%FLIPS_COUNT]; - ForgeDirection a,b,c; - switch (direction){ - case DOWN: - a= ForgeDirection.WEST; - b= ForgeDirection.SOUTH; - c= ForgeDirection.UP; - break; - case UP: - a= ForgeDirection.EAST; - b= ForgeDirection.SOUTH; - c= ForgeDirection.DOWN; - break; - case NORTH: - a= ForgeDirection.WEST; - b= ForgeDirection.DOWN; - c= ForgeDirection.SOUTH; - break; - case SOUTH: - a= ForgeDirection.EAST; - b= ForgeDirection.DOWN; - c= ForgeDirection.NORTH; - break; - case WEST: - a= ForgeDirection.SOUTH; - b= ForgeDirection.DOWN; - c= ForgeDirection.EAST; - break; - case EAST: - a= ForgeDirection.NORTH; - b= ForgeDirection.DOWN; - c= ForgeDirection.WEST; - break; - default:throw new RuntimeException("Is impossible..."); - } - switch (flip){//This duplicates some axis swaps since flip boolean would do, but seems more convenient to use - case HORIZONTAL: - a=a.getOpposite(); - break; - case BOTH: - a=a.getOpposite(); - case VERTICAL: - b=b.getOpposite(); - break; - case NONE: break; - default:throw new RuntimeException("Even more impossible..."); - } - switch (rotation) { - case CLOCKWISE: { - ForgeDirection _a=a; - a =b; - b =_a.getOpposite(); - break; - } - case UPSIDE_DOWN: - a=a.getOpposite(); - b=b.getOpposite(); - break; - case COUNTER_CLOCKWISE: { - ForgeDirection _a=a; - a =b.getOpposite(); - b =_a; - break; - } - case NORMAL: break; - default: - throw new RuntimeException("More impossible..."); - } - this.a=a; - this.b=b; - this.c=c; - integerAxisSwap =new IntegerAxisSwap(a,b,c); - } - - public static ExtendedFacing of(ForgeDirection direction, Rotation rotation, Flip flip){ - if(direction==ForgeDirection.UNKNOWN){ - return VALUES[IAlignment.getAlignmentIndex(ForgeDirection.NORTH, rotation, flip)]; - } - return VALUES[IAlignment.getAlignmentIndex(direction, rotation, flip)]; - } - - public static ExtendedFacing of(ForgeDirection direction){ - if(direction==ForgeDirection.UNKNOWN){ - return DEFAULT; - } - return VALUES[IAlignment.getAlignmentIndex(direction, Rotation.NORMAL, Flip.NONE)]; - } - - public ExtendedFacing with(ForgeDirection direction){ - return of(direction,rotation,flip); - } - - public ExtendedFacing with(Rotation rotation){ - return of(direction,rotation,flip); - } - - public ExtendedFacing with(Flip flip){ - return of(direction,rotation,flip); - } - - public ExtendedFacing getOppositeDirection() { - return of(direction.getOpposite(),rotation,flip); - } - - public ExtendedFacing getOppositeRotation() { - return of(direction,rotation.getOpposite(),flip); - } - - public ExtendedFacing getOppositeFlip() { - return of(direction,rotation,flip.getOpposite()); - } - - /** - * Gets the same effective facing achieved by different rot/flip combo - * @return same effective facing, but different enum value - */ - public ExtendedFacing getDuplicate(){ - return of(direction,rotation.getOpposite(),flip.getOpposite()); - } - - public int getIndex(){ - return ordinal(); - } - - public String getName2() { - return this.name; - } - - public static ExtendedFacing byName(String name) { - return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); - } - - public static ExtendedFacing byIndex(int index) { - return VALUES[abs(index % VALUES.length)]; - } - - public static ExtendedFacing random(Random rand) { - return VALUES[rand.nextInt(VALUES.length)]; - } - - public ForgeDirection getDirection() { - return direction; - } - - public Rotation getRotation() { - return rotation; - } - - public Flip getFlip() { - return flip; - } - - /** - * Translates relative to front facing offset to world offset - * @param abcOffset A,B,C offset (facing relative L-->R,U-->D,F-->B) - * @return X,Y,Z offset in world - */ - public Vec3 getWorldOffset(Vec3 abcOffset) { - return integerAxisSwap.inverseTranslate(abcOffset); - } - public Vec3Impl getWorldOffset(Vec3Impl abcOffset) { - return integerAxisSwap.inverseTranslate(abcOffset); - } - public void getWorldOffset(int[] point,int[] out){ - integerAxisSwap.inverseTranslate(point,out); - } - public void getWorldOffset(double[] point,double[] out){ - integerAxisSwap.inverseTranslate(point,out); - } - - - /** - * Translates world offset to relative front facing offset - * @param xyzOffset X,Y,Z offset in world - * @return A,B,C offset (facing relative L-->R,U-->D,F-->B) - */ - public Vec3 getOffsetABC(Vec3 xyzOffset){ - return integerAxisSwap.translate(xyzOffset); - } - public Vec3Impl getOffsetABC(Vec3Impl xyzOffset){ - return integerAxisSwap.translate(xyzOffset); - } - public void getOffsetABC(int[] point,int[] out){ - integerAxisSwap.translate(point,out); - } - public void getOffsetABC(double[] point,double[] out){ - integerAxisSwap.translate(point,out); - } - - public IntegerAxisSwap getIntegerAxisSwap() { - return integerAxisSwap; - } - - public ForgeDirection getRelativeLeftInWorld() { - return a; - } - - public ForgeDirection getRelativeRightInWorld() { - return a.getOpposite(); - } - - public ForgeDirection getRelativeDownInWorld() { - return b; - } - - public ForgeDirection getRelativeUpInWorld() { - return b.getOpposite(); - } - - public ForgeDirection getRelativeBackInWorld() { - return c; - } - - public ForgeDirection getRelativeForwardInWorld() { - return c.getOpposite(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java deleted file mode 100644 index 4b1dff70ec..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment.enumerable; - -import javax.annotation.Nonnull; -import java.util.Locale; -import java.util.Map; -import java.util.Random; - -import static java.lang.Math.abs; -import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toMap; - -public enum Flip { - NONE(3, "none"), - HORIZONTAL(2, "horizontal"), - VERTICAL(1, "vertical"), - BOTH(0, "both"); - - private final int opposite; - private final String name; - - public static final Flip[] VALUES = values(); - private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(Flip::getName2, (flip) -> flip)); - - Flip(int oppositeIn, String nameIn) { - this.opposite = oppositeIn; - this.name = nameIn; - } - - public int getIndex(){ - return ordinal(); - } - - public Flip getOpposite() { - return VALUES[opposite]; - } - - public String getName2() { - return this.name; - } - - public static Flip byName(String name) { - return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); - } - - public static Flip byIndex(int index) { - return VALUES[abs(index % VALUES.length)]; - } - - public static Flip random(@Nonnull Random rand) { - return VALUES[rand.nextInt(VALUES.length)]; - } - - public String toString() { - return this.name; - } - - public String getName() { - return this.name; - } - - public boolean isNotFlipped(){ - return this==NONE; - } - - public boolean isBothFlipped(){ - return this==BOTH; - } - - public boolean isHorizontallyFlipped() { - return this==HORIZONTAL || isBothFlipped(); - } - - public boolean isVerticallyFliped() { - return this==VERTICAL || isBothFlipped(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java deleted file mode 100644 index 5d41f54a11..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.github.technus.tectech.mechanics.alignment.enumerable; - -import javax.annotation.Nonnull; -import java.util.Locale; -import java.util.Map; -import java.util.Random; - -import static java.lang.Math.abs; -import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toMap; - -public enum Rotation { - NORMAL(2, "normal"), - CLOCKWISE(3, "clockwise"), - UPSIDE_DOWN(0, "upside down"), - COUNTER_CLOCKWISE(1, "counter clockwise"); - - private final int opposite; - private final String name; - - public static final Rotation[] VALUES = values(); - private static final Map NAME_LOOKUP = stream(VALUES).collect(toMap(Rotation::getName2, (rotation) -> rotation)); - - Rotation(int oppositeIn, String nameIn) { - this.opposite = oppositeIn; - this.name = nameIn; - } - - public int getIndex(){ - return ordinal(); - } - - public Rotation getOpposite() { - return VALUES[opposite]; - } - - public String getName2() { - return this.name; - } - - public static Rotation byName(String name) { - return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); - } - - public static Rotation byIndex(int index) { - return VALUES[abs(index % VALUES.length)]; - } - - public static Rotation random(@Nonnull Random rand) { - return VALUES[rand.nextInt(VALUES.length)]; - } - - public String toString() { - return this.name; - } - - public String getName() { - return this.name; - } - - public boolean isNotRotated(){ - return this==NORMAL; - } - - public boolean isClockwise(){ - return this==CLOCKWISE; - } - - public boolean isCounterClockwise(){ - return this==COUNTER_CLOCKWISE; - } - - public boolean isUpsideDown(){ - return this==UPSIDE_DOWN; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java deleted file mode 100644 index 2dc74330f9..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.github.technus.tectech.mechanics.constructable; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.IAlignment; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.common.util.ForgeDirection; - -public class ConstructableUtility { - private ConstructableUtility(){ - - } - - public static boolean handle(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if(tTileEntity==null || aPlayer instanceof FakePlayer) { - return aPlayer instanceof EntityPlayerMP; - } - if (aPlayer instanceof EntityPlayerMP) { - //struct gen - if (aPlayer.isSneaking() && aPlayer.capabilities.isCreativeMode) { - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack, false); - } else if (IMultiblockInfoContainer.contains(metaTE.getClass())) { - IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); - if(metaTE instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, false, metaTE, ( - (IAlignment) metaTE).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, false, metaTE, - ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); - } - } - } else if (tTileEntity instanceof IConstructable) { - ((IConstructable) tTileEntity).construct(aStack, false); - } else if (IMultiblockInfoContainer.contains(tTileEntity.getClass())) { - IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(tTileEntity.getClass()); - if(tTileEntity instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, false, tTileEntity, - ((IAlignment) tTileEntity).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, false, tTileEntity, - ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); - } - } - } - return true; - }else if (TecTech.proxy.isThePlayer(aPlayer)){//particles and text client side - //if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) { - if(tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack, true); - TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack)); - return false; - } else if(IMultiblockInfoContainer.contains(metaTE.getClass())){ - IMultiblockInfoContainer iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); - if(metaTE instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, true, metaTE, - ((IAlignment) metaTE).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, true, metaTE, - ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); - } - TecTech.proxy.printInchat(IMultiblockInfoContainer.get(metaTE.getClass()).getDescription(aStack)); - return false; - } - } else if(tTileEntity instanceof IConstructable){ - ((IConstructable) tTileEntity).construct(aStack,true); - TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack)); - return false; - } else if(IMultiblockInfoContainer.contains(tTileEntity.getClass())){ - IMultiblockInfoContainer iMultiblockInfoContainer = IMultiblockInfoContainer.get(tTileEntity.getClass()); - if(tTileEntity instanceof IAlignment){ - iMultiblockInfoContainer.construct(aStack, true, tTileEntity, - ((IAlignment) tTileEntity).getExtendedFacing()); - }else { - iMultiblockInfoContainer.construct(aStack, true, tTileEntity, - ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); - } - TecTech.proxy.printInchat(IMultiblockInfoContainer.get(tTileEntity.getClass()).getDescription(aStack)); - return false; - } - //} else { - // if(tTileEntity instanceof IGregTechTileEntity) { - // IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - // if (metaTE instanceof IConstructable) { - // TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); - // return false; - // } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ - // TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); - // return false; - // } - // } else if(tTileEntity instanceof IConstructable){ - // TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); - // return false; - // } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ - // TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); - // return false; - // } - //} - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java deleted file mode 100644 index 1de0381f1f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.github.technus.tectech.mechanics.constructable; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.item.ItemStack; - -/** - * Created by Tec on 24.03.2017. - */ -public interface IConstructable { - void construct(ItemStack stackSize, boolean hintsOnly); - - @SideOnly(Side.CLIENT) - String[] getStructureDescription(ItemStack stackSize); -} - diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java deleted file mode 100644 index 173e0d16ec..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.github.technus.tectech.mechanics.constructable; - -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import java.util.HashMap; - -/** - * To implement IConstructable on not own TileEntities - */ -public interface IMultiblockInfoContainer { - HashMap> MULTIBLOCK_MAP = new HashMap<>(); - - static void registerTileClass(Class clazz, IMultiblockInfoContainer info){ - MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); - } - - static void registerMetaClass(Class clazz, IMultiblockInfoContainer info){ - MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); - } - - @SuppressWarnings("unchecked") - static IMultiblockInfoContainer get(Class tClass){ - return (IMultiblockInfoContainer)MULTIBLOCK_MAP.get(tClass.getCanonicalName()); - } - - static boolean contains(Class tClass){ - return MULTIBLOCK_MAP.containsKey(tClass.getCanonicalName()); - } - - void construct(ItemStack stackSize, boolean hintsOnly, T tileEntity, ExtendedFacing aSide); - - @SideOnly(Side.CLIENT) - String[] getDescription(ItemStack stackSize); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java index 990a48ac70..f30105f1ee 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.util.Vec3Impl; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; import java.util.Collections; diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java index 268de6f71c..0fddb53fe9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.util.Vec3Impl; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; public class QuantumDataPacket extends DataPacket { diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java index e31e63f250..0480cfffd2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.mechanics.spark; -import com.github.technus.tectech.util.Vec3Impl; + +import com.gtnewhorizon.structurelib.util.Vec3Impl; import java.io.Serializable; import java.util.Objects; diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java deleted file mode 100644 index c3ea2d3e3f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.world.World; - -public interface IBlockPosConsumer { - void consume(World world, int x, int y, int z); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java deleted file mode 100644 index b70e76fbac..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -public interface ICustomBlockSetting { - /** - * Default block setting calls {@link World#setBlock(int x, int y, int z, Block block, int meta, int updateType)} like: - * {@code world.setBlock(x,y,z,this/block,meta,2)} where updateType 2 means to update lighting and stuff - * @param world world that should be affected - * @param x x position to set - * @param y y position to set - * @param z z position to set - * @param meta required meta - */ - void setBlock(World world, int x, int y, int z, int meta); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java deleted file mode 100644 index c8488d5cea..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import java.util.Arrays; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; - -public interface IStructureDefinition { - /** - * Used internally - * @param name same name as for other methods here - * @return the array of elements to process - */ - IStructureElement[] getStructureFor(String name); - - default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - boolean forceCheckAllBlocks){ - return iterate(object, null, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,false,forceCheckAllBlocks); - } - - default boolean hints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC) { - return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,true,null); - } - - default boolean build(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC) { - return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,false,null); - } - - default boolean buildOrHints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - boolean hintsOnly){ - return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC,hintsOnly,null); - } - - static boolean iterate(T object, ItemStack trigger, IStructureElement[] elements, World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){ - if(world.isRemote ^ hintsOnly){ - return false; - } - - //change base position to base offset - basePositionA=-basePositionA; - basePositionB=-basePositionB; - basePositionC=-basePositionC; - - int[] abc = new int[]{basePositionA,basePositionB,basePositionC}; - int[] xyz = new int[3]; - - if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){ - if(checkBlocksIfNotNullForceCheckAllIfTrue){ - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - return false; - } - } else { - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - return false; - } - abc[0]+=1; - } - } - } else { - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - return false; - } - } else { - if(DEBUG_MODE){ - TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ - Arrays.toString(xyz)+" "+Arrays.toString(abc)); - } - } - abc[0]+=1; - } - } - } - }else { - if(hintsOnly) { - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); - - abc[0]+=1; - } - } - } else { - for (IStructureElement element : elements) { - if(element.isNavigating()) { - abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); - abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); - abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); - }else { - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += basePositionX; - xyz[1] += basePositionY; - xyz[2] += basePositionZ; - - if (world.blockExists(xyz[0], xyz[1], xyz[2])) { - element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger); - } - abc[0]+=1; - } - } - } - } - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java deleted file mode 100644 index f946e71f91..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Use StructureUtility to instantiate - */ -public interface IStructureElement { - boolean check(T t,World world,int x,int y,int z); - - boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger); - - boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger); - - default int getStepA(){ - return 1; - } - - default int getStepB(){ - return 0; - } - - default int getStepC(){ - return 0; - } - - default boolean resetA(){ - return false; - } - - default boolean resetB(){ - return false; - } - - default boolean resetC(){ - return false; - } - - default boolean isNavigating(){ - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java deleted file mode 100644 index f9593ee1c5..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Use StructureUtility to instantiate - */ -public interface IStructureElementChain extends IStructureElement { - IStructureElement[] fallbacks(); - - @Override - default boolean check(T t, World world, int x, int y, int z){ - for (IStructureElement fallback : fallbacks()) { - if (fallback.check(t, world, x, y, z)) { - return true; - } - } - return false; - } - - @Override - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - for (IStructureElement fallback : fallbacks()) { - if (fallback.spawnHint(t, world, x, y, z, trigger)) { - return true; - } - } - return false; - } - - @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - for (IStructureElement fallback : fallbacks()) { - if (fallback.placeBlock(t, world, x, y, z, trigger)) { - return true; - } - } - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java deleted file mode 100644 index ec15aea53b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface IStructureElementCheckOnly extends IStructureElement { - @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ - return false; - } - - @Override - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){ - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java deleted file mode 100644 index dbb74312a8..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -/** - * Use StructureUtility to instantiate - */ -public interface IStructureElementDeferred extends IStructureElement { -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java deleted file mode 100644 index 47e6060878..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface IStructureElementNoPlacement extends IStructureElement { - @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ - return false; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java deleted file mode 100644 index d3f4134cea..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Use StructureUtility to instantiate - */ -interface IStructureNavigate extends IStructureElement { - @Override - default boolean check(T t, World world, int x, int y, int z){ - return true; - } - - @Override - default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return true; - } - - @Override - default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return true; - } - - default boolean isNavigating(){ - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java deleted file mode 100644 index 83951372a2..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; - -@Deprecated -public class Structure { - private Structure() { - } - - @Deprecated - @SafeVarargs - public static IHatchAdder[] adders(IHatchAdder... iHatchAdder) { - return iHatchAdder; - } - - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - @Deprecated - public static boolean checker( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - T metaTile, - ExtendedFacing extendedFacing, - boolean forceCheck) { - IGregTechTileEntity aBaseMetaTileEntity = metaTile.getBaseMetaTileEntity(); - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - if (extendedFacing == null) { - extendedFacing = ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); - } - - IGregTechTileEntity igt; - - int[] xyz = new int[3]; - int[] abc = new int[3]; - int pointer; - int baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = -verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') { - //Control chars allow skipping - abc[1] += block; - break; - } else if (block > '@') { - //characters allow to skip check A-1 skip, B-2 skips etc. - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.') { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += baseX; - xyz[1] += baseY; - xyz[2] += baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - Block worldblock = world.getBlock(xyz[0], xyz[1], xyz[2]); - int dmg = worldblock.getDamageValue(world, xyz[0], xyz[1], xyz[2]); - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (worldblock != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + worldblock.getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (dmg != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + dmg + ' ' + blockMeta[pointer]); - } - return false; - } - } else if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); - if (igt == null || !addingMethods[pointer].apply(metaTile, igt, casingTextures[pointer])) { - if (worldblock != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + worldblock.getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (dmg != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + dmg + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } - } - } else if (forceCheck) { - return false; - } - abc[0]++;//block in horizontal layer - } - } - abc[1]++;//horizontal layer - } - abc[2]++;//depth - } - return true; - } - - @Deprecated - public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - World world = tileEntity.getWorld(); - int baseX = tileEntity.getXCoord(); - int baseY = tileEntity.getYCoord(); - int baseZ = tileEntity.getZCoord(); - if (world == null || (!world.isRemote && hintsOnly)) { - return false; - } - - //TE Rotation - int[] xyz = new int[3]; - int[] abc = new int[3]; - int pointer; - - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = -verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - abc[1] += block; - break; - } - if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.')// this TE - { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc, xyz); - xyz[0] += baseX; - xyz[1] += baseY; - xyz[2] += baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded - if (hintsOnly) { - switch (block) { - case '-'://must be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); - break; - case '+'://must not be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || blockType[pointer].getDamageValue(world, xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); - } - } else if ((pointer = block - ' ') >= 0) { - if (pointer < 12) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); - } - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); - } - } - } else { - switch (block) { - case '-'://must be air - world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); - break; - case '+'://must not be air - world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - if (blockType[pointer] instanceof ICustomBlockSetting) { - ((ICustomBlockSetting) blockType[pointer]).setBlock(world, xyz[0], xyz[1], xyz[2], blockMeta[pointer]); - } else { - world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); - } - } - } - } - } - abc[0]++;//block in horizontal layer - } - } - abc[1]++;//horizontal layer - } - abc[2]++;//depth - } - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java deleted file mode 100644 index 9a1e94d98a..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java +++ /dev/null @@ -1,288 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import com.github.technus.tectech.util.Vec3Impl; - -import java.util.*; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; - -public class StructureDefinition implements IStructureDefinition { - private final Map> elements; - private final Map shapes; - private final Map[]> structures; - - public static Builder builder() { - return new Builder<>(); - } - - private StructureDefinition( - Map> elements, - Map shapes, - Map[]> structures) { - this.elements =elements; - this.shapes=shapes; - this.structures = structures; - } - - public static class Builder { - private static final char A='\uA000'; - private static final char B='\uB000'; - private static final char C='\uC000'; - private char d ='\uD000'; - private final Map navigates; - private final Map> elements; - private final Map shapes; - - private Builder() { - navigates=new HashMap<>(); - elements = new HashMap<>(); - shapes = new HashMap<>(); - } - - public Map> getElements() { - return elements; - } - - public Map getShapes() { - return shapes; - } - - /** - * Casings go: 0 1 2 3 4 5 6 7 8 9 : ; < = > ? - *
- * HatchAdders go: space ! " # $ % & ' ( ) * - * @param name - * @param structurePiece - * @return - */ - @Deprecated - public Builder addShapeOldApi(String name, String[][] structurePiece) { - StringBuilder builder = new StringBuilder(); - if (structurePiece.length > 0) { - for (String[] strings : structurePiece) { - if (strings.length > 0) { - for (String string : strings) { - for (int i = 0; i < string.length(); i++) { - char ch = string.charAt(i); - if(ch<' '){ - for (int b = 0; b < ch; b++) { - builder.append(B); - } - }else if(ch>'@'){ - for (int a = '@'; a < ch; a++) { - builder.append(A); - } - }else if(ch=='.'){ - builder.append(A); - }else{ - builder.append(ch); - } - } - builder.append(B); - } - builder.setLength(builder.length() - 1); - } - builder.append(C); - } - builder.setLength(builder.length() - 1); - } - int a=0,b=0,c=0; - for (int i = 0; i < builder.length(); i++) { - char ch = builder.charAt(i); - if(ch==A){ - a++; - }else if(ch==B){ - a=0; - b++; - }else if(ch==C){ - a=0; - b=0; - c++; - }else if(a!=0 || b!=0 || c!=0){ - Vec3Impl vec3 = new Vec3Impl(a, b, c); - Character navigate = navigates.get(vec3); - if(navigate==null){ - navigate= d++; - navigates.put(vec3,navigate); - addElement(navigate,step(vec3)); - } - builder.setCharAt(i-1,navigate); - a=0; - b=0; - c=0; - } - } - - String built = builder.toString().replaceAll("[\\uA000\\uB000\\uC000]",""); - - if(built.contains("+")){ - addElement('+',notAir()); - } - if (built.contains("-")) { - addElement('-', isAir()); - } - shapes.put(name, built); - return this; - } - - /** - * Adds shape - * +- is air/no air checks - * space bar is skip - * ~ is also skip (but marks controller position, optional and logically it is a space...) - * rest needs to be defined - * - * next char is next block(a) - * next string is next line(b) - * next string[] is next slice(c) - * - * char A000-FFFF range is reserved for generated skips - * @param name unlocalized/code name - * @param structurePiece generated or written struct - DO NOT STORE IT ANYWHERE, or at least set them to null afterwards - * @return this builder - */ - public Builder addShape(String name, String[][] structurePiece) { - StringBuilder builder = new StringBuilder(); - if (structurePiece.length > 0) { - for (String[] strings : structurePiece) { - if (strings.length > 0) { - for (String string : strings) { - builder.append(string).append(B); - } - builder.setLength(builder.length() - 1); - } - builder.append(C); - } - builder.setLength(builder.length() - 1); - } - int a=0,b=0,c=0; - for (int i = 0; i < builder.length(); i++) { - char ch = builder.charAt(i); - if(ch ==' ' || ch =='~'){ - builder.setCharAt(i,A); - ch=A; - } - if(ch==A){ - a++; - }else if(ch==B){ - a=0; - b++; - }else if(ch==C){ - a=0; - b=0; - c++; - }else if(a!=0 || b!=0 || c!=0){ - Vec3Impl vec3 = new Vec3Impl(a, b, c); - Character navigate = navigates.get(vec3); - if(navigate==null){ - navigate=d++; - navigates.put(vec3,navigate); - addElement(navigate,step(vec3)); - } - builder.setCharAt(i-1,navigate); - a=0; - b=0; - c=0; - } - } - - String built = builder.toString().replaceAll("[\\uA000\\uB000\\uC000]",""); - - if(built.contains("+")){ - addElement('+',notAir()); - } - if (built.contains("-")) { - addElement('-', isAir()); - } - shapes.put(name, built); - return this; - } - - public Builder addElement(Character name, IStructureElement structurePiece) { - elements.putIfAbsent(name, structurePiece); - return this; - } - - public IStructureDefinition build() { - Map[]> structures = compileStructureMap(); - if(DEBUG_MODE){ - return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), structures); - }else { - return structures::get; - } - } - - @SuppressWarnings("unchecked") - private Map[]> compileElementSetMap() { - Set missing = new HashSet<>(); - shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { - IStructureElement iStructureElement = elements.get((char) c); - if (iStructureElement == null) { - missing.add(c); - } - })); - if (missing.isEmpty()) { - Map[]> map = new HashMap<>(); - shapes.forEach((key, value) -> { - Set chars=new HashSet<>(); - for (char c : value.toCharArray()) { - chars.add(c); - } - IStructureElement[] compiled = new IStructureElement[chars.size()]; - int i=0; - for (Character aChar : chars) { - compiled[i++]=elements.get(aChar); - } - map.put(key, compiled); - }); - return map; - } else { - throw new RuntimeException("Missing Structure Element bindings for (chars as integers): " + - Arrays.toString(missing.toArray())); - } - } - - @SuppressWarnings("unchecked") - private Map[]> compileStructureMap() { - Set mising = new HashSet<>(); - shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { - IStructureElement iStructureElement = elements.get((char) c); - if (iStructureElement == null) { - mising.add(c); - } - })); - if (mising.isEmpty()) { - Map[]> map = new HashMap<>(); - shapes.forEach((key, value) -> { - IStructureElement[] compiled = new IStructureElement[value.length()]; - for (int i = 0; i < value.length(); i++) { - compiled[i] = elements.get(value.charAt(i)); - } - map.put(key, compiled); - }); - return map; - } else { - throw new RuntimeException("Missing Structure Element bindings for (chars as integers): " + - Arrays.toString(mising.toArray())); - } - } - } - - public Map> getElements(){ - return elements; - } - - public Map getShapes() { - return shapes; - } - - public Map[]> getStructures() { - return structures; - } - - @Override - public IStructureElement[] getStructureFor(String name) { - return structures.get(name); - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java deleted file mode 100644 index 521b0e7645..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ /dev/null @@ -1,1395 +0,0 @@ -package com.github.technus.tectech.mechanics.structure; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.structure.adders.IBlockAdder; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.adders.ITileAdder; -import com.github.technus.tectech.util.Vec3Impl; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import java.util.*; -import java.util.function.BiFunction; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Supplier; - -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; -import static java.lang.Integer.MIN_VALUE; - -/** - * Fluent API for structure checking! - * - * (Just import static this class to have a nice fluent syntax while defining structure definitions) - */ -public class StructureUtility { - private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz=|!@#$%&()[]{};:<>/?_,.*^'`"; - @SuppressWarnings("rawtypes") - private static final Map STEP = new HashMap<>(); - @SuppressWarnings("rawtypes") - private static final IStructureElement AIR = new IStructureElement() { - @Override - public boolean check(Object t, World world, int x, int y, int z) { - return world.getBlock(x, y, z).getMaterial() == Material.air; - } - - @Override - public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 13); - return true; - } - - @Override - public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, Blocks.air, 0, 2); - return false; - } - }; - @SuppressWarnings("rawtypes") - private static final IStructureElement NOT_AIR = new IStructureElement() { - @Override - public boolean check(Object t, World world, int x, int y, int z) { - return world.getBlock(x, y, z).getMaterial() != Material.air; - } - - @Override - public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 14); - return true; - } - - @Override - public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, sHintCasingsTT, 14, 2); - return true; - } - }; - @SuppressWarnings("rawtypes") - private static final IStructureElement ERROR = new IStructureElement() { - @Override - public boolean check(Object t, World world, int x, int y, int z) { - return false; - } - - @Override - public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 15); - return true; - } - - @Override - public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { - return true; - } - }; - - private StructureUtility() { - - } - - @SuppressWarnings("unchecked") - public static IStructureElement isAir() { - return AIR; - } - - @SuppressWarnings("unchecked") - public static IStructureElement notAir() { - return NOT_AIR; - } - - /** - * Check returns false. - * Placement is always handled by this and does nothing. - * Makes little to no use it in fallback chain. - * - * @param - * @return - */ - @SuppressWarnings("unchecked") - public static IStructureElement error() { - return ERROR; - } - - //region hint only - - /** - * Check always returns: true. - * - * @param dots - * @param - * @return - */ - public static IStructureElementNoPlacement ofHint(int dots) { - int meta = dots - 1; - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, meta); - return false; - } - }; - } - - /** - * Check always returns: true. - * - * @param icons - * @param - * @return - */ - public static IStructureElementNoPlacement ofHintDeferred(Supplier icons) { - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, icons.get()); - return false; - } - }; - } - - /** - * Check always returns: true. - * - * @param icons - * @param RGBa - * @param - * @return - */ - public static IStructureElementNoPlacement ofHintDeferred(Supplier icons, short[] RGBa) { - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(), RGBa); - return false; - } - }; - } - - //endregion - - //region block - - /** - * Does not allow Block duplicates (with different meta) - */ - public static IStructureElementNoPlacement ofBlocksFlatHint(Map blocsMap, Block hintBlock, int hintMeta) { - if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - }; - } - - /** - * Allows block duplicates (with different meta) - */ - public static IStructureElementNoPlacement ofBlocksMapHint(Map> blocsMap, Block hintBlock, int hintMeta) { - if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { - throw new IllegalArgumentException(); - } - for (Collection value : blocsMap.values()) { - if (value.isEmpty()) { - throw new IllegalArgumentException(); - } - } - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - }; - } - - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) { - if (block == null || hintBlock == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - }; - } - - public static IStructureElementNoPlacement ofBlockHint(Block block, int meta) { - return ofBlockHint(block, meta, block, meta); - } - - public static IStructureElementNoPlacement ofBlockAdderHint(IBlockAdder iBlockAdder, Block hintBlock, int hintMeta) { - if (iBlockAdder == null || hintBlock == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - }; - } - - /** - * Does not allow Block duplicates (with different meta) - */ - public static IStructureElement ofBlocksFlat(Map blocsMap, Block defaultBlock, int defaultMeta) { - if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { - throw new IllegalArgumentException(); - } - if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - }else { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - } - } - - /** - * Allows block duplicates (with different meta) - */ - public static IStructureElement ofBlocksMap(Map> blocsMap, Block defaultBlock, int defaultMeta) { - if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { - throw new IllegalArgumentException(); - } - for (Collection value : blocsMap.values()) { - if (value.isEmpty()) { - throw new IllegalArgumentException(); - } - } - if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - }else { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - } - } - - public static IStructureElement ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { - if (block == null || defaultBlock == null) { - throw new IllegalArgumentException(); - } - if(block instanceof ICustomBlockSetting){ - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - } else { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - } - } - - /** - * Same as above but ignores target meta id - */ - public static IStructureElement ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { - if (block == null || defaultBlock == null) { - throw new IllegalArgumentException(); - } - if(block instanceof ICustomBlockSetting){ - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return block == world.getBlock(x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - } else { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return block == world.getBlock(x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - } - } - - public static IStructureElement ofBlock(Block block, int meta) { - return ofBlock(block, meta, block, meta); - } - - /** - * Same as above but ignores target meta id - */ - public static IStructureElement ofBlockAnyMeta(Block block) { - return ofBlockAnyMeta(block, block, 0); - } - - /** - * Same as above but allows to set hint particle render - */ - public static IStructureElement ofBlockAnyMeta(Block block,int defaultMeta) { - return ofBlockAnyMeta(block, block, defaultMeta); - } - - //endregion - - //region adders - - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, Block defaultBlock, int defaultMeta) { - if (iBlockAdder == null || defaultBlock == null) { - throw new IllegalArgumentException(); - } - if(defaultBlock instanceof ICustomBlockSetting){ - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - }else { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); - return true; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); - return true; - } - }; - } - } - - public static IStructureElement ofBlockAdder(IBlockAdder iBlockAdder, int dots) { - return ofBlockAdder(iBlockAdder, sHintCasingsTT, dots - 1); - } - - public static IStructureElementNoPlacement ofTileAdder(ITileAdder iTileAdder, Block hintBlock, int hintMeta) { - if (iTileAdder == null || hintBlock == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t, tileEntity); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - }; - } - - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, int dots) { - return ofHatchAdder(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1); - } - - public static IStructureElementNoPlacement ofHatchAdder(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) { - if (iHatchAdder == null || hintBlock == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementNoPlacement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - }; - } - - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { - return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1, placeCasing, placeCasingMeta); - } - - public static IStructureElement ofHatchAdderOptional(IHatchAdder iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { - if (iHatchAdder == null || hintBlock == null) { - throw new IllegalArgumentException(); - } - if(placeCasing instanceof ICustomBlockSetting){ - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - Block worldBlock = world.getBlock(x, y, z); - return (tileEntity instanceof IGregTechTileEntity && - iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || - (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - ((ICustomBlockSetting) placeCasing).setBlock(world, x, y, z, placeCasingMeta); - return true; - } - }; - }else { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - Block worldBlock = world.getBlock(x, y, z); - return (tileEntity instanceof IGregTechTileEntity && - iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || - (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); - return true; - } - }; - } - } - - //endregion - - //region side effects - - public static , T> IStructureElement onElementPass(Consumer onCheckPass, B element) { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - boolean check = element.check(t, world, x, y, z); - if (check) { - onCheckPass.accept(t); - } - return check; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static , T> IStructureElement onElementFail(Consumer onFail, B element) { - return new IStructureElement() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - boolean check = element.check(t, world, x, y, z); - if (!check) { - onFail.accept(t); - } - return check; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return element.spawnHint(t, world, x, y, z, trigger); - } - }; - } - - //endregion - - /** - * Take care while chaining, as it will try to call every structure element until it returns true. - * If none does it will finally return false. - * - * @param elementChain - * @param - * @return - */ - @SafeVarargs - public static IStructureElementChain ofChain(IStructureElement... elementChain) { - if (elementChain == null || elementChain.length == 0) { - throw new IllegalArgumentException(); - } - for (IStructureElement iStructureElement : elementChain) { - if (iStructureElement == null) { - throw new IllegalArgumentException(); - } - } - return () -> elementChain; - } - - /** - * Take care while chaining, as it will try to call every structure element until it returns true. - * If none does it will finally return false. - * - * @param elementChain - * @param - * @return - */ - @SuppressWarnings("unchecked") - public static IStructureElementChain ofChain(List> elementChain) { - return ofChain(elementChain.toArray(new IStructureElement[0])); - } - - //region defer - - public static IStructureElementDeferred defer(Supplier> to) { - if (to == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return to.get().check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.get().placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.get().spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static IStructureElementDeferred defer(Function> to) { - if (to == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return to.apply(t).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static IStructureElementDeferred defer(Function keyExtractor, Map> map) { - if (keyExtractor == null || map == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.get(keyExtractor.apply(t)).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static IStructureElementDeferred defer(Function keyExtractor, Map> map, IStructureElement defaultElem) { - if (keyExtractor == null || map == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(t), defaultElem).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t), defaultElem).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t), defaultElem).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractor, IStructureElement... array) { - if (keyExtractor == null || array == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return array[keyExtractor.apply(t)].check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t)].placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t)].spawnHint(t, world, x, y, z, trigger); - } - }; - } - - @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractor, List> array) { - return defer(keyExtractor, array.toArray(new IStructureElement[0])); - } - - public static IStructureElementDeferred defer(BiFunction> to) { - if (to == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return to.apply(t, null).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map) { - if (keyExtractor == null || map == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.get(keyExtractor.apply(t, null)).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static IStructureElementDeferred defer(BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { - if (keyExtractor == null || map == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractor.apply(t, null), defaultElem).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - @SafeVarargs - public static IStructureElementDeferred defer(BiFunction keyExtractor, IStructureElement... array) { - if (keyExtractor == null || array == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return array[keyExtractor.apply(t, null)].check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); - } - }; - } - - @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(BiFunction keyExtractor, List> array) { - return defer(keyExtractor, array.toArray(new IStructureElement[0])); - } - - public static IStructureElementDeferred defer(Function> toCheck, BiFunction> to) { - if (to == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return toCheck.apply(t).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map) { - if (keyExtractor == null || map == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, Map> map, IStructureElement defaultElem) { - if (keyExtractor == null || map == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return map.getOrDefault(keyExtractorCheck.apply(t), defaultElem).check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); - } - }; - } - - @SafeVarargs - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, IStructureElement... array) { - if (keyExtractor == null || array == null) { - throw new IllegalArgumentException(); - } - return new IStructureElementDeferred() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - return array[keyExtractorCheck.apply(t)].check(t, world, x, y, z); - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); - } - }; - } - - @SuppressWarnings("unchecked") - public static IStructureElementDeferred defer(Function keyExtractorCheck, BiFunction keyExtractor, List> array) { - return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0])); - } - - //endregion - - /** - * Used internally, to generate skips for structure definitions - * - * @param a - * @param b - * @param c - * @param - * @return - */ - public static IStructureNavigate step(int a, int b, int c) { - return step(new Vec3Impl(a, b, c)); - } - - /** - * Used internally, to generate skips for structure definitions - * - * @param step - * @param - * @return - */ - @SuppressWarnings("unchecked") - public static IStructureNavigate step(Vec3Impl step) { - if (step == null || step.get0() < 0 || step.get1() < 0 || step.get2() < 0) { - throw new IllegalArgumentException(); - } - return STEP.computeIfAbsent(step, vec3 -> { - if (vec3.get2() > 0) { - return stepC(vec3.get0(), vec3.get1(), vec3.get2()); - } else if (vec3.get1() > 0) { - return stepB(vec3.get0(), vec3.get1(), vec3.get2()); - } else { - return stepA(vec3.get0(), vec3.get1(), vec3.get2()); - } - }); - } - - private static IStructureNavigate stepA(int a, int b, int c) { - return new IStructureNavigate() { - @Override - public int getStepA() { - return a; - } - - @Override - public int getStepB() { - return b; - } - - @Override - public int getStepC() { - return c; - } - }; - } - - private static IStructureNavigate stepB(int a, int b, int c) { - return new IStructureNavigate() { - @Override - public int getStepA() { - return a; - } - - @Override - public int getStepB() { - return b; - } - - @Override - public int getStepC() { - return c; - } - - @Override - public boolean resetA() { - return true; - } - }; - } - - private static IStructureNavigate stepC(int a, int b, int c) { - return new IStructureNavigate() { - @Override - public int getStepA() { - return a; - } - - @Override - public int getStepB() { - return b; - } - - @Override - public int getStepC() { - return c; - } - - @Override - public boolean resetA() { - return true; - } - - @Override - public boolean resetB() { - return true; - } - }; - } - - /** - * Used only to get pseudo code in structure writer... - * - * @param world - * @return - */ - public static String getPseudoJavaCode(World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - int sizeA, int sizeB, int sizeC, boolean transpose) { - Map> blocks = new TreeMap<>(Comparator.comparing(Block::getUnlocalizedName)); - Set> tiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); - Set> gtTiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); - iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC, - sizeA, sizeB, sizeC, ((w, x, y, z) -> { - TileEntity tileEntity = w.getTileEntity(x, y, z); - if (tileEntity == null) { - Block block = w.getBlock(x, y, z); - if (block != null && block != Blocks.air) { - blocks.compute(block, (b, set) -> { - if (set == null) { - set = new TreeSet<>(); - } - set.add(block.getDamageValue(world, x, y, z)); - return set; - }); - } - } else { - if (tileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); - if (meta != null) { - gtTiles.add(meta.getClass()); - } else { - tiles.add(tileEntity.getClass()); - } - } else { - tiles.add(tileEntity.getClass()); - } - } - })); - Map map = new HashMap<>(); - StringBuilder builder = new StringBuilder(); - { - int i = 0; - char c; - builder.append("\n\nStructure:\n") - .append("\nBlocks:\n"); - for (Map.Entry> entry : blocks.entrySet()) { - Block block = entry.getKey(); - Set set = entry.getValue(); - for (Integer meta : set) { - c = NICE_CHARS.charAt(i++); - if (i > NICE_CHARS.length()) { - return "Too complicated for nice chars"; - } - map.put(block.getUnlocalizedName() + '\0' + meta, c); - builder.append(c).append(" -> ofBlock...(") - .append(block.getUnlocalizedName()).append(", ").append(meta).append(", ...);\n"); - } - } - builder.append("\nTiles:\n"); - for (Class tile : tiles) { - c = NICE_CHARS.charAt(i++); - if (i > NICE_CHARS.length()) { - return "Too complicated for nice chars"; - } - map.put(tile.getCanonicalName(), c); - builder.append(c).append(" -> ofTileAdder(") - .append(tile.getCanonicalName()).append(", ...);\n"); - } - builder.append("\nMeta:\n"); - for (Class gtTile : gtTiles) { - c = NICE_CHARS.charAt(i++); - if (i > NICE_CHARS.length()) { - return "Too complicated for nice chars"; - } - map.put(gtTile.getCanonicalName(), c); - builder.append(c).append(" -> ofHatchAdder(") - .append(gtTile.getCanonicalName()).append(", textureId, ...);\n"); - } - } - builder.append("\nOffsets:\n") - .append(basePositionA).append(' ').append(basePositionB).append(' ').append(basePositionC).append('\n'); - if (transpose) { - builder.append("\nTransposed Scan:\n") - .append("new String[][]{\n") - .append(" {\""); - iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC, true, - sizeA, sizeB, sizeC, ((w, x, y, z) -> { - TileEntity tileEntity = w.getTileEntity(x, y, z); - if (tileEntity == null) { - Block block = w.getBlock(x, y, z); - if (block != null && block != Blocks.air) { - builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world, x, y, z))); - } else { - builder.append(' '); - } - } else { - if (tileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); - if (meta != null) { - builder.append(map.get(meta.getClass().getCanonicalName())); - } else { - builder.append(map.get(tileEntity.getClass().getCanonicalName())); - } - } else { - builder.append(map.get(tileEntity.getClass().getCanonicalName())); - } - } - }), - () -> builder.append("\",\""), - () -> { - builder.setLength(builder.length() - 2); - builder.append("},\n {\""); - }); - builder.setLength(builder.length() - 8); - builder.append("\n}\n\n"); - } else { - builder.append("\nNormal Scan:\n") - .append("new String[][]{{\n") - .append(" \""); - iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, - basePositionA, basePositionB, basePositionC, false, - sizeA, sizeB, sizeC, ((w, x, y, z) -> { - TileEntity tileEntity = w.getTileEntity(x, y, z); - if (tileEntity == null) { - Block block = w.getBlock(x, y, z); - if (block != null && block != Blocks.air) { - builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world, x, y, z))); - } else { - builder.append(' '); - } - } else { - if (tileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); - if (meta != null) { - builder.append(map.get(meta.getClass().getCanonicalName())); - } else { - builder.append(map.get(tileEntity.getClass().getCanonicalName())); - } - } else { - builder.append(map.get(tileEntity.getClass().getCanonicalName())); - } - } - }), - () -> builder.append("\",\n").append(" \""), - () -> { - builder.setLength(builder.length() - 7); - builder.append("\n").append("},{\n").append(" \""); - }); - builder.setLength(builder.length() - 8); - builder.append("}\n\n"); - } - return (builder.toString().replaceAll("\"\"", "E")); - } - - public static void iterate(World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - int sizeA, int sizeB, int sizeC, - IBlockPosConsumer iBlockPosConsumer) { - sizeA -= basePositionA; - sizeB -= basePositionB; - sizeC -= basePositionC; - - int[] abc = new int[3]; - int[] xyz = new int[3]; - - for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { - for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { - for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { - extendedFacing.getWorldOffset(abc, xyz); - iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); - } - - } - } - } - - public static void iterate(World world, ExtendedFacing extendedFacing, - int basePositionX, int basePositionY, int basePositionZ, - int basePositionA, int basePositionB, int basePositionC, - boolean transpose, int sizeA, int sizeB, int sizeC, - IBlockPosConsumer iBlockPosConsumer, - Runnable nextB, - Runnable nextC) { - sizeA -= basePositionA; - sizeB -= basePositionB; - sizeC -= basePositionC; - - int[] abc = new int[3]; - int[] xyz = new int[3]; - if (transpose) { - for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { - for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { - for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { - extendedFacing.getWorldOffset(abc, xyz); - iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); - } - nextB.run(); - } - nextC.run(); - } - } else { - for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { - for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { - for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { - extendedFacing.getWorldOffset(abc, xyz); - iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); - } - nextB.run(); - } - nextC.run(); - } - } - } - - /** - * Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape) - * WARNING! Do not use on old api... - * - * @param structurePiece shape (transposed shape) - * @return transposed shape (untransposed shape) - */ - public static String[][] transpose(String[][] structurePiece) { - String[][] shape = new String[structurePiece[0].length][structurePiece.length]; - for (int i = 0; i < structurePiece.length; i++) { - for (int j = 0; j < structurePiece[i].length; j++) { - shape[j][i] = structurePiece[i][j]; - } - } - return shape; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java deleted file mode 100644 index 908c4c4aca..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.technus.tectech.mechanics.structure.adders; - - -import net.minecraft.block.Block; - -public interface IBlockAdder { - /** - * Callback on block added, needs to check if block is valid (and add it) - * @param block block attempted to add - * @param meta meta of block attempted to add - * @return is structure still valid - */ - boolean apply(T t,Block block, Integer meta); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java deleted file mode 100644 index a47befc2e8..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.technus.tectech.mechanics.structure.adders; - - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -public interface IHatchAdder { - /** - * Callback to add hatch, needs to check if hatch is valid (and add it) - * @param iGregTechTileEntity hatch - * @param aShort requested texture index, or null if not... - * @return managed to add hatch (structure still valid) - */ - boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java deleted file mode 100644 index cc3c7dbb7a..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.github.technus.tectech.mechanics.structure.adders; - -import net.minecraft.tileentity.TileEntity; - -public interface ITileAdder { - /** - * Callback to add hatch, needs to check if tile is valid (and add it) - * @param tileEntity tile - * @return managed to add hatch (structure still valid) - */ - boolean apply(T t,TileEntity tileEntity); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java index 3b56b6968c..2adc25bbed 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.tesla; -import com.github.technus.tectech.util.Vec3Impl; +import com.gtnewhorizon.structurelib.util.Vec3Impl; public interface ITeslaConnectableSimple { //-128 to -1 disables capability diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java index 5c6fef6af8..0b84236709 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.tesla; -import com.github.technus.tectech.util.Vec3Impl; import com.google.common.base.Objects; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetAdd; @@ -14,7 +14,10 @@ public class TeslaCoverConnection implements ITeslaConnectableSimple { public TeslaCoverConnection(IGregTechTileEntity IGT, byte teslaReceptionCapability) { this.IGT = IGT; - this.pos = new Vec3Impl(IGT); + this.pos = new Vec3Impl(IGT.getXCoord(), + IGT.getYCoord(), + IGT.getZCoord()); + this.teslaReceptionCapability = teslaReceptionCapability; } 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 358d55be0e..114dc7399f 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,18 +215,18 @@ 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: ") + (1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20 + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + (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: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(ampere), -16777216); } else { drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); } } - drawText(10, 113, "Computation: "+computation, -16777216); - drawText(10, 123, "Min Computation: "+minComputationPerSec + " /s", -16777216); + drawText(10, 113, "Computation: " + GT_Utility.formatNumbers(computation), -16777216); + drawText(10, 123, "Min Computation: " + GT_Utility.formatNumbers(minComputationPerSec) + " /s", -16777216); } else { int i = 0; for (String descLine : recipeDesc) { 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 0c7651977e..2dc4604fd5 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,18 +215,18 @@ 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: ") + (1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20 + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + (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: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(ampere), -16777216); } else { drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); } } - drawText(10, 113, "Computation: "+computation, -16777216); - drawText(10, 123, "Min Computation: "+minComputationPerSec + " /s", -16777216); + drawText(10, 113, "Computation: " + GT_Utility.formatNumbers(computation), -16777216); + drawText(10, 123, "Min Computation: " + GT_Utility.formatNumbers(minComputationPerSec) + " /s", -16777216); } else { int i = 0; for (String descLine : recipeDesc) { diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 6a2a81057e..f8dc6a2d74 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -1,9 +1,7 @@ package com.github.technus.tectech.proxy; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.openmodularturrets.TT_turret_loader; -import com.github.technus.tectech.entity.fx.BlockHint; import com.github.technus.tectech.entity.fx.WeightlessParticleFX; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumGlassRender; @@ -16,7 +14,6 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Loader; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.gui.GuiNewChat; @@ -24,7 +21,6 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.util.ForgeDirection; @@ -48,42 +44,6 @@ public class ClientProxy extends CommonProxy { } } - @Override - public void hint_particle_tinted(World w,int x, int y, int z, IIcon[] icons,short[] RGBa) { - Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons).withColorTint(RGBa)); - - EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); - Minecraft.getMinecraft().effectRenderer.addEffect(particle); - } - - @Override - public void hint_particle_tinted(World w,int x, int y, int z, Block block, int meta,short[] RGBa) { - Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta).withColorTint(RGBa)); - - EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); - Minecraft.getMinecraft().effectRenderer.addEffect(particle); - } - - @Override - public void hint_particle(World w,int x, int y, int z, IIcon[] icons) { - Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons)); - - EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); - Minecraft.getMinecraft().effectRenderer.addEffect(particle); - } - - @Override - public void hint_particle(World w,int x, int y, int z, Block block, int meta) { - Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta)); - - EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); - Minecraft.getMinecraft().effectRenderer.addEffect(particle); - } - @Override public void em_particle(IGregTechTileEntity aMuffler, byte facing) {//CUTE! ForgeDirection aDir = ForgeDirection.getOrientation(facing); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 599d3e1c2c..97cd4a6ea6 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -8,16 +8,20 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; import gregtech.api.util.GT_Utility; import gregtech.common.GT_RecipeAdder; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.Arrays; +import java.util.Comparator; import java.util.List; public class TT_recipeAdder extends GT_RecipeAdder { @@ -39,16 +43,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { TecTech.LOGGER.error("addResearchableAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); } } - if(researchAmperage<=0) { - researchAmperage = 1; - } else if(researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if(computationRequiredPerSec<=0) { - computationRequiredPerSec = 1; - } else if(computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; - } + researchAmperage = GT_Utility.clamp(researchAmperage, 1, Short.MAX_VALUE); + computationRequiredPerSec = GT_Utility.clamp(computationRequiredPerSec, 1, Short.MAX_VALUE); TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")}, aFluidInputs, null, assDuration, assEUt, 0,true); GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine(CustomItemList.UnusedStuff.get(1), totalComputationRequired/computationRequiredPerSec, aInputs, aFluidInputs, aOutput, assDuration, assEUt)); @@ -69,17 +65,23 @@ public class TT_recipeAdder extends GT_RecipeAdder { ItemStack[] tInputs = new ItemStack[aInputs.length]; ItemStack[][] tAlts = new ItemStack[aInputs.length][]; + int tPersistentHash = 1; for(int i = 0; i < aInputs.length; i++){ Object obj = aInputs[i]; if (obj instanceof ItemStack) { tInputs[i] = (ItemStack) obj; tAlts[i] = null; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tInputs[i], true, false); continue; } else if (obj instanceof ItemStack[]) { ItemStack[] aStacks = (ItemStack[]) obj; if (aStacks.length > 0) { tInputs[i] = aStacks[0]; - tAlts[i] = Arrays.copyOf(aStacks, aStacks.length); + tAlts[i] = (ItemStack[]) Arrays.copyOf(aStacks, aStacks.length); + for (ItemStack tAlt : tAlts[i]) { + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tAlt, true, false); + } + tPersistentHash *= 31; continue; } } else if (obj instanceof Object[]) { @@ -87,16 +89,24 @@ public class TT_recipeAdder extends GT_RecipeAdder { List tList; if (objs.length >= 2 && !(tList = GT_OreDictUnificator.getOres(objs[0])).isEmpty()) { try { + // sort the output, so the hash code is stable across launches + tList.sort(Comparator.comparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) + .thenComparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) + .thenComparingInt(Items.feather::getDamage) + .thenComparingInt(s -> s.stackSize)); int tAmount = ((Number) objs[1]).intValue(); List uList = new ArrayList<>(); for (ItemStack tStack : tList) { ItemStack uStack = GT_Utility.copyAmount(tAmount, tStack); if (GT_Utility.isStackValid(uStack)) { uList.add(uStack); - if (tInputs[i] == null) tInputs[i] = uStack; + if (tInputs[i] == null) + tInputs[i] = uStack; } } - tAlts[i] = uList.toArray(nullItem); + tAlts[i] = uList.toArray(new ItemStack[0]); + tPersistentHash = tPersistentHash * 31 + (objs[0] == null ? "" : objs[0].toString()).hashCode(); + tPersistentHash = tPersistentHash * 31 + tAmount; continue; } catch (Exception t) { TecTech.LOGGER.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> there is some ... in that recipe"); @@ -105,20 +115,29 @@ public class TT_recipeAdder extends GT_RecipeAdder { } TecTech.LOGGER.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); } - if(researchAmperage<=0) { - researchAmperage = 1; - } else if(researchAmperage > Short.MAX_VALUE) { - researchAmperage = Short.MAX_VALUE; - } - if(computationRequiredPerSec<=0) { - computationRequiredPerSec = 1; - } else if(computationRequiredPerSec > Short.MAX_VALUE) { - computationRequiredPerSec = Short.MAX_VALUE; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(aResearchItem, true, false); + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(aOutput, true, false); + for (FluidStack tFluidInput : aFluidInputs) { + if (tFluidInput == null) + continue; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tFluidInput, true, false); } + researchAmperage = GT_Utility.clamp(researchAmperage, 1, Short.MAX_VALUE); + computationRequiredPerSec = GT_Utility.clamp(computationRequiredPerSec, 1, Short.MAX_VALUE); + tPersistentHash = tPersistentHash * 31 + totalComputationRequired; + tPersistentHash = tPersistentHash * 31 + computationRequiredPerSec; + tPersistentHash = tPersistentHash * 31 + researchAmperage; + tPersistentHash = tPersistentHash * 31 + researchEUt; + tPersistentHash = tPersistentHash * 31 + assDuration; + tPersistentHash = tPersistentHash * 31 + assEUt; TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false,tInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")},aFluidInputs,null,assDuration,assEUt,0,tAlts,true); - GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( CustomItemList.UnusedStuff.get(1), totalComputationRequired/computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts)); - TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( aResearchItem, totalComputationRequired/computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts)); + GT_Recipe_AssemblyLine recipeGT = new GT_Recipe_AssemblyLine(CustomItemList.UnusedStuff.get(1), totalComputationRequired / computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts); + recipeGT.setPersistentHash(tPersistentHash); + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(recipeGT); + GT_Recipe_AssemblyLine recipeTT = new GT_Recipe_AssemblyLine(aResearchItem, totalComputationRequired / computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts); + recipeTT.setPersistentHash(tPersistentHash); + TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes.add(recipeTT); return true; } diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 9bd69c67ed..9e555e3961 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -94,7 +94,7 @@ public enum CustomItemList implements IItemContainer { eM_avr_HV, eM_avr_EV, eM_avr_IV, eM_avr_LuV, eM_avr_ZPM, eM_avr_UV, eM_avr_UHV, eM_avr_UEV, eM_avr_UIV, eM_avr_UMV, - scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkFluidCover, + scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkFluidCover, powerPassUpgradeCover, Machine_TeslaCoil_1by1_LV, Machine_TeslaCoil_1by1_MV, Machine_TeslaCoil_1by1_HV, Machine_TeslaCoil_1by1_EV, Machine_TeslaCoil_1by1_IV, Machine_TeslaCoil_2by2_LV, Machine_TeslaCoil_2by2_MV, Machine_TeslaCoil_2by2_HV, Machine_TeslaCoil_2by2_EV, Machine_TeslaCoil_2by2_IV, diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java deleted file mode 100644 index 9648e41d8d..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.github.technus.tectech.thing.casing; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.thing.CustomItemList; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Block_Casings_Abstract; -import gregtech.common.blocks.GT_Material_Casings; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import java.util.List; - -import static com.github.technus.tectech.TecTech.creativeTabTecTech; - -/** - * Created by danie_000 on 03.10.2016. - */ -public class GT_Block_HintTT extends GT_Block_Casings_Abstract { - private static IIcon[] hint = new IIcon[16]; - - public GT_Block_HintTT() { - super(GT_Item_HintTT.class, "gt.blockhintTT", GT_Material_Casings.INSTANCE); - setCreativeTab(creativeTabTecTech); - - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Hint 1 dot");//id is -1 - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Hint 2 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Hint 3 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Hint 4 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Hint 5 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Hint 6 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Hint 7 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Hint 8 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Hint 9 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Hint 10 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Hint 11 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Hint 12 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Hint general"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Hint air"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Hint no air"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Hint error"); - - - CustomItemList.hint_0.set(new ItemStack(this, 1, 0)); - CustomItemList.hint_1.set(new ItemStack(this, 1, 1)); - CustomItemList.hint_2.set(new ItemStack(this, 1, 2)); - CustomItemList.hint_3.set(new ItemStack(this, 1, 3)); - CustomItemList.hint_4.set(new ItemStack(this, 1, 4)); - CustomItemList.hint_5.set(new ItemStack(this, 1, 5)); - CustomItemList.hint_6.set(new ItemStack(this, 1, 6)); - CustomItemList.hint_7.set(new ItemStack(this, 1, 7)); - CustomItemList.hint_8.set(new ItemStack(this, 1, 8)); - CustomItemList.hint_9.set(new ItemStack(this, 1, 9)); - CustomItemList.hint_10.set(new ItemStack(this, 1, 10)); - CustomItemList.hint_11.set(new ItemStack(this, 1, 11)); - CustomItemList.hint_general.set(new ItemStack(this, 1, 12)); - CustomItemList.hint_air.set(new ItemStack(this, 1, 13)); - CustomItemList.hint_noAir.set(new ItemStack(this, 1, 14)); - CustomItemList.hint_error.set(new ItemStack(this, 1, 15)); - } - - @Override - public void registerBlockIcons(IIconRegister aIconRegister) { - //super.registerBlockIcons(aIconRegister); - hint[0] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_0"); - hint[1] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_1"); - hint[2] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_2"); - hint[3] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_3"); - hint[4] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_4"); - hint[5] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_5"); - hint[6] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_6"); - hint[7] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_7"); - hint[8] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_8"); - hint[9] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_9"); - hint[10] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_10"); - hint[11] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_11"); - hint[12] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_DEFAULT"); - hint[13] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_AIR"); - hint[14] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_NOAIR"); - hint[15] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_ERROR"); - } - - @Override - public IIcon getIcon(int aSide, int aMeta) { - return hint[aMeta]; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { - int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - return getIcon(aSide, tMeta); - } - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i <= 15; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java b/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java index 071a4ae28f..40bb20d545 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java @@ -7,7 +7,7 @@ import net.minecraft.block.Block; */ public final class TT_Container_Casings { public static Block sBlockCasingsTT; - public static Block sHintCasingsTT; + public static Block sBlockCasingsBA0; public static Block sBlockCasingsNH; 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 c5243b8bc5..d6b5e28b18 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 @@ -224,22 +224,22 @@ public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { resetColorField(); //Public/Private Buttons newButtonWithSpacing(PUBLIC_BUTTON_ID, 0, 2, GT_GuiIcon.WHITELIST) - .setTooltipText("Public"); + .setTooltipText(trans("326", "Public")); newButtonWithSpacing(PRIVATE_BUTTON_ID, 1, 2, GT_GuiIcon.BLACKLIST) - .setTooltipText("Private"); + .setTooltipText(trans("327", "Private")); //Import/Export Buttons newButtonWithSpacing(IMPORT_BUTTON_ID, 0, 3, GT_GuiIcon.IMPORT) .setTooltipText(trans("007", "Import")); newButtonWithSpacing(EXPORT_BUTTON_ID, 1, 3, GT_GuiIcon.EXPORT) - .setTooltipText(trans("007", "Export")); + .setTooltipText(trans("006", "Export")); } @Override public void drawExtras(int mouseX, int mouseY, float parTicks) { super.drawExtras(mouseX, mouseY, parTicks); drawColorSquare(0, 0); - drawNewString("Color Value", 2, 0); - drawNewString("Public/Private", 2, 2); + drawNewString(trans("328", "Color Value"), 2, 0); + drawNewString(trans("329", "Public/Private"), 2, 2); drawNewString(trans("229", "Import/Export"), 2, 3); } diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java deleted file mode 100644 index 3d00fcdf35..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import com.github.technus.tectech.mechanics.constructable.ConstructableUtility; -import com.github.technus.tectech.util.CommonValues; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import java.util.List; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 15.03.2017. - */ -public final class ConstructableTriggerItem extends Item { - public static ConstructableTriggerItem INSTANCE; - - private ConstructableTriggerItem() { - setUnlocalizedName("em.constructable"); - setTextureName(MODID + ":itemConstructable"); - setCreativeTab(creativeTabTecTech); - } - - @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - return ConstructableUtility.handle(aStack, aPlayer, aWorld, aX, aY, aZ, aSide); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK_GENERAL); - aList.add(translateToLocal("item.em.constructable.desc.0"));//Triggers Constructable Interface - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.1"));//Shows multiblock construction details, - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.2"));//just Use on a multiblock controller. - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.3"));//(Sneak Use in creative to build) - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.constructable.desc.4"));//Quantity affects tier/mode/type - } - - public static void run() { - INSTANCE = new ConstructableTriggerItem(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java deleted file mode 100644 index b74f40f336..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import com.github.technus.tectech.mechanics.alignment.AlignmentUtility; -import com.github.technus.tectech.util.CommonValues; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import java.util.List; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 15.03.2017. - */ -public final class FrontRotationTriggerItem extends Item { - public static FrontRotationTriggerItem INSTANCE; - - private FrontRotationTriggerItem() { - setMaxStackSize(1); - setUnlocalizedName("em.frontRotate"); - setTextureName(MODID + ":itemFrontRotate"); - setCreativeTab(creativeTabTecTech); - } - - @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - return AlignmentUtility.handle(aPlayer,aWorld,aX,aY,aZ); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK_GENERAL); - aList.add(translateToLocal("item.em.frontRotate.desc.0"));//Triggers Front Rotation Interface - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.frontRotate.desc.1"));//Rotates only the front panel, - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.frontRotate.desc.2"));//which allows structure rotation. - } - - public static void run() { - INSTANCE = new FrontRotationTriggerItem(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java index 7dcf8bb48a..06c05e5b9d 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java +++ b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java @@ -13,7 +13,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.thing.CustomItemList.enderLinkFluidCover; +import static com.github.technus.tectech.thing.CustomItemList.powerPassUpgradeCover; import static net.minecraft.util.StatCollector.translateToLocal; public final class PowerPassUpgradeCover extends Item { @@ -28,15 +28,15 @@ public final class PowerPassUpgradeCover extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - aList.add(translateToLocal("item.tm.powerpassupgradecover.desc.0"));//Ender-Fluid-Enables Machines! - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.1"));//Use on any side of a fluid tank to link it to the Ender - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.2"));//Ender Tanks so are laggy -Bot from the Chads of NH + aList.add(translateToLocal("item.tm.powerpassupgradecover.desc.0"));//Add power pass functionality to TecTech Multiblocks + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.1"));//Active transformer in a can?? + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.2"));//Chain them up like Christmas lights! } public static void run() { INSTANCE = new PowerPassUpgradeCover(); GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - enderLinkFluidCover.set(INSTANCE); + powerPassUpgradeCover.set(INSTANCE); } @Override 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 6cbf1e801b..4aa90339cc 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 @@ -160,7 +160,10 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector 0) { - return new String[]{translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; + return new String[]{ + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, + translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), + translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; } return new String[]{ translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java index 202dc344c2..b015d71b60 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java @@ -111,7 +111,8 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription,//TODO NOT PASS DESCRIPTION - translateToLocal("gt.blockmachines.hatch.dynamotunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + (Amperes * maxEUOutput()) + EnumChatFormatting.RESET + " EU/t"//Throughput + translateToLocal("gt.blockmachines.hatch.dynamotunnel.desc.1") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(Amperes * maxEUOutput()) + EnumChatFormatting.RESET + " EU/t"//Throughput }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java index 4410372d47..0acb9849a7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java @@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -116,7 +117,8 @@ public class GT_MetaTileEntity_Hatch_EnergyMulti extends GT_MetaTileEntity_Hatch return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription, - translateToLocal("gt.blockmachines.hatch.energymulti.desc.1") + ": " + EnumChatFormatting.AQUA + maxAmperesIn() + " A"//Amperes In + translateToLocal("gt.blockmachines.hatch.energymulti.desc.1") + ": " + + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(maxAmperesIn()) + " A"//Amperes In }; } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java index 854678b79b..d44119e1ab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -108,7 +109,8 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription, - translateToLocal("gt.blockmachines.hatch.energytunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + (Amperes * maxEUInput()) + EnumChatFormatting.RESET + " EU/t"//Throughput + translateToLocal("gt.blockmachines.hatch.energytunnel.desc.1") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(Amperes * maxEUInput()) + EnumChatFormatting.RESET + " EU/t"//Throughput }; } 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 6a9b24ef55..2a04af23d1 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 @@ -12,6 +12,7 @@ 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; @@ -90,8 +91,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 + String.format(Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c\u00b2", - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + String.format(Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c\u00b2)/s", + 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.3") }; } @@ -216,9 +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 + Double.toString(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", - EnumChatFormatting.GREEN + Double.toString(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", - translateToLocalFormatted("tt.keyphrase.Mass_Disposal_speed", clientLocale) + ": " + EnumChatFormatting.BLUE + overflowDisperse + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" + EnumChatFormatting.RED + GT_Utility.formatNumbers(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(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" }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 584e28a607..4580c545af 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,27 +1,28 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -31,30 +32,6 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - //endregion - - //region structure - private static final String[][] shape = new String[][]{ - {"\u0002", "D000", "C0 0", "C0 . 0", "C0 0", "D000"}, - {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, - {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, - {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, - {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, - {"00C!C00", "02444544420", "A4G4", "A4G4", "A4G4", "!5G5!", "A4G4", "A4G4", "A4G4", "02444544420", "00C!C00",}, - {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, - {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, - {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, - {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, - {"\u0002", "D000", "C0 0", "C0 0", "C0 0", "D000"}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, - GT_MetaTileEntity_EM_annihilation::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.0"),//1 - Classic Hatches or High Power Casing @@ -62,6 +39,33 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl }; //endregion + //region structure + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "}, + {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, + {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, + {" AAA ","AA BAB AA","ACGGEGEGGCA"," G G "," G G "," G G "," G G "," G G ","ACGGEGEGGCA","AA BAB AA"," AAA "}, + {" AHHHA ","BBBBBBBBBBB","BEEEDEDEEEB","BE EB"," G G "," G G "," G G ","BE EB","BEEEDEDEEEB","BBBBBBBBBBB"," AHHHA "}, + {" AH~HA "," ABBBA "," EGGEEEGGE ","BE EB","AE EA","FD DF","AE EA","BE EB"," EGGEEEGGE "," ABBBA "," AHHHA "}, + {" AHHHA ","BBBBBBBBBBB","BEEEDEDEEEB","BE EB"," G G "," G G "," G G ","BE EB","BEEEDEDEEEB","BBBBBBBBBBB"," AHHHA "}, + {" AAA ","AA BAB AA","ACGGEGEGGCA"," G G "," G G "," G G "," G G "," G G ","ACGGEGEGGCA","AA BAB AA"," AAA "}, + {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, + {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, + {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 10)) + .addElement('E', ofBlock(sBlockCasingsTT, 12)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, textureOffset + 4,2, sBlockCasingsTT, 4)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); + //endregion + public GT_MetaTileEntity_EM_annihilation(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -77,7 +81,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); + return structureCheck_EM("main", 5, 5, 0); } @Override @@ -107,7 +111,12 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 5, 5, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 06476fb62e..363f184ebc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,14 +17,14 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHatchAdderOptional; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_INGOT_MASS_DIFF; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_MASS_TO_EU_INSTANT; -import static gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -49,92 +49,90 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E //per dim disable thingies //region structure actual - private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition - .builder() - .addShapeOldApi("t1",new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }) - .addShapeOldApi("t2",new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, - {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, - {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, - {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, - {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, - {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, - {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, - {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, - {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, - {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, - {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, - {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, - {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, - {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, - {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, - {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, - {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, - {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, - {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, - {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, - {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, - {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, - {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, - {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, - {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, - {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, - {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }) - .addElement('0', ofBlock(sBlockCasingsTT,12)) - .addElement('1', ofBlock(sBlockCasingsTT,13)) - .addElement('2', ofBlock(sBlockCasingsTT,14)) - .addElement('3', ofBlock(sBlockCasingsTT,10)) - .addElement('4', ofBlock(sBlockCasingsTT,11)) - .addElement('5', ofBlock(QuantumGlassBlock.INSTANCE,0)) - .addElement(' ', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, - textureOffset,1,sBlockCasingsTT,0)) - .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, - textureOffset + 4,2,sBlockCasingsTT,4)) + private static final IStructureDefinition STRUCTURE_DEFINITION= + StructureDefinition.builder() + .addShape("main_t1", transpose(new String[][]{ + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," C C "," DDDDD "," DDCDCDD "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," DDCDCDD "," DDDDD "," C C "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," C C "," C C "," D "," D "," DDDDDDD "," DD DD "," D EEE D "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," D EEE D "," DD DD "," DDDDDDD "," D "," D "," C C "," C C "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," C C "," D "," D "," "," "," "," "," "," CC CC "," DD DD "," CC CC "," "," "," "," "," "," D "," D "," C C "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," C C "," CCCCC "," D "," B "," B "," "," "," "," "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," "," "," "," "," B "," B "," D "," CCCCC "," C C "," "," "," "," "," "}, + {" "," "," "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "," "," "}, + {" "," "," "," C C "," CCCCC "," D "," B "," "," "," "," "," "," "," "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," "," "," "," "," "," "," "," B "," D "," CCCCC "," C C "," "," "," "}, + {" "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "}, + {" "," "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," C C "," DB BD "," C C "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," "," "}, + {" "," C C "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," CC CC "," DB BD "," CC CC "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," C C "," "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" CCCCCCC "," C C "," DDDDDDD "," "," "," "," "," "," "," "," "," "," "," D D "," D D ","CCD DCC"," D D ","CCD DCC"," D D "," D D "," "," "," "," "," "," "," "," "," "," "," DDDDDDD "," C C "," C C "}, + {" CCHHHHHCC "," DDDDD "," DD DD "," "," "," E E "," "," E E "," "," "," "," "," D D "," D D "," D D ","CD DC"," D D ","CD DC"," D D "," D D "," D D "," "," "," "," "," E E "," "," E E "," "," "," DD DD "," DDDDD "," C C "}, + {" CHHHHHHHC "," DDCDCDD "," D EEE D "," "," C C "," E E "," C C "," E E "," "," "," "," "," D D "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," D D "," "," "," "," "," E E "," C C "," E E "," C C "," "," D EEE D "," DDCDCDD "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHF~FHHC "," DDDDDDD "," DDD EAAAE DDD "," DD DD "," CDBB BBDC "," DB BD "," CDB BDC "," DB BD "," DB BD "," DB BD "," D D "," D D "," D D "," D D "," DE ED ","CDA ADC"," DA AD ","CDA ADC"," DE ED "," D D "," D D "," D D "," D D "," DB BD "," DB BD "," DB BD "," CDB BDC "," DB BD "," CDBB BBDC "," DD DD "," DDD EAAAE DDD "," DDDDDDD "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHHHHHHC "," DDCDCDD "," D EEE D "," "," C C "," E E "," C C "," E E "," "," "," "," "," D D "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," D D "," "," "," "," "," E E "," C C "," E E "," C C "," "," D EEE D "," DDCDCDD "," C C "}, + {" CCHHHHHCC "," DDDDD "," DD DD "," "," "," E E "," "," E E "," "," "," "," "," D D "," D D "," D D ","CD DC"," D D ","CD DC"," D D "," D D "," D D "," "," "," "," "," E E "," "," E E "," "," "," DD DD "," DDDDD "," C C "}, + {" CCCCCCC "," C C "," DDDDDDD "," "," "," "," "," "," "," "," "," "," "," D D "," D D ","CCD DCC"," D D ","CCD DCC"," D D "," D D "," "," "," "," "," "," "," "," "," "," "," DDDDDDD "," C C "," C C "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, + {" "," C C "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," CC CC "," DB BD "," CC CC "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," C C "," "}, + {" "," "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," C C "," DB BD "," C C "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," "," "}, + {" "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "}, + {" "," "," "," C C "," CCCCC "," D "," B "," "," "," "," "," "," "," "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," "," "," "," "," "," "," "," B "," D "," CCCCC "," C C "," "," "," "}, + {" "," "," "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "," "," "}, + {" "," "," "," "," "," C C "," CCCCC "," D "," B "," B "," "," "," "," "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," "," "," "," "," B "," B "," D "," CCCCC "," C C "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," C C "," D "," D "," "," "," "," "," "," CC CC "," DD DD "," CC CC "," "," "," "," D "," D "," D "," D "," C C "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," C C "," C C "," D "," D "," DDDDDDD "," DD DD "," D EEE D "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," D EEE D "," DD DD "," DDDDDDD "," D "," D "," C C "," C C "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," C C "," DDDDD "," DDCDCDD "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," DDCDCDD "," DDDDD "," C C "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "} + })) + .addShape("main_t2", transpose(new String[][]{ + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," GGC CGG "," GGGC CGGG "," GGGGC CGGGG "," GGGGDDDDDGGGG "," GGGDDCDCDDGGG "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," GGGDDCDCDDGGG "," GGGGDDDDDGGGG "," GGGGC CGGGG "," GGGC CGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," GGC CGG "," GGGGC CGGGG "," GGG D GGG "," GGG D GGG "," GG DDDDDDD GG "," GG DD DD GG "," GG D EEE D GG "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," GG D EEE D GG "," GG DD DD GG "," GG DDDDDDD GG "," GGG D GGG "," GGG D GGG "," GGGGC CGGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," GGGC CGGG "," GGG D GGG "," GG D GG "," GG GG "," G G "," GG GG "," G G "," G G "," CC CC "," DD DD "," CC CC "," G G "," G G "," GG GG "," G G "," GG GG "," GG D GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," GG B GG "," G G "," GG GG "," G G "," G G "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," G G "," G G "," GG GG "," G G "," GG B GG "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "," "," "}, + {" "," "," "," "," C C "," GGGGGC CGGGGG "," GGG D GGG "," GG EEEBEEE GG "," GG GG "," G G "," GG GG "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," GG GG "," G G "," GG GG "," GG EEEBEEE GG "," GGG D GGG "," GGGGGC CGGGGG "," C C "," "," "," "," "}, + {" "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "}, + {" "," "," C C "," GGGC CGGG "," GGG D GGG "," GG EEEBEEE GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG EEEBEEE GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "}, + {" "," "," GGC CGG "," GGG D GGG "," GG B GG "," GG GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," DB BD "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG GG "," GG B GG "," GGG D GGG "," GGC CGG "," "," "}, + {" "," C C "," GGGGC CGGGG "," GG D GG "," GG B GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," CC CC "," DB BD "," CC CC "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG B GG "," GG D GG "," GGGGC CGGGG "," C C "," "}, + {" "," GGC CGG "," GGG D GGG "," GG GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG GG "," GGG D GGG "," GGC CGG "," "}, + {" "," GGGC CGGG "," GGG D GGG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GGG D GGG "," GGGC CGGG "," "}, + {" CCCCCCC "," GGGGC CGGGG "," GG DDDDDDD GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GD DG "," GD DG ","CCD DCC"," D D ","CCD DCC"," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG DDDDDDD GG "," GGGGC CGGGG "," C C "}, + {" CCHHHHHCC "," GGGGDDDDDGGGG "," GG DD DD GG "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," GD DG "," D D ","CD DC"," D D ","CD DC"," D D "," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," GG DD DD GG "," GGGGDDDDDGGGG "," C C "}, + {" CHHHHHHHC "," GGGDDCDCDDGGG "," GG D EEE D GG "," G G "," C C "," G E E G "," C C "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," C C "," G E E G "," C C "," G G "," GG D EEE D GG "," GGGDDCDCDDGGG "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHF~FHHC "," DDDDDDD "," DDD EAAAE DDD "," DD DD "," CDBB BBDC "," DB BD "," CDB BDC "," DB BD "," DB BD "," DB BD "," D D "," D D "," D D "," D D "," DE ED ","CDA ADC"," DA AD ","CDA ADC"," DE ED "," D D "," D D "," D D "," D D "," DB BD "," DB BD "," DB BD "," CDB BDC "," DB BD "," CDBB BBDC "," DD DD "," DDD EAAAE DDD "," DDDDDDD "," C C "}, + {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, + {" CHHHHHHHC "," GGGDDCDCDDGGG "," GG D EEE D GG "," G G "," C C "," G E E G "," C C "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," C C "," G E E G "," C C "," G G "," GG D EEE D GG "," GGGDDCDCDDGGG "," C C "}, + {" CCHHHHHCC "," GGGGDDDDDGGGG "," GG DD DD GG "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," GD DG "," D D ","CD DC"," D D ","CD DC"," D D "," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," GG DD DD GG "," GGGGDDDDDGGGG "," C C "}, + {" CCCCCCC "," GGGGC CGGGG "," GG DDDDDDD GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GD DG "," GD DG ","CCD DCC"," D D ","CCD DCC"," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG DDDDDDD GG "," GGGGC CGGGG "," C C "}, + {" "," GGGC CGGG "," GGG D GGG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GGG D GGG "," GGGC CGGG "," "}, + {" "," GGC CGG "," GGG D GGG "," GG GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG GG "," GGG D GGG "," GGC CGG "," "}, + {" "," C C "," GGGGC CGGGG "," GG D GG "," GG B GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," CC CC "," DB BD "," CC CC "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG B GG "," GG D GG "," GGGGC CGGGG "," C C "," "}, + {" "," "," GGC CGG "," GGG D GGG "," GG B GG "," GG GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," DB BD "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG GG "," GG B GG "," GGG D GGG "," GGC CGG "," "," "}, + {" "," "," C C "," GGGC CGGG "," GGG D GGG "," GG EEEBEEE GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG EEEBEEE GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "}, + {" "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "}, + {" "," "," "," "," C C "," GGGGGC CGGGGG "," GGG D GGG "," GG EEEBEEE GG "," GG GG "," G G "," GG GG "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," GG GG "," G G "," GG GG "," GG EEEBEEE GG "," GGG D GGG "," GGGGGC CGGGGG "," C C "," "," "," "," "}, + {" "," "," "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," GG B GG "," G G "," GG GG "," G G "," G G "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," G G "," G G "," GG GG "," G G "," GG B GG "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "," "," "}, + {" "," "," "," "," "," "," C C "," GGGC CGGG "," GGG D GGG "," GG D GG "," GG GG "," G G "," GG GG "," G G "," G G "," CC CC "," DD DD "," CC CC "," G G "," G G "," GG GG "," G D G "," GG D GG "," GG D GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," C C "," GGC CGG "," GGGGC CGGGG "," GGG D GGG "," GGG D GGG "," GG DDDDDDD GG "," GG DD DD GG "," GG D EEE D GG "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," GG D EEE D GG "," GG DD DD GG "," GG DDDDDDD GG "," GGG D GGG "," GGG D GGG "," GGGGC CGGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," C C "," GGC CGG "," GGGC CGGG "," GGGGC CGGGG "," GGGGDDDDDGGGG "," GGGDDCDCDDGGG "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," GGGDDCDCDDGGG "," GGGGDDDDDGGGG "," GGGGC CGGGG "," GGGC CGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "," "," "}, + {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 10)) + .addElement('B', ofBlock(sBlockCasingsTT, 11)) + .addElement('C', ofBlock(sBlockCasingsTT, 12)) + .addElement('D', ofBlock(sBlockCasingsTT, 13)) + .addElement('E', ofBlock(sBlockCasingsTT, 14)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .build(); @Override - public IStructureDefinition getStructure_EM() { + public IStructureDefinition getStructure_EM() { return STRUCTURE_DEFINITION; } @@ -308,7 +306,12 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM((stackSize.stackSize&1)==1?"t1":"t2", 16, 16, 0, hintsOnly,stackSize); + try { + structureBuild_EM((stackSize.stackSize & 1) == 1 ? "main_t1" : "main_t2", 16, 16, 0, stackSize, hintsOnly); + } + catch (Exception e) { + e.printStackTrace(); + } } @Override 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 6a6a707399..3e2b029bba 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 @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; @@ -12,7 +9,10 @@ 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.Vec3Impl; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -22,7 +22,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -30,13 +29,15 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -51,23 +52,44 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; - private static final String[][] terminator = new String[][]{{"A ", "A ", "A ", "A ",},}; - private static final String[][] cap = new String[][]{{"-01", "A22", "A22", "-01",},}; - private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},}; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2, 1, 3}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_computer::addToMachineList, - GT_MetaTileEntity_EM_computer::addRackToMachineList); - private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{1, 3}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.computer.hint.0"),//1 - Classic/Data Hatches or Computer casing translateToLocal("gt.blockmachines.multimachine.em.computer.hint.1"),//2 - Rack Hatches or Advanced computer casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("front", transpose(new String[][]{ + {" AA"}, + {" AA"}, + {" ~A"}, + {" AA"} + })) + .addShape("cap", transpose(new String[][]{ + {"-CB"}, + {" DD"}, + {" DD"}, + {"-CB"} + })) + .addShape("slice", transpose(new String[][]{ + {"-CB"}, + {" ED"}, + {" ED"}, + {"-CB"} + })) + .addShape("back", transpose(new String[][]{ + {" AA"}, + {" AA"}, + {" AA"}, + {" AA"} + })) + .addElement('A', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 1)) + .addElement('C', ofBlock(sBlockCasingsTT, 2)) + .addElement('D', ofBlock(sBlockCasingsTT, 3)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addRackToMachineList, textureOffset + 3, 2, sBlockCasingsTT, 3)) + .build(); //endregion //region parameters @@ -129,15 +151,15 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } } eRacks.clear(); - if (!structureCheck_EM(front, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0)) { + if (!structureCheck_EM("front", 1, 2, 0)) { return false; } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, -1)) { + if (!structureCheck_EM("cap", 1, 2, -1)) { return false; } byte offset = -2, totalLen = 4; while (offset > -16) { - if (!structureCheck_EM(slice, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, offset)) { + if (!structureCheck_EM("slice", 1, 2, offset)) { break; } totalLen++; @@ -146,10 +168,10 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB if (totalLen > 17) { return false; } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { + if (!structureCheck_EM("cap", 1, 2, ++offset)) { return false; } - if (!structureCheck_EM(terminator, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, --offset)) { + if (!structureCheck_EM("back", 1, 2, --offset)) { return false; } eCertainMode = (byte) Math.min(totalLen / 3, 5); @@ -246,7 +268,10 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { if (!eOutputData.isEmpty()) { - Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + QuantumDataPacket pack = new QuantumDataPacket(eAvailableData / eOutputData.size()).unifyTraceWith(pos); if (pack == null) { return; @@ -359,16 +384,21 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity igt = getBaseMetaTileEntity(); - Structure.builder(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); - Structure.builder(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("front", 1, 2, 0, stackSize, hintsOnly); + structureBuild_EM("cap", 1, 2, -1, stackSize, hintsOnly); byte offset = -2; for (int rackSlices = Math.min(stackSize.stackSize, 12); rackSlices > 0; rackSlices--) { - Structure.builder(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("slice", 1 , 2, offset--, stackSize, hintsOnly); } - Structure.builder(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); - Structure.builder(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); + structureBuild_EM("cap", 1, 2, offset--, stackSize, hintsOnly); + structureBuild_EM("back", 1, 2, offset, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 7d8204c07f..22e4ea5eea 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,27 +1,28 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -36,32 +37,30 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {"A000", "0 0", "0 . 0", "0 0", "A000",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, - {"22222", "22222", "22122", "22222", "22222",}, - {"23432", "33333", "43134", "33333", "23432",}, - {"23332", "33333", "33533", "33333", "23332",}, - {"23432", "33333", "43134", "33333", "23432",}, - {"22222", "22222", "22122", "22222", "22222",}, - {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"A000", "0 0", "0 0", "0 0", "A000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_crafting::addClassicToMachineList, - GT_MetaTileEntity_EM_crafting::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION= StructureDefinition + .builder() + .addShape("main", transpose(new String[][]{ + {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "}, + {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, + {"AH~HA","AAAAA"," FEF ","BBEBB","CGEGC","GGDGG","CGEGC","BBEBB"," FEF ","AAAAA","AHHHA"}, + {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, + {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 9)) + .addElement('E', ofBlock(sBlockCasingsTT, 10)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); //endregion public GT_MetaTileEntity_EM_crafting(int aID, String aName, String aNameRegional) { @@ -79,7 +78,7 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -109,7 +108,12 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 582be290ac..cccdbbd2d9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; @@ -12,6 +9,9 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContaine import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,7 +20,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -28,12 +27,14 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { @@ -43,24 +44,24 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {"0 0", "0 . 0", "0 0",}, - {"0!!!0", "01110", "0!!!0",}, - {"0!!!0", "0!!!0", "0!!!0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2, 1}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, - GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.databank.hint.0"),//1 - Classic Hatches or high power casing translateToLocal("gt.blockmachines.multimachine.em.databank.hint.1"),//2 - Data Access/Data Bank Master Hatches or computer casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {"BCCCB","BDDDB","BDDDB"}, + {"BC~CB","BAAAB","BDDDB"}, + {"BCCCB","BDDDB","BDDDB"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 2)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList, textureOffset + 1, 2, sBlockCasingsTT, 1)) + .build(); //endregion public GT_MetaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { @@ -80,7 +81,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { eDataAccessHatches.clear(); eStacksDataOutputs.clear(); - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 1, 0); + return structureCheck_EM("main", 2, 1, 0); } @Override @@ -174,7 +175,12 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 1, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 1978d2acfc..0da76c2fce 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -13,6 +10,8 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -23,7 +22,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import ic2.core.init.MainConfig; import ic2.core.util.ConfigUtil; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -32,13 +30,14 @@ import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; import static com.github.technus.tectech.util.CommonValues.VN; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -58,25 +57,27 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase //endregion //region structure - private static final String[][] shape = new String[][]{ - {"0C0", "A ", "A . ", "A ", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, - {"01110", "12221", "12221", "12221", "01110",}, - {"01310", "12221", "32223", "12221", "01310",}, - {"01110", "12221", "12221", "12221", "01110",}, - {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A ", "A ", "A ", "0C0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_decay::addClassicToMachineList, - GT_MetaTileEntity_EM_decay::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; + public static final IStructureDefinition STRUCTURE_DEFINITION=IStructureDefinition + .builder() + .addShape("main",new String[][]{ + {"0 0", " &&& ", " &~& ", " &&& ", "0 0",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"0 0", " !!! ", " !0! ", " !!! ", "0 0",}, + {"01110", "12221", "12221", "12221", "01110",}, + {"01310", "12221", "32223", "12221", "01310",}, + {"01110", "12221", "12221", "12221", "01110",}, + {"0 0", " !!! ", " !0! ", " !!! ", "0 0",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"0 0", " &&& ", " &&& ", " &&& ", "0 0",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT,4)) + .addElement('1', ofBlock(sBlockCasingsTT,5)) + .addElement('2',ofBlock(sBlockCasingsTT,8)) + .addElement('3',ofBlock(sBlockCasingsTT,6)) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addClassicToMachineList,textureOffset,1,sBlockCasingsTT,0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addElementalToMachineList,textureOffset+4,2,sBlockCasingsTT,4)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.decay.hint.0"),//1 - Classic Hatches or High Power Casing @@ -110,7 +111,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -248,7 +249,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 7d5961f219..02a049290d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,23 +1,21 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -29,10 +27,13 @@ import java.util.ArrayList; import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAnyMeta; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -41,21 +42,22 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"010", "111", "010",}, - {"\"\"\"", "\"1\"", "\"\"\"",}, - {"121", "2!2", "121",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; - private static final byte[] blockMeta = new byte[]{0, 4, 0}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, - GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", new String[][]{ + {"&&&", "&~&", "&&&",}, + {"010", "111", "010",}, + {"$$$", "$1$", "$$$",}, + {"121", "2!2", "121",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT, 0)) + .addElement('1', ofBlock(sBlockCasingsTT, 4)) + .addElement('2', ofBlockAnyMeta(QuantumGlassBlock.INSTANCE)) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdder(GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3,sBlockCasingsTT,4)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.0"),//1 - Classic Hatches or High Power Casing" @@ -92,7 +94,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -138,7 +140,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 82fd2df5ed..2e9a07071e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -3,20 +3,19 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -24,10 +23,12 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.GregTech_API.mEUtoRF; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -35,22 +36,24 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", "000", "1.1", "000", " ",}, - {" ", "010", "111", "010", " ",}, - {" ", "000", "111", "000", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{7, 4}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_infuser::addClassicToMachineList); - private static final short[] casingTextures = new short[]{textureOffset}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.infuser.hint"),//1 - Classic Hatches or High Power Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {"CCC","CCC","CCC"}, + {"BBB","BAB","BBB"}, + {"A~A","AAA","AAA"}, + {"BBB","BAB","BBB"}, + {"CCC","CCC","CCC"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 7)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_infuser::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); //endregion public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { @@ -114,7 +117,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0); + return structureCheck_EM("main", 1, 2, 0); } @Override @@ -185,7 +188,12 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index d4e85de6f9..fc465f063a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,8 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -10,19 +7,21 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; -import static gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -31,32 +30,32 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"000", "000", "000",}, - {"!!!", "!0!", "!!!",}, - {"!!!", "!!!", "!!!",}, - }; - private static final String[][] shapeBig = new String[][]{ - {E, "A ", "A . ", "A ",}, - {"A!!!", "!000!", "!010!", "!000!", "A!!!",}, - {"!!!!!", "!000!", "!000!", "!000!", "!!!!!",}, - {"A!!!", "!000!", "!000!", "!000!", "A!!!",}, - {"A!!!", "!!!!!", "!!!!!", "!!!!!", "A!!!",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_junction::addClassicToMachineList, - GT_MetaTileEntity_EM_junction::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.junction.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.junction.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", new String[][]{ + {"CCC", "C~C", "CCC"}, + {"AAA", "AAA", "AAA"}, + {"DDD", "DAD", "DDD"}, + {"DDD", "DDD", "DDD"} + }) + .addShape("mainBig", new String[][]{ + {" ", " CCC ", " C~C ", " CCC ", " "}, + {" DDD ", "DAAAD", "DABAD", "DAAAD", " DDD "}, + {"DDDDD", "DAAAD", "DAAAD", "DAAAD", "DDDDD"}, + {" DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD "}, + {" DDD ", "DDDDD", "DDDDD", "DDDDD", " DDD "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion //region parameters @@ -106,9 +105,9 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { int meta = iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); if (meta == 4) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } else if (meta == 5) { - return structureCheck_EM(shapeBig, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("mainBig", 2, 2, 0); } return false; } @@ -177,7 +176,16 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + if ((stackSize.stackSize & 1) == 1) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); + } else { + structureBuild_EM("mainBig", 2, 2, 0, stackSize, hintsOnly); + } + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override 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 be036050be..6a840dcf0e 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 @@ -2,24 +2,22 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.mechanics.elementalMatter.core.transformations.EMFluidQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -33,13 +31,16 @@ import static com.github.technus.tectech.mechanics.elementalMatter.core.definiti import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAnyMeta; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -48,22 +49,23 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"010", "101", "010",}, - {"\"\"\"", "\"0\"", "\"\"\"",}, - {"202", "0!0", "202",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; - private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, - GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, - GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; - private static final String[] description = new String[]{ + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", new String[][]{ + {"&&&", "&~&", "&&&",}, + {"010", "101", "010",}, + {"$$$", "$0$", "$$$",}, + {"202", "0!0", "202",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT, 4)) + .addElement('1', ofBlock(sBlockCasingsTT, 0)) + .addElement('2', ofBlockAnyMeta(QuantumGlassBlock.INSTANCE)) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList, textureOffset + 4, 3,sBlockCasingsTT,4)) + .build(); + + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.1"),//2 - Elemental Output Hatch @@ -86,14 +88,14 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) {//TODO implement instance quantization if (GregTech_API.sPostloadFinished) { ArrayList storedInputs = getStoredInputs(); - ItemStack[] inI = storedInputs.toArray(nullItem); + ItemStack[] inI = storedInputs.toArray(nullItem); if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization @@ -132,7 +134,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } } ArrayList storedFluids = getStoredFluids(); - FluidStack[] inF = storedFluids.toArray(nullFluid); + FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { EMFluidQuantizationInfo aFQI = TecTech.transformationInfo.getFluidQuantization().get(fs.getFluid().getID()); @@ -154,7 +156,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private void startRecipe(IEMStack into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - double mass = into.getMass(); + double mass = into.getMass(); double euMult = Math.abs(mass / refMass); eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); if (mass > refUnstableMass || into.getDefinition().getRawTimeSpan(DEFAULT_ENERGY_LEVEL) < STABLE_RAW_LIFE_TIME) { @@ -198,7 +200,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 889b4cfec3..4b0294bf4d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -22,10 +22,8 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockB import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -36,7 +34,6 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; import java.util.LinkedHashMap; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -45,7 +42,10 @@ 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 gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -64,32 +64,33 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private static LinkedHashMap lServerNames; - private String clientLocale = "en_US"; - //endregion - - //region structure - private static final String[][] shape = new String[][]{ - {E, "000", E, E, E, "000"/*,E,*/}, - {"A0", "010", "A1", "A!", "A1", "010", "A0",}, - {"A0", "010", E, E, E, "010", "A0",}, - {"000", "010", E, E, E, "010", "000",}, - {"000", "212", "010", "0.0", "010", "212", "000",}, - {"000", "212", "111", "111", "111", "212", "000",}, - {"000", "222", " ", " ", " ", "222", "000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{1, 3, 2}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_research::addClassicToMachineList, - GT_MetaTileEntity_EM_research::addHolderToMachineList); - private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; - private static final byte[] blockMetaFallback = new byte[]{1, 0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.research.hint.0"),//1 - Classic/Data Hatches or Computer casing translateToLocal("gt.blockmachines.multimachine.em.research.hint.1"),//2 - Holder Hatch }; + + private String clientLocale = "en_US"; + //endregion + + //region structure + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {" ", " E ", " ", " ", "A~A", "CCC", "DDD"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 2)) + .addElement('C', ofBlock(sBlockCasingsTT, 3)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1,1, sBlockCasingsTT,1)) + .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 2)) + .build(); //endregion public GT_MetaTileEntity_EM_research(int aID, String aName, String aNameRegional) { @@ -262,7 +263,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } eHolders.clear(); - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 3, 4)) { + if (!structureCheck_EM("main", 1, 3, 4)) { return false; } @@ -378,21 +379,31 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB return new String[]{ translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t " + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t " + + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, translateToLocalFormatted("tt.keyphrase.Computation_Remaining", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + computationRequired / 20L + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(computationRequired / 20L) }; } @@ -559,7 +570,12 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 3, 4, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override 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 89255b331a..f47926b449 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 @@ -1,13 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.EMException; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -16,6 +13,8 @@ import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -36,7 +35,6 @@ import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -45,6 +43,9 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.G 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.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -54,41 +55,42 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables public static final int SCAN_DO_NOTHING = 0, - SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, - SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, - SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; + SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, + SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, + SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; private EMDefinitionStack objectResearched; private EMInstanceStackMap objectsScanned; - private String machineType; - private long computationRemaining, computationRequired; + private String machineType; + private long computationRemaining, computationRequired; private int[] scanComplexity; private String clientLocale = "en_US"; //endregion //region structure - private static final String[][] shape = new String[][]{ - {" ", " 222 ", " 2.2 ", " 222 ", " ",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"00100", "01110", "11111", "01110", "00100",}, - {"01110", "1---1", "1---1", "1---1", "01110",}, - {"01110", "1---1", "1-A-1", "1---1", "01110",}, - {"01110", "1---1", "1---1", "1---1", "01110",}, - {"00100", "01110", "11\"11", "01110", "00100",}, - {"#####", "#000#", "#0!0#", "#000#", "#####",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_scanner::addClassicToMachineList, - GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, - GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, - GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", new String[][]{ + {" 222 ", "2&&&2", "2&~&2", "2&&&2", " 222 ",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"00100", "01110", "11111", "01110", "00100",}, + {"01110", "1---1", "1---1", "1---1", "01110",}, + {"01110", "1---1", "1-A-1", "1---1", "01110",}, + {"01110", "1---1", "1---1", "1---1", "01110",}, + {"00100", "01110", "11$11", "01110", "00100",}, + {"#####", "#000#", "#0!0#", "#000#", "#####",},}) + .addElement('0', ofBlock(sBlockCasingsTT, 4)) + .addElement('1', ofBlockAnyMeta(QuantumGlassBlock.INSTANCE)) + .addElement('2', ofBlock(sBlockCasingsTT, 0)) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, textureOffset + 4, 2)) + .addElement('$', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, textureOffset + 4, 3)) + .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) + .addElement('A', ofChain(ofBlockAnyMeta(QuantumStuffBlock.INSTANCE),isAir())) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.0"),//1 - Classic Hatches or High Power Casing @@ -99,7 +101,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa //endregion //region parameters - private static final INameFunction CONFIG_NAME = + private static final INameFunction CONFIG_NAME = (base, p) -> "Config at Depth: " + (p.hatchId() * 2 + p.parameterId()); private static final IStatusFunction CONFIG_STATUS = (base, p) -> { @@ -113,7 +115,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (v < 0) return LedStatus.STATUS_TOO_LOW; return LedStatus.STATUS_OK; }; - protected Parameters.Group.ParameterIn[] scanConfiguration; + protected Parameters.Group.ParameterIn[] scanConfiguration; //endregion public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { @@ -129,9 +131,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private void quantumStuff(boolean shouldExist) { IGregTechTileEntity base = getBaseMetaTileEntity(); if (base != null && base.getWorld() != null) { - int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); - int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); - int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); + int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); + int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); + int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); Block block = base.getWorld().getBlock(xDir, yDir, zDir); if (shouldExist) { if (block != null && block.getMaterial() == Material.air) { @@ -209,7 +211,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { + if (!structureCheck_EM("main", 2, 2, 0)) { return false; } return eInputHatches.size() == 1 && eOutputHatches.size() == 1 && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() == iGregTechTileEntity.getFrontFacing(); @@ -331,7 +333,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public String[] getInfoData() { long storedEnergy = 0; - long maxEnergy = 0; + long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); @@ -409,7 +411,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa computationRemaining = aNBT.getLong("eComputationRemaining"); computationRequired = aNBT.getLong("eComputationRequired"); if (aNBT.hasKey("eObject")) { - objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eObject")); + objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eObject")); if (objectResearched.getDefinition() == nbtE__) { objectResearched = null; } @@ -423,7 +425,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } try { if (aNBT.hasKey("eScanObjects")) { - objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eScanObjects")); + objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eScanObjects")); } } catch (EMException e) { objectsScanned = new EMInstanceStackMap(); @@ -515,8 +517,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack trigger, boolean hintsOnly) { + structureBuild_EM("main", 2, 2, 0, trigger, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index dcd85af99d..1ecd92af74 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,20 +1,21 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -22,26 +23,29 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {"A010", "0 0", "1 . 1", "0 0", "A010",}, - {"23232", "32223", "22222", "32223", "23232",}, - {"12!21", "22422", "!444!", "22422", "12!21",}, - {"23232", "32223", "22222", "32223", "23232",}, - {"A010", "0 0", "1 1", "0 0", "A010",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, - GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "}, + {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, + {"FE~EF","BBBBB","GDDDG","BBBBB","FEEEF"}, + {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, + {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 9)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion public GT_MetaTileEntity_EM_stabilizer(int aID, String aName, String aNameRegional) { @@ -59,7 +63,7 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -73,7 +77,12 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 5ade4ec965..f4e02085f4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,10 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -13,24 +10,28 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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.Vec3Impl; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -38,22 +39,21 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {" ", " 0 ", " ",}, - {" ", " ", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{3}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_switch::addClassicToMachineList); - private static final short[] casingTextures = new short[]{textureOffset + 1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", "1 - Classic/Data Hatches or Computer casing",//1 - Classic/Data Hatches or Computer casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {"BBB","BBB","BBB"}, + {"B~B","BAB","BBB"}, + {"BBB","BBB","BBB"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 3)) + .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_EM_switch::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .build(); //endregion //region parameters @@ -99,7 +99,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -134,7 +134,10 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } } - Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + QuantumDataPacket pack = new QuantumDataPacket(0L).unifyTraceWith(pos); if (pack == null) { return; @@ -223,7 +226,12 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 3e288ccafa..450a8ba610 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,12 +20,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.GregTech_API.sBlockCasings1; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -46,7 +46,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo }) .addElement('0', ofBlock(sBlockCasings1,15)) .addElement('1', ofChain( - ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), + ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList,textureOffset,1), onElementPass(t->t.casingCount++,ofBlock(sBlockCasingsTT,0)) )) .build(); @@ -160,7 +160,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - structureBuild_EM("main", 1, 1, 0, hintsOnly, stackSize); + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index fa51447e9f..98be43139b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,28 +1,28 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -35,32 +35,33 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {E, E, E, "C ", "C . ", "C "/*,E,E,E,*/}, - {E, E, "D0", "C000", "B00100", "C000", "D0"/*,E,E,*/}, - {E, E, "D0", "C2A2", "B0C0", "C2A2", "D0"/*,E,E,*/}, - {E, "D0", "D0", E, "A00C00", E, "D0", "D0"/*,E,*/}, - {E, "D0", E, E, "A0E0", E, E, "D0"/*,E,*/}, - {"D0", "D0", E, E, "00E00", E, E, "D0", "D0",}, - {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, - {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, - {"B0!!!0", "A 31113 ", "031444130", "!14C41!", "!14C41!", "!14C41!", "031444130", "A 31113 ", "B0!!!0",}, - {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, - {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, - GT_MetaTileEntity_EM_wormhole::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "}, + {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, + {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, + {" EEE "," DDD "," F F "," "," "," ","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, + {" E~E "," DDBDD "," D D "," DD DD "," D D ","DD DD","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, + {" EEE "," DDD "," F F "," "," "," ","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, + {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, + {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, + {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 5)) + .addElement('B', ofBlock(sBlockCasingsTT, 10)) + .addElement('C', ofBlock(sBlockCasingsTT, 11)) + .addElement('D', ofBlock(sBlockCasingsTT, 12)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion public GT_MetaTileEntity_EM_wormhole(int aID, String aName, String aNameRegional) { @@ -78,7 +79,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 4, 4, 0); + return structureCheck_EM("main", 4, 4, 0); } @Override @@ -108,7 +109,12 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 4, 4, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 674ffe8c3e..7dd4d0067c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,20 +1,19 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; 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.Vec3Impl; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -27,10 +26,12 @@ import java.util.ArrayList; import java.util.HashSet; import static com.github.technus.tectech.loader.MainLoader.microwaving; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.GregTech_API.sBlockCasings4; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.AxisAlignedBB.getBoundingBox; import static net.minecraft.util.StatCollector.translateToLocal; @@ -44,26 +45,23 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {"00000", "00000", "00.00", "0 0",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"00000", "00000", "00000", "0 0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasings4}; - private static final byte[] blockMeta = new byte[]{1}; - - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_TM_microwave::addClassicToMachineList); - private static final short[] casingTextures = new short[]{49}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; - private static final byte[] blockMetaFallback = new byte[]{1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.microwave.hint.0"),//1 - Classic Hatches or Clean Stainless Steel Casing translateToLocal("gt.blockmachines.multimachine.tm.microwave.hint.1"),//Also acts like a hopper so give it an Output Bus }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {"AAAAA","A---A","A---A","A---A","AAAAA"}, + {"AAAAA","A---A","A---A","A---A","AAAAA"}, + {"AA~AA","A---A","A---A","A---A","AAAAA"}, + {"ABBBA","BAAAB","BAAAB","BAAAB","ABBBA"} + })) + .addElement('A', ofBlock(sBlockCasings4, 1)) + .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_TM_microwave::addClassicToMachineList, 49, 1, sBlockCasings4, 1)) + .build(); //endregion //region parameters @@ -101,7 +99,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -249,7 +247,12 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 38e14b9a6f..427f448e2a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,27 +1,32 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.constructable.IConstructable; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.CommonValues; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import static com.github.technus.tectech.mechanics.structure.Structure.adders; -import static gregtech.api.GregTech_API.sBlockCasings4; -import static net.minecraft.util.StatCollector.translateToLocal; +@Deprecated public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + protected GT_MetaTileEntity_TM_proccessingStack(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return new String[0]; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return null; + } + /* //region variables private boolean hasBeenPausedThisCycle = false; //endregion @@ -131,4 +136,5 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul public String[] getStructureDescription(ItemStack stackSize) { return description; } + */ } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index c2f475888f..61e912e8d1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -2,11 +2,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.spark.ThaumSpark; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; @@ -19,10 +16,12 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; 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.Vec3Impl; -import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; @@ -31,7 +30,6 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.*; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -41,14 +39,15 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.HashSet; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.CommonValues.V; -import static gregtech.api.enums.GT_Values.E; -import static java.lang.Math.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.*; +import static java.lang.Math.min; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { @@ -100,35 +99,44 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //endregion //region structure - private static final String[][] shape = new String[][]{//3 16 0 - {"\u000F", "A . ",}, - {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, - {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, - {"B000", "A00000", "A00000", "A00000", "B030", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "C3", "A1A3A1", " 21212 ",}, - {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, - {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, - {"\u000F", "A ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0}; - private static final byte[] blockMetaT0 = new byte[]{7, 0, 6, 8}; - private static final byte[] blockMetaT1 = new byte[]{7, 1, 6, 8}; - private static final byte[] blockMetaT2 = new byte[]{7, 2, 6, 8}; - private static final byte[] blockMetaT3 = new byte[]{7, 3, 6, 8}; - private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8}; - private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8}; - private static final byte[] blockMetaT6 = new byte[]{7, 9, 6, 8}; - private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5, blockMetaT6}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, - GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList); - private static final short[] casingTextures = new short[]{(texturePage << 7) + 16 + 6, 0}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsBA0, null}; - private static final byte[] blockMetaFallback = new byte[]{6, 0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.0"),//1 - Classic Hatches, Capacitor Hatches or Tesla Base Casing - translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.1"),//2 - Titanium Frames }; + + private static final IStructureDefinition STRUCTURE_DEFINITION = + StructureDefinition.builder() + .addShape("main", transpose(new String[][]{ + {" "," "," BBB "," BBB "," BBB "," "," "}, + {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, + {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, + {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, + {" "," "," BBB "," BCB "," BBB "," "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, + {" "," "," "," C "," "," "," "}, + {" "," "," "," C "," "," "," "}, + {" "," DDD "," D D "," D C D "," D D "," DDD "," "}, + {" EE~EE ","EAAAAAE","EADDDAE","EADADAE","EADDDAE"," AAAAAE"," EEEEE "} + })) + .addElement('A', ofBlock(sBlockCasingsBA0, 6)) + .addElement('B', ofBlock(sBlockCasingsBA0, 7)) + .addElement('C', ofBlock(sBlockCasingsBA0, 8)) + .addElement('D', defer(t -> ofBlock(sBlockCasingsBA0, t.getCoilWindingMeta()))) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, textureOffset + 16 + 6, 1, sBlockCasingsBA0, 6)) + .addElement('F', ofFrame(Materials.get("Titanium"))) + .build(); + + public int getCoilWindingMeta() { + Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); + return this.getBaseMetaTileEntity().getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); + } //endregion //region parameters @@ -348,7 +356,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock mTier = 6; }//Hacky remap because the ZPM coils were added later - if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { + if (structureCheck_EM("main", 3, 16, 0)) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); @@ -360,11 +368,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock oldRotation = (byte) getExtendedFacing().ordinal(); oldOrientation = iGregTechTileEntity.getFrontFacing(); + Vec3Impl posBMTE = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + //Calculate coordinates of the middle bottom - posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(getBaseMetaTileEntity()); + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(posBMTE); //Calculate coordinates of the top sphere - posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(getBaseMetaTileEntity()); + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(posBMTE); } return true; } @@ -680,9 +692,14 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof GT_MetaPipeEntity_Frame; } + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 7], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 3, 16, 0, stackSize, hintsOnly); } @Override 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 2fe43cb8e1..be1f0e699b 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 @@ -2,25 +2,21 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.alignment.AlignmentLimits; -import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; -import com.github.technus.tectech.mechanics.alignment.IAlignment; -import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; -import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.EMException; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.Structure; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; 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.Vec3Impl; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.IAlignment; +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; +import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -33,7 +29,6 @@ import gregtech.api.metatileentity.implementations.*; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.InventoryPlayer; @@ -144,8 +139,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private boolean explodedThisTick = false; //front rotation val - private IAlignmentLimits alignmentLimits = AlignmentLimits.UNLIMITED; - private ExtendedFacing extendedFacing = ExtendedFacing.DEFAULT; + private IAlignmentLimits alignmentLimits = IAlignmentLimits.UNLIMITED; + private ExtendedFacing extendedFacing = ExtendedFacing.DEFAULT; //endregion protected GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { @@ -175,9 +170,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt IGregTechTileEntity base = getBaseMetaTileEntity(); mMachine = false; if (getBaseMetaTileEntity().isServerSide()) { - NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), - base.getWorld().provider.dimensionId, - base.getXCoord(), base.getYCoord(), base.getZCoord(), 512); + StructureLibAPI.sendAlignment(this,getBaseMetaTileEntity().getWorld()); }else{ base.issueTextureUpdate(); } @@ -189,11 +182,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return alignmentLimits; } - @Override - public void setAlignmentLimits(IAlignmentLimits limits) { - alignmentLimits=limits; - } - @Override public boolean isFacingValid(byte aFacing) { return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing)); @@ -224,28 +212,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt horizontalOffset,verticalOffset,depthOffset,!mMachine); } - public final boolean structureBuild_EM(String piece,int horizontalOffset, int verticalOffset, int depthOffset,boolean hintsOnly,ItemStack trigger) { + public final boolean structureBuild_EM(String piece, int horizontalOffset, int verticalOffset, int depthOffset, ItemStack trigger, boolean hintsOnly) { IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); return getStructure_EM_Internal().buildOrHints(this, trigger, piece, baseMetaTileEntity.getWorld(), getExtendedFacing(), baseMetaTileEntity.getXCoord(), baseMetaTileEntity.getYCoord(), baseMetaTileEntity.getZCoord(), horizontalOffset, verticalOffset, depthOffset, hintsOnly); } - @Deprecated - @SuppressWarnings("unchecked") - public final boolean structureCheck_EM( - String[][] structure,//0-9 casing, +- air no air, a-z ignore - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset) { - return Structure.checker(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, - horizontalOffset, verticalOffset, depthOffset, (T)this, getExtendedFacing(), !mMachine); - } - //endregion //region METHODS TO OVERRIDE - general functionality, recipe check, output @@ -648,7 +621,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ protected long getAvailableData_EM() { long result = 0; - Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); + IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); + Vec3Impl pos = new Vec3Impl(baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) { if (in.q != null) { Long value = in.q.contentIfNotInTrace(pos); @@ -1095,7 +1069,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { isFacingValid(aBaseMetaTileEntity.getFrontFacing()); if (getBaseMetaTileEntity().isClientSide()) { - NetworkDispatcher.INSTANCE.sendToServer(new AlignmentMessage.AlignmentQuery(this)); + StructureLibAPI.queryAlignment(this); } onFirstTick_EM(aBaseMetaTileEntity); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java index 44bfa4445d..5ed53634de 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; -import com.github.technus.tectech.mechanics.alignment.IAlignmentProvider; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.util.LightingHelper; +import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IIconContainer; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java index cf8f26ff02..f7f37729d3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java @@ -3,19 +3,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.mechanics.structure.IStructureDefinition; -import com.github.technus.tectech.mechanics.structure.StructureDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; @@ -23,6 +19,9 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -39,12 +38,13 @@ import java.util.HashMap; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.github.technus.tectech.util.DoubleCount.add; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -59,7 +59,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; private static double MASS_TO_EU_INSTANT; - private static int STARTUP_COST, KEEPUP_COST; + private static int STARTUP_COST, KEEPUP_COST; protected byte eTier = 0; protected EMInstanceStack stack; @@ -69,7 +69,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //endregion //region collision handlers - public static final HashMap FUSE_HANDLERS = new HashMap<>(); + public static final HashMap FUSE_HANDLERS = new HashMap<>(); public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); static { @@ -263,7 +263,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //endregion //region parameters - protected Parameters.Group.ParameterIn mode; + protected Parameters.Group.ParameterIn mode; private static final IStatusFunction MODE_STATUS = (base_EM, p) -> { if (base_EM.isMaster()) { double mode = p.get(); @@ -278,7 +278,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } return STATUS_OK; }; - private static final INameFunction MODE_NAME = (base_EM, p) -> { + private static final INameFunction MODE_NAME = (base_EM, p) -> { if (base_EM.isMaster()) { double mode = p.get(); if (mode == FUSE_MODE) { @@ -294,30 +294,30 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //region structure //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition .builder() - .addShapeOldApi("main", new String[][]{ - {"I0A0A0", "I00000", "I0A0A0",}, - {"H0000000", "G001111100", "H0000000",}, - {"F22223332222", "F41155555114", "F22223332222",}, - {"E2000000000002", "E4155111115514", "E2000000000002",}, - {"D20000E00002", "D41511E11514", "D20000E00002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0030O0300", "0151O1510", "0030O0300",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"D200002&&&200002", "D415112&.&211514", "D200002&&&200002",}, - {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, - {"F2222#$#2222", "F41155555114", "F2222#$#2222",}, + .addShape("main", new String[][]{ + {" 0 0 0 ", " 00000 ", " 0 0 0 ",}, + {" 0000000 ", " 001111100 ", " 0000000 ",}, + {" 22223332222 ", " 41155555114 ", " 22223332222 ",}, + {" 2000000000002 ", " 4155111115514 ", " 2000000000002 ",}, + {" 20000 00002 ", " 41511 11514 ", " 20000 00002 ",}, + {" 2000 0002 ", " 4151 1514 ", " 2000 0002 ",}, + {" 2000 0002 ", " 4151 1514 ", " 2000 0002 ",}, + {" 200 002 ", " 0151 1510 ", " 200 002 ",}, + {" 0200 0020 ", " 0151 1510 ", " 0200 0020 ",}, + {"0020 0200", "0151 1510", "0020 0200",}, + {" 030 030 ", "0151 1510", " 030 030 ",}, + {"0030 0300", "0151 1510", "0030 0300",}, + {" 030 030 ", "0151 1510", " 030 030 ",}, + {"0020 0200", "0151 1510", "0020 0200",}, + {" 0200 0020 ", " 0151 1510 ", " 0200 0020 ",}, + {" 200 002 ", " 0151 1510 ", " 200 002 ",}, + {" 2000 0002 ", " 4151 1514 ", " 2000 0002 ",}, + {" 2000 0002 ", " 4151 1514 ", " 2000 0002 ",}, + {" 200002&&&200002 ", " 415112&~&211514 ", " 200002&&&200002 ",}, + {" 20!!22222!!02 ", " 4155111115514 ", " 20!!22222!!02 ",}, + {" 2222#$#2222 ", " 41155555114 ", " 2222#$#2222 ",}, }) .addElement('0', ofBlock(sBlockCasingsTT, 4)) .addElement('1', ofBlock(sBlockCasingsTT, 7)) @@ -337,7 +337,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) .build(); - private static final String[] description = new String[]{ + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"),//2 - Elemental Input Hatches or Molecular Casing @@ -362,7 +362,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07 * EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; STARTUP_COST = -heliumPlasmaValue * 10000; KEEPUP_COST = -heliumPlasmaValue; @@ -374,7 +374,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); EMInstanceStack stack2 = partner.stack; - double preMass = add(stack2.getMass(),stack.getMass()); + double preMass = add(stack2.getMass(), stack.getMass()); //System.out.println("preMass = " + preMass); EMInstanceStackMap map = new EMInstanceStackMap(); @@ -438,10 +438,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } protected GT_MetaTileEntity_EM_collider getPartner() { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); if (gregTechBaseTileEntity != null) { IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); @@ -652,7 +652,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB eTier = aNBT.getByte("eTier");//collider tier started = aNBT.getBoolean("eStarted"); if (aNBT.hasKey("eStack")) { - stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eStack")); + stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eStack")); } plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); } @@ -689,17 +689,17 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; if (hintsOnly) { TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); + StructureLibAPI.getBlockHint(), 12); } - structureBuild_EM("main", 11, 1, 18, hintsOnly, stackSize); + structureBuild_EM("main", 11, 1, 18, stackSize, hintsOnly); } @Override 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 e653c1a357..2735f207e4 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 @@ -1,15 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; -import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; -import com.github.technus.tectech.mechanics.structure.Structure; 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.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -23,10 +22,12 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; -import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -41,22 +42,25 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa //endregion //region structure - private static final String[][] shape = new String[][]{ - {"B0", "A ", "0 - 0", "A ", "B0",}, - {"A000", "00000", "00.00", "00000", "A000",}, - {"A121", "1---1", "2---2", "1---1", "A121",}, - {"A131", "1---1", "3-A-3", "1---1", "A131",}, - {"A121", "1---1", "2---2", "1---1", "A121",}, - {"A000", "00000", "00-00", "00000", "A000",}, - {"B0", "A!!!", "0!!!0", "A!!!", "B0",},}; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; - private static final IHatchAdder[] addingMethods = adders( - GT_MetaTileEntity_EM_machine::addClassicToMachineList, - GT_MetaTileEntity_EM_machine::addElementalToMachineList); - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; + private static final IStructureDefinition STRUCTURE_DEFINITION=IStructureDefinition + .builder() + .addShape("main",new String[][]{ + {" 0 ", " &&& ", "0& &0", " &&& ", " 0" ,}, + {" 000 ", "00000", "00~00", "00000", " 000 ",}, + {" 121 ", "1---1", "2---2", "1---1", " 121 ",}, + {" 131 ", "1---1", "3-A-3", "1---1", " 131 ",}, + {" 121 ", "1---1", "2---2", "1---1", " 121 ",}, + {" 000 ", "00000", "00-00", "00000", " 000" ,}, + {" 0 ", " !!! ", "0!!!0", " !!! ", " 0 ",},}) + .addElement('0', ofBlock(sBlockCasingsTT,4)) + .addElement('1',ofBlockAnyMeta(QuantumGlassBlock.INSTANCE)) + .addElement('2',ofBlock(sBlockCasingsTT,5)) + .addElement('3',ofBlock(sBlockCasingsTT,6)) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addClassicToMachineList,textureOffset,1,sBlockCasingsTT,0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addElementalToMachineList,textureOffset+4,2,sBlockCasingsTT,4)) + .addElement('A', ofChain(ofBlockAnyMeta(QuantumStuffBlock.INSTANCE),isAir())) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.processing.hint.0"),//1 - Classic Hatches or High Power Casing @@ -190,7 +194,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); + return structureCheck_EM("main", 2, 2, 1); } @Override @@ -354,7 +358,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + structureBuild_EM("main", 2, 2, 1, stackSize, hintsOnly); } @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 d942786916..748b680faa 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 @@ -272,11 +272,11 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine 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: ") + ((long)time * EUt) + " EU",7,93, 0x80a0ff); - font.drawString(GT_Utility.trans("153","Usage: ") + EUt + " EU/t",7,103, 0x80a0ff); - font.drawString(GT_Utility.trans("154","Voltage: ") + EUt + " EU",7,113, 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); - font.drawString( GT_Utility.trans("158","Time: ")+String.format("%.2f " + GT_Utility.trans("161"," secs"), 0.05F * time), 7,133, 0x80a0ff); + font.drawString( GT_Utility.trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * time) + GT_Utility.trans("161"," secs"), 7,133, 0x80a0ff); for(Map.Entry entry:slots.entrySet()){ gui.renderItemSimple(entry.getKey(),entry.getValue()); 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 3b194c516b..01d5e2321e 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 @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; -import com.github.technus.tectech.mechanics.structure.StructureUtility; 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.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.structure.StructureUtility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,9 +20,13 @@ 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; @@ -115,11 +119,18 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isAllowedToWork()) { - String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), - ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), +// ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), +// numbers[0], numbers[1], numbers[2], +// numbers[3], numbers[4], numbers[5],false); + String pseudoJavaCode = StructureUtility.getPseudoJavaCode( + aBaseMetaTileEntity.getWorld(), ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), numbers[0], numbers[1], numbers[2], - numbers[3], numbers[4], numbers[5],false); + te -> te.getClass().getCanonicalName(), + numbers[3], numbers[4], numbers[5], + false); TecTech.LOGGER.info(pseudoJavaCode); result = pseudoJavaCode.split("\\n"); aBaseMetaTileEntity.disableWorking(); @@ -129,11 +140,18 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); - String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), - ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), +// ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), +// numbers[0], numbers[1], numbers[2], +// numbers[3], numbers[4], numbers[5],true); + String pseudoJavaCode = StructureUtility.getPseudoJavaCode( + aBaseMetaTileEntity.getWorld(), ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), numbers[0], numbers[1], numbers[2], - numbers[3], numbers[4], numbers[5],true); + te -> te.getClass().getCanonicalName(), + numbers[3], numbers[4], numbers[5], + false); TecTech.LOGGER.info(pseudoJavaCode); result = pseudoJavaCode.split("\\n"); aBaseMetaTileEntity.disableWorking(); 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 274389b01a..3b240e4c56 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 @@ -8,10 +8,10 @@ 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.github.technus.tectech.util.Vec3Impl; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -333,7 +333,9 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @Override public Vec3Impl getTeslaPosition() { - return new Vec3Impl(this.getBaseMetaTileEntity()); + return new Vec3Impl(this.getBaseMetaTileEntity().getXCoord(), + this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord()); } @Override diff --git a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java deleted file mode 100644 index 9ba96d741a..0000000000 --- a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.github.technus.tectech.util; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.dispenser.IPosition; -import net.minecraftforge.common.util.ForgeDirection; - -public class Vec3Impl implements Comparable { - public static final Vec3Impl NULL_VECTOR = new Vec3Impl(0, 0, 0); - private final int val0; - private final int val1; - private final int val2; - - public Vec3Impl(int in0, int in1, int in2) { - this.val0 = in0; - this.val1 = in1; - this.val2 = in2; - } - - public Vec3Impl(IGregTechTileEntity baseMetaTileEntity) { - this(baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord()); - } - - public int compareTo(Vec3Impl o) { - return val1 == o.val1 ? val2 == o.val2 ? val0 - o.val0 : val2 - o.val2 : val1 - o.val1; - } - - /** - * Gets the coordinate. - */ - public int get(int index) { - switch (index){ - case 0: return val0; - case 1: return val1; - case 2: return val2; - default: return 0; - } - } - - /** - * Gets the X coordinate. - */ - public int get0() { - return this.val0; - } - - /** - * Gets the Y coordinate. - */ - public int get1() { - return this.val1; - } - - /** - * Gets the Z coordinate. - */ - public int get2() { - return this.val2; - } - - public Vec3Impl offset(ForgeDirection facing, int n) { - return n == 0 ? this : new Vec3Impl(val0 + facing.offsetX * n, val1 + facing.offsetY * n, val2 + facing.offsetZ * n); - } - - public Vec3Impl add(IGregTechTileEntity tileEntity) { - return new Vec3Impl(val0 + tileEntity.getXCoord(), val1 + tileEntity.getYCoord(), val2 + tileEntity.getZCoord()); - } - - public Vec3Impl sub(IGregTechTileEntity tileEntity) { - return new Vec3Impl(val0 - tileEntity.getXCoord(), val1 - tileEntity.getYCoord(), val2 - tileEntity.getZCoord()); - } - - public Vec3Impl add(Vec3Impl pos) { - return new Vec3Impl(val0 + pos.val0, val1 + pos.val1, val2 + pos.val2); - } - - public Vec3Impl sub(Vec3Impl pos) { - return new Vec3Impl(val0 - pos.val0, val1 - pos.val1, val2 - pos.val2); - } - - public Vec3Impl add(int pos0,int pos1,int pos2) { - return new Vec3Impl(val0 + pos0, val1 + pos1, val2 + pos2); - } - - public Vec3Impl sub(int pos0,int pos1,int pos2) { - return new Vec3Impl(val0 - pos0, val1 - pos1, val2 - pos2); - } - - public Vec3Impl crossProduct(Vec3Impl vec) { - return new Vec3Impl(val1 * vec.val2 - val2 * vec.val1, val2 * vec.val0 - val0 * vec.val2, - val0 * vec.val1 - val1 * vec.val0); - } - - public boolean withinDistance(Vec3Impl to, double distance) { - return this.distanceSq(to.val0, to.val1, to.val2, false) < distance * distance; - } - - public boolean withinDistance(IPosition to, double distance) { - return this.distanceSq(to.getX(), to.getY(), to.getZ(), true) < distance * distance; - } - - public double distanceSq(Vec3Impl to) { - return this.distanceSq(to.val0, to.val1, to.val2, true); - } - - public double distanceSq(IPosition to, boolean useCenter) { - return this.distanceSq(to.getX(), to.getY(), to.getZ(), useCenter); - } - - public double distanceSq(double x, double y, double z, boolean useCenter) { - double d0 = useCenter ? 0.5D : 0.0D; - double d1 = (double)val0 + d0 - x; - double d2 = (double)val1 + d0 - y; - double d3 = (double)val2 + d0 - z; - return d1 * d1 + d2 * d2 + d3 * d3; - } - - public int manhattanDistance(Vec3Impl to) { - float f = (float)Math.abs(to.val0 - val0); - float f1 = (float)Math.abs(to.val1 - val1); - float f2 = (float)Math.abs(to.val2 - val2); - return (int)(f + f1 + f2); - } - - @Override - public String toString() { - return "Vec3[" + val0 + ", " + val1 + ", " + val2 + "]"; - } - - public Vec3Impl abs() { - return new Vec3Impl(Math.abs(val0),Math.abs(val1),Math.abs(val2)); - } - - public boolean equals(Object o) { - if (this == o) { - return true; - } else if (o instanceof Vec3Impl) { - Vec3Impl vec3i = (Vec3Impl)o; - return val0 == vec3i.val0 && val1 == vec3i.val1 && val2 == vec3i.val2; - } - return false; - } - - public int hashCode() { - return (val1 + val2 * 31) * 31 + val0; - } -} \ No newline at end of file diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 7924545051..79c46b07a2 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -314,9 +314,9 @@ gt.blockmachines.hatch.dynamomulti64.tier.11.name=UIV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti04.tier.12.name=UMV 4A Dynamo Hatch gt.blockmachines.hatch.dynamomulti16.tier.12.name=UMV 16A Dynamo Hatch gt.blockmachines.hatch.dynamomulti64.tier.12.name=UMV 64A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti04.tier.13.name=IV 4A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti16.tier.13.name=IV 16A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti64.tier.13.name=IV 64A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti04.tier.13.name=UXV 4A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti16.tier.13.name=UXV 16A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti64.tier.13.name=UXV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti.desc.0=Multiple Ampere Energy Extractor for Multiblocks gt.blockmachines.hatch.dynamomulti.desc.1=Amperes Out @@ -652,7 +652,7 @@ gt.blockmachines.multimachine.em.scanner.hint.3=4 - Elemental Overflow Hatches o gt.blockmachines.multimachine.em.scanner.desc.0=What is existing here? gt.blockmachines.multimachine.em.scanner.desc.1=I HAVE NO IDEA (yet)! -gt.blockmachines.multimachine.em.research.name=Research station +gt.blockmachines.multimachine.em.research.name=Research Station gt.blockmachines.multimachine.em.research.hint.0=1 - Classic/Data Hatches or Computer casing gt.blockmachines.multimachine.em.research.hint.1=2 - Holder Hatch gt.blockmachines.multimachine.em.research.desc.0=Philosophers didn't even... diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 56cecd80c2..2d594ffb8e 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -50,8 +50,8 @@ item.em.EuMeterGT.desc.1=只需右键方块. item.em.frontRotate.name=正面旋转扳手 item.em.frontRotate.desc.0=触发正面旋转界面 -item.em.frontRotate.desc.1=仅旋转前面板, -item.em.frontRotate.desc.2=允许结构旋转. +item.em.frontRotate.desc.1=可以旋转多方块控制器, +item.em.frontRotate.desc.2=从而使整个结构可以旋转. item.em.parametrizerMemoryCard.name=数据化储存卡 item.em.parametrizerMemoryCard.desc.0=存储参数 @@ -313,9 +313,9 @@ gt.blockmachines.hatch.dynamomulti64.tier.11.name=64安UIV动力仓 gt.blockmachines.hatch.dynamomulti04.tier.12.name=4安UMV动力仓 gt.blockmachines.hatch.dynamomulti16.tier.12.name=16安UMV动力仓 gt.blockmachines.hatch.dynamomulti64.tier.12.name=64安UMV动力仓 -gt.blockmachines.hatch.dynamomulti04.tier.13.name=4安IV动力仓 -gt.blockmachines.hatch.dynamomulti16.tier.13.name=16安IV动力仓 -gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安IV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.13.name=4安UXV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.13.name=16安UXV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安UXV动力仓 gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f7fc68f278..21ecee23f8 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,10 +1,10 @@ [ { - "modid": "tectech", - "name": "TecTech", + "modid": "${modId}", + "name": "${modName}", "description": "TecTech - Tec Technology Interdimensional! Replace UUMatter with something overly complicated and annoying! (GT5u Addon)", - "version": "${version}", - "mcversion": "${mcversion}", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", "url": "", "updateUrl": "", "authorList": ["_Technus_"], -- cgit From 6afe8d8c62f2d2c9c496c29f133cc962a6447a96 Mon Sep 17 00:00:00 2001 From: glowredman Date: Mon, 31 Jan 2022 17:18:34 +0100 Subject: Make the TT_RecipeAdder accept AssemblyLine recipes with 16 inputs --- build.gradle | 143 ++++++++++++++++++--- .../technus/tectech/recipe/TT_recipeAdder.java | 4 +- 2 files changed, 124 insertions(+), 23 deletions(-) (limited to 'src/main') diff --git a/build.gradle b/build.gradle index b647108772..7914dd81b4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1642484596 +//version: 1643020202 /* DO NOT CHANGE THIS FILE! @@ -32,16 +32,18 @@ buildscript { } } dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7' } } plugins { id 'idea' + id 'eclipse' id 'scala' id("org.ajoberstar.grgit") version("3.1.1") id("com.github.johnrengelman.shadow") version("4.0.4") id("com.palantir.git-version") version("0.12.3") + id('de.undercouch.download') version('4.1.2') id("maven-publish") } @@ -172,6 +174,19 @@ else { archivesBaseName = modId } + +def arguments = [] +def jvmArguments = [] + +if(usesMixins.toBoolean()) { + arguments += [ + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + jvmArguments += [ + "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true" + ] +} + minecraft { version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion runDir = "run" @@ -191,6 +206,20 @@ minecraft { replace gradleTokenGroupName, modGroup } } + + clientIntellijRun { + args(arguments) + jvmArgs(jvmArguments) + + if(developmentEnvironmentUserName) { + args("--username", developmentEnvironmentUserName) + } + } + + serverIntellijRun { + args(arguments) + jvmArgs(jvmArguments) + } } if(file("addon.gradle").exists()) { @@ -322,15 +351,6 @@ afterEvaluate { } runClient { - def arguments = [] - - if(usesMixins.toBoolean()) { - arguments += [ - "--mods=../build/libs/$modId-${version}.jar", - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - } - if(developmentEnvironmentUserName) { arguments += [ "--username", @@ -339,19 +359,12 @@ runClient { } args(arguments) + jvmArgs(jvmArguments) } runServer { - def arguments = [] - - if (usesMixins.toBoolean()) { - arguments += [ - "--mods=../build/libs/$modId-${version}.jar", - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - } - args(arguments) + jvmArgs(jvmArguments) } tasks.withType(JavaExec).configureEach { @@ -494,11 +507,21 @@ artifacts { } } +// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), +// and isn't strictly needed with the POM so just disable it. +tasks.withType(GenerateModuleMetadata) { + enabled = false +} + + // publishing publishing { publications { maven(MavenPublication) { - artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: "" + from components.java + if(usesShadowedDependencies.toBoolean()) { + artifact source: shadowJar, classifier: "" + } if(!noPublishedSources) { artifact source: sourcesJar, classifier: "src" } @@ -511,6 +534,18 @@ publishing { artifactId = System.getenv("ARTIFACT_ID") ?: project.name // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion + + // Remove all non GTNH deps here. + // Original intention was to remove an invalid forgeBin being generated without a groupId (mandatory), but + // it also removes all of the MC deps + pom.withXml { + Node pomNode = asNode() + pomNode.dependencies.'*'.findAll() { + it.groupId.text() != 'com.github.GTNewHorizons' + }.each() { + it.parent().remove(it) + } + } } } @@ -581,6 +616,72 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } +// Deobfuscation + +def deobf(String sourceURL) { + try { + URL url = new URL(sourceURL) + String fileName = url.getFile() + + //get rid of directories: + int lastSlash = fileName.lastIndexOf("/") + if(lastSlash > 0) { + fileName = fileName.substring(lastSlash + 1) + } + //get rid of extension: + if(fileName.endsWith(".jar")) { + fileName = fileName.substring(0, fileName.lastIndexOf(".")) + } + + String hostName = url.getHost() + if(hostName.startsWith("www.")) { + hostName = hostName.substring(4) + } + List parts = Arrays.asList(hostName.split("\\.")) + Collections.reverse(parts) + hostName = String.join(".", parts) + + return deobf(sourceURL, hostName + "/" + fileName) + } catch(Exception e) { + return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) + } +} + +// The method above is to be prefered. Use this method if the filename is not at the end of the URL. +def deobf(String sourceURL, String fileName) { + String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" + String bon2Dir = cacheDir + "forge_gradle/deobf" + String bon2File = bon2Dir + "/BON2-2.5.0.jar" + String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar" + String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar" + + if(file(deobfFile).exists()) { + return files(deobfFile) + } + + download { + src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' + dest bon2File + quiet true + overwrite false + } + + download { + src sourceURL + dest obfFile + quiet true + overwrite false + } + + exec { + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' + workingDir bon2Dir + standardOutput = new ByteArrayOutputStream() + } + + return files(deobfFile) +} + // Helper methods def checkPropertyExists(String propertyName) { diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 71a5419500..0b3f203899 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -35,7 +35,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { if(aFluidInputs==null) { aFluidInputs = nullFluid; } - if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>15) { + if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>16) { return false; } for(ItemStack tItem : aInputs){ @@ -59,7 +59,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { if(aFluidInputs==null) { aFluidInputs = nullFluid; } - if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>15 || aFluidInputs.length>4 || assDuration<=0 || assEUt<=0) { + if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>16 || aFluidInputs.length>4 || assDuration<=0 || assEUt<=0) { return false; } -- cgit From 01ccba8c538a43cfd6a0e1d169c7659871a2f305 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 31 Jan 2022 21:29:47 +0100 Subject: Make font not use UTF-8 literal --- .../com/github/technus/tectech/font/TecTechFontRender.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java index fbbc12fe36..ffbef07158 100644 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java @@ -14,14 +14,14 @@ import org.lwjgl.opengl.GL11; public class TecTechFontRender extends FontRenderer { public static final TecTechFontRender INSTANCE = new TecTechFontRender(); - private static float DISTANCE_L = .125F; - private static float DISTANCE_L2 = DISTANCE_L * 2F; + private static final float DISTANCE_L = .125F; + private static final float DISTANCE_L2 = DISTANCE_L * 2F; - private static float DISTANCE_M = 0.06F; - private static float DISTANCE_M2 = DISTANCE_M * 2F; + private static final float DISTANCE_M = 0.06F; + private static final float DISTANCE_M2 = DISTANCE_M * 2F; - private static float DISTANCE_A = 0.06F; - private static float DISTANCE_A2 = DISTANCE_A * 2F; + private static final float DISTANCE_A = 0.06F; + private static final float DISTANCE_A2 = DISTANCE_A * 2F; private TecTechFontRender() { @@ -119,7 +119,7 @@ public class TecTechFontRender extends FontRenderer { ++i; } else { - j = "ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(c0); + j = "\u00C0\u00C1\u00C2\u00C8\u00CA\u00CB\u00CD\u00D3\u00D4\u00D5\u00DA\u00DF\u00E3\u00F5\u011F\u0130\u0131\u0152\u0153\u015E\u015F\u0174\u0175\u017E\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\u03B2\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u2205\u2208\u2229\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u0000".indexOf(c0); if (this.randomStyle && j != -1) { do { k = this.fontRandom.nextInt(this.charWidth.length); -- cgit From 87ad4fe10fbf8b816102c3cf81caf23d1c88afe3 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 31 Jan 2022 23:00:13 +0100 Subject: Cleanup structures --- .../multi/GT_MetaTileEntity_EM_annihilation.java | 54 ++++---- .../multi/GT_MetaTileEntity_EM_bhg.java | 147 ++++++++++----------- .../multi/GT_MetaTileEntity_EM_computer.java | 34 ++--- .../multi/GT_MetaTileEntity_EM_crafting.java | 16 +-- .../multi/GT_MetaTileEntity_EM_dataBank.java | 16 +-- .../multi/GT_MetaTileEntity_EM_decay.java | 6 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 28 ++-- .../multi/GT_MetaTileEntity_EM_infuser.java | 18 +-- .../multi/GT_MetaTileEntity_EM_junction.java | 14 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 20 +-- .../multi/GT_MetaTileEntity_EM_research.java | 58 ++++---- .../multi/GT_MetaTileEntity_EM_scanner.java | 44 +++--- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 16 +-- .../multi/GT_MetaTileEntity_EM_switch.java | 20 +-- .../multi/GT_MetaTileEntity_EM_transformer.java | 38 +++--- .../multi/GT_MetaTileEntity_EM_wormhole.java | 24 ++-- .../multi/GT_MetaTileEntity_TM_microwave.java | 42 +++--- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 144 ++++++++++---------- .../em_collider/GT_MetaTileEntity_EM_collider.java | 66 +++++---- .../em_machine/GT_MetaTileEntity_EM_machine.java | 30 ++--- 20 files changed, 421 insertions(+), 414 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index ba3bfe728d..8a51494b94 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -29,9 +29,9 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - private static final String[] description = new String[]{ + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.1"),//2 - Elemental Hatches or Molecular Casing @@ -39,30 +39,30 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl //endregion //region structure - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "}, - {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, - {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, - {" AAA ","AA BAB AA","ACGGEGEGGCA"," G G "," G G "," G G "," G G "," G G ","ACGGEGEGGCA","AA BAB AA"," AAA "}, - {" AHHHA ","BBBBBBBBBBB","BEEEDEDEEEB","BE EB"," G G "," G G "," G G ","BE EB","BEEEDEDEEEB","BBBBBBBBBBB"," AHHHA "}, - {" AH~HA "," ABBBA "," EGGEEEGGE ","BE EB","AE EA","FD DF","AE EA","BE EB"," EGGEEEGGE "," ABBBA "," AHHHA "}, - {" AHHHA ","BBBBBBBBBBB","BEEEDEDEEEB","BE EB"," G G "," G G "," G G ","BE EB","BEEEDEDEEEB","BBBBBBBBBBB"," AHHHA "}, - {" AAA ","AA BAB AA","ACGGEGEGGCA"," G G "," G G "," G G "," G G "," G G ","ACGGEGEGGCA","AA BAB AA"," AAA "}, - {" "," B B "," EGGEGEGGE "," G G "," G G "," G G "," G G "," G G "," EGGEGEGGE "," B B "," "}, - {" "," AB BA "," EECEEECEE "," EGGEEEGGE ","ACGGGEGGGCA","AEGGGDGGGEA","ACGGGEGGGCA"," EGGEEEGGE "," EECEEECEE "," AB BA "," "}, - {" "," AB BA "," AB BA "," BBB "," A A A ","AA F AA"," A A A "," BBB "," AB BA "," AB BA "," "} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 4)) - .addElement('B', ofBlock(sBlockCasingsTT, 5)) - .addElement('C', ofBlock(sBlockCasingsTT, 6)) - .addElement('D', ofBlock(sBlockCasingsTT, 10)) - .addElement('E', ofBlock(sBlockCasingsTT, 12)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, textureOffset + 4,2, sBlockCasingsTT, 4)) - .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .build(); + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", transpose(new String[][]{ + {" ", " AB BA ", " AB BA ", " BBB ", " A A A ", "AA F AA", " A A A ", " BBB ", " AB BA ", " AB BA ", " "}, + {" ", " AB BA ", " EECEEECEE ", " EGGEEEGGE ", "ACGGGEGGGCA", "AEGGGDGGGEA", "ACGGGEGGGCA", " EGGEEEGGE ", " EECEEECEE ", " AB BA ", " "}, + {" ", " B B ", " EGGEGEGGE ", " G G ", " G G ", " G G ", " G G ", " G G ", " EGGEGEGGE ", " B B ", " "}, + {" AAA ", "AA BAB AA", "ACGGEGEGGCA", " G G ", " G G ", " G G ", " G G ", " G G ", "ACGGEGEGGCA", "AA BAB AA", " AAA "}, + {" AHHHA ", "BBBBBBBBBBB", "BEEEDEDEEEB", "BE EB", " G G ", " G G ", " G G ", "BE EB", "BEEEDEDEEEB", "BBBBBBBBBBB", " AHHHA "}, + {" AH~HA ", " ABBBA ", " EGGEEEGGE ", "BE EB", "AE EA", "FD DF", "AE EA", "BE EB", " EGGEEEGGE ", " ABBBA ", " AHHHA "}, + {" AHHHA ", "BBBBBBBBBBB", "BEEEDEDEEEB", "BE EB", " G G ", " G G ", " G G ", "BE EB", "BEEEDEDEEEB", "BBBBBBBBBBB", " AHHHA "}, + {" AAA ", "AA BAB AA", "ACGGEGEGGCA", " G G ", " G G ", " G G ", " G G ", " G G ", "ACGGEGEGGCA", "AA BAB AA", " AAA "}, + {" ", " B B ", " EGGEGEGGE ", " G G ", " G G ", " G G ", " G G ", " G G ", " EGGEGEGGE ", " B B ", " "}, + {" ", " AB BA ", " EECEEECEE ", " EGGEEEGGE ", "ACGGGEGGGCA", "AEGGGDGGGEA", "ACGGGEGGGCA", " EGGEEEGGE ", " EECEEECEE ", " AB BA ", " "}, + {" ", " AB BA ", " AB BA ", " BBB ", " A A A ", "AA F AA", " A A A ", " BBB ", " AB BA ", " AB BA ", " "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 10)) + .addElement('E', ofBlock(sBlockCasingsTT, 12)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion public GT_MetaTileEntity_EM_annihilation(int aID, String aName, String aNameRegional) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 5f177ef859..3d6bb58cb0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -35,10 +35,10 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E private static Textures.BlockIcons.CustomIcon ScreenON; //todo CHECK VALUES - private static final double NEUTRONIUM_BLOCK_MASS = 4.1E17; - private static final double NEUTRONIUM_BLOCK_ATOM_COUNT = 2.4478671E44; + private static final double NEUTRONIUM_BLOCK_MASS = 4.1E17; + private static final double NEUTRONIUM_BLOCK_ATOM_COUNT = 2.4478671E44; private static final double NEUTRONIUM_BLOCK_TO_EU_INSTANT = URANIUM_MASS_TO_EU_INSTANT * NEUTRONIUM_BLOCK_MASS / (URANIUM_INGOT_MASS_DIFF * 1.78266191e-36);//~ 5.314e40 - private static final double NEUTRON_TO_EU_INSTANT = NEUTRONIUM_BLOCK_TO_EU_INSTANT / NEUTRONIUM_BLOCK_ATOM_COUNT;//~ 0.00021708694 + private static final double NEUTRON_TO_EU_INSTANT = NEUTRONIUM_BLOCK_TO_EU_INSTANT / NEUTRONIUM_BLOCK_ATOM_COUNT;//~ 0.00021708694 public boolean glassDome = false; //endregion @@ -48,86 +48,86 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E //per dim disable thingies //region structure actual - private static final IStructureDefinition STRUCTURE_DEFINITION= - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main_t1", transpose(new String[][]{ - {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," C C "," DDDDD "," DDCDCDD "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," DDCDCDD "," DDDDD "," C C "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," C C "," C C "," C C "," D "," D "," DDDDDDD "," DD DD "," D EEE D "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," D EEE D "," DD DD "," DDDDDDD "," D "," D "," C C "," C C "," C C "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," C C "," C C "," D "," D "," "," "," "," "," "," CC CC "," DD DD "," CC CC "," "," "," "," "," "," D "," D "," C C "," C C "," "," "," "," "," "," "}, - {" "," "," "," "," "," C C "," CCCCC "," D "," B "," B "," "," "," "," "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," "," "," "," "," B "," B "," D "," CCCCC "," C C "," "," "," "," "," "}, - {" "," "," "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "," "," "}, - {" "," "," "," C C "," CCCCC "," D "," B "," "," "," "," "," "," "," "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," "," "," "," "," "," "," "," B "," D "," CCCCC "," C C "," "," "," "}, - {" "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "}, - {" "," "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," C C "," DB BD "," C C "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," "," "}, - {" "," C C "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," CC CC "," DB BD "," CC CC "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," C C "," "}, - {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, - {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, - {" CCCCCCC "," C C "," DDDDDDD "," "," "," "," "," "," "," "," "," "," "," D D "," D D ","CCD DCC"," D D ","CCD DCC"," D D "," D D "," "," "," "," "," "," "," "," "," "," "," DDDDDDD "," C C "," C C "}, - {" CCHHHHHCC "," DDDDD "," DD DD "," "," "," E E "," "," E E "," "," "," "," "," D D "," D D "," D D ","CD DC"," D D ","CD DC"," D D "," D D "," D D "," "," "," "," "," E E "," "," E E "," "," "," DD DD "," DDDDD "," C C "}, - {" CHHHHHHHC "," DDCDCDD "," D EEE D "," "," C C "," E E "," C C "," E E "," "," "," "," "," D D "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," D D "," "," "," "," "," E E "," C C "," E E "," C C "," "," D EEE D "," DDCDCDD "," C C "}, - {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, - {" CHHF~FHHC "," DDDDDDD "," DDD EAAAE DDD "," DD DD "," CDBB BBDC "," DB BD "," CDB BDC "," DB BD "," DB BD "," DB BD "," D D "," D D "," D D "," D D "," DE ED ","CDA ADC"," DA AD ","CDA ADC"," DE ED "," D D "," D D "," D D "," D D "," DB BD "," DB BD "," DB BD "," CDB BDC "," DB BD "," CDBB BBDC "," DD DD "," DDD EAAAE DDD "," DDDDDDD "," C C "}, - {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, - {" CHHHHHHHC "," DDCDCDD "," D EEE D "," "," C C "," E E "," C C "," E E "," "," "," "," "," D D "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," D D "," "," "," "," "," E E "," C C "," E E "," C C "," "," D EEE D "," DDCDCDD "," C C "}, - {" CCHHHHHCC "," DDDDD "," DD DD "," "," "," E E "," "," E E "," "," "," "," "," D D "," D D "," D D ","CD DC"," D D ","CD DC"," D D "," D D "," D D "," "," "," "," "," E E "," "," E E "," "," "," DD DD "," DDDDD "," C C "}, - {" CCCCCCC "," C C "," DDDDDDD "," "," "," "," "," "," "," "," "," "," "," D D "," D D ","CCD DCC"," D D ","CCD DCC"," D D "," D D "," "," "," "," "," "," "," "," "," "," "," DDDDDDD "," C C "," C C "}, - {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, - {" "," C C "," D "," "," "," "," "," "," "," "," "," "," "," "," "," C C "," D D "," C C "," "," "," "," "," "," "," "," "," "," "," "," "," D "," C C "," "}, - {" "," C C "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," CC CC "," DB BD "," CC CC "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," C C "," "}, - {" "," "," C C "," D "," B "," "," "," "," "," "," "," "," "," "," "," C C "," DB BD "," C C "," "," "," "," "," "," "," "," "," "," "," B "," D "," C C "," "," "}, - {" "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "}, - {" "," "," "," C C "," CCCCC "," D "," B "," "," "," "," "," "," "," "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," "," "," "," "," "," "," "," B "," D "," CCCCC "," C C "," "," "," "}, - {" "," "," "," "," C C "," C C "," D "," EEEBEEE "," "," "," "," "," "," E E "," E E "," CC E E CC "," DB BD "," CC E E CC "," E E "," E E "," "," "," "," "," "," EEEBEEE "," D "," C C "," C C "," "," "," "," "}, - {" "," "," "," "," "," C C "," CCCCC "," D "," B "," B "," "," "," "," "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," "," "," "," "," B "," B "," D "," CCCCC "," C C "," "," "," "," "," "}, - {" "," "," "," "," "," "," C C "," C C "," D "," D "," "," "," "," "," "," CC CC "," DD DD "," CC CC "," "," "," "," D "," D "," D "," D "," C C "," C C "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," C C "," C C "," C C "," D "," D "," DDDDDDD "," DD DD "," D EEE D "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," D EEE D "," DD DD "," DDDDDDD "," D "," D "," C C "," C C "," C C "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," C C "," DDDDD "," DDCDCDD "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," DDCDCDD "," DDDDD "," C C "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "} + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " C C ", " DDDDD ", " DDCDCDD ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " DDCDCDD ", " DDDDD ", " C C ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " D ", " D ", " DDDDDDD ", " DD DD ", " D EEE D ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " D EEE D ", " DD DD ", " DDDDDDD ", " D ", " D ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " C C ", " D ", " D ", " ", " ", " ", " ", " ", " CC CC ", " DD DD ", " CC CC ", " ", " ", " ", " ", " ", " D ", " D ", " C C ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " B ", " ", " ", " ", " ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " ", " ", " ", " ", " B ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " "}, + {" ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " "}, + {" ", " ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " DB BD ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " ", " "}, + {" ", " C C ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " CC CC ", " DB BD ", " CC CC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " C C ", " "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" CCCCCCC ", " C C ", " DDDDDDD ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D D ", " D D ", "CCD DCC", " D D ", "CCD DCC", " D D ", " D D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " DDDDDDD ", " C C ", " C C "}, + {" CCHHHHHCC ", " DDDDD ", " DD DD ", " ", " ", " E E ", " ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " ", " E E ", " ", " ", " DD DD ", " DDDDD ", " C C "}, + {" CHHHHHHHC ", " DDCDCDD ", " D EEE D ", " ", " C C ", " E E ", " C C ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " C C ", " E E ", " C C ", " ", " D EEE D ", " DDCDCDD ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHF~FHHC ", " DDDDDDD ", " DDD EAAAE DDD ", " DD DD ", " CDBB BBDC ", " DB BD ", " CDB BDC ", " DB BD ", " DB BD ", " DB BD ", " D D ", " D D ", " D D ", " D D ", " DE ED ", "CDA ADC", " DA AD ", "CDA ADC", " DE ED ", " D D ", " D D ", " D D ", " D D ", " DB BD ", " DB BD ", " DB BD ", " CDB BDC ", " DB BD ", " CDBB BBDC ", " DD DD ", " DDD EAAAE DDD ", " DDDDDDD ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHHHHHHC ", " DDCDCDD ", " D EEE D ", " ", " C C ", " E E ", " C C ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " C C ", " E E ", " C C ", " ", " D EEE D ", " DDCDCDD ", " C C "}, + {" CCHHHHHCC ", " DDDDD ", " DD DD ", " ", " ", " E E ", " ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " ", " E E ", " ", " ", " DD DD ", " DDDDD ", " C C "}, + {" CCCCCCC ", " C C ", " DDDDDDD ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D D ", " D D ", "CCD DCC", " D D ", "CCD DCC", " D D ", " D D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " DDDDDDD ", " C C ", " C C "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" ", " C C ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " CC CC ", " DB BD ", " CC CC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " C C ", " "}, + {" ", " ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " DB BD ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " ", " "}, + {" ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " "}, + {" ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " B ", " ", " ", " ", " ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " ", " ", " ", " ", " B ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " C C ", " D ", " D ", " ", " ", " ", " ", " ", " CC CC ", " DD DD ", " CC CC ", " ", " ", " ", " D ", " D ", " D ", " D ", " C C ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " D ", " D ", " DDDDDDD ", " DD DD ", " D EEE D ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " D EEE D ", " DD DD ", " DDDDDDD ", " D ", " D ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " C C ", " DDDDD ", " DDCDCDD ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " DDCDCDD ", " DDDDD ", " C C ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "} })) .addShape("main_t2", transpose(new String[][]{ - {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," "," "," C C "," GGC CGG "," GGGC CGGG "," GGGGC CGGGG "," GGGGDDDDDGGGG "," GGGDDCDCDDGGG "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," GGGDDCDCDDGGG "," GGGGDDDDDGGGG "," GGGGC CGGGG "," GGGC CGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," C C "," GGC CGG "," GGGGC CGGGG "," GGG D GGG "," GGG D GGG "," GG DDDDDDD GG "," GG DD DD GG "," GG D EEE D GG "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," GG D EEE D GG "," GG DD DD GG "," GG DDDDDDD GG "," GGG D GGG "," GGG D GGG "," GGGGC CGGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," C C "," GGGC CGGG "," GGG D GGG "," GG D GG "," GG GG "," G G "," GG GG "," G G "," G G "," CC CC "," DD DD "," CC CC "," G G "," G G "," GG GG "," G G "," GG GG "," GG D GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "," "," "," "," "}, - {" "," "," "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," GG B GG "," G G "," GG GG "," G G "," G G "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," G G "," G G "," GG GG "," G G "," GG B GG "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "," "," "}, - {" "," "," "," "," C C "," GGGGGC CGGGGG "," GGG D GGG "," GG EEEBEEE GG "," GG GG "," G G "," GG GG "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," GG GG "," G G "," GG GG "," GG EEEBEEE GG "," GGG D GGG "," GGGGGC CGGGGG "," C C "," "," "," "," "}, - {" "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "}, - {" "," "," C C "," GGGC CGGG "," GGG D GGG "," GG EEEBEEE GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG EEEBEEE GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "}, - {" "," "," GGC CGG "," GGG D GGG "," GG B GG "," GG GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," DB BD "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG GG "," GG B GG "," GGG D GGG "," GGC CGG "," "," "}, - {" "," C C "," GGGGC CGGGG "," GG D GG "," GG B GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," CC CC "," DB BD "," CC CC "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG B GG "," GG D GG "," GGGGC CGGGG "," C C "," "}, - {" "," GGC CGG "," GGG D GGG "," GG GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG GG "," GGG D GGG "," GGC CGG "," "}, - {" "," GGGC CGGG "," GGG D GGG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GGG D GGG "," GGGC CGGG "," "}, - {" CCCCCCC "," GGGGC CGGGG "," GG DDDDDDD GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GD DG "," GD DG ","CCD DCC"," D D ","CCD DCC"," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG DDDDDDD GG "," GGGGC CGGGG "," C C "}, - {" CCHHHHHCC "," GGGGDDDDDGGGG "," GG DD DD GG "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," GD DG "," D D ","CD DC"," D D ","CD DC"," D D "," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," GG DD DD GG "," GGGGDDDDDGGGG "," C C "}, - {" CHHHHHHHC "," GGGDDCDCDDGGG "," GG D EEE D GG "," G G "," C C "," G E E G "," C C "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," C C "," G E E G "," C C "," G G "," GG D EEE D GG "," GGGDDCDCDDGGG "," C C "}, - {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, - {" CHHF~FHHC "," DDDDDDD "," DDD EAAAE DDD "," DD DD "," CDBB BBDC "," DB BD "," CDB BDC "," DB BD "," DB BD "," DB BD "," D D "," D D "," D D "," D D "," DE ED ","CDA ADC"," DA AD ","CDA ADC"," DE ED "," D D "," D D "," D D "," D D "," DB BD "," DB BD "," DB BD "," CDB BDC "," DB BD "," CDBB BBDC "," DD DD "," DDD EAAAE DDD "," DDDDDDD "," C C "}, - {" CHHFFFHHC "," CCCCDCCDCCDCCCC "," CCC D EAAAE D CCC "," CC CC "," CC CC "," CC E E CC "," CC CC "," CC E E CC "," C C "," CC CC "," C C "," C C ","CCD DCC","CD DC","CCE ECC","CCA ACC","CDA ADC","CCA ACC","CCE ECC","CD DC","CCD DCC"," C C "," C C "," CC CC "," C C "," CC E E CC "," CC CC "," CC E E CC "," CC CC "," CC CC "," CCC D EAAAE D CCC "," CCCCDCCDCCDCCCC "," CCCCCCCCC "}, - {" CHHHHHHHC "," GGGDDCDCDDGGG "," GG D EEE D GG "," G G "," C C "," G E E G "," C C "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," D D "," D D ","CCE ECC"," DE ED ","CCE ECC"," D D "," D D "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," C C "," G E E G "," C C "," G G "," GG D EEE D GG "," GGGDDCDCDDGGG "," C C "}, - {" CCHHHHHCC "," GGGGDDDDDGGGG "," GG DD DD GG "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," G G "," G G "," GD DG "," GD DG "," D D ","CD DC"," D D ","CD DC"," D D "," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G E E G "," G G "," G E E G "," G G "," G G "," GG DD DD GG "," GGGGDDDDDGGGG "," C C "}, - {" CCCCCCC "," GGGGC CGGGG "," GG DDDDDDD GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GD DG "," GD DG ","CCD DCC"," D D ","CCD DCC"," GD DG "," GD DG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG DDDDDDD GG "," GGGGC CGGGG "," C C "}, - {" "," GGGC CGGG "," GGG D GGG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GGG D GGG "," GGGC CGGG "," "}, - {" "," GGC CGG "," GGG D GGG "," GG GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," D D "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG GG "," GGG D GGG "," GGC CGG "," "}, - {" "," C C "," GGGGC CGGGG "," GG D GG "," GG B GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," CC CC "," DB BD "," CC CC "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG B GG "," GG D GG "," GGGGC CGGGG "," C C "," "}, - {" "," "," GGC CGG "," GGG D GGG "," GG B GG "," GG GG "," GG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," C C "," DB BD "," C C "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GG GG "," GG B GG "," GGG D GGG "," GGC CGG "," "," "}, - {" "," "," C C "," GGGC CGGG "," GGG D GGG "," GG EEEBEEE GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG EEEBEEE GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "}, - {" "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," G G "," GG GG "," G G "," G G "," G G "," G G "," G G "," C C "," CC CC "," CDB BDC "," CC CC "," C C "," G G "," G G "," G G "," G G "," G G "," GG GG "," G G "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "}, - {" "," "," "," "," C C "," GGGGGC CGGGGG "," GGG D GGG "," GG EEEBEEE GG "," GG GG "," G G "," GG GG "," G G "," G G "," G E E G "," G E E G "," CC E E CC "," DB BD "," CC E E CC "," G E E G "," G E E G "," G G "," G G "," GG GG "," G G "," GG GG "," GG EEEBEEE GG "," GGG D GGG "," GGGGGC CGGGGG "," C C "," "," "," "," "}, - {" "," "," "," "," "," C C "," GGGCCCCCGGG "," GGG D GGG "," GG B GG "," GG B GG "," G G "," GG GG "," G G "," G G "," C C "," CC CC "," CDBB BBDC "," CC CC "," C C "," G G "," G G "," GG GG "," G G "," GG B GG "," GG B GG "," GGG D GGG "," GGGCCCCCGGG "," C C "," "," "," "," "," "}, - {" "," "," "," "," "," "," C C "," GGGC CGGG "," GGG D GGG "," GG D GG "," GG GG "," G G "," GG GG "," G G "," G G "," CC CC "," DD DD "," CC CC "," G G "," G G "," GG GG "," G D G "," GG D GG "," GG D GG "," GGG D GGG "," GGGC CGGG "," C C "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," C C "," GGC CGG "," GGGGC CGGGG "," GGG D GGG "," GGG D GGG "," GG DDDDDDD GG "," GG DD DD GG "," GG D EEE D GG "," CCC D EAAAE D CCC "," DDD EAAAE DDD "," CCC D EAAAE D CCC "," GG D EEE D GG "," GG DD DD GG "," GG DDDDDDD GG "," GGG D GGG "," GGG D GGG "," GGGGC CGGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," "," "," C C "," GGC CGG "," GGGC CGGG "," GGGGC CGGGG "," GGGGDDDDDGGGG "," GGGDDCDCDDGGG "," CCCCDCCDCCDCCCC "," DDDDDDD "," CCCCDCCDCCDCCCC "," GGGDDCDCDDGGG "," GGGGDDDDDGGGG "," GGGGC CGGGG "," GGGC CGGG "," GGC CGG "," C C "," "," "," "," "," "," "," "," "," "}, - {" "," "," "," "," "," "," "," "," "," "," "," "," C C "," C C "," C C "," CCCCCCCCC "," C C "," CCCCCCCCC "," C C "," C C "," C C "," "," "," "," "," "," "," "," "," "," "," "," "} + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGC CGGG ", " GGGGC CGGGG ", " GGGGDDDDDGGGG ", " GGGDDCDCDDGGG ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " GGGDDCDCDDGGG ", " GGGGDDDDDGGGG ", " GGGGC CGGGG ", " GGGC CGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGGC CGGGG ", " GGG D GGG ", " GGG D GGG ", " GG DDDDDDD GG ", " GG DD DD GG ", " GG D EEE D GG ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " GG D EEE D GG ", " GG DD DD GG ", " GG DDDDDDD GG ", " GGG D GGG ", " GGG D GGG ", " GGGGC CGGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG D GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " CC CC ", " DD DD ", " CC CC ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GG D GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " GGGGGC CGGGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGGGC CGGGGG ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " "}, + {" ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " "}, + {" ", " ", " GGC CGG ", " GGG D GGG ", " GG B GG ", " GG GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " DB BD ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG GG ", " GG B GG ", " GGG D GGG ", " GGC CGG ", " ", " "}, + {" ", " C C ", " GGGGC CGGGG ", " GG D GG ", " GG B GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " CC CC ", " DB BD ", " CC CC ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG B GG ", " GG D GG ", " GGGGC CGGGG ", " C C ", " "}, + {" ", " GGC CGG ", " GGG D GGG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GGG D GGG ", " GGC CGG ", " "}, + {" ", " GGGC CGGG ", " GGG D GGG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GGG D GGG ", " GGGC CGGG ", " "}, + {" CCCCCCC ", " GGGGC CGGGG ", " GG DDDDDDD GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", "CCD DCC", " D D ", "CCD DCC", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG DDDDDDD GG ", " GGGGC CGGGG ", " C C "}, + {" CCHHHHHCC ", " GGGGDDDDDGGGG ", " GG DD DD GG ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " GG DD DD GG ", " GGGGDDDDDGGGG ", " C C "}, + {" CHHHHHHHC ", " GGGDDCDCDDGGG ", " GG D EEE D GG ", " G G ", " C C ", " G E E G ", " C C ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " C C ", " G E E G ", " C C ", " G G ", " GG D EEE D GG ", " GGGDDCDCDDGGG ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHF~FHHC ", " DDDDDDD ", " DDD EAAAE DDD ", " DD DD ", " CDBB BBDC ", " DB BD ", " CDB BDC ", " DB BD ", " DB BD ", " DB BD ", " D D ", " D D ", " D D ", " D D ", " DE ED ", "CDA ADC", " DA AD ", "CDA ADC", " DE ED ", " D D ", " D D ", " D D ", " D D ", " DB BD ", " DB BD ", " DB BD ", " CDB BDC ", " DB BD ", " CDBB BBDC ", " DD DD ", " DDD EAAAE DDD ", " DDDDDDD ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHHHHHHC ", " GGGDDCDCDDGGG ", " GG D EEE D GG ", " G G ", " C C ", " G E E G ", " C C ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " C C ", " G E E G ", " C C ", " G G ", " GG D EEE D GG ", " GGGDDCDCDDGGG ", " C C "}, + {" CCHHHHHCC ", " GGGGDDDDDGGGG ", " GG DD DD GG ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " GG DD DD GG ", " GGGGDDDDDGGGG ", " C C "}, + {" CCCCCCC ", " GGGGC CGGGG ", " GG DDDDDDD GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", "CCD DCC", " D D ", "CCD DCC", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG DDDDDDD GG ", " GGGGC CGGGG ", " C C "}, + {" ", " GGGC CGGG ", " GGG D GGG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GGG D GGG ", " GGGC CGGG ", " "}, + {" ", " GGC CGG ", " GGG D GGG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GGG D GGG ", " GGC CGG ", " "}, + {" ", " C C ", " GGGGC CGGGG ", " GG D GG ", " GG B GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " CC CC ", " DB BD ", " CC CC ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG B GG ", " GG D GG ", " GGGGC CGGGG ", " C C ", " "}, + {" ", " ", " GGC CGG ", " GGG D GGG ", " GG B GG ", " GG GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " DB BD ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG GG ", " GG B GG ", " GGG D GGG ", " GGC CGG ", " ", " "}, + {" ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " "}, + {" ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " GGGGGC CGGGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGGGC CGGGGG ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG D GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " CC CC ", " DD DD ", " CC CC ", " G G ", " G G ", " GG GG ", " G D G ", " GG D GG ", " GG D GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGGC CGGGG ", " GGG D GGG ", " GGG D GGG ", " GG DDDDDDD GG ", " GG DD DD GG ", " GG D EEE D GG ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " GG D EEE D GG ", " GG DD DD GG ", " GG DDDDDDD GG ", " GGG D GGG ", " GGG D GGG ", " GGGGC CGGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGC CGGG ", " GGGGC CGGGG ", " GGGGDDDDDGGGG ", " GGGDDCDCDDGGG ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " GGGDDCDCDDGGG ", " GGGGDDDDDGGGG ", " GGGGC CGGGG ", " GGGC CGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "} })) .addElement('A', ofBlock(sBlockCasingsTT, 10)) .addElement('B', ofBlock(sBlockCasingsTT, 11)) .addElement('C', ofBlock(sBlockCasingsTT, 12)) .addElement('D', ofBlock(sBlockCasingsTT, 13)) .addElement('E', ofBlock(sBlockCasingsTT, 14)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); @Override @@ -307,8 +307,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E public void construct(ItemStack stackSize, boolean hintsOnly) { try { structureBuild_EM((stackSize.stackSize & 1) == 1 ? "main_t1" : "main_t2", 16, 16, 0, stackSize, hintsOnly); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } 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 faa48d39de..6ad3282d9d 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 @@ -57,8 +57,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.computer.hint.1"),//2 - Rack Hatches or Advanced computer casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("front", transpose(new String[][]{ {" AA"}, {" AA"}, @@ -83,10 +83,10 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB {" AA"}, {" AA"} })) - .addElement('A', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) .addElement('B', ofBlock(sBlockCasingsTT, 1)) .addElement('C', ofBlock(sBlockCasingsTT, 2)) .addElement('D', ofBlock(sBlockCasingsTT, 3)) + .addElement('A', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addRackToMachineList, textureOffset + 3, 2, sBlockCasingsTT, 3)) .build(); //endregion @@ -95,17 +95,17 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB protected Parameters.Group.ParameterIn overclock, overvolt; protected Parameters.Group.ParameterOut maxCurrentTemp, availableData; - private static final INameFunction OC_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.0");//Overclock ratio - private static final INameFunction OV_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.1");//Overvoltage ratio - private static final INameFunction MAX_TEMP_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.0");//Current max. heat - private static final INameFunction COMPUTE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.1");//Produced computation - private static final IStatusFunction OC_STATUS = + private static final INameFunction OC_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.0");//Overclock ratio + private static final INameFunction OV_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.1");//Overvoltage ratio + private static final INameFunction MAX_TEMP_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.0");//Current max. heat + private static final INameFunction COMPUTE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.1");//Produced computation + private static final IStatusFunction OC_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), 0, 1, 1, 3); - private static final IStatusFunction OV_STATUS = + private static final IStatusFunction OV_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), .7, .8, 1.2, 2); private static final IStatusFunction MAX_TEMP_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), -10000, 0, 0, 5000); - private static final IStatusFunction COMPUTE_STATUS = (base, p) -> { + private static final IStatusFunction COMPUTE_STATUS = (base, p) -> { if (base.eAvailableData < 0) { return STATUS_TOO_LOW; } @@ -185,7 +185,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if(aBaseMetaTileEntity.isServerSide() && mMachine && !aBaseMetaTileEntity.isActive() && aTick % 20 == MULTI_CHECK_AT){ + if (aBaseMetaTileEntity.isServerSide() && mMachine && !aBaseMetaTileEntity.isActive() && aTick % 20 == MULTI_CHECK_AT) { double maxTemp = 0; for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { @@ -203,8 +203,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB public boolean checkRecipe_EM(ItemStack itemStack) { parametrization.setToDefaults(false, true); eAvailableData = 0; - double maxTemp = 0; - double overClockRatio = overclock.get(); + double maxTemp = 0; + double overClockRatio = overclock.get(); double overVoltageRatio = overvolt.get(); if (Double.isNaN(overClockRatio) || Double.isNaN(overVoltageRatio)) { return false; @@ -218,7 +218,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB return false; } short thingsActive = 0; - int rackComputation; + int rackComputation; for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { @@ -268,8 +268,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB public void outputAfterRecipe_EM() { if (!eOutputData.isEmpty()) { Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), - getBaseMetaTileEntity().getYCoord(), - getBaseMetaTileEntity().getZCoord()); + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); QuantumDataPacket pack = new QuantumDataPacket(eAvailableData / eOutputData.size()).unifyTraceWith(pos); if (pack == null) { @@ -388,7 +388,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB byte offset = -2; for (int rackSlices = Math.min(stackSize.stackSize, 12); rackSlices > 0; rackSlices--) { - structureBuild_EM("slice", 1 , 2, offset--, stackSize, hintsOnly); + structureBuild_EM("slice", 1, 2, offset--, stackSize, hintsOnly); } structureBuild_EM("cap", 1, 2, offset--, stackSize, hintsOnly); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 65870f9e76..014e2b3a65 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -42,23 +42,23 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.1"),//2 - Elemental Hatches or Molecular Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION= - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "}, - {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, - {"AH~HA","AAAAA"," FEF ","BBEBB","CGEGC","GGDGG","CGEGC","BBEBB"," FEF ","AAAAA","AHHHA"}, - {"AHHHA","AAAAA"," FFF ","BBBBB","GGGGG","GGGGG","GGGGG","BBBBB"," FFF ","AAAAA","AHHHA"}, - {" AAA ","AAAAA","A A","BBBBB","BGCGB","BGGGB","BGCGB","BBBBB","A A","AAAAA"," AAA "} + {" AAA ", "AAAAA", "A A", "BBBBB", "BGCGB", "BGGGB", "BGCGB", "BBBBB", "A A", "AAAAA", " AAA "}, + {"AHHHA", "AAAAA", " FFF ", "BBBBB", "GGGGG", "GGGGG", "GGGGG", "BBBBB", " FFF ", "AAAAA", "AHHHA"}, + {"AH~HA", "AAAAA", " FEF ", "BBEBB", "CGEGC", "GGDGG", "CGEGC", "BBEBB", " FEF ", "AAAAA", "AHHHA"}, + {"AHHHA", "AAAAA", " FFF ", "BBBBB", "GGGGG", "GGGGG", "GGGGG", "BBBBB", " FFF ", "AAAAA", "AHHHA"}, + {" AAA ", "AAAAA", "A A", "BBBBB", "BGCGB", "BGGGB", "BGCGB", "BBBBB", "A A", "AAAAA", " AAA "} })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) .addElement('D', ofBlock(sBlockCasingsTT, 9)) .addElement('E', ofBlock(sBlockCasingsTT, 10)) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 84e6026448..9a9747f012 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -39,7 +39,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables private final ArrayList eStacksDataOutputs = new ArrayList<>(); - private final ArrayList eDataAccessHatches = new ArrayList<>(); + private final ArrayList eDataAccessHatches = new ArrayList<>(); //endregion //region structure @@ -49,12 +49,12 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.databank.hint.1"),//2 - Data Access/Data Bank Master Hatches or computer casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {"BCCCB","BDDDB","BDDDB"}, - {"BC~CB","BAAAB","BDDDB"}, - {"BCCCB","BDDDB","BDDDB"} + {"BCCCB", "BDDDB", "BDDDB"}, + {"BC~CB", "BAAAB", "BDDDB"}, + {"BCCCB", "BDDDB", "BDDDB"} })) .addElement('A', ofBlock(sBlockCasingsTT, 1)) .addElement('B', ofBlock(sBlockCasingsTT, 2)) @@ -130,12 +130,12 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true);//todo texture } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 0b8a521581..18b0047ef4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -65,8 +65,8 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase translateToLocal("gt.blockmachines.multimachine.em.decay.hint.1"),//2 - Elemental Hatches or Molecular Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main",transpose(new String[][]{ {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"}, {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, @@ -78,8 +78,8 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) .addElement('D', ofBlock(sBlockCasingsTT, 8)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index ba1ac8b298..5a045102ef 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -43,20 +43,20 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo //region structure //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {"CCC", "ABA", "EEE", "BDB"}, - {"C~C", "BBB", "EBE", "DFD"}, - {"CCC", "ABA", "EEE", "BDB"} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 0)) - .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) - .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .build(); + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", transpose(new String[][]{ + {"CCC", "ABA", "EEE", "BDB"}, + {"C~C", "BBB", "EBE", "DFD"}, + {"CCC", "ABA", "EEE", "BDB"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .build(); private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 207768323b..f6833d2cb9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -40,14 +40,14 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa translateToLocal("gt.blockmachines.multimachine.em.infuser.hint"),//1 - Classic Hatches or High Power Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {"CCC","CCC","CCC"}, - {"BBB","BAB","BBB"}, - {"A~A","AAA","AAA"}, - {"BBB","BAB","BBB"}, - {"CCC","CCC","CCC"} + {"CCC", "CCC", "CCC"}, + {"BBB", "BAB", "BBB"}, + {"A~A", "AAA", "AAA"}, + {"BBB", "BAB", "BBB"}, + {"CCC", "CCC", "CCC"} })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 7)) @@ -169,12 +169,12 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true); } public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_whooum"); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index a3944c6e31..62ecd507c2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -35,8 +35,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.junction.hint.1"),//2 - Elemental Hatches or Molecular Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", new String[][]{ {"CCC", "C~C", "CCC"}, {"AAA", "AAA", "AAA"}, @@ -58,7 +58,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB //endregion //region parameters - private static final INameFunction ROUTE_NAME = + private static final INameFunction ROUTE_NAME = (base, p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Source") + " " : translateToLocal("tt.keyword.Destination") + " ") + p.hatchId(); private static final IStatusFunction SRC_STATUS = (base, p) -> { @@ -83,8 +83,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } return STATUS_NEUTRAL; }; - protected Parameters.Group.ParameterIn[] src; - protected Parameters.Group.ParameterIn[] dst; + protected Parameters.Group.ParameterIn[] src; + protected Parameters.Group.ParameterIn[] dst; //endregion public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { @@ -138,8 +138,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB if (inIndex < 0 || inIndex >= eInputHatches.size()) { continue; } - int outIndex = (int) dst - 1; - GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); + int outIndex = (int) dst - 1; + GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); if (outIndex == -1) {//param==0 -> null the content cleanHatchContentEM_EM(in); } else { 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 64bce35ca0..dc218da530 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 @@ -49,19 +49,19 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {"CCC","BAB","EEE","DBD"}, - {"C~C","ABA","EBE","BFB"}, - {"CCC","BAB","EEE","DBD"} + {"CCC", "BAB", "EEE", "DBD"}, + {"C~C", "ABA", "EBE", "BFB"}, + {"CCC", "BAB", "EEE", "DBD"} })) .addElement('A', ofBlock(sBlockCasingsTT, 0)) .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList,textureOffset + 4, 2)) .build(); private static final String[] description = new String[]{ @@ -94,7 +94,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock public boolean checkRecipe_EM(ItemStack itemStack) {//TODO implement instance quantization if (GregTech_API.sPostloadFinished) { ArrayList storedInputs = getStoredInputs(); - ItemStack[] inI = storedInputs.toArray(nullItem); + ItemStack[] inI = storedInputs.toArray(nullItem); if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization @@ -133,7 +133,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } } ArrayList storedFluids = getStoredFluids(); - FluidStack[] inF = storedFluids.toArray(nullFluid); + FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { EMFluidQuantizationInfo aFQI = TecTech.transformationInfo.getFluidQuantization().get(fs.getFluid().getID()); @@ -155,7 +155,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private void startRecipe(IEMStack into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - double mass = into.getMass(); + double mass = into.getMass(); double euMult = Math.abs(mass / refMass); eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); if (mass > refUnstableMass || into.getDefinition().getRawTimeSpan(DEFAULT_ENERGY_LEVEL) < STABLE_RAW_LIFE_TIME) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 33660d838f..9cd3bf40e7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -53,13 +53,13 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; */ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables - private final ArrayList eHolders = new ArrayList<>(); - private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; - private TT_recipe.TT_assLineRecipe aRecipe; - private String machineType; - private static final String assembly="Assembly line"; - private ItemStack holdItem; - private long computationRemaining, computationRequired; + private final ArrayList eHolders = new ArrayList<>(); + private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; + private TT_recipe.TT_assLineRecipe aRecipe; + private String machineType; + private static final String assembly = "Assembly line"; + private ItemStack holdItem; + private long computationRemaining, computationRequired; private static LinkedHashMap lServerNames; @@ -73,23 +73,23 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"}, - {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, - {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, - {" ", " E ", " ", " ", "A~A", "CCC", "DDD"}, - {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, - {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, - {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"} - })) - .addElement('A', ofBlock(sBlockCasingsTT, 1)) - .addElement('B', ofBlock(sBlockCasingsTT, 2)) - .addElement('C', ofBlock(sBlockCasingsTT, 3)) - .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1,1, sBlockCasingsTT,1)) - .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 2)) - .build(); + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", transpose(new String[][]{ + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {" ", " E ", " ", " ", "A~A", "CCC", "DDD"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 2)) + .addElement('C', ofBlock(sBlockCasingsTT, 3)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 2)) + .build(); //endregion public GT_MetaTileEntity_EM_research(int aID, String aName, String aNameRegional) { @@ -143,12 +143,12 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private void makeStick2() { String s = tRecipe.mOutput.getDisplayName(); if (getBaseMetaTileEntity().isServerSide()) { - if(lServerNames != null) { + if (lServerNames != null) { s = lServerNames.get(tRecipe.mOutput.getDisplayName()); if (s == null) { s = tRecipe.mOutput.getDisplayName(); } - }else{ + } else { s = tRecipe.mOutput.getDisplayName(); } } @@ -187,7 +187,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB tNBTList.appendTag(new NBTTagString("Construction plan for " + tRecipe.mOutput.stackSize + " " + s + ". Needed EU/t: " + tRecipe.mEUt + " Production time: " + (tRecipe.mDuration / 20))); for (int i = 0; i < tRecipe.mInputs.length; i++) { if (tRecipe.mOreDictAlt[i] != null) { - int count = 0; + int count = 0; StringBuilder tBuilder = new StringBuilder("Input Bus " + (i + 1) + ": "); for (ItemStack tStack : tRecipe.mOreDictAlt[i]) { if (tStack != null) { @@ -240,7 +240,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB mEfficiencyIncrease = 10000; eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); - mEUt = Math.min(ttRecipe.mEUt,-ttRecipe.mEUt); + mEUt = Math.min(ttRecipe.mEUt, -ttRecipe.mEUt); eHolders.get(0).getBaseMetaTileEntity().setActive(true); return true; } @@ -362,7 +362,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public String[] getInfoData() { long storedEnergy = 0; - long maxEnergy = 0; + long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); 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 68e7519950..8d4f86c164 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 @@ -57,15 +57,15 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables public static final int SCAN_DO_NOTHING = 0, - SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, - SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, - SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; + SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, + SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, + SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; private EMDefinitionStack objectResearched; private EMInstanceStackMap objectsScanned; - private String machineType; - private long computationRemaining, computationRequired; + private String machineType; + private long computationRemaining, computationRequired; private int[] scanComplexity; private String clientLocale = "en_US"; @@ -80,27 +80,27 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"}, - {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, - {"CA~AC","BBBBB","DDDDD","D---D","D---D","D---D","DDGDD","EBFBE"}, - {"CAAAC","BBBBB","BDDDB","D---D","D---D","D---D","BDDDB","EBBBE"}, - {"CCCCC","BBBBB","BBDBB","BDDDB","BDDDB","BDDDB","BBDBB","EEEEE"} + {"CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE"}, + {"CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE"}, + {"CA~AC", "BBBBB", "DDDDD", "D---D", "D---D", "D---D", "DDGDD", "EBFBE"}, + {"CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE"}, + {"CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE"} })) .addElement('A', ofBlock(sBlockCasingsTT, 0)) .addElement('B', ofBlock(sBlockCasingsTT, 4)) - .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, textureOffset + 4, 2)) .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, textureOffset + 4, 3)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) .build(); //endregion //region parameters - private static final INameFunction CONFIG_NAME = + private static final INameFunction CONFIG_NAME = (base, p) -> "Config at Depth: " + (p.hatchId() * 2 + p.parameterId()); private static final IStatusFunction CONFIG_STATUS = (base, p) -> { @@ -114,7 +114,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (v < 0) return LedStatus.STATUS_TOO_LOW; return LedStatus.STATUS_OK; }; - protected Parameters.Group.ParameterIn[] scanConfiguration; + protected Parameters.Group.ParameterIn[] scanConfiguration; //endregion public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { @@ -130,9 +130,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private void quantumStuff(boolean shouldExist) { IGregTechTileEntity base = getBaseMetaTileEntity(); if (base != null && base.getWorld() != null) { - int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); - int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); - int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); + int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); + int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); + int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); Block block = base.getWorld().getBlock(xDir, yDir, zDir); if (shouldExist) { if (block != null && block.getMaterial() == Material.air) { @@ -332,7 +332,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public String[] getInfoData() { long storedEnergy = 0; - long maxEnergy = 0; + long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); @@ -420,7 +420,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa computationRemaining = aNBT.getLong("eComputationRemaining"); computationRequired = aNBT.getLong("eComputationRequired"); if (aNBT.hasKey("eObject")) { - objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eObject")); + objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eObject")); if (objectResearched.getDefinition() == EMPrimitiveDefinition.nbtE__) { objectResearched = null; } @@ -434,7 +434,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } try { if (aNBT.hasKey("eScanObjects")) { - objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eScanObjects")); + objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eScanObjects")); } } catch (EMException e) { objectsScanned = new EMInstanceStackMap(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 6bedce3ede..7103e6dfff 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -28,21 +28,21 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.1"),//2 - Elemental Hatches or Molecular Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "}, - {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, - {"FE~EF","BBBBB","GDDDG","BBBBB","FEEEF"}, - {"AEEEA","CBBBC","BBDBB","CBBBC","AEEEA"}, - {" AFA ","BCBCB","FBGBF","BCBCB"," AFA "} + {" AFA ", "BCBCB", "FBGBF", "BCBCB", " AFA "}, + {"AEEEA", "CBBBC", "BBDBB", "CBBBC", "AEEEA"}, + {"FE~EF", "BBBBB", "GDDDG", "BBBBB", "FEEEF"}, + {"AEEEA", "CBBBC", "BBDBB", "CBBBC", "AEEEA"}, + {" AFA ", "BCBCB", "FBGBF", "BCBCB", " AFA "} })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) .addElement('D', ofBlock(sBlockCasingsTT, 9)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index bd38a46b7f..bbf33c6ae7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -43,12 +43,12 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas "1 - Classic/Data Hatches or Computer casing",//1 - Classic/Data Hatches or Computer casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {"BBB","BBB","BBB"}, - {"B~B","BAB","BBB"}, - {"BBB","BBB","BBB"} + {"BBB", "BBB", "BBB"}, + {"B~B", "BAB", "BBB"}, + {"BBB", "BBB", "BBB"} })) .addElement('A', ofBlock(sBlockCasingsTT, 3)) .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_EM_switch::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) @@ -56,7 +56,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas //endregion //region parameters - private static final INameFunction ROUTE_NAME = + private static final INameFunction ROUTE_NAME = (base, p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Destination") + " " : translateToLocal("tt.keyword.Weight") + " ") + p.hatchId(); private static final IStatusFunction WEI_STATUS = (base, p) -> { @@ -79,8 +79,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } return STATUS_NEUTRAL; }; - protected Parameters.Group.ParameterIn[] dst; - protected Parameters.Group.ParameterIn[] weight; + protected Parameters.Group.ParameterIn[] dst; + protected Parameters.Group.ParameterIn[] weight; //endregion public GT_MetaTileEntity_EM_switch(int aID, String aName, String aNameRegional) { @@ -134,8 +134,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), - getBaseMetaTileEntity().getYCoord(), - getBaseMetaTileEntity().getZCoord()); + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); QuantumDataPacket pack = new QuantumDataPacket(0L).unifyTraceWith(pos); if (pack == null) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 208d33c610..75eb05bdeb 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -32,24 +32,24 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[] description = new String[]{ + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.transformer.hint"),//1 - Energy IO Hatches or High Power Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() - .addShape("main",new String[][]{ - {"111", "1~1", "111",}, - {"111", "101", "111",}, - {"111", "111", "111",}, - }) - .addElement('0', ofBlock(sBlockCasings1,15)) - .addElement('1', ofChain( - ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList,textureOffset,1), - onElementPass(t->t.casingCount++,ofBlock(sBlockCasingsTT,0)) - )) - .build(); - private int casingCount=0; + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("main", new String[][]{ + {"111", "1~1", "111",}, + {"111", "101", "111",}, + {"111", "111", "111",}, + }) + .addElement('0', ofBlock(sBlockCasings1, 15)) + .addElement('1', ofChain( + ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList, textureOffset, 1), + onElementPass(t -> t.casingCount++, ofBlock(sBlockCasingsTT, 0)) + )) + .build(); + private int casingCount = 0; @Override public IStructureDefinition getStructure_EM() { @@ -86,8 +86,8 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - casingCount=0; - return structureCheck_EM("main", 1, 1, 0) && casingCount>=5; + casingCount = 0; + return structureCheck_EM("main", 1, 1, 0) && casingCount >= 5; } @Override @@ -116,12 +116,12 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, false); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, false); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, false); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, false); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 502a300bb3..83151d71c3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -40,25 +40,25 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.1"),//2 - Elemental Hatches or Molecular Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "}, - {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, - {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, - {" EEE "," DDD "," F F "," "," "," ","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, - {" E~E "," DDBDD "," D D "," DD DD "," D D ","DD DD","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, - {" EEE "," DDD "," F F "," "," "," ","DA AD","GBF FBG","GBC CBG","GBF FBG","DA AD"}, - {" "," D "," D "," D "," "," ","DDA ADD","DABFFFBAD","DABCCCBAD","DABFFFBAD","DDA ADD"}, - {" "," "," "," D "," D "," D "," DDAAADD "," EABBBAE "," EABBBAE "," EABBBAE "," DDAAADD "}, - {" "," "," "," "," "," D "," DDDDD "," DGGGD "," DGGGD "," DGGGD "," DDDDD "} + {" ", " ", " ", " ", " ", " D ", " DDDDD ", " DGGGD ", " DGGGD ", " DGGGD ", " DDDDD "}, + {" ", " ", " ", " D ", " D ", " D ", " DDAAADD ", " EABBBAE ", " EABBBAE ", " EABBBAE ", " DDAAADD "}, + {" ", " D ", " D ", " D ", " ", " ", "DDA ADD", "DABFFFBAD", "DABCCCBAD", "DABFFFBAD", "DDA ADD"}, + {" EEE ", " DDD ", " F F ", " ", " ", " ", "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD"}, + {" E~E ", " DDBDD ", " D D ", " DD DD ", " D D ", "DD DD", "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD"}, + {" EEE ", " DDD ", " F F ", " ", " ", " ", "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD"}, + {" ", " D ", " D ", " D ", " ", " ", "DDA ADD", "DABFFFBAD", "DABCCCBAD", "DABFFFBAD", "DDA ADD"}, + {" ", " ", " ", " D ", " D ", " D ", " DDAAADD ", " EABBBAE ", " EABBBAE ", " EABBBAE ", " DDAAADD "}, + {" ", " ", " ", " ", " ", " D ", " DDDDD ", " DGGGD ", " DGGGD ", " DGGGD ", " DDDDD "} })) .addElement('A', ofBlock(sBlockCasingsTT, 5)) .addElement('B', ofBlock(sBlockCasingsTT, 10)) .addElement('C', ofBlock(sBlockCasingsTT, 11)) .addElement('D', ofBlock(sBlockCasingsTT, 12)) - .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 3df25033ca..fec070407b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -50,13 +50,13 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock translateToLocal("gt.blockmachines.multimachine.tm.microwave.hint.1"),//Also acts like a hopper so give it an Output Bus }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {"AAAAA","A---A","A---A","A---A","AAAAA"}, - {"AAAAA","A---A","A---A","A---A","AAAAA"}, - {"AA~AA","A---A","A---A","A---A","AAAAA"}, - {"ABBBA","BAAAB","BAAAB","BAAAB","ABBBA"} + {"AAAAA", "A---A", "A---A", "A---A", "AAAAA"}, + {"AAAAA", "A---A", "A---A", "A---A", "AAAAA"}, + {"AA~AA", "A---A", "A---A", "A---A", "AAAAA"}, + {"ABBBA", "BAAAB", "BAAAB", "BAAAB", "ABBBA"} })) .addElement('A', ofBlock(sBlockCasings4, 1)) .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_TM_microwave::addClassicToMachineList, 49, 1, sBlockCasings4, 1)) @@ -69,11 +69,11 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock private static final INameFunction POWER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgi.0");//Power setting private static final INameFunction TIMER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgi.1");//Timer setting - private static final INameFunction TIMER_VALUE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.0");//Timer value - private static final INameFunction TIMER_REMAINING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.1");//Timer remaining - private static final IStatusFunction POWER_STATUS = + private static final INameFunction TIMER_VALUE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.0");//Timer value + private static final INameFunction TIMER_REMAINING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.1");//Timer remaining + private static final IStatusFunction POWER_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), 300, 1000, 1000, Double.POSITIVE_INFINITY); - private static final IStatusFunction TIMER_STATUS = (base, p) -> { + private static final IStatusFunction TIMER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -98,7 +98,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM("main", 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -125,16 +125,16 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } timerValue.set(timerValue.get() + 1); remainingTime.set(timerSetting.get() - timerValue.get()); - IGregTechTileEntity mte = getBaseMetaTileEntity(); - Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 2)); - double xPos = mte.getXCoord() + 0.5f + xyzOffsets.get0(); - double yPos = mte.getYCoord() + 0.5f + xyzOffsets.get1(); - double zPos = mte.getZCoord() + 0.5f + xyzOffsets.get2(); + IGregTechTileEntity mte = getBaseMetaTileEntity(); + Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 2)); + double xPos = mte.getXCoord() + 0.5f + xyzOffsets.get0(); + double yPos = mte.getYCoord() + 0.5f + xyzOffsets.get1(); + double zPos = mte.getZCoord() + 0.5f + xyzOffsets.get2(); AxisAlignedBB aabb = getBoundingBox(-2, -2, -2, 2, 2, 2) .offset(xPos, yPos, zPos); xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -4, 0)); Vec3Impl xyzExpansion = getExtendedFacing().getWorldOffset(new Vec3Impl(1, 0, 1)).abs(); - int power = (int) powerSetting.get(); + int power = (int) powerSetting.get(); int damagingFactor = Math.min(power >> 6, 8) + Math.min(power >> 8, 24) + @@ -142,7 +142,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock (power >> 18); ArrayList itemsToOutput = new ArrayList<>(); - HashSet tickedStuff = new HashSet<>(); + HashSet tickedStuff = new HashSet<>(); boolean inside = true; do { @@ -170,7 +170,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } } aabb.offset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); - aabb = aabb.expand(xyzExpansion.get0()*1.5, xyzExpansion.get1()*1.5, xyzExpansion.get2()*1.5); + aabb = aabb.expand(xyzExpansion.get0() * 1.5, xyzExpansion.get1() * 1.5, xyzExpansion.get2() * 1.5); inside = false; damagingFactor >>= 1; } while (damagingFactor > 0); @@ -195,12 +195,12 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true);//todo texture } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index c4d1de75fe..f2081547c3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -53,38 +53,38 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { //Interface fields private final Multimap teslaNodeMap = MultimapBuilder.treeKeys().linkedListValues().build(); - private final HashSet sparkList = new HashSet<>(); - private int sparkCount = 10; + private final HashSet sparkList = new HashSet<>(); + private int sparkCount = 10; //region variables - private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32 - private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TRANSCEIVER;//Default is 16 - private static final int transferRadiusCoverUltimateFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_COVER;//Default is 16 - private static final int plasmaRangeMultiT1 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1;//Default is 2 - private static final int plasmaRangeMultiT2 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2;//Default is 4 - private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM;//Default is 100 - private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN;//Default is 50 - private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON;//Default is 50 + private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32 + private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TRANSCEIVER;//Default is 16 + private static final int transferRadiusCoverUltimateFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_COVER;//Default is 16 + private static final int plasmaRangeMultiT1 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1;//Default is 2 + private static final int plasmaRangeMultiT2 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2;//Default is 4 + private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM;//Default is 100 + private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN;//Default is 50 + private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON;//Default is 50 //Default is {1, 1, 1} - private static final int[] plasmaTierLoss = new int[]{TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T0, + private static final int[] plasmaTierLoss = new int[]{TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T0, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T1, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T2}; - private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F; - private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false + private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F; + private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false //Face icons private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - private int mTier = 0; //Determines max voltage (LV to ZPM) + private int mTier = 0; //Determines max voltage (LV to ZPM) private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon (Does not match actual plasma tiers) private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs, so the tesla takes a second to 'cool' any plasma it would output as a gas private final ArrayList eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps - private long energyCapacity = 0; //Total energy storage limited by capacitors + private long energyCapacity = 0; //Total energy storage limited by capacitors private long outputVoltageMax = 0; //Tesla voltage output limited by capacitors - private int vTier = -1; //Tesla voltage tier limited by capacitors + private int vTier = -1; //Tesla voltage tier limited by capacitors private long outputCurrentMax = 0; //Tesla current output limited by capacitors //outputVoltage and current after settings @@ -92,10 +92,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private long outputCurrent; //Prevents unnecessary offset calculation, saving on lag - private byte oldRotation = -1; - private byte oldOrientation = -1; + private byte oldRotation = -1; + private byte oldOrientation = -1; //Location of the center of the sphere on top of the tower, used as the Thaumcraft lightning and origin - public Vec3Impl posTop = Vec3Impl.NULL_VECTOR; + public Vec3Impl posTop = Vec3Impl.NULL_VECTOR; //endregion //region structure @@ -104,26 +104,26 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.0"),//1 - Classic Hatches, Capacitor Hatches or Tesla Base Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", transpose(new String[][]{ - {" "," "," BBB "," BBB "," BBB "," "," "}, - {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, - {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, - {" "," BBB "," BBBBB "," BBBBB "," BBBBB "," BBB "," "}, - {" "," "," BBB "," BCB "," BBB "," "," "}, - {" "," "," "," C "," "," "," "}, - {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, - {" "," "," "," C "," "," "," "}, - {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, - {" "," "," "," C "," "," "," "}, - {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, - {" "," "," "," C "," "," "," "}, - {" "," BBB "," B F B "," BFCFB "," B F B "," BBB "," "}, - {" "," "," "," C "," "," "," "}, - {" "," "," "," C "," "," "," "}, - {" "," DDD "," D D "," D C D "," D D "," DDD "," "}, - {" EE~EE ","EAAAAAE","EADDDAE","EADADAE","EADDDAE"," AAAAAE"," EEEEE "} + {" ", " ", " BBB ", " BBB ", " BBB ", " ", " "}, + {" ", " BBB ", " BBBBB ", " BBBBB ", " BBBBB ", " BBB ", " "}, + {" ", " BBB ", " BBBBB ", " BBBBB ", " BBBBB ", " BBB ", " "}, + {" ", " BBB ", " BBBBB ", " BBBBB ", " BBBBB ", " BBB ", " "}, + {" ", " ", " BBB ", " BCB ", " BBB ", " ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " DDD ", " D D ", " D C D ", " D D ", " DDD ", " "}, + {" EE~EE ", "EAAAAAE", "EADDDAE", "EADADAE", "EADDDAE", " AAAAAE", " EEEEE "} })) .addElement('A', ofBlock(sBlockCasingsBA0, 6)) .addElement('B', ofBlock(sBlockCasingsBA0, 7)) @@ -143,28 +143,28 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock protected Parameters.Group.ParameterIn popogaSetting, histLowSetting, histHighSetting, transferRadiusTowerSetting, transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting, outputCurrentSetting, sortTimeMinSetting, overDriveSetting; protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay, transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, sortTimeDisplay; - private static final INameFunction HYSTERESIS_LOW_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0");//Hysteresis low setting - private static final INameFunction HYSTERESIS_HIGH_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1");//Hysteresis high setting - private static final INameFunction TRANSFER_RADIUS_TOWER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.2");//Tesla Towers transfer radius setting - private static final INameFunction TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.3");//Tesla Transceiver transfer radius setting + private static final INameFunction HYSTERESIS_LOW_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0");//Hysteresis low setting + private static final INameFunction HYSTERESIS_HIGH_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1");//Hysteresis high setting + private static final INameFunction TRANSFER_RADIUS_TOWER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.2");//Tesla Towers transfer radius setting + private static final INameFunction TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.3");//Tesla Transceiver transfer radius setting private static final INameFunction TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.4");//Tesla Ultimate Cover transfer radius setting - private static final INameFunction OUTPUT_VOLTAGE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.5");//Output voltage setting - private static final INameFunction OUTPUT_CURRENT_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.6");//Output current setting - private static final INameFunction SCAN_TIME_MIN_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.7");//Scan time Min setting - private static final INameFunction OVERDRIVE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.8");//Overdrive setting - private static final INameFunction POPOGA_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.9");//Unused - - private static final INameFunction TRANSFER_RADIUS_TOWER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.0");//Tesla Towers transfer radius display - private static final INameFunction TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.1");//Tesla Transceiver transfer radius display + private static final INameFunction OUTPUT_VOLTAGE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.5");//Output voltage setting + private static final INameFunction OUTPUT_CURRENT_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.6");//Output current setting + private static final INameFunction SCAN_TIME_MIN_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.7");//Scan time Min setting + private static final INameFunction OVERDRIVE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.8");//Overdrive setting + private static final INameFunction POPOGA_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.9");//Unused + + private static final INameFunction TRANSFER_RADIUS_TOWER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.0");//Tesla Towers transfer radius display + private static final INameFunction TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.1");//Tesla Transceiver transfer radius display private static final INameFunction TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.2");//Tesla Ultimate Cover transfer radius display - private static final INameFunction OUTPUT_VOLTAGE_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3");//Output voltage display - private static final INameFunction OUTPUT_CURRENT_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4");//Output current display - private static final INameFunction ENERGY_CAPACITY_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.5");//Energy Capacity display - private static final INameFunction ENERGY_STORED_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.6");//Energy Stored display - private static final INameFunction ENERGY_FRACTION_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7");//Energy Fraction display - private static final INameFunction SCAN_TIME_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8");//Scan time display - - private static final IStatusFunction HYSTERESIS_LOW_STATUS = (base, p) -> { + private static final INameFunction OUTPUT_VOLTAGE_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3");//Output voltage display + private static final INameFunction OUTPUT_CURRENT_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4");//Output current display + private static final INameFunction ENERGY_CAPACITY_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.5");//Energy Capacity display + private static final INameFunction ENERGY_STORED_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.6");//Energy Stored display + private static final INameFunction ENERGY_FRACTION_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7");//Energy Fraction display + private static final INameFunction SCAN_TIME_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8");//Scan time display + + private static final IStatusFunction HYSTERESIS_LOW_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) { return STATUS_WRONG; @@ -173,14 +173,14 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value > base.histHighSetting.get()) return STATUS_TOO_HIGH; return STATUS_OK; }; - private static final IStatusFunction HYSTERESIS_HIGH_STATUS = (base, p) -> { + private static final IStatusFunction HYSTERESIS_HIGH_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; if (value <= base.histLowSetting.get()) return STATUS_TOO_LOW; if (value > 0.95) return STATUS_TOO_HIGH; return STATUS_OK; }; - private static final IStatusFunction TRANSFER_RADIUS_TOWER_STATUS = (base, p) -> { + private static final IStatusFunction TRANSFER_RADIUS_TOWER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -189,7 +189,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value < transferRadiusTowerFromConfig) return STATUS_LOW; return STATUS_OK; }; - private static final IStatusFunction TRANSFER_RADIUS_TRANSCEIVER_STATUS = (base, p) -> { + private static final IStatusFunction TRANSFER_RADIUS_TRANSCEIVER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -207,7 +207,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value < transferRadiusCoverUltimateFromConfig) return STATUS_LOW; return STATUS_OK; }; - private static final IStatusFunction OUTPUT_VOLTAGE_OR_CURRENT_STATUS = (base, p) -> { + private static final IStatusFunction OUTPUT_VOLTAGE_OR_CURRENT_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (long) value; @@ -215,7 +215,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value <= 0) return STATUS_TOO_LOW; return STATUS_OK; }; - private static final IStatusFunction SCAN_TIME_MIN_STATUS = (base, p) -> { + private static final IStatusFunction SCAN_TIME_MIN_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -223,7 +223,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value == 100) return STATUS_OK; return STATUS_HIGH; }; - private static final IStatusFunction OVERDRIVE_STATUS = (base, p) -> { + private static final IStatusFunction OVERDRIVE_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -231,20 +231,20 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value == 0) return STATUS_LOW; return STATUS_HIGH; }; - private static final IStatusFunction POPOGA_STATUS = (base, p) -> { + private static final IStatusFunction POPOGA_STATUS = (base, p) -> { if (base.getBaseMetaTileEntity().getWorld().isThundering()) { return STATUS_WTF; } return STATUS_NEUTRAL; }; - private static final IStatusFunction SCAN_TIME_STATUS = (base, p) -> { + private static final IStatusFunction SCAN_TIME_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; if (value == 0) return STATUS_HIGH; return STATUS_LOW; }; - private static final IStatusFunction POWER_STATUS = (base, p) -> { + private static final IStatusFunction POWER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (long) value; @@ -254,7 +254,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return STATUS_LOW; } }; - private static final IStatusFunction ENERGY_STATUS = (base, p) -> { + private static final IStatusFunction ENERGY_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; if (base.energyFractionDisplay.get() > base.histHighSetting.get()) { @@ -369,8 +369,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock oldOrientation = iGregTechTileEntity.getFrontFacing(); Vec3Impl posBMTE = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), - getBaseMetaTileEntity().getYCoord(), - getBaseMetaTileEntity().getZCoord()); + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); //Calculate coordinates of the middle bottom posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(posBMTE); @@ -612,10 +612,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //TODO Encapsulate the spark sender sparkCount--; - if (sparkCount == 0){ + if (sparkCount == 0) { IGregTechTileEntity mte = getBaseMetaTileEntity(); sparkCount = 10; - if(!sparkList.isEmpty()){ + if (!sparkList.isEmpty()) { NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), mte.getWorld().provider.dimensionId, mte.getXCoord(), diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java index b7db310d12..6871be2a5f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java @@ -59,7 +59,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; private static double MASS_TO_EU_INSTANT; - private static int STARTUP_COST, KEEPUP_COST; + private static int STARTUP_COST, KEEPUP_COST; protected byte eTier = 0; protected EMInstanceStack stack; @@ -69,7 +69,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //endregion //region collision handlers - public static final HashMap FUSE_HANDLERS = new HashMap<>(); + public static final HashMap FUSE_HANDLERS = new HashMap<>(); public static final HashMap PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); static { @@ -263,7 +263,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //endregion //region parameters - protected Parameters.Group.ParameterIn mode; + protected Parameters.Group.ParameterIn mode; private static final IStatusFunction MODE_STATUS = (base_EM, p) -> { if (base_EM.isMaster()) { double mode = p.get(); @@ -278,7 +278,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } return STATUS_OK; }; - private static final INameFunction MODE_NAME = (base_EM, p) -> { + private static final INameFunction MODE_NAME = (base_EM, p) -> { if (base_EM.isMaster()) { double mode = p.get(); if (mode == FUSE_MODE) { @@ -303,23 +303,31 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() - .addShape("main", transpose(new String[][]{ - {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "}, - {" AAAAA "," AADDDDDAA "," CDDEEEEEDDC "," CDEEDDDDDEEDC "," CDEDD DDEDC "," CDED DEDC "," CDED DEDC "," ADED DEDA "," ADED DEDA ","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA","ADED DEDA"," ADED DEDA "," ADED DEDA "," CDED DEDC "," CDED DEDC "," CDEDDBJ~JBDDEDC "," CDEEDDDDDEEDC "," CDDEEEEEDDC "}, - {" A A A "," AAAAAAA "," BBBBIIIBBBB "," BAAAAAAAAAAAB "," BAAAA AAAAB "," BAAA AAAB "," BAAA AAAB "," BAA AAB "," ABAA AABA ","AABA ABAA"," AIA AIA ","AAIA AIAA"," AIA AIA ","AABA ABAA"," ABAA AABA "," BAA AAB "," BAAA AAAB "," BAAA AAAB "," BAAAABJJJBAAAAB "," BAHHBBBBBHHAB "," BBBBGFGBBBB "} + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() + .addShape("tier1", transpose(new String[][]{ + {" A A A ", " AAAAAAA ", " bbbbIIIbbbb ", " bAAAAAAAAAAAb ", " bAAAA AAAAb ", " bAAA AAAb ", " bAAA AAAb ", " bAA AAb ", " AbAA AAbA ", "AAbA AbAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AAbA AbAA", " AbAA AAbA ", " bAA AAb ", " bAAA AAAb ", " bAAA AAAb ", " bAAAAbJJJbAAAAb ", " bAHHbbbbbHHAb ", " bbbbGFGbbbb "}, + {" AAAAA ", " AADDDDDAA ", " cDDeeeeeDDc ", " cDeeDDDDDeeDc ", " cDeDD DDeDc ", " cDeD DeDc ", " cDeD DeDc ", " ADeD DeDA ", " ADeD DeDA ", "ADeD DeDA", "ADeD DeDA", "ADeD DeDA", "ADeD DeDA", "ADeD DeDA", " ADeD DeDA ", " ADeD DeDA ", " cDeD DeDc ", " cDeD DeDc ", " cDeDDbJ~JbDDeDc ", " cDeeDDDDDeeDc ", " cDDeeeeeDDc "}, + {" A A A ", " AAAAAAA ", " bbbbIIIbbbb ", " bAAAAAAAAAAAb ", " bAAAA AAAAb ", " bAAA AAAb ", " bAAA AAAb ", " bAA AAb ", " AbAA AAbA ", "AAbA AbAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AAbA AbAA", " AbAA AAbA ", " bAA AAb ", " bAAA AAAb ", " bAAA AAAb ", " bAAAAbJJJbAAAAb ", " bAHHbbbbbHHAb ", " bbbbGFGbbbb "} + })) + .addShape("tier2", transpose(new String[][]{ + {" A A A ", " AAAAAAA ", " BBBBIIIBBBB ", " BAAAAAAAAAAAB ", " BAAAA AAAAB ", " BAAA AAAB ", " BAAA AAAB ", " BAA AAB ", " ABAA AABA ", "AABA ABAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AABA ABAA", " ABAA AABA ", " BAA AAB ", " BAAA AAAB ", " BAAA AAAB ", " BAAAABJJJBAAAAB ", " BAHHBBBBBHHAB ", " BBBBGFGBBBB "}, + {" AAAAA ", " AADDDDDAA ", " CDDEEEEEDDC ", " CDEEDDDDDEEDC ", " CDEDD DDEDC ", " CDED DEDC ", " CDED DEDC ", " ADED DEDA ", " ADED DEDA ", "ADED DEDA", "ADED DEDA", "ADED DEDA", "ADED DEDA", "ADED DEDA", " ADED DEDA ", " ADED DEDA ", " CDED DEDC ", " CDED DEDC ", " CDEDDBJ~JBDDEDC ", " CDEEDDDDDEEDC ", " CDDEEEEEDDC "}, + {" A A A ", " AAAAAAA ", " BBBBIIIBBBB ", " BAAAAAAAAAAAB ", " BAAAA AAAAB ", " BAAA AAAB ", " BAAA AAAB ", " BAA AAB ", " ABAA AABA ", "AABA ABAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AABA ABAA", " ABAA AABA ", " BAA AAB ", " BAAA AAAB ", " BAAA AAAB ", " BAAAABJJJBAAAAB ", " BAHHBBBBBHHAB ", " BBBBGFGBBBB "} })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) - .addElement('B', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) - .addElement('C', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) + .addElement('b', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('c', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) .addElement('D', ofBlock(sBlockCasingsTT, 7)) - .addElement('E', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) - .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) - .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) - .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('e', ofBlock(sBlockCasingsTT, 8)) + .addElement('E', ofBlock(sBlockCasingsTT, 9)) .addElement('I', ofBlock(QuantumGlassBlock.INSTANCE, 0)) .addElement('J', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) .build(); @Override @@ -338,7 +346,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07 * EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; STARTUP_COST = -heliumPlasmaValue * 10000; KEEPUP_COST = -heliumPlasmaValue; @@ -350,7 +358,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); EMInstanceStack stack2 = partner.stack; - double preMass = add(stack2.getMass(),stack.getMass()); + double preMass = add(stack2.getMass(), stack.getMass()); //System.out.println("preMass = " + preMass); EMInstanceStackMap map = new EMInstanceStackMap(); @@ -414,10 +422,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } protected GT_MetaTileEntity_EM_collider getPartner() { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); if (gregTechBaseTileEntity != null) { IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); @@ -477,7 +485,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB eTier = 0; return false; } - if (structureCheck_EM("main", 11, 1, 18)) { + if (structureCheck_EM("tier"+eTier, 11, 1, 18)) { return true; } eTier = 0; @@ -628,7 +636,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB eTier = aNBT.getByte("eTier");//collider tier started = aNBT.getBoolean("eStarted"); if (aNBT.hasKey("eStack")) { - stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eStack")); + stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eStack")); } plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); } @@ -663,11 +671,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { + public void construct(ItemStack trigger, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; if (hintsOnly) { StructureLibAPI.hintParticle(iGregTechTileEntity.getWorld(), iGregTechTileEntity.getXCoord() + xDir, @@ -675,7 +683,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB iGregTechTileEntity.getZCoord() + zDir, StructureLibAPI.getBlockHint(), 12); } - structureBuild_EM("main", 11, 1, 18, stackSize, hintsOnly); + structureBuild_EM("tier"+((trigger.stackSize%2)+1), 11, 1, 18, trigger, hintsOnly); } @Override 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 3b0e8ba91d..9540a84fcf 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 @@ -36,7 +36,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa //region variables public static final String machine = "EM Machinery"; - private ItemStack loadedMachine; + private ItemStack loadedMachine; private IBehaviour currentBehaviour; //endregion @@ -47,27 +47,27 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"),//2 - Elemental Hatches or Molecular Casing }; - private static final IStructureDefinition STRUCTURE_DEFINITION = - IStructureDefinition.builder() + private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition + .builder() .addShape("main", new String[][]{ - {" A "," AAA "," EBE "," ECE "," EBE "," AAA "," A "}, - {" DDD ","AAAAA","E---E","E---E","E---E","AAAAA"," FFF "}, - {"AD-DA","AA~AA","B---B","C---C","B---B","AA-AA","AFFFA"}, - {" DDD ","AAAAA","E---E","E---E","E---E","AAAAA"," FFF "}, - {" A "," AAA "," EBE "," ECE "," EBE "," AAA "," A "} + {" A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A "}, + {" DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF "}, + {"AD-DA", "AA~AA", "B---B", "C---C", "B---B", "AA-AA", "AFFFA"}, + {" DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF "}, + {" A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A "} }) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) - .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) .build(); //endregion //region parameters - protected Parameters.Group.ParameterIn[] inputMux; - protected Parameters.Group.ParameterIn[] outputMux; + protected Parameters.Group.ParameterIn[] inputMux; + protected Parameters.Group.ParameterIn[] outputMux; private static final IStatusFunction SRC_STATUS = (base, p) -> { double v = p.get(); @@ -91,7 +91,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } return STATUS_NEUTRAL; }; - private static final INameFunction ROUTE_NAME = + private static final INameFunction ROUTE_NAME = (base, p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Source") + " " : translateToLocal("tt.keyword.Destination") + " ") + p.hatchId(); //endregion @@ -169,9 +169,9 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa private void quantumStuff(boolean shouldIExist) { IGregTechTileEntity base = getBaseMetaTileEntity(); if (base != null && base.getWorld() != null) { - int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 2 + base.getXCoord(); - int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 2 + base.getYCoord(); - int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 2 + base.getZCoord(); + int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 2 + base.getXCoord(); + int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 2 + base.getYCoord(); + int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 2 + base.getZCoord(); Block block = base.getWorld().getBlock(xDir, yDir, zDir); if (shouldIExist) { if (block != null && block.getMaterial() == Material.air) { -- cgit From 1cee4ac982c2d3b7b29789456a4cd72f10b8c320 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 31 Jan 2022 23:54:19 +0100 Subject: Fix structures --- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 21 --------------------- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 21 --------------------- .../technus/tectech/font/TecTechFontRender.java | 2 +- .../multi/GT_MetaTileEntity_EM_junction.java | 10 +++++----- .../multi/GT_MetaTileEntity_EM_scanner.java | 2 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 1 + .../em_collider/GT_MetaTileEntity_EM_collider.java | 2 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 7 ++++--- 8 files changed, 13 insertions(+), 53 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 3278aa812b..e91dd2c4af 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -13,13 +13,11 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; @@ -157,25 +155,6 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (hintsOnly) { - StructureLibAPI.hintParticle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - StructureLibAPI.getBlockHint(), 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock( - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - StructureLibAPI.getBlockHint(), 12, 2); - } - } structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index debbcd2ae0..befc9ac77e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -15,11 +15,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; @@ -131,25 +129,6 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (hintsOnly) { - StructureLibAPI.hintParticle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - StructureLibAPI.getBlockHint(), 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock( - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - StructureLibAPI.getBlockHint(), 12, 2); - } - } structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java index ffbef07158..826ed3af5d 100644 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java @@ -165,7 +165,7 @@ public class TecTechFontRender extends FontRenderer { } private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) { - return p_78278_2_ == ' ' ? 4.0F : ("ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); + return p_78278_2_ == ' ' ? 4.0F : ("\u00C0\u00C1\u00C2\u00C8\u00CA\u00CB\u00CD\u00D3\u00D4\u00D5\u00DA\u00DF\u00E3\u00F5\u011F\u0130\u0131\u0152\u0153\u015E\u015F\u0174\u0175\u017E\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\u03B2\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u2205\u2208\u2229\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 62ecd507c2..23e7267388 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -44,11 +44,11 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB {"DDD", "DDD", "DDD"} }) .addShape("mainBig", new String[][]{ - {" ", " CCC ", " C~C ", " CCC ", " "}, - {" DDD ", "DAAAD", "DABAD", "DAAAD", " DDD "}, - {"DDDDD", "DAAAD", "DAAAD", "DAAAD", "DDDDD"}, + {" A ", " CCC ", "AC~CA", " CCC ", " A "}, {" DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD "}, - {" DDD ", "DDDDD", "DDDDD", "DDDDD", " DDD "} + {"ADDDA", "DAAAD", "DABAD", "DAAAD", "ADDDA"}, + {" DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD "}, + {" A ", "DDDDD", "ADDDA", "DDDDD", " A "} }) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) @@ -102,7 +102,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int meta = iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); + int meta = iGregTechTileEntity.getMetaIDAtSideAndDistance(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing()),2); if (meta == 4) { return structureCheck_EM("main", 1, 1, 0); } else if (meta == 5) { 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 8d4f86c164..8583f03193 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 @@ -85,7 +85,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa .addShape("main", transpose(new String[][]{ {"CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE"}, {"CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE"}, - {"CA~AC", "BBBBB", "DDDDD", "D---D", "D---D", "D---D", "DDGDD", "EBFBE"}, + {"CA~AC", "BBBBB", "DDDDD", "D---D", "D- -D", "D---D", "DDGDD", "EBFBE"}, {"CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE"}, {"CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE"} })) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index f2081547c3..8d910d9431 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -102,6 +102,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.0"),//1 - Classic Hatches, Capacitor Hatches or Tesla Base Casing + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.1"),//2 - ""Titanium frames"" }; private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java index 6871be2a5f..a2a9eab3a1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java @@ -683,7 +683,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB iGregTechTileEntity.getZCoord() + zDir, StructureLibAPI.getBlockHint(), 12); } - structureBuild_EM("tier"+((trigger.stackSize%2)+1), 11, 1, 18, trigger, hintsOnly); + structureBuild_EM("tier"+(((trigger.stackSize-1)%2)+1), 11, 1, 18, trigger, hintsOnly); } @Override 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 9540a84fcf..2c4217aaba 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 @@ -26,6 +26,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; @@ -49,13 +50,13 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa private static final IStructureDefinition STRUCTURE_DEFINITION = IStructureDefinition .builder() - .addShape("main", new String[][]{ + .addShape("main", transpose(new String[][]{ {" A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A "}, {" DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF "}, - {"AD-DA", "AA~AA", "B---B", "C---C", "B---B", "AA-AA", "AFFFA"}, + {"AD-DA", "AA~AA", "B---B", "C- -C", "B---B", "AA-AA", "AFFFA"}, {" DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF "}, {" A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A "} - }) + })) .addElement('A', ofBlock(sBlockCasingsTT, 4)) .addElement('B', ofBlock(sBlockCasingsTT, 5)) .addElement('C', ofBlock(sBlockCasingsTT, 6)) -- cgit From 24f4cac5ea02b85501f976caaad898e86cce5a4f Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 1 Feb 2022 22:19:59 +0100 Subject: Sort things out in the load order --- dependencies.gradle | 1 + .../worldedit-forge-mc1.7.10-6.1.1-dist.jar | Bin 0 -> 1461467 bytes .../java/com/github/technus/tectech/TecTech.java | 46 +++++++++++---------- 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 dependencies/worldedit-forge-mc1.7.10-6.1.1-dist.jar (limited to 'src/main') diff --git a/dependencies.gradle b/dependencies.gradle index 74c58e52c3..ed933b256e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -44,4 +44,5 @@ dependencies { compile files("dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar") compile files("dependencies/AdvancedSolarPanel_1.7.10_Edition.jar") + compile files("dependencies/worldedit-forge-mc1.7.10-6.1.1-dist.jar") } diff --git a/dependencies/worldedit-forge-mc1.7.10-6.1.1-dist.jar b/dependencies/worldedit-forge-mc1.7.10-6.1.1-dist.jar new file mode 100644 index 0000000000..0361359748 Binary files /dev/null and b/dependencies/worldedit-forge-mc1.7.10-6.1.1-dist.jar differ diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 03701668ef..1248437e30 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -35,8 +35,12 @@ import java.util.Iterator; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" - + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;" + "required-after:structurelib;") +@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, + dependencies = "required-after:Forge@[10.13.4.1614,);" + + "required-after:YAMCore@[0.5.70,);" + "required-after:structurelib;" + + "after:ComputerCraft;" + "after:OpenComputers;" + + "required-after:gregtech;" + "after:dreamcraft;" + + "after:appliedenergistics2;" + "after:CoFHCore;" + "after:Thaumcraft;") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) public static CommonProxy proxy; @@ -44,27 +48,27 @@ public class TecTech { @Mod.Instance(Reference.MODID) public static TecTech instance; - public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; + public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; public static final LogHelper LOGGER = new LogHelper(Reference.MODID); - public static CreativeTabTecTech creativeTabTecTech; - public static CreativeTabEM creativeTabEM; + public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabEM creativeTabEM; private static IngameErrorLog moduleAdminErrorLogs; - public static TecTechConfig configTecTech; + public static TecTechConfig configTecTech; - public static ChunkDataHandler chunkDataHandler; - public static AnomalyHandler anomalyHandler; + public static ChunkDataHandler chunkDataHandler; + public static AnomalyHandler anomalyHandler; public static PlayerPersistence playerPersistence; - public static final EMDefinitionsRegistry definitionsRegistry =new EMDefinitionsRegistry(); - public static final EMTransformationRegistry transformationInfo =new EMTransformationRegistry(); + public static final EMDefinitionsRegistry definitionsRegistry = new EMDefinitionsRegistry(); + public static final EMTransformationRegistry transformationInfo = new EMTransformationRegistry(); /** * For Loader.isModLoaded checks during the runtime */ public static boolean hasCOFH = false; - public static final byte tectechTexturePage1=8; + public static final byte tectechTexturePage1 = 8; public static void AddLoginError(String pMessage) { if (moduleAdminErrorLogs != null) { @@ -93,11 +97,11 @@ public class TecTech { moduleAdminErrorLogs = new IngameErrorLog(); } - playerPersistence=new PlayerPersistence("tec"); + playerPersistence = new PlayerPersistence("tec"); FMLCommonHandler.instance().bus().register(playerPersistence); MinecraftForge.EVENT_BUS.register(playerPersistence); - chunkDataHandler=new ChunkDataHandler(); + chunkDataHandler = new ChunkDataHandler(); FMLCommonHandler.instance().bus().register(chunkDataHandler); MinecraftForge.EVENT_BUS.register(chunkDataHandler); @@ -108,13 +112,13 @@ public class TecTech { public void Load(FMLInitializationEvent event) { hasCOFH = Loader.isModLoaded(Reference.COFHCORE); - if(configTecTech.DISABLE_MATERIAL_LOADING_FFS){ + if (configTecTech.DISABLE_MATERIAL_LOADING_FFS) { try { - Field modifiersField = Field.class.getDeclaredField( "modifiers" ); - modifiersField.setAccessible( true ); - Field field= GT_Proxy.class.getDeclaredField("mEvents"); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + Field field = GT_Proxy.class.getDeclaredField("mEvents"); field.setAccessible(true); - modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL ); + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); field.set(GT_Mod.gregtechproxy, new Collection() { @Override public int size() { @@ -203,9 +207,9 @@ public class TecTech { @Mod.EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { - MainLoader.postLoad(definitionsRegistry,transformationInfo); + MainLoader.postLoad(definitionsRegistry, transformationInfo); - chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler=new AnomalyHandler()); + chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler = new AnomalyHandler()); } @Mod.EventHandler @@ -213,7 +217,7 @@ public class TecTech { pEvent.registerServerCommand(new ConvertInteger()); pEvent.registerServerCommand(new ConvertFloat()); pEvent.registerServerCommand(new EMList()); - if(DEBUG_MODE) { + if (DEBUG_MODE) { pEvent.registerServerCommand(new EMGive()); pEvent.registerServerCommand(new CancerCommand()); pEvent.registerServerCommand(new ChargeCommand()); -- cgit