diff options
author | Tec <daniel112092@gmail.com> | 2020-07-18 13:21:46 +0200 |
---|---|---|
committer | Tec <daniel112092@gmail.com> | 2020-07-18 13:21:46 +0200 |
commit | ea07f135b704822d7ad26f20bdb2928d6cbb69e9 (patch) | |
tree | df1bfda8cc26e2167a7cb37f6f46178f8754abca | |
parent | a45c43ea42bdd0911c2c05667695441f9e0e68a5 (diff) | |
download | GT5-Unofficial-ea07f135b704822d7ad26f20bdb2928d6cbb69e9.tar.gz GT5-Unofficial-ea07f135b704822d7ad26f20bdb2928d6cbb69e9.tar.bz2 GT5-Unofficial-ea07f135b704822d7ad26f20bdb2928d6cbb69e9.zip |
On demand static import
7 files changed, 37 insertions, 35 deletions
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java index 3472f15cec..e00bf2d264 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java @@ -3,7 +3,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; + +import static com.github.technus.tectech.util.DoubleCount.add; /** * Created by danie_000 on 22.10.2016. @@ -57,7 +58,7 @@ public final class cElementalDecay { //Deny decay code is in instance! double qtty = 0D; for (cElementalDefinitionStack stack : outputStacks.values()) { - qtty= DoubleCount.add(qtty,stack.amount); + qtty= add(qtty,stack.amount); } if (qtty <= 0D) { return decayResult; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index dccc0f87ae..a712dc2c39 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -4,13 +4,14 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElement import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import java.util.*; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; +import static com.github.technus.tectech.util.DoubleCount.sub; /** * Created by danie_000 on 22.01.2017. @@ -132,7 +133,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn if (testOnly) { return target.amount >= instance.amount; } else { - double diff = DoubleCount.sub(target.amount,instance.amount); + double diff = sub(target.amount,instance.amount); if (diff > 0) { target.amount = diff; return true; @@ -152,7 +153,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn if (testOnly) { return target.amount >= stack.getAmount(); } else { - double diff = DoubleCount.sub(target.amount,stack.getAmount()); + double diff = sub(target.amount,stack.getAmount()); if (diff > 0) { target.amount = diff; return true; @@ -381,11 +382,10 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return charge; } - @Deprecated public double getCountOfAllAmounts(){ double sum=0; for(cElementalInstanceStack stack:map.values()){ - sum+=stack.amount; + sum= add(sum,stack.amount); } return sum; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java index 5b925aeea6..020f5a5f8c 100644 --- 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 @@ -4,13 +4,13 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElement import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import net.minecraft.nbt.NBTTagCompound; import 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. @@ -101,7 +101,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) { return target.amount >= instance.amount; } else { - double diff = DoubleCount.sub(target.amount,instance.amount); + double diff = sub(target.amount,instance.amount); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -121,7 +121,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) { return target.amount >= stack.getAmount(); } else { - double diff = DoubleCount.sub(target.amount,stack.getAmount()); + double diff = sub(target.amount,stack.getAmount()); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java index 3e5a7f7b33..f8e7aa39e4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java @@ -9,6 +9,8 @@ import java.util.Collection; import java.util.Set; import java.util.TreeMap; +import static com.github.technus.tectech.util.DoubleCount.add; + /** * Created by Tec on 12.05.2017. */ @@ -65,11 +67,10 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { return var.toArray(new iElementalDefinition[0]); } - @Deprecated - public long getCountOfAllAmounts(){ - long sum=0; + public double getCountOfAllAmounts(){ + double sum=0; for(cElementalDefinitionStack stack:map.values()){ - sum+=stack.amount; + sum= add(sum,stack.amount); } return sum; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java index 2371b1b986..a2d22c30ed 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java @@ -2,10 +2,10 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.util.DoubleCount.add; /** * Created by danie_000 on 20.11.2016. @@ -61,7 +61,7 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition if(amount==0) { return this; } - return new cElementalDefinitionStack(definition, DoubleCount.add(amount,this.amount)); + return new cElementalDefinitionStack(definition, add(amount,this.amount)); } public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) { @@ -70,7 +70,7 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition } double l = 0; for (cElementalDefinitionStack stack : other) { - l=DoubleCount.add(l,stack.amount); + l= add(l,stack.amount); } return addAmountIntoNewInstance(l); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index fb4f0fed33..2a441150f7 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -6,7 +6,6 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefin import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.util.DoubleCount; import com.github.technus.tectech.util.Util; import net.minecraft.nbt.NBTTagCompound; @@ -15,6 +14,7 @@ import java.util.ArrayList; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.DoubleCount.*; import static java.lang.Math.ulp; /** @@ -190,8 +190,8 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { if(definition.usesMultipleDecayCalls(energy)){ double amountTemp=amount; long decayCnt=(long) Math.min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); - double amountPer= DoubleCount.div(amount,decayCnt); - amount=DoubleCount.sub(amount,amountPer*(--decayCnt)); + double amountPer= div(amount,decayCnt); + amount= sub(amount,amountPer*(--decayCnt)); cElementalInstanceStackMap output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(output==null){ amount=amountTemp; @@ -234,7 +234,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { //Use to get direct decay output providing correct decay array private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { double decayInverseRatio=Math.pow(2D,1D/* 1 second *//lifeTime); - double newAmount=DoubleCount.div(amount,decayInverseRatio+ulp(decayInverseRatio)); + double newAmount= div(amount,decayInverseRatio+ulp(decayInverseRatio)); //if(definition.getSymbol().startsWith("U ")) { // System.out.println("newAmount = " + newAmount); // System.out.println("amountRemaining = " + amountRemaining); @@ -253,7 +253,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { //split to non decaying and decaying part double amount=this.amount; - this.amount=DoubleCount.sub(this.amount,newAmount); + this.amount= sub(this.amount,newAmount); cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); this.amount=newAmount; products.putUnify(clone()); @@ -305,7 +305,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { for (int i = 0; i < probabilities.length; i++) { probabilities[i]=decays[i].probability; } - double[] qttyOfDecay = DoubleCount.distribute(this.amount, probabilities); + double[] qttyOfDecay = distribute(this.amount, probabilities); //long amountRemaining = this.amount, amount = this.amount; //float remainingProbability = 1D; // @@ -406,7 +406,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { for (cElementalInstanceStack instance : instances) { if (instance != null && compareTo(instance) == 0) { - amount=DoubleCount.add(amount,instance.amount); + amount= add(amount,instance.amount); energyTotal += instance.energy * instance.amount; if(instance.energy>maxEnergy){ maxEnergy=instance.energy; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index c44e5a3d42..4b0842be7b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -8,13 +8,13 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.util.DoubleCount; import java.util.Arrays; -import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.DoubleCount.*; /** * Created by danie_000 on 24.12.2017. @@ -83,7 +83,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - double amountPerFraction = DoubleCount.div(me.amount,fractionCount); + double amountPerFraction = div(me.amount,fractionCount); cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; for (int i = 0; i < fractionCount; i++) { stacks[i] = me.clone(); @@ -125,7 +125,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav while (inputMass > maxCapacity) { cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); - randomStack.amount=DoubleCount.sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap + randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); stacks = input.values(); @@ -176,16 +176,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav double tempMass=Math.abs(stack.getMass()); if(tempMass!=0) { double amount = stack.amount; - stack.amount =DoubleCount.mul(stack.amount,mixingFactor); + stack.amount = mul(stack.amount,mixingFactor); addRandomly(stack, outputs, fractionCount); - stack.amount = DoubleCount.sub(amount,stack.amount); + stack.amount = sub(amount,stack.amount); absMassPerOutput += tempMass; } } //if(DEBUG_MODE){ // TecTech.LOGGER.info("absMass "+absMassPerOutput); //} - absMassPerOutput =DoubleCount.div(absMassPerOutput,fractionCount); + absMassPerOutput = div(absMassPerOutput,fractionCount); if(DEBUG_MODE){ TecTech.LOGGER.info("absMassPerOutput "+absMassPerOutput); } @@ -196,7 +196,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (int stackNo = 0; stackNo < stacks.length; stackNo++) { if (stacks[stackNo] != null) { double stackMass = Math.abs(stacks[stackNo].getMass()); - double amount = DoubleCount.div(remaining,Math.abs(stacks[stackNo].definition.getMass())); + double amount = div(remaining,Math.abs(stacks[stackNo].definition.getMass())); //if(DEBUG_MODE){ // TecTech.LOGGER.info("stackMass "+stackMass); // TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass()); @@ -207,15 +207,15 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav addRandomly(stacks[stackNo], outputs, fractionCount); stacks[stackNo] = null; } else if (amount >= stacks[stackNo].amount) { - remaining=DoubleCount.sub(remaining,stackMass); + remaining= sub(remaining,stackMass); outputs[fraction].putUnify(stacks[stackNo]); stacks[stackNo] = null; } else if (amount > 0) { - remaining=DoubleCount.sub(remaining,DoubleCount.mul(amount,stacks[stackNo].definition.getMass())); + remaining= sub(remaining, mul(amount,stacks[stackNo].definition.getMass())); cElementalInstanceStack clone = stacks[stackNo].clone(); clone.amount = amount; outputs[fraction].putUnify(clone); - stacks[stackNo].amount=DoubleCount.sub(stacks[stackNo].amount,amount); + stacks[stackNo].amount= sub(stacks[stackNo].amount,amount); //if(DEBUG_MODE){ // TecTech.LOGGER.info("remainingAfter "+remaining); // TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount); |