From f63b5f231c82fd28db00b6b9a6c1cf809f60ed09 Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Sun, 8 Oct 2023 05:41:13 +0330 Subject: [PATCH 01/12] + new Meteor WorldGen --- src/main/java/org/altadoon/gt6x/Gt6xMod.java | 7 +- .../java/org/altadoon/gt6x/ProxyClient.java | 9 +- .../java/org/altadoon/gt6x/ProxyServer.java | 20 +++- .../altadoon/gt6x/features/GT6XFeature.java | 2 +- .../gt6x/features/meotorite/Meteor.java | 46 ++++++++ .../features/meotorite/WorldgenMeteor.java | 103 ++++++++++++++++++ 6 files changed, 169 insertions(+), 18 deletions(-) create mode 100644 src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java create mode 100644 src/main/java/org/altadoon/gt6x/features/meotorite/WorldgenMeteor.java diff --git a/src/main/java/org/altadoon/gt6x/Gt6xMod.java b/src/main/java/org/altadoon/gt6x/Gt6xMod.java index 040ad4df..e5295df7 100644 --- a/src/main/java/org/altadoon/gt6x/Gt6xMod.java +++ b/src/main/java/org/altadoon/gt6x/Gt6xMod.java @@ -1,12 +1,13 @@ package org.altadoon.gt6x; +import cpw.mods.fml.common.event.FMLInitializationEvent; import gregapi.data.CS; import org.altadoon.gt6x.common.*; -import org.altadoon.gt6x.common.items.ItemMaterialDisplay; import org.altadoon.gt6x.common.items.MultiItemsX; import org.altadoon.gt6x.features.GT6XFeature; import org.altadoon.gt6x.features.basicchem.BasicChemistry; import org.altadoon.gt6x.features.ceramics.Ceramics; +import org.altadoon.gt6x.features.meotorite.Meteor; import org.altadoon.gt6x.features.oil.OilProcessing; import org.altadoon.gt6x.features.pgm.PgmProcessing; import org.altadoon.gt6x.features.metallurgy.Metallurgy; @@ -57,7 +58,7 @@ public final class Gt6xMod extends gregapi.api.Abstract_Mod { OilProcessing.class, PgmProcessing.class, RefractoryMetals.class, - VerticalMixers.class + VerticalMixers.class, Meteor.class }; private final ArrayList enabledFeatures; @@ -87,7 +88,7 @@ public void onModPreInit2(cpw.mods.fml.common.event.FMLPreInitializationEvent aE } @Override - public void onModInit2(cpw.mods.fml.common.event.FMLInitializationEvent aEvent) { + public void onModInit2(FMLInitializationEvent aEvent) { for (GT6XFeature feature : enabledFeatures) { feature.init(); } diff --git a/src/main/java/org/altadoon/gt6x/ProxyClient.java b/src/main/java/org/altadoon/gt6x/ProxyClient.java index dcf6768b..8f781068 100644 --- a/src/main/java/org/altadoon/gt6x/ProxyClient.java +++ b/src/main/java/org/altadoon/gt6x/ProxyClient.java @@ -1,13 +1,6 @@ package org.altadoon.gt6x; -import gregapi.api.Abstract_Proxy; - -/** - * @author Max Mustermann - * - * An example implementation for a Clientside Proxy using my System. - */ -public final class ProxyClient extends Abstract_Proxy { +public class ProxyClient extends ProxyServer { // Insert your Clientside-only implementation of Stuff here } \ No newline at end of file diff --git a/src/main/java/org/altadoon/gt6x/ProxyServer.java b/src/main/java/org/altadoon/gt6x/ProxyServer.java index 7cf5ba30..fb2d36d1 100644 --- a/src/main/java/org/altadoon/gt6x/ProxyServer.java +++ b/src/main/java/org/altadoon/gt6x/ProxyServer.java @@ -1,13 +1,21 @@ package org.altadoon.gt6x; +import cpw.mods.fml.common.IWorldGenerator; import gregapi.api.Abstract_Proxy; +import gregapi.data.CS; +import gregapi.worldgen.WorldgenObject; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; +import java.util.Random; -/** - * @author Max Mustermann - * - * An example implementation for a Serverside Proxy using my System. - */ -public final class ProxyServer extends Abstract_Proxy { + +public class ProxyServer extends Abstract_Proxy implements IWorldGenerator { + @Override + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { +// if(world.provider.dimensionId == CS.DIM_OVERWORLD){ +// new WorldgenObject().generate(world,world.getChunkFromChunkCoords(chunkX,chunkZ),) +// } + } // Insert your Serverside-only implementation of Stuff here } \ No newline at end of file diff --git a/src/main/java/org/altadoon/gt6x/features/GT6XFeature.java b/src/main/java/org/altadoon/gt6x/features/GT6XFeature.java index 425476be..2cc392db 100644 --- a/src/main/java/org/altadoon/gt6x/features/GT6XFeature.java +++ b/src/main/java/org/altadoon/gt6x/features/GT6XFeature.java @@ -3,7 +3,7 @@ import org.altadoon.gt6x.common.Config; public abstract class GT6XFeature { - public abstract String name(); + public String name() {return this.getClass().getName();} public abstract void configure(Config config); public void beforePreInit() {} public abstract void preInit(); diff --git a/src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java b/src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java new file mode 100644 index 00000000..e24481eb --- /dev/null +++ b/src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java @@ -0,0 +1,46 @@ +package org.altadoon.gt6x.features.meotorite; + +import gregapi.data.MD; +import micdoodle8.mods.galacticraft.core.blocks.GCBlocks; +import net.minecraft.init.Blocks; +import org.altadoon.gt6x.common.Config; +import org.altadoon.gt6x.features.GT6XFeature; + +import static gregapi.data.CS.*; + +public class Meteor extends GT6XFeature { + + @Override + public void configure(Config config) { + + } + + @Override + public void preInit() { + + } + + @Override + public void init() { + new WorldgenMeteor("meotorite.1" , T, GEN_OVERWORLD, GEN_GT, GEN_PFAA, GEN_TFC); + if(MD.GC.mLoaded){ + new WorldgenMeteor("meotorite.2", BlocksGT.GraniteBlack, GCBlocks.blockMoon, T, GEN_MOON); + new WorldgenMeteor("meotorite.3", BlocksGT.GraniteBlack, T, GEN_MARS); + new WorldgenMeteor("meotorite.4", BlocksGT.GraniteBlack, GCBlocks.blockMoon, T, GEN_ASTEROIDS); + } + + if(MD.TF.mLoaded){ + new WorldgenMeteor("meotorite.5", BlocksGT.GraniteBlack, BlocksGT.Granite, T, GEN_TWILIGHT); + } + + if(MD.ATUM.mLoaded){ + new WorldgenMeteor("meotorite.6", BlocksGT.GraniteBlack, Blocks.sandstone, T, GEN_ATUM); + } + + } + + @Override + public void postInit() { + + } +} diff --git a/src/main/java/org/altadoon/gt6x/features/meotorite/WorldgenMeteor.java b/src/main/java/org/altadoon/gt6x/features/meotorite/WorldgenMeteor.java new file mode 100644 index 00000000..1df834f1 --- /dev/null +++ b/src/main/java/org/altadoon/gt6x/features/meotorite/WorldgenMeteor.java @@ -0,0 +1,103 @@ +package org.altadoon.gt6x.features.meotorite; + +import gregapi.data.MT; +import gregapi.util.WD; +import gregapi.worldgen.WorldgenObject; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; + +import java.util.List; +import java.util.Random; +import java.util.Set; + +import static gregapi.data.CS.*; + +public class WorldgenMeteor extends WorldgenObject { + Block baseBlock = BlocksGT.GraniteBlack; + Block crustBlock = BlocksGT.GraniteBlack; + + @SafeVarargs + public WorldgenMeteor(String aName, boolean aDefault, List... aLists) { + super(aName, aDefault, aLists); + } + + @SafeVarargs + public WorldgenMeteor(String aName, Block aMainBlock, boolean aDefault, List... aLists) { + this(aName, aDefault, aLists); + baseBlock = aMainBlock; + crustBlock = baseBlock; + } + + @SafeVarargs + public WorldgenMeteor(String aName, Block aMainBlock, Block aCrust, boolean aDefault, List... aLists) { + this(aName,aMainBlock, aDefault, aLists); + crustBlock = aCrust; + } + + @Override + public boolean generate(World aWorld, Chunk aChunk, int aDimType, int aMinX, int aMinZ, int aMaxX, int aMaxZ, Random aRandom, BiomeGenBase[][] aBiomes, Set aBiomeNames) { + if (aRandom.nextInt(50) == 0 || ((aDimType==DIM_MOON||aDimType==DIM_MARS||aDimType==DIM_ASTEROIDS)&&aRandom.nextInt(10)==0)) { + int radius = 3 + aRandom.nextInt(7); + int centerX = aMinX + aRandom.nextInt(15); + int centerZ = aMinZ + aRandom.nextInt(15); + int centerY = aWorld.getChunkFromBlockCoords(centerX, centerZ).getHeightValue(centerX & 15, centerZ & 15); + // prevent floating in water + while (WD.anywater(aWorld, centerX, centerY - 1, centerZ)) { + centerY--; + if (centerY == 0) break; + } + + centerY = centerY - radius - aRandom.nextInt(50); // let's burry the metorite under the ground slightly + if (centerY < 5) centerY = radius; // prevent from spawing under the bedrock + // make an Impact creator if the asteroid is above ground + int radius2 = radius + 5 + aRandom.nextInt(5); + int creatorY = centerY + radius2 - radius + aRandom.nextInt(3); + if (centerY > WD.waterLevel(aWorld) && aWorld.canBlockSeeTheSky(centerX, centerY + radius2, centerZ)) + for (int i = -radius2; i <= radius2; i++) { + for (int j = -radius2; j <= radius2; j++) { + for (int k = -radius2; k < radius2; k++) { + var x = centerX + i; + var y = creatorY + j; + var z = centerZ + k; + var dis = ((x - centerX) * (x - centerX) + (y - creatorY) * (y - creatorY) + (z - centerZ) * (z - centerZ)); + if (dis <= radius2 * radius2) { + if (!WD.anywater(aWorld, x, y, z)) { + WD.set(aWorld, x, y, z, Blocks.air, 0, 0); + } else if (aBiomeNames.contains(BiomeGenBase.ocean.biomeName) || WD.anywater(aWorld, centerX, centerY, centerZ)) { + WD.set(aWorld, x, y, z, BlocksGT.Ocean, 0, 0); + } + } + } + } + } + + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k < radius; k++) { + var x = centerX + i; + var y = centerY + j; + var z = centerZ + k; + var dis = ((x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) + (z - centerZ) * (z - centerZ)); + if (dis <= radius * radius) { + // it's in sphere + if (WD.bedrock(aWorld, x, y, z)) continue; // dont replace bedrock duh + boolean edge = false; + for (byte l = 0; l < 6; l++) if (!WD.obstructed(aWorld, x, y, z, l)) edge = true; + if(edge) WD.set(aWorld,x,y,z,crustBlock,0,0); + else WD.set(aWorld, x, y, z, baseBlock, 0, 0, T); + if (aRandom.nextInt(4) == 0) WD.setSmallOre(aWorld, x, y, z, MT.MeteoricIron); + else if (aRandom.nextInt(5) == 0) WD.setSmallOre(aWorld, x, y, z, MT.Ni); + else if (aRandom.nextInt(8) == 0) WD.setOre(aWorld, x, y, z, MT.MeteoricIron); + else if (aRandom.nextInt(20) == 0) WD.setOre(aWorld, x, y, z, MT.Ir); + } + } + } + } + return T; + } + return F; + } +} From 5030361e9863c3737cbd9ff90e2a1a1ec094ab4d Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Thu, 12 Oct 2023 19:31:12 +0330 Subject: [PATCH 02/12] + Worldgen Feature --- src/main/java/org/altadoon/gt6x/Gt6xMod.java | 23 +++++++-- .../gt6x/features/meotorite/Meteor.java | 46 ------------------ .../gt6x/features/worldgen/WorldGen.java | 48 +++++++++++++++++++ .../WorldgenMeteor.java | 4 +- 4 files changed, 69 insertions(+), 52 deletions(-) delete mode 100644 src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java create mode 100644 src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java rename src/main/java/org/altadoon/gt6x/features/{meotorite => worldgen}/WorldgenMeteor.java (96%) diff --git a/src/main/java/org/altadoon/gt6x/Gt6xMod.java b/src/main/java/org/altadoon/gt6x/Gt6xMod.java index e5295df7..e1d92733 100644 --- a/src/main/java/org/altadoon/gt6x/Gt6xMod.java +++ b/src/main/java/org/altadoon/gt6x/Gt6xMod.java @@ -7,7 +7,7 @@ import org.altadoon.gt6x.features.GT6XFeature; import org.altadoon.gt6x.features.basicchem.BasicChemistry; import org.altadoon.gt6x.features.ceramics.Ceramics; -import org.altadoon.gt6x.features.meotorite.Meteor; +import org.altadoon.gt6x.features.worldgen.WorldGen; import org.altadoon.gt6x.features.oil.OilProcessing; import org.altadoon.gt6x.features.pgm.PgmProcessing; import org.altadoon.gt6x.features.metallurgy.Metallurgy; @@ -58,7 +58,7 @@ public final class Gt6xMod extends gregapi.api.Abstract_Mod { OilProcessing.class, PgmProcessing.class, RefractoryMetals.class, - VerticalMixers.class, Meteor.class + VerticalMixers.class, WorldGen.class }; private final ArrayList enabledFeatures; @@ -67,7 +67,23 @@ public Gt6xMod() { this.modConfig = new Config(allFeatures); this.enabledFeatures = modConfig.getEnabledFeatures(); - + // try to use shady reflection code to detect feature classes + // sometimes work sometimes dosent +// try{ +// Field field = ClassLoader.class.getDeclaredField("classes"); +// field.setAccessible(true); +// Collection> clzs = (Collection>) field.get(this.getClass().getClassLoader()); +// for(var claz:clzs){ +// if(claz.getName().contains("org.altadoon.gt6x.features.")){ +// System.out.println(claz.getName()); +// if(claz.getSuperclass().equals(GT6XFeature.class)){ +// allFeatures.add((Class) claz); +// } +// } +// } +// } catch (Exception ignored){ +// ignored.printStackTrace(); +// } final Gt6xMod copy = this; GT.mBeforePreInit.add(copy::prePreInit); GT.mAfterPreInit.add(copy::postPreInit); @@ -81,7 +97,6 @@ public void onModPreInit2(cpw.mods.fml.common.event.FMLPreInitializationEvent aE MTx.touch(); RMx.init(); MultiItemsX.instance = new MultiItemsX(MOD_ID, "gt6x.multiitems"); - for (GT6XFeature feature : enabledFeatures) { feature.preInit(); } diff --git a/src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java b/src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java deleted file mode 100644 index e24481eb..00000000 --- a/src/main/java/org/altadoon/gt6x/features/meotorite/Meteor.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.altadoon.gt6x.features.meotorite; - -import gregapi.data.MD; -import micdoodle8.mods.galacticraft.core.blocks.GCBlocks; -import net.minecraft.init.Blocks; -import org.altadoon.gt6x.common.Config; -import org.altadoon.gt6x.features.GT6XFeature; - -import static gregapi.data.CS.*; - -public class Meteor extends GT6XFeature { - - @Override - public void configure(Config config) { - - } - - @Override - public void preInit() { - - } - - @Override - public void init() { - new WorldgenMeteor("meotorite.1" , T, GEN_OVERWORLD, GEN_GT, GEN_PFAA, GEN_TFC); - if(MD.GC.mLoaded){ - new WorldgenMeteor("meotorite.2", BlocksGT.GraniteBlack, GCBlocks.blockMoon, T, GEN_MOON); - new WorldgenMeteor("meotorite.3", BlocksGT.GraniteBlack, T, GEN_MARS); - new WorldgenMeteor("meotorite.4", BlocksGT.GraniteBlack, GCBlocks.blockMoon, T, GEN_ASTEROIDS); - } - - if(MD.TF.mLoaded){ - new WorldgenMeteor("meotorite.5", BlocksGT.GraniteBlack, BlocksGT.Granite, T, GEN_TWILIGHT); - } - - if(MD.ATUM.mLoaded){ - new WorldgenMeteor("meotorite.6", BlocksGT.GraniteBlack, Blocks.sandstone, T, GEN_ATUM); - } - - } - - @Override - public void postInit() { - - } -} diff --git a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java new file mode 100644 index 00000000..1b943dc5 --- /dev/null +++ b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java @@ -0,0 +1,48 @@ +package org.altadoon.gt6x.features.worldgen; + +import gregapi.data.MD; +import micdoodle8.mods.galacticraft.core.blocks.GCBlocks; +import net.minecraft.init.Blocks; +import org.altadoon.gt6x.common.Config; +import org.altadoon.gt6x.features.GT6XFeature; + +import static gregapi.data.CS.*; + +public class WorldGen extends GT6XFeature { + public static boolean enableMeteorite = true; + + @Override + public void configure(Config config) { + enableMeteorite = config.cfg.get("Meteor","enable", enableMeteorite).getBoolean(); + } + + @Override + public void preInit() { + + } + + @Override + public void init() { + if(enableMeteorite){ + new WorldgenMeteor("meotorite.1" , T, GEN_OVERWORLD, GEN_GT, GEN_PFAA, GEN_TFC,GEN_PLANETS); + if(MD.GC.mLoaded){ + new WorldgenMeteor("meotorite.2", BlocksGT.GraniteBlack, GCBlocks.blockMoon, T, GEN_MOON); + new WorldgenMeteor("meotorite.3", BlocksGT.GraniteBlack, T, GEN_MARS); + new WorldgenMeteor("meotorite.4", BlocksGT.GraniteBlack, GCBlocks.blockMoon, T, GEN_ASTEROIDS); + } + + if(MD.TF.mLoaded){ + new WorldgenMeteor("meotorite.5", BlocksGT.GraniteBlack, BlocksGT.Granite, T, GEN_TWILIGHT); + } + + if(MD.ATUM.mLoaded){ + new WorldgenMeteor("meotorite.6", BlocksGT.GraniteBlack, Blocks.sandstone, T, GEN_ATUM); + } + } + } + + @Override + public void postInit() { + + } +} diff --git a/src/main/java/org/altadoon/gt6x/features/meotorite/WorldgenMeteor.java b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java similarity index 96% rename from src/main/java/org/altadoon/gt6x/features/meotorite/WorldgenMeteor.java rename to src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java index 1df834f1..f769bcc1 100644 --- a/src/main/java/org/altadoon/gt6x/features/meotorite/WorldgenMeteor.java +++ b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java @@ -1,4 +1,4 @@ -package org.altadoon.gt6x.features.meotorite; +package org.altadoon.gt6x.features.worldgen; import gregapi.data.MT; import gregapi.util.WD; @@ -39,7 +39,7 @@ public WorldgenMeteor(String aName, Block aMainBlock, Block aCrust, boolean aDef @Override public boolean generate(World aWorld, Chunk aChunk, int aDimType, int aMinX, int aMinZ, int aMaxX, int aMaxZ, Random aRandom, BiomeGenBase[][] aBiomes, Set aBiomeNames) { - if (aRandom.nextInt(50) == 0 || ((aDimType==DIM_MOON||aDimType==DIM_MARS||aDimType==DIM_ASTEROIDS)&&aRandom.nextInt(10)==0)) { + if (aRandom.nextInt(50) == 0 || ((aDimType==DIM_MOON||aDimType==DIM_MARS||aDimType==DIM_ASTEROIDS||aDimType==DIM_PLANETS)&&aRandom.nextInt(10)==0)) { int radius = 3 + aRandom.nextInt(7); int centerX = aMinX + aRandom.nextInt(15); int centerZ = aMinZ + aRandom.nextInt(15); From 2477c8dd064affe0120bdb0954c90b62895f0096 Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:51:28 +0330 Subject: [PATCH 03/12] + refactor naming --- src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java index 1b943dc5..0c94a6c5 100644 --- a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java +++ b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldGen.java @@ -13,7 +13,7 @@ public class WorldGen extends GT6XFeature { @Override public void configure(Config config) { - enableMeteorite = config.cfg.get("Meteor","enable", enableMeteorite).getBoolean(); + enableMeteorite = config.cfg.get("meotorite","enable", enableMeteorite).getBoolean(); } @Override From 7eac50a8e95108ca7e92284c6db73b103dbbb4cd Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:26:25 +0330 Subject: [PATCH 04/12] + bring MT3 into dev enviroment (for its dev commands) --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 21ec7b37..6a921755 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -109,7 +109,7 @@ dependencies { //compileOnly "micdoodle8.mods:GalacticraftCore:1.7-3.0.12.504:Dev" //compileOnly "micdoodle8.mods:MicdoodleCore:1.7-3.0.12.504:Dev" //compileOnly "minechem:Minechem:1.7.10-6.0.407:dev" - //compileOnly "minetweaker:MineTweaker3:1.7.10-3.0.10:dev-full" + compile "minetweaker:MineTweaker3:1.7.10-3.0.10:dev-full" //compileOnly "mods.railcraft:Railcraft_1.7.10:9.12.3.0:dev" //compileOnly "mrtjp:ForgeRelocation:0.0.1.4:dev" //compileOnly "mrtjp:MrTJPCore:1.1.0.34:dev" From 1311cdd25ddcb8c92f2af044b83354d29a1980ea Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:26:47 +0330 Subject: [PATCH 05/12] + EAF RM into RMx --- src/main/java/org/altadoon/gt6x/common/RMx.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/altadoon/gt6x/common/RMx.java b/src/main/java/org/altadoon/gt6x/common/RMx.java index 7712e6e4..200fda46 100644 --- a/src/main/java/org/altadoon/gt6x/common/RMx.java +++ b/src/main/java/org/altadoon/gt6x/common/RMx.java @@ -1,12 +1,14 @@ package org.altadoon.gt6x.common; import gregapi.recipes.Recipe.RecipeMap; +import org.altadoon.gt6x.features.metallurgy.utils.EAFSmeltingRecipe; import static gregapi.data.CS.RES_PATH_GUI; /** Common recipe maps */ public class RMx { public static RecipeMap sintering = null; + public static RecipeMap electric_arc_furnace = EAFSmeltingRecipe.FakeRecipes; public static void init() { sintering = new RecipeMap(null, "gt6x.recipe.sintering", "Sintering", null, 0, 1, RES_PATH_GUI+"machines/Sintering", 6, 1, 1, 0, 0, 0, 1, 1, "", 1, "", true, true, true, true, false, true, true); From 03abcc81dec39bce59e0e6efcccd7bd98bd930f2 Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:28:12 +0330 Subject: [PATCH 06/12] + RecipeBuilder --- src/main/java/org/altadoon/gt6x/Gt6xMod.java | 3 + .../gt6x/common/recipe/RecipeBuilder.java | 409 ++++++++++++++++++ .../altadoon/gt6x/common/utils/OD_Utils.java | 49 +++ 3 files changed, 461 insertions(+) create mode 100644 src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java create mode 100644 src/main/java/org/altadoon/gt6x/common/utils/OD_Utils.java diff --git a/src/main/java/org/altadoon/gt6x/Gt6xMod.java b/src/main/java/org/altadoon/gt6x/Gt6xMod.java index e1d92733..fc6646e0 100644 --- a/src/main/java/org/altadoon/gt6x/Gt6xMod.java +++ b/src/main/java/org/altadoon/gt6x/Gt6xMod.java @@ -29,6 +29,7 @@ public final class Gt6xMod extends gregapi.api.Abstract_Mod { public static final String MOD_NAME = "GRADLETOKEN_MODNAME"; public static final String VERSION = "GRADLETOKEN_VERSION"; public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME"; + public static Gt6xMod instance; public static gregapi.code.ModData MOD_DATA = new gregapi.code.ModData(MOD_ID, MOD_NAME); @cpw.mods.fml.common.SidedProxy(modId = MOD_ID, clientSide = "gregapi.api.example.Example_Proxy_Client", serverSide = "gregapi.api.example.Example_Proxy_Server") @@ -59,6 +60,8 @@ public final class Gt6xMod extends gregapi.api.Abstract_Mod { PgmProcessing.class, RefractoryMetals.class, VerticalMixers.class, WorldGen.class + VerticalMixers.class, + WorldGen.class, }; private final ArrayList enabledFeatures; diff --git a/src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java b/src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java new file mode 100644 index 00000000..710d2132 --- /dev/null +++ b/src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java @@ -0,0 +1,409 @@ +package org.altadoon.gt6x.common.recipe; + +import gregapi.data.FL; +import gregapi.oredict.OreDictMaterial; +import gregapi.oredict.OreDictPrefix; +import gregapi.recipes.Recipe; +import gregapi.util.ST; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import org.altadoon.gt6x.common.utils.OD_Utils; + +import java.util.ArrayList; +import java.util.List; + +import static gregapi.data.CS.*; + +public class RecipeBuilder { + + List builderList = new ArrayList<>(); + + public static RecipeBuilder create(Recipe.RecipeMap recipeMap){ + return new RecipeBuilder(recipeMap); + } + public RecipeBuilder(Recipe.RecipeMap aRecipeMap) { + RecipeBuilderInternal builder = new RecipeBuilderInternal(aRecipeMap); + builderList.add(builder); + } + + /** + * @param aStacks an OreDictionary List of Items + * Warning: Outputs do not inTake OreDictionary + */ + public RecipeBuilder item(List aStacks, boolean isInput, int aChance){ + if(aStacks.isEmpty()) return this; + List aList = new ArrayList<>(); + for(var s:aStacks) { + builderList.forEach(builder -> { + if (isInput) aList.add(new RecipeBuilderInternal(builder).input(s)); + if (!isInput && aChance > -1) aList.add(new RecipeBuilderInternal(builder).output(s)); + if (!isInput && aChance < 0) aList.add(new RecipeBuilderInternal(builder).chancedOutput(s,aChance)); + }); + } + builderList.clear(); + builderList.addAll(aList); + return this; + } + + public RecipeBuilder item(List aStacks, boolean isInput){ + return item(aStacks,isInput,-1); + } + + public RecipeBuilder item(String aOreDictionary,int aAmount, boolean isInput, int aChances){ + return item(OD_Utils.getOres(aOreDictionary,aAmount,false),isInput,aChances); + } + + public RecipeBuilder item(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount, boolean isInput,boolean aOreDict,int aChance){ + if(aOreDict) return item(OD_Utils.getOres(aPrefix,aMaterial,aAmount,false),isInput,aChance); + return item(aPrefix.mat(aMaterial,aAmount),isInput,aChance); + } + + /** + * @param aStacks an OreDictionary List of Items + */ + public RecipeBuilder input(List aStacks){ + return item(aStacks,true); + } + + /** + * @param aStacks an OreDictionary List of Items + */ + @Deprecated() + public RecipeBuilder output(List aStacks){ + return item(aStacks,false); + } + + public RecipeBuilder item(ItemStack aStack,boolean isInput,int aChance){ + builderList.forEach(builder->builder.item(aStack,isInput,aChance)); + return this; + } + public RecipeBuilder item(ItemStack aStack,boolean isInput){ + return item(aStack,isInput,-1); + } + + public RecipeBuilder input(ItemStack aStack){ + return item(aStack,true); + } + + public RecipeBuilder output(ItemStack aStack){ + return item(aStack,false); + } + + public RecipeBuilder input(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount){ + return item(aPrefix,aMaterial,aAmount,true,true,-1); + } + + //TODO: fixone item sometimes randomally get stackSize of 1 while rest are correct + public RecipeBuilder output(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount){ + return item(aPrefix,aMaterial,aAmount,false,false,-1); + } + + public RecipeBuilder input(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount,boolean aUseOreDict){ + return item(aPrefix,aMaterial,aAmount,true,aUseOreDict,-1); + } + +// @Deprecated() +// public RecipeBuilder output(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount,boolean aUseOreDict){ +// return item(aPrefix,aMaterial,aAmount,false,aUseOreDict,-1); +// } + + public RecipeBuilder input(String aOreDictionary,int aAmount){ + return item(aOreDictionary,aAmount,true,-1); + } + @Deprecated() + public RecipeBuilder output(String aOreDictionary,int aAmount){ + return item(aOreDictionary,aAmount,false,-1); + } + @Deprecated() + public RecipeBuilder chancedOutput(String aOreDictionary,int aAmount, int aChances){ + return item(aOreDictionary,aAmount,false,aChances); + } + + /** + * @param aStacks oreDict Output, this is one item in a recipe! + * @param aChance anything less than 0 is considered 100% + */ + @Deprecated() + public RecipeBuilder chancedOutput(List aStacks, int aChance){ + return item(aStacks,false,aChance); + } + + public RecipeBuilder chancedOutput(ItemStack aStack, int aChances){ + List aStacks = new ArrayList<>();aStacks.add(aStack); return chancedOutput(aStacks,aChances); + } + + public RecipeBuilder chancedOutput(OreDictPrefix aPrefix,OreDictMaterial aMaterial,int aAmount, int aChances){ + return item(aPrefix,aMaterial,aAmount,false,false,aChances); + } + + public RecipeBuilder notConsumed(OreDictPrefix aPrefix,OreDictMaterial aMaterial){ + return input(aPrefix,aMaterial,0,false); + } + + @Deprecated + public RecipeBuilder notConsumed(String aOreDict){ + return input(aOreDict,0); + } + + public RecipeBuilder notConsumed(Item aItem){ + return notConsumed(aItem,W); + } + + public RecipeBuilder notConsumed(Item aItem,short aMeta){ + return input(ST.make(aItem,0,aMeta)); + } + + public RecipeBuilder notConsumed(ItemStack aStack){ + return input(ST.amount(0,aStack)); + } + + @Deprecated() + public RecipeBuilder notConsumed(List aStacks){ + aStacks.forEach(itemStack -> itemStack.stackSize=0); + return input(aStacks); + } + + public RecipeBuilder fluid(boolean aInput,FluidStack... aFluidStack){ + builderList.forEach(builder -> builder.fluid(aInput,aFluidStack)); + return this; + } + + public RecipeBuilder inputFluid(FluidStack... aFluidStack){ + return fluid(true,aFluidStack); + } + + public RecipeBuilder outputFluid(FluidStack... aFluidStack){ + return fluid(true,aFluidStack); + } + + public RecipeBuilder inputFluid(Fluid aFluid, int aAmount){ + return fluid(true, FL.make(aFluid,aAmount)); + } + + public RecipeBuilder outputFluid(Fluid aFluid, int aAmount){ + return fluid(false, FL.make(aFluid,aAmount)); + } + + public RecipeBuilder circuit(int aCircuit){ + builderList.forEach(builder -> builder.circuit(aCircuit)); + return this; + } + + public RecipeBuilder fake(){ + builderList.forEach(RecipeBuilderInternal::fake); + return this; + } + + public RecipeBuilder eut(int aEUt) { + builderList.forEach(builder -> builder.eut(aEUt)); + return this; + } + + public RecipeBuilder duration(int aDuration) { + builderList.forEach(builder -> builder.duration(aDuration)); + return this; + } + + /** + * Warning: We check for collision which basically removes oreDict Possibilities from outputs + * this is necessary because outputs cannot be different! + */ + public void build() { + builderList.forEach(RecipeBuilderInternal::optimizedBuild); + } + + final class RecipeBuilderInternal { + Recipe.RecipeMap recipeMap; + ItemStack[] mInputs,mOutputs; + FluidStack[] mFluidInputs, mFluidOutputs; + + long[] mChances, mMaxChances; + /** An Item that needs to be inside the Special Slot, like for example the Copy Slot inside the Printer. This is only useful for Fake Recipes in NEI, since findRecipe() and containsInput() don't give a shit about this Field. Lists are also possible. */ + Object mSpecialItems = null; + /** Use this to just disable a specific Recipe, but the Configuration enables that already for every single Recipe. */ + public boolean mEnabled = T; + /** If this Recipe is hidden from NEI */ + public boolean mHidden = F; + /** If this Recipe is Fake and therefore doesn't get found by the findRecipe Function (It is still in the HashMaps, so that containsInput does return T on those fake Inputs) */ + public boolean mFakeRecipe = F; + /** If this Recipe can be stored inside a Machine in order to make Recipe searching more Efficient by trying the previously used Recipe first. In case you have a Recipe Map overriding things and returning one time use Recipes, you have to set this to F. */ + public boolean mCanBeBuffered = T; + /** If this Recipe needs the Output Slots to be completely empty. Needed in case you have randomised Outputs */ + public boolean mNeedsEmptyOutput = F; + + long mDuration, mEUt, mSpecialValue; + + public RecipeBuilderInternal(Recipe.RecipeMap recipeMap){ + this.recipeMap = recipeMap; mDuration=100; mEUt = 0; + mInputs = new ItemStack[recipeMap.mInputItemsCount]; + mOutputs = new ItemStack[recipeMap.mOutputItemsCount]; + mFluidInputs = new FluidStack[recipeMap.mInputFluidCount]; + mFluidOutputs = new FluidStack[recipeMap.mOutputFluidCount]; + mChances = new long[mOutputs.length]; + } + + public RecipeBuilderInternal(RecipeBuilderInternal aCopy){ + recipeMap=aCopy.recipeMap; + mDuration=aCopy.mDuration; + mChances=aCopy.mChances; + mMaxChances=aCopy.mMaxChances; + mEUt=aCopy.mEUt; + mInputs=aCopy.mInputs.clone(); + mOutputs= aCopy.mOutputs.clone(); + mFluidInputs=aCopy.mFluidInputs.clone(); + mFluidOutputs= aCopy.mFluidOutputs.clone(); + mSpecialItems=aCopy.mSpecialItems; + mSpecialValue=aCopy.mSpecialValue; + mFakeRecipe=aCopy.mFakeRecipe; + mEnabled=aCopy.mEnabled; + mHidden=aCopy.mHidden; + mCanBeBuffered=aCopy.mCanBeBuffered; + mNeedsEmptyOutput=aCopy.mNeedsEmptyOutput; + } + + public RecipeBuilderInternal eut(int aEUt){ + mEUt=aEUt; + return this; + } + + public RecipeBuilderInternal duration(int aDuration){ + mDuration=aDuration; + return this; + } + + /* INPUTS */ + + /** + * puts items one by one, first item goes on next availble index, dose nothing if it excedes maximum numbers of items allowed + */ + public RecipeBuilderInternal input(ItemStack... aItemStack){ + return item(true,aItemStack); + } + + public RecipeBuilderInternal output(ItemStack... aItemStack){ + return item(false,aItemStack); + } + + public RecipeBuilderInternal input(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount){ + return item(aPrefix,aMaterial,aAmount,true); + } + + public RecipeBuilderInternal output(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount){ + return item(aPrefix,aMaterial,aAmount,false); + } + + public RecipeBuilderInternal item(boolean aInput, ItemStack... aItemStack){ + for (int i = 0; i < aItemStack.length; i++) { + if(aInput) + for (int j = 0; j < mInputs.length; j++) { + if(mInputs[j]==null) { + mInputs[j] = aItemStack[i]; + break; + } + } + else { + for (int j = 0; j < mOutputs.length; j++) { + if(mOutputs[j]==null) { + mOutputs[j] = aItemStack[i]; + break; + } + } + } + } + return this; + } + + public RecipeBuilderInternal item(ItemStack aStack, boolean aInput ,int aChance){ + if(!aInput){ + for (int j = 0; j < mOutputs.length; j++) { + if(mOutputs[j]==null) { + mOutputs[j] = aStack; + mChances[j]=aChance; + break; + } + } + return this; + } + return item(aInput,aStack); + } + + public RecipeBuilderInternal item(ItemStack aStack, boolean aInput){ + return item(aStack,aInput,-1); + } + + public RecipeBuilderInternal item(OreDictPrefix aPrefix,OreDictMaterial aMaterial,int aAmount, boolean isInput){ + return item(aPrefix.mat(aMaterial,aAmount),isInput); + } + + public RecipeBuilderInternal item(OreDictPrefix aPrefix,OreDictMaterial aMaterial,int aAmount, boolean isInput,int aChance){ + return item(aPrefix.mat(aMaterial,aAmount),isInput,aChance); + } + + public RecipeBuilderInternal chancedOutput(ItemStack aStack, int aChance){ + return item(aStack,false,aChance); + } + + + + public RecipeBuilderInternal fluid(boolean aInput, FluidStack... aFluidStack){ + for (int i = 0; i < aFluidStack.length; i++) { + if(aInput) + for (int j = 0; j < mFluidInputs.length; j++) { + if(mFluidInputs[j]==null) { + mFluidInputs[j] = aFluidStack[i]; + break; + } + } + else { + for (int j = 0; j < mFluidOutputs.length; j++) { + if(mFluidOutputs[j]==null) { + mFluidOutputs[j] = aFluidStack[i]; + break; + } + } + } + } + return this; + } + + public RecipeBuilderInternal inputFluid(FluidStack... aFluidStacks){ + return fluid(true,aFluidStacks); + } + + public RecipeBuilderInternal outputFluid(FluidStack... aFluidStacks){ + return fluid(false,aFluidStacks); + } + + public RecipeBuilderInternal circuit(int aCircuit){ + input(ST.tag(aCircuit)); + return this; + } + + public RecipeBuilderInternal fake(){ + mFakeRecipe=true; + return this; + } + + public RecipeBuilderInternal hide(){ + mHidden=true; + return this; + } + + /* BUILD BLOCK */ + public void build(boolean aOptimize, boolean aUnification){ + var ret = new Recipe(aOptimize,aUnification,mInputs,mOutputs,mSpecialItems,mChances,mFluidInputs,mFluidOutputs,mDuration,mEUt,mSpecialValue); + recipeMap.addRecipe(ret,true,mFakeRecipe,mHidden,true); + } + + public void build(){ + build(false,false); + } + + public void optimizedBuild(){ + build(true,true); + } + } + +} diff --git a/src/main/java/org/altadoon/gt6x/common/utils/OD_Utils.java b/src/main/java/org/altadoon/gt6x/common/utils/OD_Utils.java new file mode 100644 index 00000000..10f9076d --- /dev/null +++ b/src/main/java/org/altadoon/gt6x/common/utils/OD_Utils.java @@ -0,0 +1,49 @@ +package org.altadoon.gt6x.common.utils; + +import gregapi.code.ArrayListNoNulls; +import gregapi.oredict.OreDictMaterial; +import gregapi.oredict.OreDictMaterialStack; +import gregapi.oredict.OreDictPrefix; +import gregapi.util.ST; +import gregapi.util.UT; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.List; + +import static gregapi.data.CS.*; +import static gregapi.data.CS.F; + +public class OD_Utils { + /* + just a reWrite of OreDictManager.getOres that also handles amounts + */ + public static List getOres(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount,boolean aTransformWildcardBlocksTo16) { + return getOres(aPrefix.mNameInternal + aMaterial.mNameInternal, aAmount, aTransformWildcardBlocksTo16); + } + /** @return a Copy of the OreDictionary.getOres() List */ + public static List getOres(OreDictPrefix aPrefix, OreDictMaterialStack aMaterial, int aAmount, boolean aTransformWildcardBlocksTo16) { + return getOres(aPrefix.mNameInternal + aMaterial.mMaterial.mNameInternal, aAmount, aTransformWildcardBlocksTo16); + } + + /** @return a Copy of the OreDictionary.getOres() List */ + public static List getOres(Object aOreName,int aAmount, boolean aTransformWildcardBlocksTo16) { + String aName = aOreName==null?"":aOreName.toString(); + List rList = new ArrayListNoNulls<>(), tList; + if (UT.Code.stringValid(aName)) { + if (aTransformWildcardBlocksTo16) { + tList = OreDictionary.getOres(aName, F); + for (ItemStack tStack : tList) { + if (ST.meta_(tStack) == W && ST.block(tStack) != NB) { + for (int i = 0; i < 16; i++) rList.add(ST.make(tStack.getItem(), aAmount, i)); + } else { + rList.add(tStack); + } + } + } else { + rList.addAll(OreDictionary.getOres(aName, F)); + } + } + return rList; + } +} From 2fb8f38ba3cea589c3d6dba6f04fde6072d175e9 Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:37:55 +0330 Subject: [PATCH 07/12] + AE SkyStone for Meotorites outer shell --- .../gt6x/features/worldgen/WorldgenMeteor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java index f769bcc1..3e58495d 100644 --- a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java +++ b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java @@ -1,6 +1,9 @@ package org.altadoon.gt6x.features.worldgen; +import appeng.api.AEApi; +import gregapi.data.MD; import gregapi.data.MT; +import gregapi.data.OP; import gregapi.util.WD; import gregapi.worldgen.WorldgenObject; import net.minecraft.block.Block; @@ -22,13 +25,18 @@ public class WorldgenMeteor extends WorldgenObject { @SafeVarargs public WorldgenMeteor(String aName, boolean aDefault, List... aLists) { super(aName, aDefault, aLists); + if (MD.AE.mLoaded) { + crustBlock = AEApi.instance().definitions().blocks().skyStone().maybeBlock().or(BlocksGT.GraniteBlack); + if (crustBlock == BlocksGT.GraniteBlack) + System.out.println("> ERROR, AE is present but SkyStone is not accessible."); + } } @SafeVarargs public WorldgenMeteor(String aName, Block aMainBlock, boolean aDefault, List... aLists) { this(aName, aDefault, aLists); baseBlock = aMainBlock; - crustBlock = baseBlock; +// crustBlock = baseBlock; } @SafeVarargs From 8e1fe5bc098cbb801fd0a9fc155bac13aff78bae Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:38:12 +0330 Subject: [PATCH 08/12] * Reformat --- .../org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java index 3e58495d..4516008d 100644 --- a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java +++ b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java @@ -41,13 +41,13 @@ public WorldgenMeteor(String aName, Block aMainBlock, boolean aDefault, List... aLists) { - this(aName,aMainBlock, aDefault, aLists); + this(aName, aMainBlock, aDefault, aLists); crustBlock = aCrust; } @Override public boolean generate(World aWorld, Chunk aChunk, int aDimType, int aMinX, int aMinZ, int aMaxX, int aMaxZ, Random aRandom, BiomeGenBase[][] aBiomes, Set aBiomeNames) { - if (aRandom.nextInt(50) == 0 || ((aDimType==DIM_MOON||aDimType==DIM_MARS||aDimType==DIM_ASTEROIDS||aDimType==DIM_PLANETS)&&aRandom.nextInt(10)==0)) { + if (aRandom.nextInt(50) == 0 || ((aDimType == DIM_MOON || aDimType == DIM_MARS || aDimType == DIM_ASTEROIDS || aDimType == DIM_PLANETS) && aRandom.nextInt(10) == 0)) { int radius = 3 + aRandom.nextInt(7); int centerX = aMinX + aRandom.nextInt(15); int centerZ = aMinZ + aRandom.nextInt(15); @@ -94,7 +94,7 @@ public boolean generate(World aWorld, Chunk aChunk, int aDimType, int aMinX, int if (WD.bedrock(aWorld, x, y, z)) continue; // dont replace bedrock duh boolean edge = false; for (byte l = 0; l < 6; l++) if (!WD.obstructed(aWorld, x, y, z, l)) edge = true; - if(edge) WD.set(aWorld,x,y,z,crustBlock,0,0); + if (edge) WD.set(aWorld, x, y, z, crustBlock, 0, 0); else WD.set(aWorld, x, y, z, baseBlock, 0, 0, T); if (aRandom.nextInt(4) == 0) WD.setSmallOre(aWorld, x, y, z, MT.MeteoricIron); else if (aRandom.nextInt(5) == 0) WD.setSmallOre(aWorld, x, y, z, MT.Ni); From 4bb07660299f8fc848c7faf073965cea59178f79 Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:38:28 +0330 Subject: [PATCH 09/12] + Center Loot for Meteors --- .../gt6x/features/worldgen/WorldgenMeteor.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java index 4516008d..ea5e98e5 100644 --- a/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java +++ b/src/main/java/org/altadoon/gt6x/features/worldgen/WorldgenMeteor.java @@ -100,6 +100,19 @@ public boolean generate(World aWorld, Chunk aChunk, int aDimType, int aMinX, int else if (aRandom.nextInt(5) == 0) WD.setSmallOre(aWorld, x, y, z, MT.Ni); else if (aRandom.nextInt(8) == 0) WD.setOre(aWorld, x, y, z, MT.MeteoricIron); else if (aRandom.nextInt(20) == 0) WD.setOre(aWorld, x, y, z, MT.Ir); + + if ((x == centerX) && (y == centerY) && (z == centerZ)) { + // center for spawning loots and what not + if ((radius > 2)) // default core is lava! + WD.set(aWorld, x, y, z, Blocks.lava, W, 2); + if ((radius > 2) && aRandom.nextInt(2) == 0) + WD.set(aWorld, x, y, z, OP.blockPlate.mat(MT.MeteoricIron, 1)); + if ((radius > 2) && aRandom.nextInt(3) == 0) + WD.set(aWorld, x, y, z, OP.blockPlate.mat(MT.DamascusSteel, 1)); + if ((radius > 2) && aRandom.nextInt(5) == 0) + WD.set(aWorld, x, y, z, OP.blockPlate.mat(MT.DuraniumAlloy, 1)); + + } } } } From bc0340a82d4c2fbf44a7a15ea207db3f577ebfa0 Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:39:04 +0330 Subject: [PATCH 10/12] + make RecipeBuilder more robust --- .../gt6x/common/recipe/RecipeBuilder.java | 94 ++++++++++++++----- 1 file changed, 70 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java b/src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java index 710d2132..0eb633bc 100644 --- a/src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java +++ b/src/main/java/org/altadoon/gt6x/common/recipe/RecipeBuilder.java @@ -1,6 +1,7 @@ package org.altadoon.gt6x.common.recipe; import gregapi.data.FL; +import gregapi.oredict.OreDictManager; import gregapi.oredict.OreDictMaterial; import gregapi.oredict.OreDictPrefix; import gregapi.recipes.Recipe; @@ -16,6 +17,9 @@ import static gregapi.data.CS.*; +/** + * + */ public class RecipeBuilder { List builderList = new ArrayList<>(); @@ -68,11 +72,10 @@ public RecipeBuilder input(List aStacks){ } /** - * @param aStacks an OreDictionary List of Items + * @param aStacks gets the first OreDictionary List of Items */ - @Deprecated() public RecipeBuilder output(List aStacks){ - return item(aStacks,false); + return item(aStacks.get(0),false,-1); } public RecipeBuilder item(ItemStack aStack,boolean isInput,int aChance){ @@ -83,6 +86,34 @@ public RecipeBuilder item(ItemStack aStack,boolean isInput){ return item(aStack,isInput,-1); } + public RecipeBuilder item(Item aItem, boolean isInput) { + return item(aItem, W, isInput); + } + + public RecipeBuilder item(Item aItem, short aMeta, boolean isInput) { + return item(aItem, 1, aMeta, isInput); + } + + public RecipeBuilder input(Item aItem, short aMeta) { + return input(aItem, 1, aMeta); + } + + public RecipeBuilder input(Item aItem, int aSize, short aMeta) { + return item(aItem, aSize, aMeta, true); + } + + public RecipeBuilder output(Item aItem, short aMeta) { + return output(aItem, 1, aMeta); + } + + public RecipeBuilder output(Item aItem, int aSize, short aMeta) { + return item(aItem, aSize, aMeta, false); + } + + public RecipeBuilder item(Item aItem, int aSize, short aMeta, boolean isInput){ + return item(ST.make(aItem,aSize,aMeta),isInput); + } + public RecipeBuilder input(ItemStack aStack){ return item(aStack,true); } @@ -91,51 +122,65 @@ public RecipeBuilder output(ItemStack aStack){ return item(aStack,false); } + public RecipeBuilder input(OreDictPrefix aPrefix, OreDictMaterial aMaterial) { + return input(aPrefix, aMaterial, 1); + } + public RecipeBuilder input(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount){ return item(aPrefix,aMaterial,aAmount,true,true,-1); } + //TODO: fixone item sometimes randomally get stackSize of 1 while rest are correct + public RecipeBuilder output(OreDictPrefix aPrefix, OreDictMaterial aMaterial) { + return output(aPrefix, aMaterial, 1); + } + //TODO: fixone item sometimes randomally get stackSize of 1 while rest are correct public RecipeBuilder output(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount){ return item(aPrefix,aMaterial,aAmount,false,false,-1); } - public RecipeBuilder input(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount,boolean aUseOreDict){ + public RecipeBuilder input(OreDictPrefix aPrefix, OreDictMaterial aMaterial, boolean aUseOreDict) { + return input(aPrefix, aMaterial, 1, aUseOreDict); + } + + public RecipeBuilder input(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount, boolean aUseOreDict){ return item(aPrefix,aMaterial,aAmount,true,aUseOreDict,-1); } -// @Deprecated() -// public RecipeBuilder output(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount,boolean aUseOreDict){ -// return item(aPrefix,aMaterial,aAmount,false,aUseOreDict,-1); -// } + public RecipeBuilder input(String aOreDictionary) { + return input(aOreDictionary, 1); + } - public RecipeBuilder input(String aOreDictionary,int aAmount){ + public RecipeBuilder input(String aOreDictionary, int aAmount){ return item(aOreDictionary,aAmount,true,-1); } - @Deprecated() - public RecipeBuilder output(String aOreDictionary,int aAmount){ - return item(aOreDictionary,aAmount,false,-1); - } - @Deprecated() - public RecipeBuilder chancedOutput(String aOreDictionary,int aAmount, int aChances){ - return item(aOreDictionary,aAmount,false,aChances); + + /** + * @param aOreDictionary gets the first item of the ore dictionary + */ + public RecipeBuilder output(String aOreDictionary) { + return output(aOreDictionary, 1); } /** - * @param aStacks oreDict Output, this is one item in a recipe! - * @param aChance anything less than 0 is considered 100% + * @param aOreDictionary gets the first item of the ore dictionary */ - @Deprecated() - public RecipeBuilder chancedOutput(List aStacks, int aChance){ - return item(aStacks,false,aChance); + public RecipeBuilder output(String aOreDictionary, int aAmount){ + return output(ST.amount(aAmount,OreDictManager.getOres(aOreDictionary,false).get(0))); } + public RecipeBuilder chancedOutput(ItemStack aStack, int aChances){ - List aStacks = new ArrayList<>();aStacks.add(aStack); return chancedOutput(aStacks,aChances); + return item(aStack,false,aChances); + } + + public RecipeBuilder chancedOutput(OreDictPrefix aPrefix,OreDictMaterial aMaterial, int aChances) { + return chancedOutput(aPrefix, aMaterial, 1, aChances); } - public RecipeBuilder chancedOutput(OreDictPrefix aPrefix,OreDictMaterial aMaterial,int aAmount, int aChances){ - return item(aPrefix,aMaterial,aAmount,false,false,aChances); + public RecipeBuilder chancedOutput(OreDictPrefix aPrefix, OreDictMaterial aMaterial, int aAmount, int aChances){ + return chancedOutput(aPrefix.mat(aMaterial,aAmount),aChances); } public RecipeBuilder notConsumed(OreDictPrefix aPrefix,OreDictMaterial aMaterial){ @@ -143,6 +188,7 @@ public RecipeBuilder notConsumed(OreDictPrefix aPrefix,OreDictMaterial aMaterial } @Deprecated + // FIXME: OreDicts dont work in not consumption public RecipeBuilder notConsumed(String aOreDict){ return input(aOreDict,0); } From 32a02d59d01d47cee2b562813508d51033eb4ba2 Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:39:57 +0330 Subject: [PATCH 11/12] + added a Helper Builder for RMs --- .../org/altadoon/gt6x/common/recipe/RB.java | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 src/main/java/org/altadoon/gt6x/common/recipe/RB.java diff --git a/src/main/java/org/altadoon/gt6x/common/recipe/RB.java b/src/main/java/org/altadoon/gt6x/common/recipe/RB.java new file mode 100644 index 00000000..678daff4 --- /dev/null +++ b/src/main/java/org/altadoon/gt6x/common/recipe/RB.java @@ -0,0 +1,101 @@ +package org.altadoon.gt6x.common.recipe; + +import gregapi.data.RM; +import gregapi.recipes.Recipe; + +public class RB { + public static final RB DidYouKnow=new RB(RM.DidYouKnow) + , Autocrafter=new RB(RM.Autocrafter) + , DistillationTower=new RB(RM.DistillationTower) + , CryoDistillationTower=new RB(RM.CryoDistillationTower) + , SteamCracking=new RB(RM.SteamCracking) + , CatalyticCracking=new RB(RM.CatalyticCracking) + , Fermenter=new RB(RM.Fermenter) + , Distillery=new RB(RM.Distillery) + , Drying=new RB(RM.Drying) + , Coagulator=new RB(RM.Coagulator) + , CrystallisationCrucible=new RB(RM.CrystallisationCrucible) + , Mixer=new RB(RM.Mixer) + , HeatMixer=new RB(RM.HeatMixer) + , BurnMixer=new RB(RM.BurnMixer) + , CryoMixer=new RB(RM.CryoMixer) + , CokeOven=new RB(RM.CokeOven) + , Roasting=new RB(RM.Roasting) + , Bath=new RB(RM.Bath) + , Sluice=new RB(RM.Sluice) + , MagneticSeparator=new RB(RM.MagneticSeparator) + , Sifting=new RB(RM.Sifting) + , Calciner=new RB(RM.Calciner) + , ImplosionCompressor=new RB(RM.ImplosionCompressor) + , Compressor=new RB(RM.Compressor) + , Injector=new RB(RM.Injector) + , Loom=new RB(RM.Loom) + , Laminator=new RB(RM.Laminator) + , Autoclave=new RB(RM.Autoclave) + , Freezer=new RB(RM.Freezer) + , Polarizer=new RB(RM.Polarizer) + , Lightning=new RB(RM.Lightning) + , Slicer=new RB(RM.Slicer) + , Lathe=new RB(RM.Lathe) + , Debarker=new RB(RM.Debarker) + , Press=new RB(RM.Press) + , Squeezer=new RB(RM.Squeezer) + , Juicer=new RB(RM.Juicer) + , Furnace=new RB(RM.Furnace) + , Microwave=new RB(RM.Microwave) + , Cooking=new RB(RM.Cooking) + , BumbleQueens=new RB(RM.BumbleQueens) + , Bumblelyzer=new RB(RM.Bumblelyzer) + , Trees=new RB(RM.Trees) + , Plantalyzer=new RB(RM.Plantalyzer) + , Wiremill=new RB(RM.Wiremill) + , ClusterMill=new RB(RM.ClusterMill) + , RollingMill=new RB(RM.RollingMill) + , RollBender=new RB(RM.RollBender) + , RollFormer=new RB(RM.RollFormer) + , LaserEngraver=new RB(RM.LaserEngraver) + , Welder=new RB(RM.Welder) + , Anvil=new RB(RM.Anvil) + , AnvilBendSmall=new RB(RM.AnvilBendSmall) + , AnvilBendBig=new RB(RM.AnvilBendBig) + , Centrifuge=new RB(RM.Centrifuge) + , Electrolyzer=new RB(RM.Electrolyzer) + , ToolHeads=new RB(RM.ToolHeads) + , Sharpening=new RB(RM.Sharpening) + , CrucibleAlloying=new RB(RM.CrucibleAlloying) + , CrucibleSmelting=new RB(RM.CrucibleSmelting) + , Cutter=new RB(RM.Cutter) + , Smelter=new RB(RM.Smelter) + , Mortar=new RB(RM.Mortar) + , Shredder=new RB(RM.Shredder) + , Crusher=new RB(RM.Crusher) + , Extruder=new RB(RM.Extruder) + , Hammer=new RB(RM.Hammer) + , Chisel=new RB(RM.Chisel) + , Nanofab=new RB(RM.Nanofab) + , Printer=new RB(RM.Printer) + , ScannerVisuals=new RB(RM.ScannerVisuals) + , ScannerMolecular=new RB(RM.ScannerMolecular) + , Massfab=new RB(RM.Massfab) + , Replicator=new RB(RM.Replicator) + , Fusion=new RB(RM.Fusion) + , Canner=new RB(RM.Canner) + , Boxinator=new RB(RM.Boxinator) + , Unboxinator=new RB(RM.Unboxinator) + , Generifier=new RB(RM.Generifier) + , BedrockOreList=new RB(RM.BedrockOreList) + , ByProductList=new RB(RM.ByProductList) + , BlastFurnace=new RB(RM.BlastFurnace) + , VacuumFreezer=new RB(RM.VacuumFreezer) + , Assembler=new RB(RM.Assembler) + , CNC=new RB(RM.CNC); + + public final Recipe.RecipeMap MAP; + RB(Recipe.RecipeMap aRecipeMap){ + MAP = aRecipeMap; + } + + public RecipeBuilder builder(){ + return new RecipeBuilder(MAP); + } +} From 73308f10ccdc4d5e5a155b12f2d66c019f9ab89a Mon Sep 17 00:00:00 2001 From: bioastroiner <68257484+bioastroiner@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:54:55 +0330 Subject: [PATCH 12/12] * Fix Building Error --- src/main/java/org/altadoon/gt6x/Gt6xMod.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/altadoon/gt6x/Gt6xMod.java b/src/main/java/org/altadoon/gt6x/Gt6xMod.java index fc6646e0..d1fb8f25 100644 --- a/src/main/java/org/altadoon/gt6x/Gt6xMod.java +++ b/src/main/java/org/altadoon/gt6x/Gt6xMod.java @@ -59,9 +59,8 @@ public final class Gt6xMod extends gregapi.api.Abstract_Mod { OilProcessing.class, PgmProcessing.class, RefractoryMetals.class, - VerticalMixers.class, WorldGen.class VerticalMixers.class, - WorldGen.class, + WorldGen.class }; private final ArrayList enabledFeatures;