diff options
| author | Blood-Asp <bloodasphendrik@gmail.com> | 2017-02-28 01:55:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-28 01:55:31 +0100 |
| commit | 476146cd394a583e8d6872482b93bb9ad83612b0 (patch) | |
| tree | ccde7e77754c534a54fcbdcba81d1fb4e158fbde /src/main/java/gregtech/api/objects/GT_UO_Fluid.java | |
| parent | 64ddbfef6e92274c65b50bd15019240f110caad8 (diff) | |
| parent | 8e2280bc2c700a04ae5b829fe79eba4ba95a22d3 (diff) | |
| download | GT5-Unofficial-476146cd394a583e8d6872482b93bb9ad83612b0.tar.gz GT5-Unofficial-476146cd394a583e8d6872482b93bb9ad83612b0.tar.bz2 GT5-Unofficial-476146cd394a583e8d6872482b93bb9ad83612b0.zip | |
Merge pull request #890 from maixgame/unstable
Fix bug > Oil Teleportation to GC Planets #837
Diffstat (limited to 'src/main/java/gregtech/api/objects/GT_UO_Fluid.java')
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_UO_Fluid.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java new file mode 100644 index 0000000000..c2d9b70bd2 --- /dev/null +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -0,0 +1,63 @@ +package gregtech.api.objects; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Random; + +import gregtech.api.enums.GT_Values; +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +public class GT_UO_Fluid { + public String Registry = "null"; + public int MaxAmount = 0; + public int MinAmount = 0; + public int Chance = 0; + public int DecreasePerOperationAmount = 5; + + public GT_UO_Fluid(ConfigCategory aConfigCategory) { + if (aConfigCategory.containsKey("Registry")) + { + aConfigCategory.get("Registry").comment = "Fluid registry"; + Registry = aConfigCategory.get("Registry").getString(); + } + if (aConfigCategory.containsKey("MaxAmount")) + { + aConfigCategory.get("MaxAmount").comment = "Max amount generation (per operation Amount)"; + MaxAmount = aConfigCategory.get("MaxAmount").getInt(0); + } + if (aConfigCategory.containsKey("MinAmount")) + { + aConfigCategory.get("MinAmount").comment = "Max amount generation (per operation Amount)"; + MinAmount = aConfigCategory.get("MinAmount").getInt(0); + } + if (aConfigCategory.containsKey("Chance")) + { + aConfigCategory.get("Chance").comment = "Chance generating"; + Chance = aConfigCategory.get("Chance").getInt(0); + } + if (aConfigCategory.containsKey("DecreasePerOperationAmount")) + { + aConfigCategory.get("DecreasePerOperationAmount").comment = "Decrease per operation Amount (X/5000L per operation)"; + DecreasePerOperationAmount = aConfigCategory.get("DecreasePerOperationAmount").getInt(5); + } + //System.out.println("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" Min:"+MinAmount+" Chance:"+Chance); + } + + public Fluid getFluid(){ + try { + return FluidRegistry.getFluid(this.Registry); + } catch (Exception e) { + return null; + } + } + + public int getRandomAmount(Random aRandom){ + int r1 = (int)Math.round(Math.pow((MaxAmount-MinAmount)*500000.d, 0.2)); + int r2 = (int)Math.floor(Math.pow(MinAmount*500000.d, 0.2)); + double amount = aRandom.nextInt(r1)+r2+aRandom.nextDouble(); + return (int) (Math.pow(amount, 5) / 100); + } + +}
\ No newline at end of file |
