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> <version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.bukkit.craftbukkit</groupId>
<artifactId>cb-1.16.2</artifactId>
<version>1.16.2</version>
<scope>provided</scope>
</dependency>
<!-- Utilities --> <!-- Utilities -->
<dependency> <dependency>
<groupId>org.bstats</groupId> <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> layers = biome.generateLayers(rx, rz, getMasterRandom(), height, height - getFluidHeight());
KList<BlockData> cavernLayers = null; KList<BlockData> cavernLayers = null;
KList<BlockData> seaLayers = biome.isAquatic() || biome.isShore() ? biome.generateSeaLayers(rx, rz, getMasterRandom(), fluidHeight - height) : new KList<>(); 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; boolean caverning = false;
KList<Integer> cavernHeights = new KList<>(); KList<Integer> cavernHeights = new KList<>();
int lastCavernHeight = -1; int lastCavernHeight = -1;
@ -234,7 +236,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
// Set Sea Material (water/lava) // Set Sea Material (water/lava)
if(underwater) 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 // Set Surface Material for cavern layer surfaces

View File

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

View File

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

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);
}