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
@@ -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
@@ -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)
@@ -42,11 +42,15 @@ 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)
private KList<IrisEntitySpawn> entitySpawns = new KList<>();
@ArrayType(min = 1, type = IrisEffect.class)
@DontObfuscate
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play arround the player even if where the effect was played is no longer in the biome the player is in.")
@@ -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);
}