From 901a7d66c1766b3f21de4f74e696a30e5d178018 Mon Sep 17 00:00:00 2001 From: Maxime Legkiy Date: Mon, 13 Feb 2017 04:24:48 +0300 Subject: Add new flexible configuration undeground oil --- .../java/gregtech/api/objects/GT_UO_Fluid.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/main/java/gregtech/api/objects/GT_UO_Fluid.java (limited to 'src/main/java/gregtech/api/objects/GT_UO_Fluid.java') 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..e326fac46c --- /dev/null +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -0,0 +1,41 @@ +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; + public int MaxAmount; + public int MinAmount; + public int Chance; + + public GT_UO_Fluid(ConfigCategory aConfigCategory) { + Registry = aConfigCategory.get("Registry").getString();; + MaxAmount = aConfigCategory.get("MaxAmount").getInt(); + MinAmount = aConfigCategory.get("MinAmount").getInt(); + Chance = aConfigCategory.get("Chance").getInt(); + //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 -- cgit From 8e2280bc2c700a04ae5b829fe79eba4ba95a22d3 Mon Sep 17 00:00:00 2001 From: Maxime Legkiy Date: Fri, 17 Feb 2017 01:55:54 +0300 Subject: Fix name config category to UndergroundFluid Fix comments configuration Fix Start config - add nether and end to BlackList. Default spawn fluids on overworld and Moon. Add Decrease Per Operation Amount (if 0 an endless source) --- .../java/gregtech/api/objects/GT_UO_Fluid.java | 40 +++++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'src/main/java/gregtech/api/objects/GT_UO_Fluid.java') diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java index e326fac46c..c2d9b70bd2 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -10,16 +10,38 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; public class GT_UO_Fluid { - public String Registry; - public int MaxAmount; - public int MinAmount; - public int Chance; + 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) { - Registry = aConfigCategory.get("Registry").getString();; - MaxAmount = aConfigCategory.get("MaxAmount").getInt(); - MinAmount = aConfigCategory.get("MinAmount").getInt(); - Chance = aConfigCategory.get("Chance").getInt(); + 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); } -- cgit From c12e474c23ca02fb3479312850f6ae07e623d8b9 Mon Sep 17 00:00:00 2001 From: Technus Date: Mon, 1 May 2017 08:18:30 +0200 Subject: Oil and pollution overhaul --- src/main/java/gregtech/api/objects/GT_UO_Fluid.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/api/objects/GT_UO_Fluid.java') diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java index 84fefb5110..398717b5b6 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -14,7 +14,7 @@ public class GT_UO_Fluid { public int MaxAmount = 0; public int MinAmount = 0; public int Chance = 0; - public int DecreasePerOperationAmount = 5; + public int DecreasePerOperationAmountInBuckets = 5; public GT_UO_Fluid(ConfigCategory aConfigCategory) {//TODO CONFIGURE if (aConfigCategory.containsKey("Registry")) @@ -40,7 +40,7 @@ public class GT_UO_Fluid { if (aConfigCategory.containsKey("DecreasePerOperationAmount")) { aConfigCategory.get("DecreasePerOperationAmount").comment = "Decrease per operation Amount (X/5000L per operation)"; - DecreasePerOperationAmount = aConfigCategory.get("DecreasePerOperationAmount").getInt(5); + DecreasePerOperationAmountInBuckets = aConfigCategory.get("DecreasePerOperationAmount").getInt(5); } //System.out.println("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" Min:"+MinAmount+" Chance:"+Chance); } @@ -53,7 +53,7 @@ public class GT_UO_Fluid { } } - public int getRandomAmount(Random aRandom){ + public int getRandomAmount(Random aRandom){//generates milliBuckets 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(); -- cgit From f2b8bbdde8c7ebac99e5e6fdb3cc497d39dd575e Mon Sep 17 00:00:00 2001 From: Technus Date: Mon, 1 May 2017 10:24:30 +0200 Subject: Optimize imports --- src/main/java/gregtech/api/objects/GT_UO_Fluid.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/main/java/gregtech/api/objects/GT_UO_Fluid.java') diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java index 398717b5b6..81d1387e12 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -1,14 +1,11 @@ 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; +import java.util.Random; + public class GT_UO_Fluid { public String Registry = "null"; public int MaxAmount = 0; -- cgit From 8e0e51673f1148fdbbac13e03b4becaa1ac88ad5 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 7 May 2017 22:21:44 +0200 Subject: another oil rewrite, even more BloodAsp like --- .../java/gregtech/api/objects/GT_UO_Fluid.java | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/main/java/gregtech/api/objects/GT_UO_Fluid.java') diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java index 81d1387e12..5675f73b45 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -6,38 +6,40 @@ import net.minecraftforge.fluids.FluidRegistry; import java.util.Random; +import static gregtech.common.GT_UndergroundOil.DIVIDER; + public class GT_UO_Fluid { public String Registry = "null"; public int MaxAmount = 0; public int MinAmount = 0; public int Chance = 0; - public int DecreasePerOperationAmountInBuckets = 5; + public int DecreasePerOperationAmount = 5; public GT_UO_Fluid(ConfigCategory aConfigCategory) {//TODO CONFIGURE if (aConfigCategory.containsKey("Registry")) { - aConfigCategory.get("Registry").comment = "Fluid registry"; + aConfigCategory.get("Registry").comment = "Fluid registry name"; Registry = aConfigCategory.get("Registry").getString(); } if (aConfigCategory.containsKey("MaxAmount")) { - aConfigCategory.get("MaxAmount").comment = "Max amount generation (per operation Amount)"; + aConfigCategory.get("MaxAmount").comment = "Max amount generation (per operation, sets the VeinData) 80000 MAX"; MaxAmount = aConfigCategory.get("MaxAmount").getInt(0); } if (aConfigCategory.containsKey("MinAmount")) { - aConfigCategory.get("MinAmount").comment = "Max amount generation (per operation Amount)"; + aConfigCategory.get("MinAmount").comment = "Min amount generation (per operation, sets the VeinData) 0 MIN"; MinAmount = aConfigCategory.get("MinAmount").getInt(0); } if (aConfigCategory.containsKey("Chance")) { - aConfigCategory.get("Chance").comment = "Chance generating"; + aConfigCategory.get("Chance").comment = "Chance generating (weighted chance!, there will be a fluid in chunk always!)"; Chance = aConfigCategory.get("Chance").getInt(0); } if (aConfigCategory.containsKey("DecreasePerOperationAmount")) { - aConfigCategory.get("DecreasePerOperationAmount").comment = "Decrease per operation Amount (X/5000L per operation)"; - DecreasePerOperationAmountInBuckets = aConfigCategory.get("DecreasePerOperationAmount").getInt(5); + aConfigCategory.get("DecreasePerOperationAmount").comment = "Decrease per operation (actual fluid gained works like (Litre)VeinData/5000)"; + DecreasePerOperationAmount = aConfigCategory.get("DecreasePerOperationAmount").getInt(5); } //System.out.println("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" Min:"+MinAmount+" Chance:"+Chance); } @@ -50,11 +52,10 @@ public class GT_UO_Fluid { } } - public int getRandomAmount(Random aRandom){//generates milliBuckets - 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); + public int getRandomAmount(Random aRandom){//generates some random ass number that correlates to extraction speeds + int div = (int)Math.floor(Math.pow((MaxAmount-MinAmount)*100.d*DIVIDER, 0.2d)); + int min = (int)Math.floor(Math.pow(MinAmount*100.d*DIVIDER, 0.2d)); + double amount = min+aRandom.nextInt(div)+aRandom.nextDouble(); + return (int) (Math.pow(amount, 5) / 100);//reverses the computation above } - } \ No newline at end of file -- cgit