From aa167711ef76c0b949032d38f8dac590e51a0dcb Mon Sep 17 00:00:00 2001 From: PiggyChu620 <68910494+PiggyChu620@users.noreply.github.com> Date: Mon, 12 Feb 2024 03:30:38 +0800 Subject: [PATCH] 202402120330 --- README.md | 5 ++++- mod.hjson | 4 ++-- src/ec620/EC620JavaMod.java | 2 +- src/ec620/content/EC620PlanetGenerator.java | 19 ++++++++++--------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 853ec21..6989c00 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Mindustry Java Mod - Random Planet v0.4.5.2 +# Mindustry Java Mod - Random Planet v0.4.6 A Java Mindustry mod. Randomly generate a planet and its sectors, including the starting sector. @@ -128,6 +128,9 @@ I combined both technologies from Serpulo and Erekir as best as I could, includi *v0.4.5.2* - Change the ore placement sorting criteria to hardness as it could better represent the "tier" of the ores and make it more "random". +*v0.4.6* +- Fix new sector loading forever if Mineable Alloys is not installed. + --- **1.** [Schematic Instruction](SchematicInstruction.md) diff --git a/mod.hjson b/mod.hjson index 9bd0959..6ba725a 100644 --- a/mod.hjson +++ b/mod.hjson @@ -1,5 +1,5 @@ #the mod name as displayed in-game -displayName: "Random Planet v0.4.5.2" +displayName: "Random Planet v0.4.6" repo: "PiggyChu620/MindustryRandomPlanet" @@ -16,7 +16,7 @@ main: "ec620.EC620JavaMod" description: "Randomly generate a planet and its sectors.\nIt's a mixtech mod, I myself don't like the idea of \"Oh, you can only use these things here, and you can only use those things there, bruh, bruh, bruh!\", so I make one myself, if you don't like mixtech and think it's \"unbalanced\" and \"boring\", then please go away, much appreciated!" #the mod version -version: 0.4.5.2 +version: 0.4.6 #the minimum game build required to run this mod minGameVersion: 140 diff --git a/src/ec620/EC620JavaMod.java b/src/ec620/EC620JavaMod.java index c6c20ea..9dc8e2b 100644 --- a/src/ec620/EC620JavaMod.java +++ b/src/ec620/EC620JavaMod.java @@ -47,7 +47,7 @@ public EC620JavaMod() dd.titleFont= Fonts.def; dd.titleFontColor=new Color(1,0,0); BaseDialog dialog = new BaseDialog("Random Planet", dd); - dialog.cont.add("Welcome to Random Planet v0.4.5.2",Color.green,1.2f).center().row(); + dialog.cont.add("Welcome to Random Planet v0.4.6",Color.green,1.2f).center().row(); dialog.cont.add("Please see Settings for customization",Color.cyan).center().row(); //dialog.cont.add("in order to see the setting info,",Color.cyan).row(); //dialog.cont.add("I can not figure out how to make it wrap,",Color.cyan).row(); diff --git a/src/ec620/content/EC620PlanetGenerator.java b/src/ec620/content/EC620PlanetGenerator.java index 86c3c36..ab8d755 100644 --- a/src/ec620/content/EC620PlanetGenerator.java +++ b/src/ec620/content/EC620PlanetGenerator.java @@ -581,6 +581,7 @@ void setOre(Block block) Seq ores = Seq.with(oreCopper,oreLead); Seq availableOres= content.blocks().select(b->b instanceof OreBlock && !ores.contains(b) && !b.itemDrop.hidden); int l= availableOres.size; + if(l<5) l=5; if(sector.id==0) { @@ -605,14 +606,14 @@ void setOre(Block block) // ores.add(availableOres.get(i)); // } } - while(ores.size<5) - { - Block b=availableOres.getFrac(pgRand.nextFloat()); - String n="ma620."+b.name; - - if(Core.settings.has(n)) if(pgRand.chance(Core.settings.getFloat(n)/100f)) ores.add(b); - else if(pgRand.nextDouble()*2>=b.itemDrop.cost) ores.add(b); - } +// while(ores.size<5) +// { +// Block b=availableOres.getFrac(pgRand.nextFloat()); +// String n="ma620."+b.name; +// +// if(Core.settings.has(n)) if(pgRand.chance(Core.settings.getFloat(n)/100f)) ores.add(b); +// else if(pgRand.nextDouble()*2>=b.itemDrop.cost) ores.add(b); +// } } if(!hasSand && !ores.contains(oreScrap) && !ores.contains(b->b.itemDrop == Items.sand)) ores.add(oreScrap); @@ -1072,7 +1073,7 @@ void setOre(Block block) //if(Core.settings.getBool("ec620.room")) newRooms.add(new Room((int)lh.center.x,(int)lh.center.y,(int)lh.radius)); int m=fores.size*i/oSeq.size; m+=pgRand.random(-3,3); - if(m<0) m=pgRand.random(0,2); + if(m<0) m=pgRand.random(0,1); else if(m>= fores.size) m= pgRand.random(0,fores.size-1); for(Vec2 v:lh.pos) {