9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 12:29:20 +00:00

Cave fluids

This commit is contained in:
Daniel Mills
2020-09-09 04:13:21 -04:00
parent 8ffe6fa8fb
commit f5854f9342
5 changed files with 103 additions and 21 deletions

View File

@@ -0,0 +1,61 @@
package com.volmit.iris.object;
import org.bukkit.block.data.BlockData;
import com.volmit.iris.gen.atomics.AtomicCache;
import com.volmit.iris.util.B;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.Required;
import lombok.Data;
@Desc("Translate objects")
@Data
public class IrisCaveFluid
{
@Required
@MaxNumber(255)
@MinNumber(0)
@DontObfuscate
@Desc("The cave zoom. Higher values makes caves spread out further and branch less often, but are thicker.")
private int fluidHeight = 35;
@DontObfuscate
@Desc("Insead of fluidHeight & below being fluid, turning inverse height on will simply spawn fluid in this cave layer from min(max_height, cave_height) to the fluid height. Basically, fluid will spawn above the fluidHeight value instead of below the fluidHeight.")
private boolean inverseHeight = false;
@Required
@DontObfuscate
@Desc("The fluid type that should spawn here")
private String fluidType = "CAVE_AIR";
private transient AtomicCache<BlockData> fluidData = new AtomicCache<>();
public IrisCaveFluid()
{
}
public boolean hasFluid()
{
return !B.isAir(getFluid());
}
public BlockData getFluid()
{
return fluidData.aquire(() ->
{
BlockData b = B.get(getFluidType());
if(b != null)
{
return b;
}
return B.get("CAVE_AIR");
});
}
}

View File

@@ -21,6 +21,10 @@ public class IrisCaveLayer
@Desc("The horizontal slope this cave layer follows")
private IrisShapedGeneratorStyle horizontalSlope = new IrisShapedGeneratorStyle();
@DontObfuscate
@Desc("If defined, a cave fluid will fill this cave below (or above) the specified fluidHeight in this object.")
private IrisCaveFluid fluid = new IrisCaveFluid();
@MinNumber(0.001)
@DontObfuscate
@Desc("The cave zoom. Higher values makes caves spread out further and branch less often, but are thicker.")

View File

@@ -202,19 +202,14 @@ public class IrisDepositGenerator
continue;
}
boolean allow = true;
if(g.getDimension().isVanillaCaves())
boolean allow = false;
BlockData b = data.getBlockData(nx, ny, nz);
for(BlockData f : g.getDimension().getRockData())
{
allow = false;
BlockData b = data.getBlockData(nx, ny, nz);
for(BlockData f : g.getDimension().getRockData())
if(f.getMaterial().equals(b.getMaterial()))
{
if(f.getMaterial().equals(b.getMaterial()))
{
allow = true;
break;
}
allow = true;
break;
}
}