Spawnrates.

This commit is contained in:
bconlon 2020-07-18 20:37:44 -07:00
parent e7ec977e08
commit ab6faadecd
4 changed files with 21 additions and 51 deletions

View file

@ -45,9 +45,12 @@ public class BronzeDungeon extends AetherDungeon {
return false;
}
if (random.nextInt(25) != 0)
if (random.nextInt(40) != 0)
{
return false;
if (random.nextInt(60) != 0)
{
return false;
}
}
setBlocks(this.lockedBlock(), this.lockedLightBlock(), 20);

View file

@ -2,12 +2,10 @@ package com.legacy.aether.world.gen;
import java.util.Random;
import com.legacy.aether.world.util.AetherRandomTracker;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.MapGenStructure;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureStart;
import com.legacy.aether.world.gen.components.ComponentGoldenDungeon;
@ -26,17 +24,15 @@ public class MapGenGoldenDungeon extends MapGenStructure {
@Override
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) {
AetherRandomTracker tracker = AetherRandomTracker.INSTANCE;
int rand = tracker.testRandom(this.rand, 180);
if (this.rand.nextInt(120) != 0)
{
if (this.rand.nextInt(140) != 0)
{
return false;
}
}
if (rand != 0)
{
return false;
}
else
{
return chunkX % 10 == 0 && chunkZ % 10 == 0;
}
return chunkX % 10 == 0 && chunkZ % 10 == 0;
}
@Override

View file

@ -2,7 +2,6 @@ package com.legacy.aether.world.gen;
import java.util.Random;
import com.legacy.aether.world.util.AetherRandomTracker;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.MapGenStructure;
@ -22,17 +21,15 @@ public class MapGenSilverDungeon extends MapGenStructure {
@Override
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) {
AetherRandomTracker tracker = AetherRandomTracker.INSTANCE;
int rand = tracker.testRandom(this.rand, 60);
if (this.rand.nextInt(60) != 0)
{
if (this.rand.nextInt(80) != 0)
{
return false;
}
}
if (rand != 0)
{
return false;
}
else
{
return chunkX % 6 == 0 && chunkZ % 6 == 0;
}
return chunkX % 6 == 0 && chunkZ % 6 == 0;
}
@Override

View file

@ -1,26 +0,0 @@
package com.legacy.aether.world.util;
import java.util.Random;
public class AetherRandomTracker
{
public static AetherRandomTracker INSTANCE = new AetherRandomTracker();
public int lastRand = -1;
public int testRandom(Random random, int bound)
{
int inputRandom = random.nextInt(bound);
if (inputRandom != this.lastRand)
{
this.lastRand = inputRandom;
return inputRandom;
}
else
{
testRandom(random, bound);
}
return -1;
}
}