mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-01-06 15:51:30 +00:00
REMOVE FBD
This commit is contained in:
@@ -367,12 +367,12 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
|
||||
|
||||
if(j == i || j + i == 16)
|
||||
{
|
||||
chunk.setBlock(i, h, j, B.getBlockData("RED_TERRACOTTA").getType());
|
||||
chunk.setBlock(i, h, j, B.getBlockData("RED_TERRACOTTA").getMaterial());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
chunk.setBlock(i, h, j, B.getBlockData("BLACK_TERRACOTTA").getType());
|
||||
chunk.setBlock(i, h, j, B.getBlockData("BLACK_TERRACOTTA").getMaterial());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.File;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
@@ -26,10 +27,10 @@ public abstract class DimensionalTerrainProvider extends ContextualTerrainProvid
|
||||
{
|
||||
private String dimensionName;
|
||||
private IrisDimension forceDimension;
|
||||
protected static final FastBlockData AIR = FastBlockData.of(Material.AIR);
|
||||
protected static final FastBlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||
protected static final FastBlockData BEDROCK = FastBlockData.of(Material.BEDROCK);
|
||||
protected static final FastBlockData WATER = FastBlockData.of(Material.WATER);
|
||||
protected static final BlockData AIR = Material.AIR.createBlockData();
|
||||
protected static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||
protected static final BlockData BEDROCK = Material.BEDROCK.createBlockData();
|
||||
protected static final BlockData WATER = Material.WATER.createBlockData();
|
||||
|
||||
public DimensionalTerrainProvider(TerrainTarget t, String dimensionName)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.function.Function;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockDropItemEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
@@ -348,7 +349,7 @@ public class IrisTerrainProvider extends PostBlockTerrainProvider implements Iri
|
||||
return;
|
||||
}
|
||||
|
||||
FastBlockData data = FastBlockData.of(e.getBlockState().getBlockData());
|
||||
BlockData data = e.getBlockState().getBlockData();
|
||||
KList<ItemStack> drops = new KList<>();
|
||||
boolean skipParents = false;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
@@ -128,15 +129,15 @@ public abstract class ParallaxTerrainProvider extends TopographicTerrainProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, FastBlockData d)
|
||||
public void set(int x, int y, int z, BlockData d)
|
||||
{
|
||||
getParallaxSliver(x, z).set(y, d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FastBlockData get(int x, int y, int z)
|
||||
public BlockData get(int x, int y, int z)
|
||||
{
|
||||
FastBlockData b = sampleSliver(x, z).getBlock()[y];
|
||||
BlockData b = sampleSliver(x, z).getBlock()[y];
|
||||
return b == null ? AIR : b;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.volmit.iris.gen;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
@@ -84,7 +85,7 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
|
||||
}
|
||||
|
||||
@Override
|
||||
public FastBlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
if(y > 255 || y < 0)
|
||||
{
|
||||
@@ -94,7 +95,7 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
|
||||
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
|
||||
{
|
||||
getPostLock().lock();
|
||||
FastBlockData d = FastBlockData.of(currentData.getBlockData(x & 15, y, z & 15));
|
||||
BlockData d = currentData.getBlockData(x & 15, y, z & 15);
|
||||
getPostLock().unlock();
|
||||
return d;
|
||||
}
|
||||
@@ -103,22 +104,12 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPostBlock(int x, int y, int z, FastBlockData d, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
public void setPostBlock(int x, int y, int z, BlockData d, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
|
||||
{
|
||||
getPostLock().lock();
|
||||
|
||||
if(d.hasBlockData())
|
||||
{
|
||||
currentData.setBlock(x & 15, y, z & 15, d.getBlockData());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
currentData.setBlock(x & 15, y, z & 15, d.getType());
|
||||
}
|
||||
|
||||
currentData.setBlock(x & 15, y, z & 15, d);
|
||||
getPostLock().unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.volmit.iris.util.RNG;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@@ -128,7 +129,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
|
||||
RNG crand = getMasterRandom().nextParallelRNG(rx).nextParallelRNG(rz);
|
||||
FastBlockData block;
|
||||
BlockData block;
|
||||
int fluidHeight = getDimension().getFluidHeight();
|
||||
double ox = getModifiedX(rx, rz);
|
||||
double oz = getModifiedZ(rx, rz);
|
||||
@@ -149,10 +150,10 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
throw new RuntimeException("Null Biome!");
|
||||
}
|
||||
|
||||
KList<FastBlockData> layers = biome.generateLayers(rx, rz, getMasterRandom(), height, height - getFluidHeight(), getData());
|
||||
KList<FastBlockData> cavernLayers = null;
|
||||
KList<FastBlockData> seaLayers = biome.isAquatic() || biome.isShore() ? biome.generateSeaLayers(rx, rz, getMasterRandom(), fluidHeight - height, getData()) : new KList<>();
|
||||
FastBlockData biomeFluid = biome.getFluidType().isEmpty() ? null : B.get(biome.getFluidType());
|
||||
KList<BlockData> layers = biome.generateLayers(rx, rz, getMasterRandom(), height, height - getFluidHeight(), getData());
|
||||
KList<BlockData> cavernLayers = null;
|
||||
KList<BlockData> seaLayers = biome.isAquatic() || biome.isShore() ? biome.generateSeaLayers(rx, rz, getMasterRandom(), fluidHeight - height, getData()) : new KList<>();
|
||||
BlockData biomeFluid = biome.getFluidType().isEmpty() ? null : B.get(biome.getFluidType());
|
||||
|
||||
boolean caverning = false;
|
||||
KList<Integer> cavernHeights = new KList<>();
|
||||
@@ -314,9 +315,9 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
KList<FastBlockData> floor = caveBiome.generateLayers(wx, wz, rockRandom, i.getFloor() - 2, i.getFloor() - 2, getData());
|
||||
KList<FastBlockData> ceiling = caveBiome.generateLayers(wx + 256, wz + 256, rockRandom, (carvable ? getCarvedWaterHeight(rx, rz) : height) - i.getCeiling() - 2, (carvable ? getCarvedWaterHeight(rx, rz) : height) - i.getCeiling() - 2, getData());
|
||||
FastBlockData blockc = null;
|
||||
KList<BlockData> floor = caveBiome.generateLayers(wx, wz, rockRandom, i.getFloor() - 2, i.getFloor() - 2, getData());
|
||||
KList<BlockData> ceiling = caveBiome.generateLayers(wx + 256, wz + 256, rockRandom, (carvable ? getCarvedWaterHeight(rx, rz) : height) - i.getCeiling() - 2, (carvable ? getCarvedWaterHeight(rx, rz) : height) - i.getCeiling() - 2, getData());
|
||||
BlockData blockc = null;
|
||||
for(int j = 0; j < floor.size(); j++)
|
||||
{
|
||||
if(j == 0)
|
||||
@@ -368,7 +369,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
return map;
|
||||
}
|
||||
|
||||
private void decorateLand(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, FastBlockData block)
|
||||
private void decorateLand(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, BlockData block)
|
||||
{
|
||||
if(!getDimension().isDecorate())
|
||||
{
|
||||
@@ -384,7 +385,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
FastBlockData d = i.getBlockData(biome, rng.nextParallelRNG(38888 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
BlockData d = i.getBlockData(biome, rng.nextParallelRNG(38888 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -409,12 +410,12 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
if(d.getBlockData() instanceof Bisected && k < 254)
|
||||
if(d instanceof Bisected && k < 254)
|
||||
{
|
||||
FastBlockData bb = d.clone();
|
||||
Bisected t = ((Bisected) d.getBlockData());
|
||||
BlockData bb = d.clone();
|
||||
Bisected t = ((Bisected) d);
|
||||
t.setHalf(Half.TOP);
|
||||
Bisected b = ((Bisected) bb.getBlockData());
|
||||
Bisected b = ((Bisected) bb);
|
||||
b.setHalf(Half.BOTTOM);
|
||||
sliver.set(k + 1, bb);
|
||||
sliver.set(k + 2, d);
|
||||
@@ -423,7 +424,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
else
|
||||
{
|
||||
int stack = i.getHeight(rng.nextParallelRNG((int) (39456 + (10000 * i.getChance()) + i.getStackMax() + i.getStackMin() + i.getZoom())), rx, rz, getData());
|
||||
FastBlockData top = null;
|
||||
BlockData top = null;
|
||||
|
||||
if(stack > 1 && i.getTopPalette().hasElements())
|
||||
{
|
||||
@@ -439,7 +440,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
{
|
||||
for(int l = 0; l < stack; l++)
|
||||
{
|
||||
FastBlockData dd = i.getBlockData100(biome, rng.nextParallelRNG(38888 + l + biome.getRarity() + biome.getName().length() + j++), rx + l, rz - l, getData());
|
||||
BlockData dd = i.getBlockData100(biome, rng.nextParallelRNG(38888 + l + biome.getRarity() + biome.getName().length() + j++), rx + l, rz - l, getData());
|
||||
d = dd != null ? dd : d;
|
||||
sliver.set(k + l + 1, l == stack - 1 && top != null ? top : d);
|
||||
}
|
||||
@@ -451,7 +452,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
private void decorateCave(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, FastBlockData block)
|
||||
private void decorateCave(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, BlockData block)
|
||||
{
|
||||
if(!getDimension().isDecorate())
|
||||
{
|
||||
@@ -462,7 +463,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
|
||||
for(IrisDecorator i : biome.getDecorators())
|
||||
{
|
||||
FastBlockData d = i.getBlockData(biome, rng.nextParallelRNG(2333877 + biome.getRarity() + biome.getName().length() + +j++), rx, rz, getData());
|
||||
BlockData d = i.getBlockData(biome, rng.nextParallelRNG(2333877 + biome.getRarity() + biome.getName().length() + +j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -479,12 +480,12 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
if(d.getBlockData() instanceof Bisected && k < 254)
|
||||
if(d instanceof Bisected && k < 254)
|
||||
{
|
||||
FastBlockData bb = d.clone();
|
||||
Bisected t = ((Bisected) d.getBlockData());
|
||||
BlockData bb = d.clone();
|
||||
Bisected t = ((Bisected) d);
|
||||
t.setHalf(Half.TOP);
|
||||
Bisected b = ((Bisected) bb.getBlockData());
|
||||
Bisected b = ((Bisected) bb);
|
||||
b.setHalf(Half.BOTTOM);
|
||||
sliver.set(k + 1, bb);
|
||||
sliver.set(k + 2, d);
|
||||
@@ -534,7 +535,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
FastBlockData d = i.getBlockData(biome, getMasterRandom().nextParallelRNG(2555 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
BlockData d = i.getBlockData(biome, getMasterRandom().nextParallelRNG(2555 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
@@ -21,7 +22,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AtomicSliver
|
||||
{
|
||||
public static final FastBlockData AIR = B.getBlockData("AIR");
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
public static boolean forgetful = false;
|
||||
private transient Biome[] biome;
|
||||
private transient Biome onlyBiome;
|
||||
@@ -31,7 +32,7 @@ public class AtomicSliver
|
||||
private transient final byte x;
|
||||
private transient final byte z;
|
||||
private transient boolean modified = false;
|
||||
private FastBlockData[] block;
|
||||
private BlockData[] block;
|
||||
private KList<Byte> blockUpdates;
|
||||
private int highestBlock = 0;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class AtomicSliver
|
||||
this.x = (byte) x;
|
||||
this.z = (byte) z;
|
||||
blockUpdates = new KList<>(4);
|
||||
this.block = new FastBlockData[256];
|
||||
this.block = new BlockData[256];
|
||||
this.biome = new Biome[256];
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ public class AtomicSliver
|
||||
blockUpdates.remove(Byte.valueOf((byte) (y + Byte.MIN_VALUE)));
|
||||
}
|
||||
|
||||
public FastBlockData get(int h)
|
||||
public BlockData get(int h)
|
||||
{
|
||||
if(forgetful)
|
||||
{
|
||||
@@ -97,7 +98,7 @@ public class AtomicSliver
|
||||
h = 0;
|
||||
}
|
||||
|
||||
FastBlockData b = block[h];
|
||||
BlockData b = block[h];
|
||||
last = M.ms();
|
||||
|
||||
if(b == null)
|
||||
@@ -108,13 +109,13 @@ public class AtomicSliver
|
||||
return b;
|
||||
}
|
||||
|
||||
public FastBlockData getOrNull(int h)
|
||||
public BlockData getOrNull(int h)
|
||||
{
|
||||
if(forgetful || oob(h))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
FastBlockData b = block[h];
|
||||
BlockData b = block[h];
|
||||
last = M.ms();
|
||||
|
||||
if(b.getMaterial().equals(Material.AIR))
|
||||
@@ -125,7 +126,7 @@ public class AtomicSliver
|
||||
return b;
|
||||
}
|
||||
|
||||
public void set(int h, FastBlockData d)
|
||||
public void set(int h, BlockData d)
|
||||
{
|
||||
if(forgetful || oob(h))
|
||||
{
|
||||
@@ -139,7 +140,7 @@ public class AtomicSliver
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
public void setSilently(int h, FastBlockData d)
|
||||
public void setSilently(int h, BlockData d)
|
||||
{
|
||||
if(forgetful)
|
||||
{
|
||||
@@ -233,7 +234,7 @@ public class AtomicSliver
|
||||
|
||||
else
|
||||
{
|
||||
d.setBlock(x, i, z, block[i].getBlockData());
|
||||
d.setBlock(x, i, z, block[i]);
|
||||
}
|
||||
}
|
||||
lock.unlock();
|
||||
@@ -272,14 +273,14 @@ public class AtomicSliver
|
||||
public void read(DataInputStream din) throws IOException
|
||||
{
|
||||
lock.lock();
|
||||
this.block = new FastBlockData[256];
|
||||
this.block = new BlockData[256];
|
||||
|
||||
getUpdatables().clear();
|
||||
// Block Palette
|
||||
int p = din.readByte() - Byte.MIN_VALUE;
|
||||
int h = din.readByte() - Byte.MIN_VALUE;
|
||||
int u = din.readByte() - Byte.MIN_VALUE;
|
||||
KList<FastBlockData> palette = new KList<FastBlockData>();
|
||||
KList<BlockData> palette = new KList<BlockData>();
|
||||
highestBlock = h;
|
||||
|
||||
for(int i = 0; i < p; i++)
|
||||
@@ -316,8 +317,8 @@ public class AtomicSliver
|
||||
|
||||
for(int i = 0; i <= highestBlock; i++)
|
||||
{
|
||||
FastBlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getBlockData().getAsString(true);
|
||||
BlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getAsString(true);
|
||||
|
||||
if(!palette.contains(d))
|
||||
{
|
||||
@@ -337,8 +338,8 @@ public class AtomicSliver
|
||||
// Blocks
|
||||
for(int i = 0; i <= highestBlock; i++)
|
||||
{
|
||||
FastBlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getBlockData().getAsString(true);
|
||||
BlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getAsString(true);
|
||||
dos.writeByte(palette.indexOf(d) + Byte.MIN_VALUE);
|
||||
}
|
||||
|
||||
@@ -362,7 +363,7 @@ public class AtomicSliver
|
||||
{
|
||||
if(block[i] == null || block[i].equals(AIR))
|
||||
{
|
||||
FastBlockData b = atomicSliver.block[i];
|
||||
BlockData b = atomicSliver.block[i];
|
||||
if(b == null || b.equals(AIR))
|
||||
{
|
||||
continue;
|
||||
@@ -384,7 +385,7 @@ public class AtomicSliver
|
||||
|
||||
for(int i = 0; i < block.length; i++)
|
||||
{
|
||||
FastBlockData b = block[i];
|
||||
BlockData b = block[i];
|
||||
if(b != null)
|
||||
{
|
||||
if(b.getMaterial().equals(Material.AIR))
|
||||
@@ -392,15 +393,7 @@ public class AtomicSliver
|
||||
continue;
|
||||
}
|
||||
|
||||
if(b.hasBlockData())
|
||||
{
|
||||
currentData.setBlock(x, i, z, b.getBlockData());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
currentData.setBlock(x, i, z, b.getType());
|
||||
}
|
||||
currentData.setBlock(x, i, z, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.volmit.iris.gen.layer;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.volmit.iris.util.*;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.volmit.iris.gen.TopographicTerrainProvider;
|
||||
@@ -11,17 +12,13 @@ import com.volmit.iris.noise.FastNoiseDouble.CellularDistanceFunction;
|
||||
import com.volmit.iris.noise.FastNoiseDouble.CellularReturnType;
|
||||
import com.volmit.iris.noise.FastNoiseDouble.NoiseType;
|
||||
import com.volmit.iris.object.IrisCaveLayer;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
import com.volmit.iris.util.GenLayer;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public class GenLayerCave extends GenLayer
|
||||
{
|
||||
public static boolean bad = false;
|
||||
public static final FastBlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
|
||||
public static final FastBlockData AIR = B.getBlockData("AIR");
|
||||
public static final BlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
private static final KList<CaveResult> EMPTY = new KList<>();
|
||||
private final FastNoiseDouble gg;
|
||||
|
||||
@@ -55,7 +52,7 @@ public class GenLayerCave extends GenLayer
|
||||
public void generateCave(KList<CaveResult> result, double wxx, double wzz, int x, int z, AtomicSliver data, IrisCaveLayer layer, int seed)
|
||||
{
|
||||
double scale = layer.getCaveZoom();
|
||||
Function<Integer, FastBlockData> fluid = (height) ->
|
||||
Function<Integer, BlockData> fluid = (height) ->
|
||||
{
|
||||
if(!layer.getFluid().hasFluid(iris.getData()))
|
||||
{
|
||||
@@ -160,15 +157,15 @@ public class GenLayerCave extends GenLayer
|
||||
}
|
||||
}
|
||||
|
||||
public boolean dig(int x, int y, int z, AtomicSliver data, Function<Integer, FastBlockData> caveFluid)
|
||||
public boolean dig(int x, int y, int z, AtomicSliver data, Function<Integer, BlockData> caveFluid)
|
||||
{
|
||||
Material a = data.getTypeSafe(y);
|
||||
Material c = data.getTypeSafe(y + 1);
|
||||
Material d = data.getTypeSafe(y + 2);
|
||||
Material e = data.getTypeSafe(y + 3);
|
||||
Material f = data.getTypeSafe(y - 1);
|
||||
FastBlockData b = caveFluid.apply(y);
|
||||
FastBlockData b2 = caveFluid.apply(y + 1);
|
||||
BlockData b = caveFluid.apply(y);
|
||||
BlockData b2 = caveFluid.apply(y + 1);
|
||||
|
||||
if(can(a) && canAir(c, b) && canAir(f, b) && canWater(d) && canWater(e))
|
||||
{
|
||||
@@ -180,9 +177,9 @@ public class GenLayerCave extends GenLayer
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canAir(Material m, FastBlockData caveFluid)
|
||||
public boolean canAir(Material m, BlockData caveFluid)
|
||||
{
|
||||
return (B.isSolid(m) || (B.isDecorant(FastBlockData.of(m))) || m.equals(Material.AIR) || m.equals(caveFluid.getMaterial()) || m.equals(B.mat("CAVE_AIR").getMaterial())) && !m.equals(Material.BEDROCK);
|
||||
return (B.isSolid(m) || (B.isDecorant(m.createBlockData())) || m.equals(Material.AIR) || m.equals(caveFluid.getMaterial()) || m.equals(B.mat("CAVE_AIR").getMaterial())) && !m.equals(Material.BEDROCK);
|
||||
}
|
||||
|
||||
public boolean canWater(Material m)
|
||||
|
||||
@@ -18,13 +18,14 @@ import com.volmit.iris.util.RNG;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class GenLayerRavine extends GenLayer
|
||||
{
|
||||
private static final FastBlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||
private static final FastBlockData LAVA = B.get("LAVA");
|
||||
private static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||
private static final BlockData LAVA = B.get("LAVA");
|
||||
private CNG cng;
|
||||
|
||||
public GenLayerRavine(TopographicTerrainProvider iris, RNG rng)
|
||||
@@ -39,9 +40,9 @@ public class GenLayerRavine extends GenLayer
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void set(TerrainChunk pos, int x, int y, int z, FastBlockData b, HeightMap h, AtomicSliverMap map)
|
||||
private void set(TerrainChunk pos, int x, int y, int z, BlockData b, HeightMap h, AtomicSliverMap map)
|
||||
{
|
||||
pos.setBlock(x, y, z, b.getBlockData());
|
||||
pos.setBlock(x, y, z, b);
|
||||
map.getSliver(x, z).set(y, b);
|
||||
|
||||
if(h.getHeight(x, z) > y)
|
||||
@@ -50,12 +51,12 @@ public class GenLayerRavine extends GenLayer
|
||||
}
|
||||
}
|
||||
|
||||
private FastBlockData get(TerrainChunk pos, int x, int y, int z)
|
||||
private BlockData get(TerrainChunk pos, int x, int y, int z)
|
||||
{
|
||||
return FastBlockData.of(pos.getBlockData(x, y, z));
|
||||
return pos.getBlockData(x, y, z);
|
||||
}
|
||||
|
||||
private FastBlockData getSurfaceBlock(BiomeMap map, int n6, int i, RNG rmg)
|
||||
private BlockData getSurfaceBlock(BiomeMap map, int n6, int i, RNG rmg)
|
||||
{
|
||||
return map.getBiome(n6, i).getSurfaceBlock(n6, i, rmg, iris.getData());
|
||||
}
|
||||
@@ -163,7 +164,7 @@ public class GenLayerRavine extends GenLayer
|
||||
continue;
|
||||
}
|
||||
|
||||
FastBlockData bb = get(terrain, i, j, n6);
|
||||
BlockData bb = get(terrain, i, j, n6);
|
||||
|
||||
if(B.isWater(bb))
|
||||
{
|
||||
@@ -200,7 +201,7 @@ public class GenLayerRavine extends GenLayer
|
||||
continue;
|
||||
}
|
||||
|
||||
FastBlockData blockData = get(terrain, n6, j, i);
|
||||
BlockData blockData = get(terrain, n6, j, i);
|
||||
|
||||
if(isSurface(blockData))
|
||||
{
|
||||
@@ -242,7 +243,7 @@ public class GenLayerRavine extends GenLayer
|
||||
return bb;
|
||||
}
|
||||
|
||||
private boolean isDirt(FastBlockData d)
|
||||
private boolean isDirt(BlockData d)
|
||||
{
|
||||
//@builder
|
||||
Material m = d.getMaterial();
|
||||
@@ -252,7 +253,7 @@ public class GenLayerRavine extends GenLayer
|
||||
//@done
|
||||
}
|
||||
|
||||
private boolean isSurface(FastBlockData d)
|
||||
private boolean isSurface(BlockData d)
|
||||
{
|
||||
//@builder
|
||||
Material m = d.getMaterial();
|
||||
|
||||
@@ -13,10 +13,11 @@ import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.GenLayer;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public class GenLayerText extends GenLayer
|
||||
{
|
||||
public static final FastBlockData AIR = B.getBlockData("AIR");
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
|
||||
private final AtomicCache<IrisObject> debug = new AtomicCache<>();
|
||||
|
||||
@@ -30,7 +31,7 @@ public class GenLayerText extends GenLayer
|
||||
return debug.aquire(() -> createTextObject("Test", "Impact", 24, B.get("STONE")));
|
||||
}
|
||||
|
||||
public IrisObject createTextObject(String text, String font, int size, FastBlockData b)
|
||||
public IrisObject createTextObject(String text, String font, int size, BlockData b)
|
||||
{
|
||||
Font f = new Font(font, Font.PLAIN, size);
|
||||
int w = ((Graphics2D) new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB).getGraphics()).getFontMetrics(f).stringWidth(text);
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
@@ -129,7 +130,7 @@ public class GenLayerUpdate extends BlockPopulator
|
||||
public void update(Chunk c, int x, int y, int z, int rx, int rz, RNG rng)
|
||||
{
|
||||
Block b = c.getBlock(x, y, z);
|
||||
FastBlockData d = FastBlockData.of(b.getBlockData());
|
||||
BlockData d = b.getBlockData();
|
||||
|
||||
if(B.isLit(d))
|
||||
{
|
||||
@@ -211,7 +212,7 @@ public class GenLayerUpdate extends BlockPopulator
|
||||
scramble(inv, rng);
|
||||
}
|
||||
|
||||
public void updateStorage(Block b, FastBlockData data, int rx, int rz, RNG rng)
|
||||
public void updateStorage(Block b, BlockData data, int rx, int rz, RNG rng)
|
||||
{
|
||||
InventorySlotType slot = null;
|
||||
|
||||
@@ -285,9 +286,9 @@ public class GenLayerUpdate extends BlockPopulator
|
||||
inventory.setContents(nitems);
|
||||
}
|
||||
|
||||
public void updateLight(Block b, FastBlockData data)
|
||||
public void updateLight(Block b, BlockData data)
|
||||
{
|
||||
b.setType(Material.AIR, false);
|
||||
b.setBlockData(data.getBlockData(), false);
|
||||
b.setBlockData(data, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
@@ -92,7 +93,7 @@ public class ProvisionBukkit extends ChunkGenerator implements Provisioned
|
||||
{
|
||||
for(int k = 0; k < 16; k++)
|
||||
{
|
||||
FastBlockData b = FastBlockData.of(snapshot.getBlockData(i, (h * 16) + j, k));
|
||||
BlockData b = snapshot.getBlockData(i, (h * 16) + j, k);
|
||||
|
||||
if(!Iris.edit.get(cachedWorld, i + cx, (h * 16) + j, k + cz).equals(b))
|
||||
{
|
||||
|
||||
@@ -102,11 +102,9 @@ public class IrisComplex implements DataProvider
|
||||
.cache2D(64);
|
||||
chunkRngStream = rngStream.blockToChunkCoords();
|
||||
rockStream = dimension.getRockPalette().getLayerGenerator(rng.nextRNG(), data).stream()
|
||||
.select(dimension.getRockPalette().getBlockData(data))
|
||||
.convert((v) -> v.getBlockData());
|
||||
.select(dimension.getRockPalette().getBlockData(data));
|
||||
fluidStream = dimension.getFluidPalette().getLayerGenerator(rng.nextRNG(), data).stream()
|
||||
.select(dimension.getFluidPalette().getBlockData(data))
|
||||
.convert((v) -> v.getBlockData());
|
||||
.select(dimension.getFluidPalette().getBlockData(data));
|
||||
regionStream = dimension.getRegionStyle().create(rng.nextRNG()).stream()
|
||||
.zoom(dimension.getRegionZoom())
|
||||
.selectRarity(dimension.getRegions())
|
||||
@@ -197,7 +195,7 @@ public class IrisComplex implements DataProvider
|
||||
|
||||
if(atDepth + th >= depth)
|
||||
{
|
||||
return i.get(rng, x, y, z, data).getBlockData();
|
||||
return i.get(rng, x, y, z, data);
|
||||
}
|
||||
|
||||
atDepth += th;
|
||||
@@ -217,7 +215,7 @@ public class IrisComplex implements DataProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
FastBlockData block = i.getBlockData(b, rngc, x, z, data);
|
||||
BlockData block = i.getBlockData(b, rngc, x, z, data);
|
||||
|
||||
if(block != null)
|
||||
{
|
||||
|
||||
@@ -83,18 +83,18 @@ public class IrisTerrainGenerator
|
||||
|
||||
for(int i = 0; i < stack; i++)
|
||||
{
|
||||
h.set(ax, i + floor, az, deco.getBlockData100(b, rng, rx - i, rz + i, data).getBlockData());
|
||||
h.set(ax, i + floor, az, deco.getBlockData100(b, rng, rx - i, rz + i, data));
|
||||
}
|
||||
|
||||
if(deco.getTopPalette().isNotEmpty())
|
||||
{
|
||||
h.set(ax, stack + floor - 1, az, deco.getBlockDataForTop(b, rng, rx - stack, rz + stack, data).getBlockData());
|
||||
h.set(ax, stack + floor - 1, az, deco.getBlockDataForTop(b, rng, rx - stack, rz + stack, data));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
h.set(ax, floor, az, deco.getBlockData100(b, rng, rx, rz, data).getBlockData());
|
||||
h.set(ax, floor, az, deco.getBlockData100(b, rng, rx, rz, data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,18 +110,18 @@ public class IrisTerrainGenerator
|
||||
|
||||
for(int i = 0; i < stack; i++)
|
||||
{
|
||||
h.set(ax, -i + ceiling, az, cdeco.getBlockData100(b, rng, rx - i, rz + i, data).getBlockData());
|
||||
h.set(ax, -i + ceiling, az, cdeco.getBlockData100(b, rng, rx - i, rz + i, data));
|
||||
}
|
||||
|
||||
if(cdeco.getTopPalette().isNotEmpty())
|
||||
{
|
||||
h.set(ax, -stack + ceiling - 1, az, cdeco.getBlockDataForTop(b, rng, rx - stack, rz + stack, data).getBlockData());
|
||||
h.set(ax, -stack + ceiling - 1, az, cdeco.getBlockDataForTop(b, rng, rx - stack, rz + stack, data));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
h.set(ax, ceiling, az, cdeco.getBlockData100(b, rng, rx, rz, data).getBlockData());
|
||||
h.set(ax, ceiling, az, cdeco.getBlockData100(b, rng, rx, rz, data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ public class BlockDataHunkIOAdapter extends PaletteHunkIOAdapter<BlockData> {
|
||||
|
||||
@Override
|
||||
public BlockData read(DataInputStream din) throws IOException {
|
||||
return B.get(din.readUTF()).getBlockData();
|
||||
return B.get(din.readUTF());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,12 +36,12 @@ public class ChunkHunkView implements Hunk<BlockData>
|
||||
@Override
|
||||
public void setRaw(int x, int y, int z, BlockData t)
|
||||
{
|
||||
Iris.edit.set(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), FastBlockData.of(t));
|
||||
Iris.edit.set(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData getRaw(int x, int y, int z)
|
||||
{
|
||||
return Iris.edit.get(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16)).getBlockData();
|
||||
return Iris.edit.get(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.parallax;
|
||||
|
||||
import com.sun.tools.javac.code.Attribute;
|
||||
import com.volmit.iris.gen.v2.scaffold.hunk.io.HunkIOAdapter;
|
||||
import com.volmit.iris.gen.v2.scaffold.hunk.io.PaletteHunkIOAdapter;
|
||||
import com.volmit.iris.util.CompoundTag;
|
||||
|
||||
Reference in New Issue
Block a user