Custom fluids

This commit is contained in:
Daniel Mills 2020-09-05 02:59:45 -04:00
parent 44d800de1e
commit 5b6f1182fe
5 changed files with 37 additions and 4 deletions

11
pom.xml
View File

@ -161,6 +161,17 @@
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit.craftbukkit</groupId>
<artifactId>cb-1.16.2</artifactId>
<version>1.16.2</version>
<scope>provided</scope>
</dependency>
<!-- Utilities -->
<dependency>
<groupId>org.bstats</groupId>

View File

@ -149,6 +149,8 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
KList<BlockData> layers = biome.generateLayers(rx, rz, getMasterRandom(), height, height - getFluidHeight());
KList<BlockData> cavernLayers = null;
KList<BlockData> seaLayers = biome.isAquatic() || biome.isShore() ? biome.generateSeaLayers(rx, rz, getMasterRandom(), fluidHeight - height) : new KList<>();
BlockData biomeFluid = biome.getFluidType().isEmpty() ? null : B.get(biome.getFluidType());
boolean caverning = false;
KList<Integer> cavernHeights = new KList<>();
int lastCavernHeight = -1;
@ -234,7 +236,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
// Set Sea Material (water/lava)
if(underwater)
{
block = seaLayers.hasIndex(fluidHeight - k) ? seaLayers.get(depth) : getDimension().getFluid(rockRandom, wx, k, wz);
block = seaLayers.hasIndex(fluidHeight - k) ? seaLayers.get(depth) : biomeFluid != null ? biomeFluid : getDimension().getFluid(rockRandom, wx, k, wz);
}
// Set Surface Material for cavern layer surfaces

View File

@ -43,7 +43,7 @@ public class GenLayerUpdate extends BlockPopulator
{
PrecisionStopwatch p = PrecisionStopwatch.start();
AtomicSliverMap map = gen.getParallaxChunk(c.getX(), c.getZ());
RNG rx = rng.nextParallelRNG(c.getX()).nextParallelRNG(c.getZ());
RNG rx = rng.nextParallelRNG(c.getX() + r.nextInt()).nextParallelRNG(c.getZ() + r.nextInt());
for(int i = 0; i < 16; i++)
{
@ -60,9 +60,9 @@ public class GenLayerUpdate extends BlockPopulator
}
}
}
p.end();
gen.getMetrics().getUpdate().put(p.getMilliseconds());
}
public void update(Chunk c, int x, int y, int z, int rx, int rz, RNG rng)

View File

@ -42,6 +42,10 @@ public class IrisBiome extends IrisRegistrant implements IRare
@ArrayType(min = 1, type = IrisTextPlacement.class)
private KList<IrisTextPlacement> text = new KList<>();
@DontObfuscate
@Desc("The type of fluid if this biome is underwater")
private String fluidType = "";
@DontObfuscate
@Desc("Entity spawns to override or add to this biome")
@ArrayType(min = 1, type = IrisEntitySpawn.class)

View File

@ -0,0 +1,16 @@
package com.volmit.iris.util;
import org.bukkit.Chunk;
import org.bukkit.World;
import com.volmit.iris.gen.TerrainChunkGenerator;
public abstract class WorldGenLayer
{
public WorldGenLayer()
{
}
public abstract void gen(TerrainChunkGenerator g, Chunk c, int x, int z, World w, RNG r);
}