mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 20:19:06 +00:00
Faster block data!
This commit is contained in:
@@ -370,12 +370,12 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
|
||||
|
||||
if(j == i || j + i == 16)
|
||||
{
|
||||
chunk.setBlock(i, h, j, B.getBlockData("RED_TERRACOTTA"));
|
||||
chunk.setBlock(i, h, j, B.getBlockData("RED_TERRACOTTA").getType());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
chunk.setBlock(i, h, j, B.getBlockData("BLACK_TERRACOTTA"));
|
||||
chunk.setBlock(i, h, j, B.getBlockData("BLACK_TERRACOTTA").getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ 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;
|
||||
@@ -15,6 +14,7 @@ import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
@@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode;
|
||||
public abstract class DimensionalTerrainProvider extends ContextualTerrainProvider
|
||||
{
|
||||
private String dimensionName;
|
||||
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();
|
||||
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);
|
||||
|
||||
public DimensionalTerrainProvider(TerrainTarget t, String dimensionName)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@ 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;
|
||||
@@ -31,6 +30,7 @@ import com.volmit.iris.object.IrisEffect;
|
||||
import com.volmit.iris.object.IrisEntityInitialSpawn;
|
||||
import com.volmit.iris.object.IrisEntitySpawnOverride;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IrisStructureResult;
|
||||
import com.volmit.iris.util.KList;
|
||||
@@ -331,7 +331,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
|
||||
return;
|
||||
}
|
||||
|
||||
BlockData data = e.getBlockState().getBlockData();
|
||||
FastBlockData data = FastBlockData.of(e.getBlockState().getBlockData());
|
||||
KList<ItemStack> drops = new KList<>();
|
||||
boolean skipParents = false;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ 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;
|
||||
|
||||
@@ -29,6 +28,7 @@ import com.volmit.iris.util.BiomeMap;
|
||||
import com.volmit.iris.util.CarveResult;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
import com.volmit.iris.util.ChunkPosition;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.HeightMap;
|
||||
import com.volmit.iris.util.IObjectPlacer;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
@@ -129,15 +129,15 @@ public abstract class ParallaxTerrainProvider extends TopographicTerrainProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, BlockData d)
|
||||
public void set(int x, int y, int z, FastBlockData d)
|
||||
{
|
||||
getParallaxSliver(x, z).set(y, d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData get(int x, int y, int z)
|
||||
public FastBlockData get(int x, int y, int z)
|
||||
{
|
||||
BlockData b = sampleSliver(x, z).getBlock()[y];
|
||||
FastBlockData b = sampleSliver(x, z).getBlock()[y];
|
||||
return b == null ? AIR : b;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.volmit.iris.gen;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
@@ -8,6 +7,7 @@ import com.volmit.iris.gen.post.PostMasterPatcher;
|
||||
import com.volmit.iris.gen.scaffold.TerrainChunk;
|
||||
import com.volmit.iris.gen.scaffold.TerrainTarget;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.IPostBlockAccess;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.KList;
|
||||
@@ -83,17 +83,17 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
public FastBlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
if(y > 255 || y < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
|
||||
{
|
||||
getPostLock().lock();
|
||||
BlockData d = currentData.getBlockData(x & 15, y, z & 15);
|
||||
FastBlockData d = FastBlockData.of(currentData.getBlockData(x & 15, y, z & 15));
|
||||
getPostLock().unlock();
|
||||
return d;
|
||||
}
|
||||
@@ -102,12 +102,22 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPostBlock(int x, int y, int z, BlockData d, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
public void setPostBlock(int x, int y, int z, FastBlockData d, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
|
||||
{
|
||||
getPostLock().lock();
|
||||
currentData.setBlock(x & 15, y, z & 15, d);
|
||||
|
||||
if(d.hasBlockData())
|
||||
{
|
||||
currentData.setBlock(x & 15, y, z & 15, d.getBlockData());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
currentData.setBlock(x & 15, y, z & 15, d.getType());
|
||||
}
|
||||
|
||||
getPostLock().unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.Bisected.Half;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.atomics.AtomicSliver;
|
||||
@@ -29,6 +28,7 @@ import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.BiomeMap;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.HeightMap;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.KList;
|
||||
@@ -70,6 +70,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
@Override
|
||||
public void onInit(RNG rng)
|
||||
{
|
||||
generatorSize = 0;
|
||||
super.onInit(rng);
|
||||
getData().preferFolder(getDimension().getLoadFile().getParentFile().getParentFile().getName());
|
||||
buildGenLayers(getMasterRandom());
|
||||
@@ -126,7 +127,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
|
||||
RNG crand = getMasterRandom().nextParallelRNG(rx).nextParallelRNG(rz);
|
||||
BlockData block;
|
||||
FastBlockData block;
|
||||
int fluidHeight = getDimension().getFluidHeight();
|
||||
double ox = getModifiedX(rx, rz);
|
||||
double oz = getModifiedZ(rx, rz);
|
||||
@@ -146,10 +147,10 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
throw new RuntimeException("Null Biome!");
|
||||
}
|
||||
|
||||
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());
|
||||
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());
|
||||
|
||||
boolean caverning = false;
|
||||
KList<Integer> cavernHeights = new KList<>();
|
||||
@@ -306,9 +307,9 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
for(int j = 0; j < floor.size(); j++)
|
||||
{
|
||||
if(j == 0)
|
||||
@@ -351,7 +352,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
private void decorateLand(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, BlockData block)
|
||||
private void decorateLand(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, FastBlockData block)
|
||||
{
|
||||
if(!getDimension().isDecorate())
|
||||
{
|
||||
@@ -367,7 +368,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData d = i.getBlockData(biome, rng.nextParallelRNG(38888 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
FastBlockData d = i.getBlockData(biome, rng.nextParallelRNG(38888 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -392,14 +393,15 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
if(d instanceof Bisected && k < 254)
|
||||
if(d.getBlockData() instanceof Bisected && k < 254)
|
||||
{
|
||||
Bisected t = ((Bisected) d.clone());
|
||||
FastBlockData bb = d.clone();
|
||||
Bisected t = ((Bisected) d.getBlockData());
|
||||
t.setHalf(Half.TOP);
|
||||
Bisected b = ((Bisected) d.clone());
|
||||
Bisected b = ((Bisected) bb.getBlockData());
|
||||
b.setHalf(Half.BOTTOM);
|
||||
sliver.set(k + 1, b);
|
||||
sliver.set(k + 2, t);
|
||||
sliver.set(k + 1, bb);
|
||||
sliver.set(k + 2, d);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -425,7 +427,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
private void decorateCave(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, BlockData block)
|
||||
private void decorateCave(RNG rng, IrisBiome biome, AtomicSliver sliver, int k, int rx, int rz, FastBlockData block)
|
||||
{
|
||||
if(!getDimension().isDecorate())
|
||||
{
|
||||
@@ -436,7 +438,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
|
||||
for(IrisBiomeDecorator i : biome.getDecorators())
|
||||
{
|
||||
BlockData d = i.getBlockData(biome, rng.nextParallelRNG(2333877 + biome.getRarity() + biome.getName().length() + +j++), rx, rz, getData());
|
||||
FastBlockData d = i.getBlockData(biome, rng.nextParallelRNG(2333877 + biome.getRarity() + biome.getName().length() + +j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -453,14 +455,15 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
if(d instanceof Bisected && k < 254)
|
||||
if(d.getBlockData() instanceof Bisected && k < 254)
|
||||
{
|
||||
Bisected t = ((Bisected) d.clone());
|
||||
FastBlockData bb = d.clone();
|
||||
Bisected t = ((Bisected) d.getBlockData());
|
||||
t.setHalf(Half.TOP);
|
||||
Bisected b = ((Bisected) d.clone());
|
||||
Bisected b = ((Bisected) bb.getBlockData());
|
||||
b.setHalf(Half.BOTTOM);
|
||||
sliver.set(k + 1, b);
|
||||
sliver.set(k + 2, t);
|
||||
sliver.set(k + 1, bb);
|
||||
sliver.set(k + 2, d);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -507,7 +510,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData d = i.getBlockData(biome, getMasterRandom().nextParallelRNG(2555 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
FastBlockData d = i.getBlockData(biome, getMasterRandom().nextParallelRNG(2555 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -723,6 +726,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
@Override
|
||||
public void onHotload()
|
||||
{
|
||||
generatorSize = 0;
|
||||
super.onHotload();
|
||||
getData().preferFolder(getDimension().getLoadFile().getParentFile().getParentFile().getName());
|
||||
loadGenerators();
|
||||
@@ -756,7 +760,15 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
|
||||
for(int j = 0; j < generatorSize; j++)
|
||||
{
|
||||
h += interpolateGenerator(rrx, rrz, generatorList.get(j));
|
||||
try
|
||||
{
|
||||
h += interpolateGenerator(rrx, rrz, generatorList.get(j));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return h;
|
||||
|
||||
@@ -6,12 +6,12 @@ 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;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.HeightMap;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.KList;
|
||||
@@ -22,7 +22,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AtomicSliver
|
||||
{
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
public static final FastBlockData AIR = B.getBlockData("AIR");
|
||||
public static boolean forgetful = false;
|
||||
private transient Biome[] biome;
|
||||
private transient Biome onlyBiome;
|
||||
@@ -32,7 +32,7 @@ public class AtomicSliver
|
||||
private transient final byte x;
|
||||
private transient final byte z;
|
||||
private transient boolean modified = false;
|
||||
private BlockData[] block;
|
||||
private FastBlockData[] block;
|
||||
private KList<Byte> blockUpdates;
|
||||
private int highestBlock = 0;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class AtomicSliver
|
||||
this.x = (byte) x;
|
||||
this.z = (byte) z;
|
||||
blockUpdates = new KList<>(4);
|
||||
this.block = new BlockData[256];
|
||||
this.block = new FastBlockData[256];
|
||||
this.biome = new Biome[256];
|
||||
}
|
||||
|
||||
@@ -81,13 +81,13 @@ public class AtomicSliver
|
||||
blockUpdates.remove(Byte.valueOf((byte) (y + Byte.MIN_VALUE)));
|
||||
}
|
||||
|
||||
public BlockData get(int h)
|
||||
public FastBlockData get(int h)
|
||||
{
|
||||
if(forgetful)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlockData b = block[h];
|
||||
FastBlockData b = block[h];
|
||||
last = M.ms();
|
||||
|
||||
if(b == null)
|
||||
@@ -98,13 +98,13 @@ public class AtomicSliver
|
||||
return b;
|
||||
}
|
||||
|
||||
public BlockData getOrNull(int h)
|
||||
public FastBlockData getOrNull(int h)
|
||||
{
|
||||
if(forgetful || oob(h))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlockData b = block[h];
|
||||
FastBlockData b = block[h];
|
||||
last = M.ms();
|
||||
|
||||
if(b.getMaterial().equals(Material.AIR))
|
||||
@@ -115,7 +115,7 @@ public class AtomicSliver
|
||||
return b;
|
||||
}
|
||||
|
||||
public void set(int h, BlockData d)
|
||||
public void set(int h, FastBlockData d)
|
||||
{
|
||||
if(forgetful || oob(h))
|
||||
{
|
||||
@@ -129,7 +129,7 @@ public class AtomicSliver
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
public void setSilently(int h, BlockData d)
|
||||
public void setSilently(int h, FastBlockData d)
|
||||
{
|
||||
if(forgetful)
|
||||
{
|
||||
@@ -217,13 +217,13 @@ public class AtomicSliver
|
||||
{
|
||||
if(!skipNull)
|
||||
{
|
||||
d.setBlock(x, i, z, AIR);
|
||||
d.setBlock(x, i, z, AIR.getMaterial());
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
d.setBlock(x, i, z, block[i]);
|
||||
d.setBlock(x, i, z, block[i].getBlockData());
|
||||
}
|
||||
}
|
||||
lock.unlock();
|
||||
@@ -262,14 +262,14 @@ public class AtomicSliver
|
||||
public void read(DataInputStream din) throws IOException
|
||||
{
|
||||
lock.lock();
|
||||
this.block = new BlockData[256];
|
||||
this.block = new FastBlockData[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<BlockData> palette = new KList<BlockData>();
|
||||
KList<FastBlockData> palette = new KList<FastBlockData>();
|
||||
highestBlock = h;
|
||||
|
||||
for(int i = 0; i < p; i++)
|
||||
@@ -306,8 +306,8 @@ public class AtomicSliver
|
||||
|
||||
for(int i = 0; i <= highestBlock; i++)
|
||||
{
|
||||
BlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getAsString(true);
|
||||
FastBlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getBlockData().getAsString(true);
|
||||
|
||||
if(!palette.contains(d))
|
||||
{
|
||||
@@ -327,8 +327,8 @@ public class AtomicSliver
|
||||
// Blocks
|
||||
for(int i = 0; i <= highestBlock; i++)
|
||||
{
|
||||
BlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getAsString(true);
|
||||
FastBlockData dat = block[i];
|
||||
String d = (dat == null ? AIR : dat).getBlockData().getAsString(true);
|
||||
dos.writeByte(palette.indexOf(d) + Byte.MIN_VALUE);
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ public class AtomicSliver
|
||||
{
|
||||
if(block[i] == null || block[i].equals(AIR))
|
||||
{
|
||||
BlockData b = atomicSliver.block[i];
|
||||
FastBlockData b = atomicSliver.block[i];
|
||||
if(b == null || b.equals(AIR))
|
||||
{
|
||||
continue;
|
||||
@@ -374,7 +374,7 @@ public class AtomicSliver
|
||||
|
||||
for(int i = 0; i < block.length; i++)
|
||||
{
|
||||
BlockData b = block[i];
|
||||
FastBlockData b = block[i];
|
||||
if(b != null)
|
||||
{
|
||||
if(b.getMaterial().equals(Material.AIR))
|
||||
@@ -382,7 +382,15 @@ public class AtomicSliver
|
||||
continue;
|
||||
}
|
||||
|
||||
currentData.setBlock(x, i, z, b);
|
||||
if(b.hasBlockData())
|
||||
{
|
||||
currentData.setBlock(x, i, z, b.getBlockData());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
currentData.setBlock(x, i, z, b.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ public class BiomeDataProvider
|
||||
private InferredType type;
|
||||
private CNG generator;
|
||||
private GenLayerBiome layer;
|
||||
private double offx = 0;
|
||||
private double offz = 0;
|
||||
|
||||
public BiomeDataProvider(@NonNull GenLayerBiome layer, @NonNull InferredType type, @NonNull RNG rng)
|
||||
{
|
||||
@@ -31,16 +33,22 @@ public class BiomeDataProvider
|
||||
Iris.error("BIOME STYLE IS NULL FOR " + type);
|
||||
}
|
||||
|
||||
generator = b.create(rng.nextParallelRNG(4645079 + (type.ordinal() * 23845)));
|
||||
generator = b.create(rng.nextParallelRNG((layer.getIris().getDimension().isAggressiveBiomeReshuffle() ? (177 + type.ordinal() + rng.nextParallelRNG(229 - type.ordinal()).nextInt()) : 4645079) + (type.ordinal() * 23845)));
|
||||
|
||||
if(layer.getIris().getDimension().isAggressiveBiomeReshuffle())
|
||||
{
|
||||
offx += generator.fitDouble(-1000, 1000, 10000, -10000);
|
||||
offz += generator.fitDouble(-1000, 1000, -10000, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
public IrisBiome generatePureData(ContextualTerrainProvider g, double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
return layer.generateBiomeData(bx, bz, regionData, getGenerator(), regionData.getBiomes(g, getType()), getType(), rawX, rawZ, true);
|
||||
return layer.generateBiomeData(bx + offx, bz + offz, regionData, getGenerator(), regionData.getBiomes(g, getType()), getType(), (int) (rawX + offx), (int) (rawZ + offz), true);
|
||||
}
|
||||
|
||||
public IrisBiome generateData(ContextualTerrainProvider g, double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
return layer.generateBiomeData(bx, bz, regionData, getGenerator(), regionData.getBiomes(g, getType()), getType(), rawX, rawZ, false);
|
||||
return layer.generateBiomeData(bx + offx, bz + offz, regionData, getGenerator(), regionData.getBiomes(g, getType()), getType(), (int) (rawX + offx), (int) (rawZ + offz), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,14 @@ public class GenLayerBiome extends GenLayer
|
||||
this.iris = iris;
|
||||
riverRandom = iris.getMasterRandom().nextParallelRNG(-324778);
|
||||
lakeRandom = iris.getMasterRandom().nextParallelRNG(-868778);
|
||||
seaProvider = new BiomeDataProvider(this, InferredType.SEA, rng);
|
||||
landProvider = new BiomeDataProvider(this, InferredType.LAND, rng);
|
||||
shoreProvider = new BiomeDataProvider(this, InferredType.SHORE, rng);
|
||||
caveProvider = new BiomeDataProvider(this, InferredType.CAVE, rng);
|
||||
riverProvider = new BiomeDataProvider(this, InferredType.RIVER, rng);
|
||||
lakeProvider = new BiomeDataProvider(this, InferredType.LAKE, rng);
|
||||
regionGenerator = iris.getDimension().getRegionStyle().create(rng.nextParallelRNG(1188519)).bake().scale(1D / iris.getDimension().getRegionZoom());
|
||||
bridgeGenerator = iris.getDimension().getContinentalStyle().create(rng.nextParallelRNG(1541462)).bake().scale(1D / iris.getDimension().getContinentZoom());
|
||||
seaProvider = new BiomeDataProvider(this, InferredType.SEA, !iris.getDimension().isAggressiveBiomeReshuffle() ? rng : rng.nextParallelRNG((int) (29866777 * iris.getDimension().getCoordFractureZoom())));
|
||||
landProvider = new BiomeDataProvider(this, InferredType.LAND, !iris.getDimension().isAggressiveBiomeReshuffle() ? rng : rng.nextParallelRNG(-38356777 * iris.getMasterRandom().nextParallelRNG(2344).nextInt()));
|
||||
shoreProvider = new BiomeDataProvider(this, InferredType.SHORE, !iris.getDimension().isAggressiveBiomeReshuffle() ? rng : rng.nextParallelRNG(29899571 + iris.getMasterRandom().nextParallelRNG(-222344).nextInt()));
|
||||
caveProvider = new BiomeDataProvider(this, InferredType.CAVE, !iris.getDimension().isAggressiveBiomeReshuffle() ? rng : rng.nextParallelRNG(983564346 * -iris.getMasterRandom().nextParallelRNG(-44).nextInt()));
|
||||
riverProvider = new BiomeDataProvider(this, InferredType.RIVER, !iris.getDimension().isAggressiveBiomeReshuffle() ? rng : rng.nextParallelRNG(-266717 - iris.getMasterRandom().nextParallelRNG(8100044).nextInt()));
|
||||
lakeProvider = new BiomeDataProvider(this, InferredType.LAKE, !iris.getDimension().isAggressiveBiomeReshuffle() ? rng : rng.nextParallelRNG((int) (-298356111 * iris.getTarget().getSeed())));
|
||||
regionGenerator = iris.getDimension().getRegionStyle().create(rng.nextParallelRNG(1188519 + (iris.getDimension().isAggressiveBiomeReshuffle() ? 329395 + (iris.getDimension().getName().hashCode()) : 0))).bake().scale(1D / iris.getDimension().getRegionZoom());
|
||||
bridgeGenerator = iris.getDimension().getContinentalStyle().create(rng.nextParallelRNG(1541462 + (iris.getDimension().isAggressiveBiomeReshuffle() ? 29355 * (iris.getDimension().getRegions().size()) : 0))).bake().scale(1D / iris.getDimension().getContinentZoom());
|
||||
}
|
||||
|
||||
public IrisRegion getRegion(double bx, double bz)
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.volmit.iris.gen.layer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.TopographicTerrainProvider;
|
||||
import com.volmit.iris.gen.atomics.AtomicSliver;
|
||||
@@ -14,6 +13,7 @@ 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.FastBlockData;
|
||||
import com.volmit.iris.util.GenLayer;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.RNG;
|
||||
@@ -21,8 +21,8 @@ import com.volmit.iris.util.RNG;
|
||||
public class GenLayerCave extends GenLayer
|
||||
{
|
||||
public static boolean bad = false;
|
||||
public static final BlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
public static final FastBlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
|
||||
public static final FastBlockData AIR = B.getBlockData("AIR");
|
||||
private static final KList<CaveResult> EMPTY = new KList<>();
|
||||
private final FastNoiseDouble gg;
|
||||
|
||||
@@ -56,7 +56,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, BlockData> fluid = (height) ->
|
||||
Function<Integer, FastBlockData> fluid = (height) ->
|
||||
{
|
||||
if(!layer.getFluid().hasFluid(iris.getData()))
|
||||
{
|
||||
@@ -161,15 +161,15 @@ public class GenLayerCave extends GenLayer
|
||||
}
|
||||
}
|
||||
|
||||
public boolean dig(int x, int y, int z, AtomicSliver data, Function<Integer, BlockData> caveFluid)
|
||||
public boolean dig(int x, int y, int z, AtomicSliver data, Function<Integer, FastBlockData> 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);
|
||||
BlockData b = caveFluid.apply(y);
|
||||
BlockData b2 = caveFluid.apply(y + 1);
|
||||
FastBlockData b = caveFluid.apply(y);
|
||||
FastBlockData b2 = caveFluid.apply(y + 1);
|
||||
|
||||
if(can(a) && canAir(c, b) && canAir(f, b) && canWater(d) && canWater(e))
|
||||
{
|
||||
@@ -181,9 +181,9 @@ public class GenLayerCave extends GenLayer
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canAir(Material m, BlockData caveFluid)
|
||||
public boolean canAir(Material m, FastBlockData caveFluid)
|
||||
{
|
||||
return (B.isSolid(m) || (B.isDecorant(m)) || m.equals(Material.AIR) || m.equals(caveFluid.getMaterial()) || m.equals(B.mat("CAVE_AIR"))) && !m.equals(Material.BEDROCK);
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean canWater(Material m)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.volmit.iris.gen.layer;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.TopographicTerrainProvider;
|
||||
import com.volmit.iris.gen.atomics.AtomicSliverMap;
|
||||
@@ -12,6 +11,7 @@ import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.BiomeMap;
|
||||
import com.volmit.iris.util.BlockPosition;
|
||||
import com.volmit.iris.util.ChunkPosition;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.GenLayer;
|
||||
import com.volmit.iris.util.HeightMap;
|
||||
import com.volmit.iris.util.MathHelper;
|
||||
@@ -24,8 +24,8 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class GenLayerRavine extends GenLayer
|
||||
{
|
||||
private static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||
private static final BlockData LAVA = B.get("LAVA");
|
||||
private static final FastBlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||
private static final FastBlockData LAVA = B.get("LAVA");
|
||||
private CNG cng;
|
||||
|
||||
public GenLayerRavine(TopographicTerrainProvider iris, RNG rng)
|
||||
@@ -40,9 +40,9 @@ public class GenLayerRavine extends GenLayer
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void set(TerrainChunk pos, int x, int y, int z, BlockData b, HeightMap h, AtomicSliverMap map)
|
||||
private void set(TerrainChunk pos, int x, int y, int z, FastBlockData b, HeightMap h, AtomicSliverMap map)
|
||||
{
|
||||
pos.setBlock(x, y, z, b);
|
||||
pos.setBlock(x, y, z, b.getBlockData());
|
||||
map.getSliver(x, z).set(y, b);
|
||||
|
||||
if(h.getHeight(x, z) > y)
|
||||
@@ -51,12 +51,12 @@ public class GenLayerRavine extends GenLayer
|
||||
}
|
||||
}
|
||||
|
||||
private BlockData get(TerrainChunk pos, int x, int y, int z)
|
||||
private FastBlockData get(TerrainChunk pos, int x, int y, int z)
|
||||
{
|
||||
return pos.getBlockData(x, y, z);
|
||||
return FastBlockData.of(pos.getBlockData(x, y, z));
|
||||
}
|
||||
|
||||
private BlockData getSurfaceBlock(BiomeMap map, int n6, int i, RNG rmg)
|
||||
private FastBlockData getSurfaceBlock(BiomeMap map, int n6, int i, RNG rmg)
|
||||
{
|
||||
return map.getBiome(n6, i).getSurfaceBlock(n6, i, rmg, iris.getData());
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class GenLayerRavine extends GenLayer
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData bb = get(terrain, i, j, n6);
|
||||
FastBlockData bb = get(terrain, i, j, n6);
|
||||
|
||||
if(B.isWater(bb))
|
||||
{
|
||||
@@ -201,7 +201,7 @@ public class GenLayerRavine extends GenLayer
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData blockData = get(terrain, n6, j, i);
|
||||
FastBlockData blockData = get(terrain, n6, j, i);
|
||||
|
||||
if(isSurface(blockData))
|
||||
{
|
||||
@@ -243,7 +243,7 @@ public class GenLayerRavine extends GenLayer
|
||||
return bb;
|
||||
}
|
||||
|
||||
private boolean isDirt(BlockData d)
|
||||
private boolean isDirt(FastBlockData d)
|
||||
{
|
||||
//@builder
|
||||
Material m = d.getMaterial();
|
||||
@@ -253,7 +253,7 @@ public class GenLayerRavine extends GenLayer
|
||||
//@done
|
||||
}
|
||||
|
||||
private boolean isSurface(BlockData d)
|
||||
private boolean isSurface(FastBlockData d)
|
||||
{
|
||||
//@builder
|
||||
Material m = d.getMaterial();
|
||||
|
||||
@@ -5,20 +5,19 @@ import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.TopographicTerrainProvider;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.object.IrisMaterialPalette;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.GenLayer;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
public class GenLayerText extends GenLayer
|
||||
{
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
public static final FastBlockData AIR = B.getBlockData("AIR");
|
||||
|
||||
private final AtomicCache<IrisObject> debug = new AtomicCache<>();
|
||||
|
||||
@@ -29,11 +28,10 @@ public class GenLayerText extends GenLayer
|
||||
|
||||
public IrisObject getDebug()
|
||||
{
|
||||
return debug.aquire(() ->
|
||||
createTextObject("Test", "Impact", 24, B.get("STONE")));
|
||||
return debug.aquire(() -> createTextObject("Test", "Impact", 24, B.get("STONE")));
|
||||
}
|
||||
|
||||
public IrisObject createTextObject(String text, String font, int size, BlockData b)
|
||||
public IrisObject createTextObject(String text, String font, int size, FastBlockData 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);
|
||||
|
||||
@@ -6,7 +6,6 @@ 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;
|
||||
@@ -25,6 +24,7 @@ import com.volmit.iris.object.IrisLootTable;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.object.LootMode;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.IrisStructureResult;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.PrecisionStopwatch;
|
||||
@@ -62,7 +62,7 @@ public class GenLayerUpdate extends BlockPopulator
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
((IrisTerrainProvider) gen).spawnInitials(c, rx);
|
||||
p.end();
|
||||
@@ -129,14 +129,14 @@ 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);
|
||||
BlockData d = b.getBlockData();
|
||||
FastBlockData d = FastBlockData.of(b.getBlockData());
|
||||
|
||||
if(B.isLit(d.getMaterial()))
|
||||
if(B.isLit(d))
|
||||
{
|
||||
updateLight(b, d);
|
||||
}
|
||||
|
||||
else if(B.isStorage(d.getMaterial()))
|
||||
else if(B.isStorage(d))
|
||||
{
|
||||
updateStorage(b, d, rx, rz, rng);
|
||||
}
|
||||
@@ -219,11 +219,11 @@ public class GenLayerUpdate extends BlockPopulator
|
||||
scramble(inv, rng);
|
||||
}
|
||||
|
||||
public void updateStorage(Block b, BlockData data, int rx, int rz, RNG rng)
|
||||
public void updateStorage(Block b, FastBlockData data, int rx, int rz, RNG rng)
|
||||
{
|
||||
InventorySlotType slot = null;
|
||||
|
||||
if(B.isStorageChest(data.getMaterial()))
|
||||
if(B.isStorageChest(data))
|
||||
{
|
||||
slot = InventorySlotType.STORAGE;
|
||||
}
|
||||
@@ -307,9 +307,9 @@ public class GenLayerUpdate extends BlockPopulator
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLight(Block b, BlockData data)
|
||||
public void updateLight(Block b, FastBlockData data)
|
||||
{
|
||||
b.setType(Material.AIR, false);
|
||||
b.setBlockData(data, false);
|
||||
b.setBlockData(data.getBlockData(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.volmit.iris.gen.post;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
import org.bukkit.block.data.type.Slab.Type;
|
||||
@@ -13,14 +12,15 @@ import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
{
|
||||
private static final BlockData WATER = B.getBlockData("WATER");
|
||||
private static final BlockData AIR = B.getBlockData("AIR");
|
||||
private static final FastBlockData WATER = B.getBlockData("WATER");
|
||||
private static final FastBlockData AIR = B.getBlockData("AIR");
|
||||
private final RNG rng;
|
||||
|
||||
@DontObfuscate
|
||||
@@ -82,8 +82,8 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|
||||
if(g >= 3)
|
||||
{
|
||||
BlockData bc = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
|
||||
BlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bc = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData b = getPostBlock(x, h + 1, z, currentPostX, currentPostZ, currentData);
|
||||
Material m = bc.getMaterial();
|
||||
|
||||
if(m.isSolid())
|
||||
@@ -105,10 +105,10 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|
||||
if(g >= 3)
|
||||
{
|
||||
BlockData ba = getPostBlock(x, ha, z, currentPostX, currentPostZ, currentData);
|
||||
BlockData bb = getPostBlock(x, hb, z, currentPostX, currentPostZ, currentData);
|
||||
BlockData bc = getPostBlock(x, hc, z, currentPostX, currentPostZ, currentData);
|
||||
BlockData bd = getPostBlock(x, hd, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData ba = getPostBlock(x, ha, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bb = getPostBlock(x, hb, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bc = getPostBlock(x, hc, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bd = getPostBlock(x, hd, z, currentPostX, currentPostZ, currentData);
|
||||
g = 0;
|
||||
g = B.isSolid(ba) ? g + 1 : g;
|
||||
g = B.isSolid(bb) ? g + 1 : g;
|
||||
@@ -138,7 +138,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|
||||
for(int i = h; i > h - max; i--)
|
||||
{
|
||||
BlockData d = biome.getWall().get(rng, x + i, i + h, z + i, gen.getData());
|
||||
FastBlockData d = biome.getWall().get(rng, x + i, i + h, z + i, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|| (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, currentPostX, currentPostZ, currentData)))
|
||||
//@done
|
||||
{
|
||||
BlockData d = biome.getSlab().get(rng, x, h, z, gen.getData());
|
||||
FastBlockData d = biome.getSlab().get(rng, x, h, z, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -202,11 +202,11 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
}
|
||||
|
||||
// Waterlogging
|
||||
BlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData b = getPostBlock(x, h, z, currentPostX, currentPostZ, currentData);
|
||||
|
||||
if(b instanceof Waterlogged)
|
||||
if(b.getBlockData() instanceof Waterlogged)
|
||||
{
|
||||
Waterlogged ww = (Waterlogged) b;
|
||||
Waterlogged ww = (Waterlogged) b.getBlockData();
|
||||
boolean w = false;
|
||||
if(isWaterOrWaterlogged(x, h + 1, z, currentPostX, currentPostZ, currentData))
|
||||
{
|
||||
@@ -221,7 +221,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
if(w != ww.isWaterlogged())
|
||||
{
|
||||
ww.setWaterlogged(w);
|
||||
setPostBlock(x, h, z, ww, currentPostX, currentPostZ, currentData);
|
||||
setPostBlock(x, h, z, b, currentPostX, currentPostZ, currentData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|
||||
if(g >= 3)
|
||||
{
|
||||
BlockData bc = getPostBlock(x, f, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bc = getPostBlock(x, f, z, currentPostX, currentPostZ, currentData);
|
||||
b = getPostBlock(x, f + 1, z, currentPostX, currentPostZ, currentData);
|
||||
Material m = bc.getMaterial();
|
||||
|
||||
@@ -302,10 +302,10 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|
||||
if(g >= 3)
|
||||
{
|
||||
BlockData ba = getPostBlock(x, fa, z, currentPostX, currentPostZ, currentData);
|
||||
BlockData bb = getPostBlock(x, fb, z, currentPostX, currentPostZ, currentData);
|
||||
BlockData bc = getPostBlock(x, fc, z, currentPostX, currentPostZ, currentData);
|
||||
BlockData bd = getPostBlock(x, fd, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData ba = getPostBlock(x, fa, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bb = getPostBlock(x, fb, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bc = getPostBlock(x, fc, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData bd = getPostBlock(x, fd, z, currentPostX, currentPostZ, currentData);
|
||||
g = 0;
|
||||
g = B.isSolid(ba) ? g + 1 : g;
|
||||
g = B.isSolid(bb) ? g + 1 : g;
|
||||
@@ -330,7 +330,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|| (fd == f + 1 && isSolidNonSlab(x, fd, z - 1, currentPostX, currentPostZ, currentData)))
|
||||
//@done
|
||||
{
|
||||
BlockData d = cave.getSlab().get(rng, x, f, z, gen.getData());
|
||||
FastBlockData d = cave.getSlab().get(rng, x, f, z, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -365,7 +365,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|| (cd == c - 1 && isSolidNonSlab(x, cd, z - 1, currentPostX, currentPostZ, currentData)))
|
||||
//@done
|
||||
{
|
||||
BlockData d = cave.getSlab().get(rng, x, c, z, gen.getData());
|
||||
FastBlockData d = cave.getSlab().get(rng, x, c, z, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -376,7 +376,7 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
cancel = true;
|
||||
}
|
||||
|
||||
if(!(d instanceof Slab))
|
||||
if(!(d.getBlockData() instanceof Slab))
|
||||
{
|
||||
cancel = true;
|
||||
}
|
||||
@@ -388,9 +388,9 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|
||||
if(!cancel && isAirOrWater(x, c, z, currentPostX, currentPostZ, currentData))
|
||||
{
|
||||
Slab slab = (Slab) d.clone();
|
||||
Slab slab = (Slab) d.getBlockData();
|
||||
slab.setType(Type.TOP);
|
||||
setPostBlock(x, c, z, slab, currentPostX, currentPostZ, currentData);
|
||||
setPostBlock(x, c, z, d, currentPostX, currentPostZ, currentData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ 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;
|
||||
|
||||
@@ -21,6 +20,7 @@ import com.volmit.iris.gen.scaffold.Provisioned;
|
||||
import com.volmit.iris.gen.scaffold.TerrainChunk;
|
||||
import com.volmit.iris.gen.scaffold.TerrainProvider;
|
||||
import com.volmit.iris.util.ChunkPosition;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.RNG;
|
||||
@@ -92,7 +92,7 @@ public class ProvisionBukkit extends ChunkGenerator implements Provisioned
|
||||
{
|
||||
for(int k = 0; k < 16; k++)
|
||||
{
|
||||
BlockData b = snapshot.getBlockData(i, (h * 16) + j, k);
|
||||
FastBlockData b = FastBlockData.of(snapshot.getBlockData(i, (h * 16) + j, k));
|
||||
|
||||
if(!Iris.edit.get(cachedWorld, i + cx, (h * 16) + j, k + cz).equals(b))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user