aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2022-01-15 00:16:05 +0100
committerMartin Robertz <dream-master@gmx.net>2022-01-29 21:23:00 +0100
commitc82522576d27ba1b0fdaf7fe1283489cb9f40744 (patch)
tree5652bf1d1ebfc04554f3e232584183b8ea145d75 /src/main/java
parent91ca8b69b5e2a9610411a5e6b1fac66d3663de15 (diff)
downloadGT5-Unofficial-c82522576d27ba1b0fdaf7fe1283489cb9f40744.tar.gz
GT5-Unofficial-c82522576d27ba1b0fdaf7fe1283489cb9f40744.tar.bz2
GT5-Unofficial-c82522576d27ba1b0fdaf7fe1283489cb9f40744.zip
cherry pick
Cleanup EM maps
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java27
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java4
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java42
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java2
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java6
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java565
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java278
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java181
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java)22
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java)8
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java12
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java10
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java58
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java)43
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java214
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java50
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java187
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java130
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java)15
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java)19
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java35
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java54
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java)9
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java10
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java14
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java14
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java14
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java16
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java18
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java18
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java16
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java194
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java68
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java2
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipe.java30
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java12
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java18
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java109
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java100
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java63
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java114
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java90
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java58
63 files changed, 1299 insertions, 1750 deletions
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<AVOGADRO_CONSTANT_DIMINISHED){
- TecTech.anomalyHandler.addAnomaly(this,hatchContentPointer.remove(stack.definition).getMass());//todo reduce
- continue;
- }
- hatchContentPointer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT));
- stack=stack.clone();
- stack.amount = AVOGADRO_CONSTANT;
- return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack);
+ if (hatchContentPointer == null || hatchContentPointer.isEmpty()) {
+ return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null);
}
- return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null);
-
- //todo make the recipe require some overflow hatches
+ cElementalInstanceStack stack = hatchContentPointer.getRandom();
+ double amount = Math.min(AVOGADRO_CONSTANT,stack.amount);
+ hatchContentPointer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT));
+ stack=stack.clone();
+ stack.amount = amount;
+ return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack);
}
@Override
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 a31ba4ef2c..a5d64fb886 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.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental;
import cpw.mods.fml.common.Optional;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -63,6 +63,6 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity {
private cElementalInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) {
hatch.updateTexture((byte) 8,(byte) 4);
- return hatch.getContainerHandler();
+ return hatch.getContentHandler();
}
}
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 8f570c1247..98ad5bbf63 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
@@ -3,8 +3,8 @@ 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.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.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;
@@ -18,7 +18,7 @@ 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.cElementalDecay.noDecay;
+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;
@@ -31,37 +31,27 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
private static final byte nbtType = (byte) 'c';
- private final cElementalDefinitionStackMap aspectStacks;
-
- @Deprecated
- public dComplexAspectDefinition(cElementalDefinition... aspects) throws tElementalException {
- this(true, new cElementalDefinitionStackMap(aspects));
- }
-
- @Deprecated
- private dComplexAspectDefinition(boolean check, cElementalDefinition... aspects) throws tElementalException {
- this(check, new cElementalDefinitionStackMap(aspects));
- }
+ private final cElementalConstantStackMap aspectStacks;
public dComplexAspectDefinition(cElementalDefinitionStack... aspects) throws tElementalException {
- this(true, new cElementalDefinitionStackMap(aspects));
+ this(true, new cElementalConstantStackMap(aspects));
}
private dComplexAspectDefinition(boolean check, cElementalDefinitionStack... aspects) throws tElementalException {
- this(check, new cElementalDefinitionStackMap(aspects));
+ this(check, new cElementalConstantStackMap(aspects));
}
- public dComplexAspectDefinition(cElementalDefinitionStackMap aspects) throws tElementalException {
+ public dComplexAspectDefinition(cElementalConstantStackMap aspects) throws tElementalException {
this(true, aspects);
}
- private dComplexAspectDefinition(boolean check, cElementalDefinitionStackMap aspects) throws tElementalException {
+ 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.values()) {
+ for (cElementalDefinitionStack stack : aspects.valuesToArray()) {
mass += stack.getMass();
}
this.mass = mass;
@@ -69,9 +59,9 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
}
//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 aspects : stacks.values()) {
+ for (cElementalDefinitionStack aspects : stacks.valuesToArray()) {
if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) {
return false;
}
@@ -97,7 +87,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
@Override
public String getSymbol() {
StringBuilder symbol = new StringBuilder(8);
- for (cElementalDefinitionStack aspect : aspectStacks.values()) {
+ for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) {
if (aspect.definition instanceof ePrimalAspectDefinition) {
for (int i = 0; i < aspect.amount; i++) {
symbol.append(aspect.definition.getSymbol());
@@ -116,7 +106,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
@Override
public String getShortSymbol() {
StringBuilder symbol = new StringBuilder(8);
- for (cElementalDefinitionStack aspect : aspectStacks.values()) {
+ for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) {
if (aspect.definition instanceof ePrimalAspectDefinition) {
for (int i = 0; i < aspect.amount; i++) {
symbol.append(aspect.definition.getShortSymbol());
@@ -137,10 +127,10 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
return getNbtTagCompound(nbtType, aspectStacks);
}
- public static NBTTagCompound getNbtTagCompound(byte nbtType, cElementalDefinitionStackMap aspectStacks) {
+ public static NBTTagCompound getNbtTagCompound(byte nbtType, cElementalConstantStackMap aspectStacks) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setByte("t", nbtType);
- cElementalDefinitionStack[] quarkStacksValues = aspectStacks.values();
+ 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());
@@ -189,7 +179,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
}
@Override
- public cElementalDefinitionStackMap getSubParticles() {
+ public cElementalConstantStackMap getSubParticles() {
return aspectStacks;
}
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 9c6d107bff..5db067a552 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
@@ -2,7 +2,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defi
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;
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_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java
index c11a68b5d0..c939f10d6b 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,7 @@ 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.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.Structure;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
@@ -94,12 +94,12 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_
return false;
}
- cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContainerHandler();
+ cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler();
if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) {
return false;
}
- cElementalInstanceStack stack = inputHatchContainer.get(TecTech.RANDOM.nextInt(inputHatchContainer.size()));
+ cElementalInstanceStack stack = inputHatchContainer.getRandom();
if (stack.amount < AVOGADRO_CONSTANT_DIMINISHED) {
cleanStackEM_EM(inputHatchContainer.remove(stack.definition));
mEUt = (int) -V[6];
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 74dff47aa4..62ac339155 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
@@ -3,7 +3,7 @@ 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.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.structure.Structure;
@@ -108,7 +108,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu
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/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<cElementalInstanceStackMap> {
- TreeMap<iElementalDefinition, cElementalInstanceStack> 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<stacks.length;i++) {
- stacks[i] = in[i].clone();
- }
- putUnifyAll(stacks);
- } else {
- putUnifyAll(in);
- }
- }
-
- @Deprecated
- private cElementalInstanceStackMap(TreeMap<iElementalDefinition, cElementalInstanceStack> inSafe) {
- this(true, inSafe);
- }
-
- @Deprecated
- private cElementalInstanceStackMap(boolean clone, TreeMap<iElementalDefinition, cElementalInstanceStack> 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<iElementalDefinition, cElementalDefinitionStack> 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<iElementalDefinition, cElementalInstanceStack> getRawMap() {
- return map;
- }
-
- public Set<Map.Entry<iElementalDefinition, cElementalInstanceStack>> 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<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) {
- test &= removeAmount(true, entry.getValue());
- }
- if (testOnly || !test) {
- return test;
- }
- for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) {
- removeAmount(false, entry.getValue());
- }
- return true;
- }
-
- public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) {
- boolean test=true;
- for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) {
- test &= removeAmount(true, entry.getValue());
- }
- if (testOnly || !test) {
- return test;
- }
- for (Map.Entry<iElementalDefinition, cElementalInstanceStack> 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<iElementalDefinition, cElementalInstanceStack> 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<iElementalDefinition, cElementalInstanceStack> 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<cElementalInstanceStack> 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<String> getScanShortSymbols(int[] capabilities) {
- ArrayList<String> list=new ArrayList<>(16);
- for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){
- e.getValue().addScanShortSymbols(list,capabilities);
- }
- return list;
- }
-
- public ArrayList<String> getScanInfo(int[] capabilities) {
- ArrayList<String> list=new ArrayList<>(16);
- for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){
- e.getValue().addScanResults(list,capabilities);
- }
- return list;
- }
-
- public cElementalInstanceStack[] values() {
- Collection<cElementalInstanceStack> var = map.values();
- return var.toArray(new cElementalInstanceStack[0]);
- }
-
- public iElementalDefinition[] keys() {
- Set<iElementalDefinition> 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<String> 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<String> 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<iElementalDefinition, cElementalInstanceStack> 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<iElementalDefinition, cElementalDefinitionStack> in) {
- this(true, in);
- }
-
- public cElementalMutableDefinitionStackMap(boolean clone, TreeMap<iElementalDefinition, cElementalDefinitionStack> 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<iElementalDefinition, cElementalDefinitionStack> 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<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) {
- test &= removeAmount(true, entry.getValue());
- }
- if (testOnly || !test) {
- return test;
- }
- for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) {
- removeAmount(false, entry.getValue());
- }
- return true;
- }
-
- public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) {
- boolean test=true;
- for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) {
- test &= removeAmount(true, entry.getValue());
- }
- if (testOnly || !test) {
- return test;
- }
- for (Map.Entry<iElementalDefinition, cElementalInstanceStack> 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<iElementalDefinition, cElementalDefinitionStack> 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<iElementalDefinition, cElementalDefinitionStack> 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<cElementalStackMap> {
- protected TreeMap<iElementalDefinition, cElementalDefinitionStack> map;
-
- @Override
- public abstract cElementalStackMap clone();
-
- @Deprecated
- public abstract TreeMap<iElementalDefinition, cElementalDefinitionStack> 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<cElementalDefinitionStack> var = map.values();
- return var.toArray(new cElementalDefinitionStack[0]);
- }
-
- public final iElementalDefinition[] keys() {
- Set<iElementalDefinition> 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/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java
index e67f773a86..79103f7fa0 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/decay/cElementalDecay.java
@@ -1,5 +1,7 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core;
+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;
@@ -14,10 +16,10 @@ public final class cElementalDecay {
//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];
+ 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 double probability;
+ public final cElementalConstantStackMap outputStacks;
+ public final double probability;
public cElementalDecay(iElementalDefinition... outSafe) {
this(1D, outSafe);
@@ -28,7 +30,7 @@ public final class cElementalDecay {
for (int i = 0; i < outArr.length; i++) {
outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D);
}
- outputStacks = new cElementalDefinitionStackMap(outArr);
+ outputStacks = new cElementalConstantStackMap(outArr);
this.probability = probability;
}
@@ -37,15 +39,15 @@ public final class cElementalDecay {
}
public cElementalDecay(double probability, cElementalDefinitionStack... out) {
- outputStacks = new cElementalDefinitionStackMap(out);
+ outputStacks = new cElementalConstantStackMap(out);
this.probability = probability;
}
- public cElementalDecay(cElementalDefinitionStackMap tree) {
+ public cElementalDecay(cElementalConstantStackMap tree) {
this(1D, tree);
}
- public cElementalDecay(double probability, cElementalDefinitionStackMap tree) {
+ public cElementalDecay(double probability, cElementalConstantStackMap tree) {
outputStacks = tree;
this.probability = probability;
}
@@ -57,7 +59,7 @@ public final class cElementalDecay {
}
//Deny decay code is in instance!
double qtty = 0D;
- for (cElementalDefinitionStack stack : outputStacks.values()) {
+ for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) {
qtty= add(qtty,stack.amount);
}
if (qtty <= 0D) {
@@ -65,7 +67,7 @@ public final class cElementalDecay {
}
//energyTotalForProducts /= qtty;
//lifeMult /= (float) qtty;
- for (cElementalDefinitionStack stack : outputStacks.values()) {
+ 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
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/decay/cElementalDecayResult.java
index 4ca63d14fe..43f4341720 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java
@@ -1,9 +1,11 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core;
+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;
+ private double massAffected;
+ private double massDiff;
public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) {
this.output = output;
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<cElementalDefinitionStack> {//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<iElementalDefinition, cElementalDefinitionStack> in) {
+ super(Collections.unmodifiableNavigableMap(in));
+ }
+
+ @Override
+ public Class<cElementalDefinitionStack> 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/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java
index ce0840bc8b..1273119bb3 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/maps/cElementalDefinitionStackMap.java
@@ -1,55 +1,46 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core;
+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 Tec on 12.05.2017.
+ * Created by danie_000 on 22.01.2017.
*/
-public final class cElementalDefinitionStackMap/*IMMUTABLE*/ extends cElementalStackMap {//Target class for construction of definitions/recipes
+public final class cElementalDefinitionStackMap extends cElementalStackMap<cElementalDefinitionStack> implements iElementalMapRW<cElementalDefinitionStack> {//Transient class for construction of definitions/recipes
//Constructors + Clone, all make a whole new OBJ.
- public static final cElementalDefinitionStackMap EMPTY = new cElementalDefinitionStackMap();
-
- private cElementalDefinitionStackMap() {
- map = new TreeMap<>();
- }
-
- @Deprecated
- public cElementalDefinitionStackMap(iElementalDefinition... in) {
- map=new cElementalMutableDefinitionStackMap(in).map;
- }
+ public cElementalDefinitionStackMap() {}
public cElementalDefinitionStackMap(cElementalDefinitionStack... in) {
- map=new cElementalMutableDefinitionStackMap(in).map;
+ putUnifyAll(in);
}
- public cElementalDefinitionStackMap(TreeMap<iElementalDefinition, cElementalDefinitionStack> in) {
- map = new TreeMap<>(in);
+ public cElementalDefinitionStackMap(NavigableMap<iElementalDefinition, cElementalDefinitionStack> in) {
+ super(in);
}
- cElementalDefinitionStackMap(cElementalMutableDefinitionStackMap unsafeMap){
- map=unsafeMap.map;
+ @Override
+ public Class<cElementalDefinitionStack> getType() {
+ return cElementalDefinitionStack.class;
}
- //IMMUTABLE DON'T NEED IT
@Override
public cElementalDefinitionStackMap clone() {
- return this;
+ return new cElementalDefinitionStackMap(new TreeMap<>(map));
}
- public cElementalMutableDefinitionStackMap toMutable() {
- return new cElementalMutableDefinitionStackMap(map);
+ public cElementalConstantStackMap toImmutable() {
+ return new cElementalConstantStackMap(new TreeMap<>(map));
}
- @Override
- @Deprecated//BETTER TO JUST MAKE A MUTABLE VERSION AND DO SHIT ON IT
- public TreeMap<iElementalDefinition, cElementalDefinitionStack> getRawMap() {
- return toMutable().getRawMap();
+ public cElementalConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() {
+ return new cElementalConstantStackMap(map);
}
public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException {
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<cElementalInstanceStack> implements iElementalMapRW<cElementalInstanceStack> {
+ //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<stacks.length;i++) {
+ stacks[i] = in[i].clone();
+ }
+ putUnifyAll(stacks);
+ } else {
+ putUnifyAll(in);
+ }
+ }
+
+ private cElementalInstanceStackMap(NavigableMap<iElementalDefinition, cElementalInstanceStack> inSafe) {
+ this(true, inSafe);
+ }
+
+ private cElementalInstanceStackMap(boolean clone, NavigableMap<iElementalDefinition, cElementalInstanceStack> in) {
+ if (clone) {
+ map = new TreeMap<>();
+ for(cElementalInstanceStack stack:in.values()) {
+ putUnify(stack.clone());
+ }
+ } else {
+ map = in;
+ }
+ }
+
+ @Override
+ public Class<cElementalInstanceStack> 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<String> getScanShortSymbols(int[] capabilities) {
+ ArrayList<String> list=new ArrayList<>(16);
+ for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){
+ e.getValue().addScanShortSymbols(list,capabilities);
+ }
+ return list;
+ }
+
+ public ArrayList<String> getScanInfo(int[] capabilities) {
+ ArrayList<String> list=new ArrayList<>(16);
+ for(Map.Entry<iElementalDefinition,cElementalInstanceStack> 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<String> 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<String> 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<iElementalDefinition, cElementalInstanceStack> 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<T extends iElementalStack> implements iElementalMapR<T> {
+ protected NavigableMap<iElementalDefinition, T> map;
+
+ protected cElementalStackMap() {
+ this(new TreeMap<>());
+ }
+
+ protected cElementalStackMap(NavigableMap<iElementalDefinition, T> map) {
+ this.map = map;
+ }
+
+ @Override
+ public NavigableMap<iElementalDefinition, T> getBackingMap() {
+ return map;
+ }
+
+ @Override
+ public abstract cElementalStackMap<T> 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<T extends iElementalStack> extends Comparable<iElementalMapR<? extends iElementalStack>>, Cloneable {
+ NavigableMap<iElementalDefinition,T> getBackingMap();
+
+ iElementalMapR<T> clone();
+
+ default Set<Map.Entry<iElementalDefinition, T>> entrySet(){
+ return getBackingMap().entrySet();
+ }
+
+ default Set<iElementalDefinition> keySet(){
+ return getBackingMap().keySet();
+ }
+
+ default iElementalDefinition[] keySetToArray() {
+ return keySetToArray(new iElementalDefinition[size()]);
+ }
+
+ default iElementalDefinition[] keySetToArray(iElementalDefinition[] array) {
+ return getBackingMap().keySet().toArray(array);
+ }
+
+ default Collection<T> 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<T> 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<iElementalDefinition, T> 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<? extends iElementalStack> o) {//this actually compares rest
+ int sizeDiff = size() - o.size();
+ if (sizeDiff != 0) {
+ return sizeDiff;
+ }
+
+ Iterator<T> iterator = values().iterator();
+ Iterator<? extends iElementalStack> 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<iElementalDefinition, T> entry : getBackingMap().entrySet()) {
+ mass+=entry.getValue().getMass();
+ }
+ return mass;
+ }
+
+ default long getCharge(){
+ long charge=0;
+ for (Map.Entry<iElementalDefinition, T> 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<T extends iElementalStack> extends iElementalMapR<T> {
+ iElementalMapRW<T> 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<? extends iElementalStack> container) {
+ boolean test=true;
+ for (Map.Entry<iElementalDefinition, ? extends iElementalStack> entry : container.entrySet()) {
+ test &= removeAmount(true, entry.getValue());
+ }
+ if (testOnly || !test) {
+ return test;
+ }
+ for (Map.Entry<iElementalDefinition, ? extends iElementalStack> 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<T> 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<T> 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/recipes/rElementalRecipe.java
index e191cc0e0a..8c0fb40a4b 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java
@@ -1,5 +1,6 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core;
+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;
@@ -7,17 +8,17 @@ import net.minecraftforge.fluids.FluidStack;
* Created by Tec on 02.03.2017.
*/
public class rElementalRecipe implements Comparable<rElementalRecipe> {
- public final short ID;
- public final cElementalDefinitionStackMap inEM;
- public final cElementalDefinitionStackMap outEM;
- public final ItemStack[] outItems;
+ 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(
- cElementalDefinitionStackMap inEM,//not null plz
+ cElementalConstantStackMap inEM,//not null plz
short id,
- cElementalDefinitionStackMap outEM,
+ cElementalConstantStackMap outEM,
ItemStack[] outItems,
FluidStack[] outFluids) {
this.inEM = inEM;
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/recipes/rElementalRecipeMap.java
index ed5e46f43f..56a9030354 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java
@@ -1,4 +1,7 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core;
+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;
@@ -8,7 +11,7 @@ import java.util.Map;
*/
public class rElementalRecipeMap {//TODO FIX
//Multimap for multiple recipes from the same thing - you know parameters might differ the output
- private final HashMap<cElementalDefinitionStackMap, HashMap<Short, rElementalRecipe>> recipes;
+ private final HashMap<cElementalConstantStackMap, HashMap<Short, rElementalRecipe>> recipes;
public rElementalRecipeMap() {
recipes = new HashMap<>();
@@ -26,11 +29,11 @@ public class rElementalRecipeMap {//TODO FIX
}
}
- public rElementalRecipe remove(cElementalStackMap map, short id) {
+ public rElementalRecipe remove(iElementalMapR<cElementalDefinitionStack> map, short id) {
return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that
}
- public HashMap<Short, rElementalRecipe> remove(cElementalStackMap map) {
+ public HashMap<Short, rElementalRecipe> remove(iElementalMapR<cElementalDefinitionStack> map) {
return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that
}
@@ -41,15 +44,15 @@ public class rElementalRecipeMap {//TODO FIX
//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<Short, rElementalRecipe> findExact(cElementalStackMap in) {
+ public HashMap<Short, rElementalRecipe> findExact(iElementalMapR<cElementalDefinitionStack> 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<Short, rElementalRecipe> findMatch(cElementalMutableDefinitionStackMap in, boolean testOnlyTruePreferred) {
- for (Map.Entry<cElementalDefinitionStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) {
+ public HashMap<Short, rElementalRecipe> findMatch(cElementalDefinitionStackMap in, boolean testOnlyTruePreferred) {
+ for (Map.Entry<cElementalConstantStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) {
if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) {
return cElementalDefinitionStackMapHashMapEntry.getValue();
}
@@ -58,7 +61,7 @@ public class rElementalRecipeMap {//TODO FIX
}
public HashMap<Short, rElementalRecipe> findMatch(cElementalInstanceStackMap in, boolean testOnly) {
- for (Map.Entry<cElementalDefinitionStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) {
+ for (Map.Entry<cElementalConstantStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) {
if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) {
return cElementalDefinitionStackMapHashMapEntry.getValue();
}
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;
@@ -25,6 +24,14 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition
}
@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
@@ -82,6 +82,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
}
@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<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){
+ private void scanContents(ArrayList<String> lines, cElementalConstantStackMap definitions, int depth, int[] detailsOnDepthLevels){
if(definitions!=null && depth<detailsOnDepthLevels.length){
int deeper=depth+1;
- for(cElementalDefinitionStack definitionStack:definitions.values()) {
+ for(cElementalDefinitionStack definitionStack:definitions.valuesToArray()) {
lines.add("");//def separator
if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,detailsOnDepthLevels[depth])) {
lines.add("DEPTH = " + depth);
@@ -532,7 +538,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
}
@Override
- public int compareTo(iHasElementalDefinition o) {//use for unification
+ public int compareTo(iElementalStack o) {//use for unification
return definition.compareTo(o.getDefinition());
}
@@ -541,8 +547,8 @@ public final class cElementalInstanceStack 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/iHasElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java
index 1d8af7bab7..65f2ed3b78 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/iElementalStack.java
@@ -1,11 +1,12 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import net.minecraft.nbt.NBTTagCompound;
/**
* Created by danie_000 on 30.01.2017.
*/
-public interface iHasElementalDefinition extends Comparable<iHasElementalDefinition>,Cloneable {
+public interface iElementalStack extends Comparable<iElementalStack>,Cloneable {
iElementalDefinition getDefinition();
double getAmount();
@@ -14,5 +15,9 @@ public interface iHasElementalDefinition extends Comparable<iHasElementalDefinit
double getMass();
- iHasElementalDefinition clone();
+ iElementalStack clone();
+
+ iElementalStack mutateAmount(double amount);
+
+ NBTTagCompound toNBT();
}
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 51025148a7..43e42df988 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
@@ -1,7 +1,7 @@
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.iHasElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
import net.minecraft.nbt.NBTTagCompound;
import java.lang.reflect.Method;
@@ -62,7 +62,7 @@ public abstract class cElementalDefinition extends iElementalDefinition {
//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().values(), o.getSubParticles().values());
+ return compareInnerContentsWithAmounts(getSubParticles().valuesToArray(), o.getSubParticles().valuesToArray());
}
//use only for nested operations!
@@ -112,8 +112,8 @@ public abstract class cElementalDefinition extends iElementalDefinition {
if (obj instanceof iElementalDefinition) {
return compareTo((iElementalDefinition) obj) == 0;
}
- if (obj instanceof iHasElementalDefinition) {
- return compareTo(((iHasElementalDefinition) obj).getDefinition()) == 0;
+ if (obj instanceof iElementalStack) {
+ return compareTo(((iElementalStack) obj).getDefinition()) == 0;
}
return false;
}
@@ -121,7 +121,7 @@ public abstract class cElementalDefinition extends iElementalDefinition {
@Override
public int hashCode() {//Internal amounts should be also hashed
int hash = -(getSubParticles().size() << 4);
- for (cElementalDefinitionStack stack : getSubParticles().values()) {
+ for (cElementalDefinitionStack stack : getSubParticles().valuesToArray()) {
int amount=(int)stack.amount;
hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.definition.hashCode();
}
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 6ee8591c58..70af6445c9 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
@@ -1,8 +1,8 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.templates;
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.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;
@@ -169,7 +169,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
}
@Override
- public final cElementalDefinitionStackMap getSubParticles() {
+ public final cElementalConstantStackMap getSubParticles() {
return null;
}
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 90ac2eb339..8065e9c170 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
@@ -1,7 +1,7 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.templates;
-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.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;
@@ -64,7 +64,7 @@ public abstract class iElementalDefinition implements Comparable<iElementalDefin
public abstract boolean isTimeSpanHalfLife();
- public abstract cElementalDefinitionStackMap getSubParticles();//contents... null if none
+ public abstract cElementalConstantStackMap getSubParticles();//contents... null if none
public abstract aFluidDequantizationInfo someAmountIntoFluidStack();
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 3d8b7a881f..0d91b57ed5 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
@@ -1,28 +1,28 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition;
+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<iHasElementalDefinition,FluidStack> {
- private final iHasElementalDefinition in;
- private final FluidStack out;
+public class aFluidDequantizationInfo implements iExchangeInfo<iElementalStack,FluidStack> {
+ private final iElementalStack in;
+ private final FluidStack out;
- public aFluidDequantizationInfo(iHasElementalDefinition emIn, FluidStack fluidStackOut){
+ public aFluidDequantizationInfo(iElementalStack emIn, FluidStack fluidStackOut){
in=emIn;
out=fluidStackOut;
}
- public aFluidDequantizationInfo(iHasElementalDefinition emIn, Fluid fluid, int fluidAmount){
+ public aFluidDequantizationInfo(iElementalStack emIn, Fluid fluid, int fluidAmount){
in=emIn;
out=new FluidStack(fluid,fluidAmount);
}
@Override
- public iHasElementalDefinition input() {
+ public iElementalStack input() {
return in.clone();//MEH!
}
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 563b87f8ee..39e4ec4671 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
@@ -1,22 +1,22 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition;
+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<FluidStack,iHasElementalDefinition> {
- private final FluidStack in;
- private final iHasElementalDefinition out;
+public class aFluidQuantizationInfo implements iExchangeInfo<FluidStack, iElementalStack> {
+ private final FluidStack in;
+ private final iElementalStack out;
- public aFluidQuantizationInfo(FluidStack fluidStackIn, iHasElementalDefinition emOut){
+ public aFluidQuantizationInfo(FluidStack fluidStackIn, iElementalStack emOut){
in=fluidStackIn;
out=emOut;
}
- public aFluidQuantizationInfo(Fluid fluid, int fluidAmount, iHasElementalDefinition emOut){
+ public aFluidQuantizationInfo(Fluid fluid, int fluidAmount, iElementalStack emOut){
in=new FluidStack(fluid,fluidAmount);
out=emOut;
}
@@ -27,7 +27,7 @@ public class aFluidQuantizationInfo implements iExchangeInfo<FluidStack,iHasElem
}
@Override
- public iHasElementalDefinition output() {
+ public iElementalStack output() {
return out.clone();
}
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 8b42c61d6c..fb71275276 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
@@ -1,6 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition;
+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;
@@ -9,22 +9,22 @@ import net.minecraft.item.ItemStack;
/**
* Created by Tec on 23.05.2017.
*/
-public class aItemDequantizationInfo implements iExchangeInfo<iHasElementalDefinition,ItemStack> {
- private final iHasElementalDefinition in;
- private final ItemStack out;
+public class aItemDequantizationInfo implements iExchangeInfo<iElementalStack,ItemStack> {
+ private final iElementalStack in;
+ private final ItemStack out;
- public aItemDequantizationInfo(iHasElementalDefinition emIn, ItemStack itemStackOut){
+ public aItemDequantizationInfo(iElementalStack emIn, ItemStack itemStackOut){
in=emIn;
out=itemStackOut;
}
- public aItemDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, Materials material, int amount) {
+ public aItemDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int amount) {
in = emIn;
out = GT_OreDictUnificator.get(prefix, material, amount);
}
@Override
- public iHasElementalDefinition input() {
+ public iElementalStack input() {
return in.clone();
}
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 8f33f5096d..da9950a186 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
@@ -1,6 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition;
+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;
@@ -11,18 +11,18 @@ import net.minecraftforge.oredict.OreDictionary;
/**
* Created by Tec on 23.05.2017.
*/
-public class aItemQuantizationInfo implements iExchangeInfo<ItemStack,iHasElementalDefinition> {
- private final ItemStack in;
- private final boolean skipNBT;
- private final iHasElementalDefinition out;
+public class aItemQuantizationInfo implements iExchangeInfo<ItemStack, iElementalStack> {
+ private final ItemStack in;
+ private final boolean skipNBT;
+ private final iElementalStack out;
- public aItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, iHasElementalDefinition emOut) {
+ 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, iHasElementalDefinition emOut) {
+ public aItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, iElementalStack emOut) {
in = GT_OreDictUnificator.get(prefix, material, amount);
out = emOut;
this.skipNBT = skipNBT;
@@ -34,7 +34,7 @@ public class aItemQuantizationInfo implements iExchangeInfo<ItemStack,iHasElemen
}
@Override
- public iHasElementalDefinition output() {
+ public iElementalStack output() {
return out.clone();
}
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 bbf94682b4..20f2252bd8 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
@@ -1,37 +1,37 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition;
+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<iHasElementalDefinition,String> {
- private final iHasElementalDefinition in;
- public final String out;
- public final int amount;
+public class aOredictDequantizationInfo implements iExchangeInfo<iElementalStack,String> {
+ private final iElementalStack in;
+ public final String out;
+ public final int amount;
- public aOredictDequantizationInfo(iHasElementalDefinition emIn, String name, int qty) {
+ public aOredictDequantizationInfo(iElementalStack emIn, String name, int qty) {
in = emIn;
out =name;
amount = qty;
}
- public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, Materials material, int qty) {
+ public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int qty) {
in = emIn;
out = prefix.name() + material.mName;
amount = qty;
}
- public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, String materialName, int qty) {
+ public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, String materialName, int qty) {
in = emIn;
out = prefix.name() + materialName;
amount = qty;
}
@Override
- public iHasElementalDefinition input() {
+ public iElementalStack input() {
return in.clone();//MEH!
}
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 964d317b80..252b524185 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
@@ -1,30 +1,30 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition;
+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<String,iHasElementalDefinition> {
- public final String in;
- public final int amount;
- private final iHasElementalDefinition out;
+public class aOredictQuantizationInfo implements iExchangeInfo<String, iElementalStack> {
+ public final String in;
+ public final int amount;
+ private final iElementalStack out;
- public aOredictQuantizationInfo(String name, int qty, iHasElementalDefinition emOut){
+ public aOredictQuantizationInfo(String name, int qty, iElementalStack emOut){
in=name;
amount=qty;
out=emOut;
}
- public aOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, iHasElementalDefinition 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, iHasElementalDefinition emOut){
+ public aOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, iElementalStack emOut){
in=prefix.name() + materialName;
amount=qty;
out=emOut;
@@ -36,7 +36,7 @@ public class aOredictQuantizationInfo implements iExchangeInfo<String,iHasElemen
}
@Override
- public iHasElementalDefinition output() {
+ public iElementalStack output() {
return out.clone();
}
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 69a4b9683c..39f946c54a 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
@@ -1,6 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-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.templates.iElementalDefinition;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
@@ -69,14 +69,14 @@ public class bTransformationInfo {
this.oredictDequantization = oredictDequantization;
}
- public void addFluid(iHasElementalDefinition em, FluidStack fluidStack){
+ 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(iHasElementalDefinition em, Fluid fluid, int fluidAmount){
+ 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());
@@ -87,35 +87,35 @@ public class bTransformationInfo {
itemQuantization.put(aIQI,aIQI);
}
- public void addItem(iHasElementalDefinition em, ItemStack itemStack, boolean skipNBT){
+ 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(iHasElementalDefinition em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){
+ 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(iHasElementalDefinition em, String name, int qty){
+ 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(iHasElementalDefinition em, OrePrefixes prefix, Materials material, int qty){
+ 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(iHasElementalDefinition em, OrePrefixes prefix, String materialName, int qty){
+ 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());
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 e97d5994e9..291ec8fe6b 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
@@ -3,9 +3,9 @@ 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.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;
@@ -83,33 +83,23 @@ public final class dAtomDefinition extends cElementalDefinition {
private final boolean iaeaDefinitionExistsAndHasEnergyLevels;
- private final cElementalDefinitionStackMap elementalStacks;
+ private final cElementalConstantStackMap elementalStacks;
//stable is rawLifeTime>=10^9
- @Deprecated
- public dAtomDefinition(iElementalDefinition... things) throws tElementalException {
- this(true, new cElementalDefinitionStackMap(things));
- }
-
- @Deprecated
- private dAtomDefinition(boolean check, iElementalDefinition... things) throws tElementalException {
- this(check, new cElementalDefinitionStackMap(things));
- }
-
public dAtomDefinition(cElementalDefinitionStack... things) throws tElementalException {
- this(true, new cElementalDefinitionStackMap(things));
+ this(true, new cElementalConstantStackMap(things));
}
private dAtomDefinition(boolean check, cElementalDefinitionStack... things) throws tElementalException {
- this(check, new cElementalDefinitionStackMap(things));
+ this(check, new cElementalConstantStackMap(things));
}
- public dAtomDefinition(cElementalDefinitionStackMap things) throws tElementalException {
+ public dAtomDefinition(cElementalConstantStackMap things) throws tElementalException {
this(true, things);
}
- private dAtomDefinition(boolean check, cElementalDefinitionStackMap things) throws tElementalException {
+ private dAtomDefinition(boolean check, cElementalConstantStackMap things) throws tElementalException {
if (check && !canTheyBeTogether(things)) {
throw new tElementalException("Atom Definition error");
}
@@ -121,7 +111,7 @@ public final class dAtomDefinition extends cElementalDefinition {
int neutralCount = 0, element = 0;
int type = 0;
boolean containsAnti = false;
- for (cElementalDefinitionStack stack : elementalStacks.values()) {
+ for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) {
iElementalDefinition def = stack.definition;
int amount = (int)stack.amount;
if((int)stack.amount!=stack.amount){
@@ -274,10 +264,10 @@ public final class dAtomDefinition extends cElementalDefinition {
return rawLifeTime;
}
- private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) {
+ private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) {
boolean nuclei = false;
long qty=0;
- for (cElementalDefinitionStack stack : stacks.values()) {
+ for (cElementalDefinitionStack stack : stacks.valuesToArray()) {
if (stack.definition instanceof dHadronDefinition) {
if (((dHadronDefinition) stack.definition).amount != 3) {
return false;
@@ -407,7 +397,7 @@ public final class dAtomDefinition extends cElementalDefinition {
}
@Override
- public cElementalDefinitionStackMap getSubParticles() {
+ public cElementalConstantStackMap getSubParticles() {
return elementalStacks.clone();
}
@@ -484,33 +474,33 @@ public final class dAtomDefinition extends cElementalDefinition {
}
private boolean getDecayFromIaea(ArrayList<cElementalDecay> 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<cElementalDecay> 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<cElementalDecay> 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<cElementalDecay> 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<cElementalDecay> 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<cElementalDecay> 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<cElementalDecay> decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,double probability,boolean spontaneousCheck) {
- cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap();
- double[] liquidDrop= liquidDropFunction(Math.abs(element)<=97);
+ private boolean Fission(ArrayList<cElementalDecay> 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)<stack.amount-80)) {
return false;
@@ -1138,9 +1128,9 @@ public final class dAtomDefinition extends cElementalDefinition {
}
try {
- particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(fissile.toImmutable_optimized_unsafeLeavesExposedElementalTree()),1));
- particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_optimized_unsafeLeavesExposedElementalTree()),1));
- decaysList.add(new cElementalDecay(probability, particles.toImmutable_optimized_unsafeLeavesExposedElementalTree()));
+ 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) {
@@ -1273,7 +1263,7 @@ public final class dAtomDefinition extends cElementalDefinition {
public cElementalDecay[] getNaturalDecayInstant() {
//disembody
ArrayList<cElementalDefinitionStack> 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<GT_MetaTileEntity_EM_collider> STRUCTURE_DEFINITION = StructureDefinition
+ .<GT_MetaTileEntity_EM_collider>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<GT_MetaTileEntity_EM_collider> STRUCTURE_DEFINITION =
- StructureDefinition.<GT_MetaTileEntity_EM_collider>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<GT_MetaTileEntity_EM_collider> getStructure_EM() {
+ public IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> 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<GT_MetaTileEntity_EM_decay>[] 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<GT_MetaTileEntity_EM_decay> STRUCTURE_DEFINITION =
- StructureDefinition.<GT_MetaTileEntity_EM_decay>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<GT_MetaTileEntity_EM_decay> 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<GT_MetaTileEntity_EM_dequantizer> STRUCTURE_DEFINITION =
- StructureDefinition.<GT_MetaTileEntity_EM_dequantizer>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<GT_MetaTileEntity_EM_dequantizer>[] 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<GT_MetaTileEntity_EM_dequantizer> 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<GT_MetaTileEntity_EM_scanner>[] 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<GT_MetaTileEntity_EM_scanner> STRUCTURE_DEFINITION =
- StructureDefinition.<GT_MetaTileEntity_EM_scanner>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<GT_MetaTileEntity_EM_scanner> 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();
}
@@ -195,6 +190,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
@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<T>[] addingMethods,
+ IHatchAdder<T>[] 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 && 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<GT_MetaTileEntity_EM_machine>[] 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<GT_MetaTileEntity_EM_machine> STRUCTURE_DEFINITION =
- StructureDefinition.<GT_MetaTileEntity_EM_machine>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<GT_MetaTileEntity_EM_machine> getStructure_EM() {
- return STRUCTURE_DEFINITION;
+ Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly);
}
@Override