mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-23 17:19:16 +00:00
Faster block data!
This commit is contained in:
@@ -47,6 +47,8 @@ import com.volmit.iris.util.Queue;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.ShurikenQueue;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
|
||||
public class Iris extends MortarPlugin
|
||||
{
|
||||
public static KList<GroupedExecutor> executors = new KList<>();
|
||||
@@ -178,6 +180,7 @@ public class Iris extends MortarPlugin
|
||||
J.a(this::bstats);
|
||||
J.s(this::splash, 20);
|
||||
J.sr(this::tickQueue, 0);
|
||||
PaperLib.suggestPaper(this);
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
|
||||
@@ -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,7 +83,7 @@ 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)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
|
||||
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;
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.volmit.iris.manager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
@@ -12,6 +11,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.edit.BlockEditor;
|
||||
import com.volmit.iris.edit.BukkitBlockEditor;
|
||||
import com.volmit.iris.edit.WEBlockEditor;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.M;
|
||||
|
||||
@@ -26,14 +26,14 @@ public class EditManager implements Listener
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::update, 0, 0);
|
||||
}
|
||||
|
||||
public BlockData get(World world, int x, int y, int z)
|
||||
public FastBlockData get(World world, int x, int y, int z)
|
||||
{
|
||||
return open(world).get(x, y, z);
|
||||
return FastBlockData.of(open(world).get(x, y, z));
|
||||
}
|
||||
|
||||
public void set(World world, int x, int y, int z, BlockData d)
|
||||
public void set(World world, int x, int y, int z, FastBlockData d)
|
||||
{
|
||||
open(world).set(x, y, z, d);
|
||||
open(world).set(x, y, z, d.getBlockData());
|
||||
}
|
||||
|
||||
public void setBiome(World world, int x, int y, int z, Biome d)
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.util.C;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.M;
|
||||
|
||||
@@ -202,7 +203,7 @@ public class WandManager implements Listener
|
||||
}
|
||||
|
||||
BlockVector bv = b.getLocation().subtract(c.getLowerNE().toVector()).toVector().toBlockVector();
|
||||
s.setUnsigned(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ(), b.getBlockData());
|
||||
s.setUnsigned(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ(), FastBlockData.of(b.getBlockData()));
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.volmit.iris.object;
|
||||
import java.awt.Color;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualTerrainProvider;
|
||||
@@ -15,6 +14,7 @@ import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.DependsOn;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.IRare;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
@@ -349,14 +349,14 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return childrenCell.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137)).bake().scale(scale).bake());
|
||||
}
|
||||
|
||||
public KList<BlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height, IrisDataManager rdata)
|
||||
public KList<FastBlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height, IrisDataManager rdata)
|
||||
{
|
||||
if(isLockLayers())
|
||||
{
|
||||
return generateLockedLayers(wx, wz, random, maxDepth, height, rdata);
|
||||
}
|
||||
|
||||
KList<BlockData> data = new KList<>();
|
||||
KList<FastBlockData> data = new KList<>();
|
||||
|
||||
if(maxDepth <= 0)
|
||||
{
|
||||
@@ -400,10 +400,10 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return data;
|
||||
}
|
||||
|
||||
public KList<BlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisDataManager rdata)
|
||||
public KList<FastBlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisDataManager rdata)
|
||||
{
|
||||
KList<BlockData> data = new KList<>();
|
||||
KList<BlockData> real = new KList<>();
|
||||
KList<FastBlockData> data = new KList<>();
|
||||
KList<FastBlockData> real = new KList<>();
|
||||
int maxDepth = Math.min(maxDepthf, getLockLayersMax());
|
||||
if(maxDepth <= 0)
|
||||
{
|
||||
@@ -470,9 +470,9 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return this;
|
||||
}
|
||||
|
||||
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisDataManager rdata)
|
||||
public KList<FastBlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisDataManager rdata)
|
||||
{
|
||||
KList<BlockData> data = new KList<>();
|
||||
KList<FastBlockData> data = new KList<>();
|
||||
|
||||
for(int i = 0; i < seaLayers.size(); i++)
|
||||
{
|
||||
@@ -660,7 +660,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return getBiomeGenerator(rng).fit(biomeScatter, x, y, z);
|
||||
}
|
||||
|
||||
public BlockData getSurfaceBlock(int x, int z, RNG rng, IrisDataManager idm)
|
||||
public FastBlockData getSurfaceBlock(int x, int z, RNG rng, IrisDataManager idm)
|
||||
{
|
||||
if(getLayers().isEmpty())
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
@@ -10,6 +8,7 @@ import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.DependsOn;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
@@ -91,7 +90,7 @@ public class IrisBiomeDecorator
|
||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> varianceGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> blockData = new AtomicCache<>();
|
||||
|
||||
public int getHeight(RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
@@ -127,7 +126,7 @@ public class IrisBiomeDecorator
|
||||
return palette;
|
||||
}
|
||||
|
||||
public BlockData getBlockData(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
public FastBlockData getBlockData(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockData(data).isEmpty())
|
||||
{
|
||||
@@ -151,14 +150,14 @@ public class IrisBiomeDecorator
|
||||
return null;
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData(IrisDataManager data)
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
for(IrisBlockData i : palette)
|
||||
{
|
||||
BlockData bx = i.getBlockData(data);
|
||||
FastBlockData bx = i.getBlockData(data);
|
||||
if(bx != null)
|
||||
{
|
||||
blockData.add(bx);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.noise.CNG;
|
||||
@@ -9,6 +7,7 @@ import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.DependsOn;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
@@ -56,7 +55,7 @@ public class IrisBiomePaletteLayer
|
||||
@Desc("The palette of blocks to be used in this layer")
|
||||
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("GRASS_BLOCK"));
|
||||
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
|
||||
@@ -65,7 +64,7 @@ public class IrisBiomePaletteLayer
|
||||
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
|
||||
}
|
||||
|
||||
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager data)
|
||||
public FastBlockData get(RNG rng, double x, double y, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockData(data).isEmpty())
|
||||
{
|
||||
@@ -96,14 +95,14 @@ public class IrisBiomePaletteLayer
|
||||
return palette;
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData(IrisDataManager data)
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
BlockData bx = ix.getBlockData(data);
|
||||
FastBlockData bx = ix.getBlockData(data);
|
||||
if(bx != null)
|
||||
{
|
||||
for(int i = 0; i < ix.getWeight(); i++)
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
@@ -57,7 +56,7 @@ public class IrisBlockData extends IrisRegistrant
|
||||
@Desc("Optional properties for this block data such as 'waterlogged': true")
|
||||
private KMap<String, Object> data = new KMap<>();
|
||||
|
||||
private final transient AtomicCache<BlockData> blockdata = new AtomicCache<>();
|
||||
private final transient AtomicCache<FastBlockData> blockdata = new AtomicCache<>();
|
||||
private final transient AtomicCache<String> realProperties = new AtomicCache<>();
|
||||
|
||||
public IrisBlockData(String b)
|
||||
@@ -87,11 +86,11 @@ public class IrisBlockData extends IrisRegistrant
|
||||
return computeProperties(getData());
|
||||
}
|
||||
|
||||
public BlockData getBlockData(IrisDataManager data)
|
||||
public FastBlockData getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockdata.aquire(() ->
|
||||
{
|
||||
BlockData b = null;
|
||||
FastBlockData b = null;
|
||||
|
||||
IrisBlockData customData = data.getBlockLoader().load(getBlock(), false);
|
||||
|
||||
@@ -103,7 +102,7 @@ public class IrisBlockData extends IrisRegistrant
|
||||
{
|
||||
b = b.clone();
|
||||
|
||||
String st = b.getAsString(true);
|
||||
String st = b.getBlockData().getAsString(true);
|
||||
|
||||
if(st.contains("["))
|
||||
{
|
||||
@@ -124,7 +123,7 @@ public class IrisBlockData extends IrisRegistrant
|
||||
Iris.warn("Debug block data " + sx + " (CUSTOM)");
|
||||
}
|
||||
|
||||
BlockData bx = B.get(sx);
|
||||
FastBlockData bx = B.get(sx);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
@@ -8,6 +7,7 @@ import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
@@ -46,17 +46,17 @@ public class IrisBlockDrops
|
||||
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
|
||||
private boolean replaceVanillaDrops = false;
|
||||
|
||||
private final transient AtomicCache<KList<BlockData>> data = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> data = new AtomicCache<>();
|
||||
|
||||
public boolean shouldDropFor(BlockData data, IrisDataManager rdata)
|
||||
public boolean shouldDropFor(FastBlockData data, IrisDataManager rdata)
|
||||
{
|
||||
KList<BlockData> list = this.data.aquire(() ->
|
||||
KList<FastBlockData> list = this.data.aquire(() ->
|
||||
{
|
||||
KList<BlockData> b = new KList<>();
|
||||
KList<FastBlockData> b = new KList<>();
|
||||
|
||||
for(IrisBlockData i : getBlocks())
|
||||
{
|
||||
BlockData dd = i.getBlockData(rdata);
|
||||
FastBlockData dd = i.getBlockData(rdata);
|
||||
|
||||
if(dd != null)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ public class IrisBlockDrops
|
||||
return b.removeDuplicates();
|
||||
});
|
||||
|
||||
for(BlockData i : list)
|
||||
for(FastBlockData i : list)
|
||||
{
|
||||
if(exactBlocks ? i.equals(data) : i.getMaterial().equals(data.getMaterial()))
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.Required;
|
||||
@@ -40,18 +39,18 @@ public class IrisCaveFluid
|
||||
@Desc("The fluid type that should spawn here")
|
||||
private IrisBlockData fluidType = new IrisBlockData("CAVE_AIR");
|
||||
|
||||
private final transient AtomicCache<BlockData> fluidData = new AtomicCache<>();
|
||||
private final transient AtomicCache<FastBlockData> fluidData = new AtomicCache<>();
|
||||
|
||||
public boolean hasFluid(IrisDataManager rdata)
|
||||
{
|
||||
return !B.isAir(getFluid(rdata));
|
||||
}
|
||||
|
||||
public BlockData getFluid(IrisDataManager rdata)
|
||||
public FastBlockData getFluid(IrisDataManager rdata)
|
||||
{
|
||||
return fluidData.aquire(() ->
|
||||
{
|
||||
BlockData b = getFluidType().getBlockData(rdata);
|
||||
FastBlockData b = getFluidType().getBlockData(rdata);
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
|
||||
@@ -4,11 +4,11 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
@@ -20,7 +20,7 @@ public class IrisCompat
|
||||
{
|
||||
private KList<IrisCompatabilityBlockFilter> blockFilters = new KList<>();
|
||||
private KList<IrisCompatabilityItemFilter> itemFilters = new KList<>();
|
||||
private transient KMap<String, BlockData> blockResolves = new KMap<>();
|
||||
private transient KMap<String, FastBlockData> blockResolves = new KMap<>();
|
||||
private transient KMap<String, Material> itemResolves = new KMap<>();
|
||||
|
||||
public IrisCompat()
|
||||
@@ -29,7 +29,7 @@ public class IrisCompat
|
||||
itemFilters = getDefaultItemCompatabilityFilters();
|
||||
}
|
||||
|
||||
public BlockData getBlock(String n)
|
||||
public FastBlockData getBlock(String n)
|
||||
{
|
||||
return blockResolves.compute(n, (k, v) ->
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public class IrisCompat
|
||||
String buf = k;
|
||||
int err = 16;
|
||||
|
||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
||||
FastBlockData tx = B.parseBlockDataOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ public class IrisCompat
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
BlockData b = i.getReplace();
|
||||
FastBlockData b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
@@ -121,29 +121,29 @@ public class IrisCompat
|
||||
}
|
||||
|
||||
buf = k;
|
||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
||||
FastBlockData tx = B.parseBlockDataOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
{
|
||||
return tx.getMaterial();
|
||||
return tx.getType();
|
||||
}
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(err-- <= 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
}
|
||||
|
||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
BlockData b = i.getReplace();
|
||||
FastBlockData b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
return b.getMaterial();
|
||||
return b.getType();
|
||||
}
|
||||
|
||||
buf = i.getSupplement();
|
||||
@@ -151,7 +151,7 @@ public class IrisCompat
|
||||
}
|
||||
}
|
||||
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
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.FastBlockData;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -35,25 +34,24 @@ public class IrisCompatabilityBlockFilter
|
||||
@Desc("If exact is true, it compares block data for example minecraft:some_log[axis=x]")
|
||||
private boolean exact = false;
|
||||
|
||||
private final transient AtomicCache<BlockData> findData = new AtomicCache<>(true);
|
||||
private final transient AtomicCache<BlockData> replaceData = new AtomicCache<>(true);
|
||||
private final transient AtomicCache<FastBlockData> findData = new AtomicCache<>(true);
|
||||
private final transient AtomicCache<FastBlockData> replaceData = new AtomicCache<>(true);
|
||||
|
||||
public IrisCompatabilityBlockFilter(String when, String supplement)
|
||||
{
|
||||
this(when, supplement, false);
|
||||
}
|
||||
|
||||
|
||||
public BlockData getFind()
|
||||
public FastBlockData getFind()
|
||||
{
|
||||
return findData.aquire(() -> B.getBlockData(when));
|
||||
}
|
||||
|
||||
public BlockData getReplace()
|
||||
public FastBlockData getReplace()
|
||||
{
|
||||
return replaceData.aquire(() ->
|
||||
{
|
||||
BlockData b = B.parseBlockDataOrNull(supplement);
|
||||
FastBlockData b = B.parseBlockDataOrNull(supplement);
|
||||
|
||||
if(b == null)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.HeightMap;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
@@ -86,7 +87,7 @@ public class IrisDepositGenerator
|
||||
private int varience = 3;
|
||||
|
||||
private final transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> blockData = new AtomicCache<>();
|
||||
|
||||
public IrisObject getClump(RNG rng, IrisDataManager rdata)
|
||||
{
|
||||
@@ -136,20 +137,20 @@ public class IrisDepositGenerator
|
||||
return o;
|
||||
}
|
||||
|
||||
private BlockData nextBlock(RNG rngv, IrisDataManager rdata)
|
||||
private FastBlockData nextBlock(RNG rngv, IrisDataManager rdata)
|
||||
{
|
||||
return getBlockData(rdata).get(rngv.i(0, getBlockData(rdata).size() - 1));
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData(IrisDataManager rdata)
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager rdata)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
BlockData bx = ix.getBlockData(rdata);
|
||||
FastBlockData bx = ix.getBlockData(rdata);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -220,8 +221,8 @@ public class IrisDepositGenerator
|
||||
|
||||
if(!allow)
|
||||
{
|
||||
BlockData b = data.getBlockData(nx, ny, nz);
|
||||
for(BlockData f : g.getDimension().getRockPalette().getBlockData(g.getData()))
|
||||
FastBlockData b = FastBlockData.of(data.getBlockData(nx, ny, nz));
|
||||
for(FastBlockData f : g.getDimension().getRockPalette().getBlockData(g.getData()))
|
||||
{
|
||||
if(f.getMaterial().equals(b.getMaterial()))
|
||||
{
|
||||
@@ -235,7 +236,7 @@ public class IrisDepositGenerator
|
||||
{
|
||||
BlockData b = data.getBlockData(nx, ny, nz);
|
||||
|
||||
if(b.getMaterial().equals(Material.ICE) || b.getMaterial().equals(Material.PACKED_ICE) || b.getMaterial().equals(B.mat("BLUE_ICE")) || b.getMaterial().equals(B.mat("FROSTED_ICE")) || b.getMaterial().equals(Material.SAND) || b.getMaterial().equals(Material.RED_SAND) || !B.isSolid(b.getMaterial()))
|
||||
if(b.getMaterial().equals(Material.ICE) || b.getMaterial().equals(Material.PACKED_ICE) || b.getMaterial().equals(B.mat("BLUE_ICE").getMaterial()) || b.getMaterial().equals(B.mat("FROSTED_ICE").getMaterial()) || b.getMaterial().equals(Material.SAND) || b.getMaterial().equals(Material.RED_SAND) || !B.isSolid(b.getMaterial()))
|
||||
{
|
||||
allow = false;
|
||||
}
|
||||
@@ -243,7 +244,7 @@ public class IrisDepositGenerator
|
||||
|
||||
if(allow)
|
||||
{
|
||||
data.setBlock(nx, ny, nz, clump.getBlocks().get(j));
|
||||
data.setBlock(nx, ny, nz, clump.getBlocks().get(j).getBlockData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.ChunkPosition;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
@@ -54,6 +55,10 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("Create an inverted dimension in the sky (like the nether)")
|
||||
private IrisDimension sky = null;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
|
||||
private boolean aggressiveBiomeReshuffle = false;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
|
||||
private String resourcePack = "";
|
||||
@@ -498,7 +503,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
});
|
||||
}
|
||||
|
||||
public BlockData resolveBlock(String bd)
|
||||
public FastBlockData resolveBlock(String bd)
|
||||
{
|
||||
return Iris.compat.getBlock(bd);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.noise.CNG;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
@@ -40,11 +39,11 @@ public class IrisMaterialPalette
|
||||
@Desc("The palette of blocks to be used in this layer")
|
||||
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("STONE"));
|
||||
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
|
||||
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager rdata)
|
||||
public FastBlockData get(RNG rng, double x, double y, double z, IrisDataManager rdata)
|
||||
{
|
||||
if(getBlockData(rdata).isEmpty())
|
||||
{
|
||||
@@ -88,14 +87,14 @@ public class IrisMaterialPalette
|
||||
return this;
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData(IrisDataManager rdata)
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager rdata)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
BlockData bx = ix.getBlockData(rdata);
|
||||
FastBlockData bx = ix.getBlockData(rdata);
|
||||
if(bx != null)
|
||||
{
|
||||
for(int i = 0; i < ix.getWeight(); i++)
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Leaves;
|
||||
import org.bukkit.util.BlockVector;
|
||||
@@ -23,6 +22,7 @@ import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.BlockPosition;
|
||||
import com.volmit.iris.util.CarveResult;
|
||||
import com.volmit.iris.util.ChunkPosition;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.IObjectPlacer;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.KMap;
|
||||
@@ -30,7 +30,6 @@ import com.volmit.iris.util.RNG;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@@ -38,12 +37,12 @@ import lombok.experimental.Accessors;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
private static final BlockData AIR = B.getBlockData("CAVE_AIR");
|
||||
private static final BlockData VAIR = B.getBlockData("VOID_AIR");
|
||||
private static final BlockData VAIR_DEBUG = B.getBlockData("COBWEB");
|
||||
private static final BlockData[] SNOW_LAYERS = new BlockData[] {B.getBlockData("minecraft:snow[layers=1]"), B.getBlockData("minecraft:snow[layers=2]"), B.getBlockData("minecraft:snow[layers=3]"), B.getBlockData("minecraft:snow[layers=4]"), B.getBlockData("minecraft:snow[layers=5]"), B.getBlockData("minecraft:snow[layers=6]"), B.getBlockData("minecraft:snow[layers=7]"), B.getBlockData("minecraft:snow[layers=8]")};
|
||||
private static final FastBlockData AIR = B.getBlockData("CAVE_AIR");
|
||||
private static final FastBlockData VAIR = B.getBlockData("VOID_AIR");
|
||||
private static final FastBlockData VAIR_DEBUG = B.getBlockData("COBWEB");
|
||||
private static final FastBlockData[] SNOW_LAYERS = new FastBlockData[] {B.getBlockData("minecraft:snow[layers=1]"), B.getBlockData("minecraft:snow[layers=2]"), B.getBlockData("minecraft:snow[layers=3]"), B.getBlockData("minecraft:snow[layers=4]"), B.getBlockData("minecraft:snow[layers=5]"), B.getBlockData("minecraft:snow[layers=6]"), B.getBlockData("minecraft:snow[layers=7]"), B.getBlockData("minecraft:snow[layers=8]")};
|
||||
public static boolean shitty = false;
|
||||
private KMap<BlockVector, BlockData> blocks;
|
||||
private KMap<BlockVector, FastBlockData> blocks;
|
||||
private int w;
|
||||
private int d;
|
||||
private int h;
|
||||
@@ -278,7 +277,7 @@ public class IrisObject extends IrisRegistrant
|
||||
dos.writeShort(i.getBlockX());
|
||||
dos.writeShort(i.getBlockY());
|
||||
dos.writeShort(i.getBlockZ());
|
||||
dos.writeUTF(blocks.get(i).getAsString(true));
|
||||
dos.writeUTF(blocks.get(i).getBlockData().getAsString(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +287,7 @@ public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
return;
|
||||
}
|
||||
KMap<BlockVector, BlockData> d = blocks.copy();
|
||||
KMap<BlockVector, FastBlockData> d = blocks.copy();
|
||||
blocks.clear();
|
||||
|
||||
for(BlockVector i : d.k())
|
||||
@@ -297,7 +296,7 @@ public class IrisObject extends IrisRegistrant
|
||||
}
|
||||
}
|
||||
|
||||
public void setUnsigned(int x, int y, int z, BlockData block)
|
||||
public void setUnsigned(int x, int y, int z, FastBlockData block)
|
||||
{
|
||||
if(shitty)
|
||||
{
|
||||
@@ -327,7 +326,7 @@ public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
return;
|
||||
}
|
||||
place(x, -1, z, placer, config, rng,rdata);
|
||||
place(x, -1, z, placer, config, rng, rdata);
|
||||
}
|
||||
|
||||
public void place(int x, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, CarveResult c, IrisDataManager rdata)
|
||||
@@ -336,12 +335,12 @@ public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
return;
|
||||
}
|
||||
place(x, -1, z, placer, config, rng, null, c,rdata);
|
||||
place(x, -1, z, placer, config, rng, null, c, rdata);
|
||||
}
|
||||
|
||||
public int place(int x, int yv, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, IrisDataManager rdata)
|
||||
{
|
||||
return place(x, yv, z, placer, config, rng, null, null,rdata);
|
||||
return place(x, yv, z, placer, config, rng, null, null, rdata);
|
||||
}
|
||||
|
||||
public int place(int x, int yv, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, Consumer<BlockPosition> listener, CarveResult c, IrisDataManager rdata)
|
||||
@@ -509,25 +508,25 @@ public class IrisObject extends IrisRegistrant
|
||||
BlockVector i = g.clone();
|
||||
i = config.getRotation().rotate(i.clone(), spinx, spiny, spinz).clone();
|
||||
i = config.getTranslate().translate(i.clone(), config.getRotation(), spinx, spiny, spinz).clone();
|
||||
BlockData data = blocks.get(g).clone();
|
||||
FastBlockData data = blocks.get(g).clone();
|
||||
|
||||
if(stilting && i.getBlockY() < lowest && !B.isAir(data))
|
||||
{
|
||||
lowest = i.getBlockY();
|
||||
}
|
||||
|
||||
if(placer.isPreventingDecay() && data instanceof Leaves && !((Leaves) data).isPersistent())
|
||||
if(placer.isPreventingDecay() && (data.getBlockData()) instanceof Leaves && !((Leaves) (data.getBlockData())).isPersistent())
|
||||
{
|
||||
((Leaves) data).setPersistent(true);
|
||||
((Leaves) data.getBlockData()).setPersistent(true);
|
||||
}
|
||||
|
||||
for(IrisObjectReplace j : config.getEdit())
|
||||
{
|
||||
for(BlockData k : j.getFind(rdata))
|
||||
for(FastBlockData k : j.getFind(rdata))
|
||||
{
|
||||
if(j.isExact() ? k.matches(data) : k.getMaterial().equals(data.getMaterial()))
|
||||
{
|
||||
data = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z,rdata).clone();
|
||||
data = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z, rdata).clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -597,7 +596,7 @@ public class IrisObject extends IrisRegistrant
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData d = blocks.get(i);
|
||||
FastBlockData d = blocks.get(i);
|
||||
|
||||
if(d == null || B.isAir(d))
|
||||
{
|
||||
@@ -655,7 +654,7 @@ public class IrisObject extends IrisRegistrant
|
||||
return;
|
||||
}
|
||||
|
||||
KMap<BlockVector, BlockData> v = blocks.copy();
|
||||
KMap<BlockVector, FastBlockData> v = blocks.copy();
|
||||
blocks.clear();
|
||||
|
||||
for(BlockVector i : v.keySet())
|
||||
@@ -673,7 +672,7 @@ public class IrisObject extends IrisRegistrant
|
||||
|
||||
for(BlockVector i : blocks.keySet())
|
||||
{
|
||||
at.clone().add(0, getCenter().getY(), 0).add(i).getBlock().setBlockData(blocks.get(i), false);
|
||||
at.clone().add(0, getCenter().getY(), 0).add(i).getBlock().setBlockData(blocks.get(i).getBlockData(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.noise.CNG;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
@@ -40,18 +39,18 @@ public class IrisObjectReplace
|
||||
private boolean exact = false;
|
||||
|
||||
private final transient AtomicCache<CNG> replaceGen = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> findData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> replaceData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> findData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> replaceData = new AtomicCache<>();
|
||||
|
||||
public KList<BlockData> getFind(IrisDataManager rdata)
|
||||
public KList<FastBlockData> getFind(IrisDataManager rdata)
|
||||
{
|
||||
return findData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> b = new KList<>();
|
||||
KList<FastBlockData> b = new KList<>();
|
||||
|
||||
for(IrisBlockData i : find)
|
||||
{
|
||||
BlockData bx = i.getBlockData(rdata);
|
||||
FastBlockData bx = i.getBlockData(rdata);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -63,7 +62,7 @@ public class IrisObjectReplace
|
||||
});
|
||||
}
|
||||
|
||||
public BlockData getReplace(RNG seed, double x, double y, double z, IrisDataManager rdata)
|
||||
public FastBlockData getReplace(RNG seed, double x, double y, double z, IrisDataManager rdata)
|
||||
{
|
||||
return getReplace().get(seed, x, y, z, rdata);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -111,15 +112,16 @@ public class IrisObjectRotation
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
|
||||
public BlockData rotate(BlockData d, int spinxx, int spinyy, int spinzz)
|
||||
public FastBlockData rotate(FastBlockData dd, int spinxx, int spinyy, int spinzz)
|
||||
{
|
||||
BlockData d = dd.getBlockData();
|
||||
int spinx = (int) (90D * (Math.ceil(Math.abs((spinxx % 360D) / 90D))));
|
||||
int spiny = (int) (90D * (Math.ceil(Math.abs((spinyy % 360D) / 90D))));
|
||||
int spinz = (int) (90D * (Math.ceil(Math.abs((spinzz % 360D) / 90D))));
|
||||
|
||||
if(!canRotate())
|
||||
{
|
||||
return d;
|
||||
return FastBlockData.of(d);
|
||||
}
|
||||
|
||||
if(d instanceof Directional)
|
||||
@@ -179,7 +181,7 @@ public class IrisObjectRotation
|
||||
}
|
||||
}
|
||||
|
||||
return d;
|
||||
return FastBlockData.of(d);
|
||||
}
|
||||
|
||||
public BlockVector rotate(BlockVector b, int spinx, int spiny, int spinz)
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -42,6 +41,7 @@ import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.C;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.FastBlockData;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.IObjectPlacer;
|
||||
@@ -70,9 +70,9 @@ public class StructureTemplate implements Listener, IObjectPlacer
|
||||
private Location center;
|
||||
private ChronoLatch u = new ChronoLatch(50);
|
||||
private World world;
|
||||
private static final BlockData STONE = B.get("STONE");
|
||||
private static final BlockData RED = B.get("RED_STAINED_GLASS");
|
||||
private static final BlockData GREEN = B.get("LIME_STAINED_GLASS");
|
||||
private static final FastBlockData STONE = B.get("STONE");
|
||||
private static final FastBlockData RED = B.get("RED_STAINED_GLASS");
|
||||
private static final FastBlockData GREEN = B.get("LIME_STAINED_GLASS");
|
||||
private int task;
|
||||
private ChronoLatch dirtyLatch;
|
||||
private ChronoLatch gLatch;
|
||||
@@ -446,7 +446,7 @@ public class StructureTemplate implements Listener, IObjectPlacer
|
||||
Location loc = new Location(world, b.getX(), b.getY(), b.getZ());
|
||||
BlockVector v = loc.clone().subtract(min).subtract(o.getCenter()).toVector().toBlockVector();
|
||||
v = r.getPlacement().getRotation().rotate(v, 0, 0, 0);
|
||||
BlockData next = r.getPlacement().getRotation().rotate(b.getBlockData(), 0, 0, 0);
|
||||
FastBlockData next = r.getPlacement().getRotation().rotate(FastBlockData.of(b.getBlockData()), 0, 0, 0);
|
||||
|
||||
o.getBlocks().put(v, next);
|
||||
}
|
||||
@@ -789,7 +789,7 @@ public class StructureTemplate implements Listener, IObjectPlacer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, BlockData d)
|
||||
public void set(int x, int y, int z, FastBlockData d)
|
||||
{
|
||||
if(get(x, y, z).equals(d))
|
||||
{
|
||||
@@ -800,9 +800,9 @@ public class StructureTemplate implements Listener, IObjectPlacer
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData get(int x, int y, int z)
|
||||
public FastBlockData get(int x, int y, int z)
|
||||
{
|
||||
return world.getBlockAt(x, y, z).getBlockData();
|
||||
return FastBlockData.of(world.getBlockAt(x, y, z).getBlockData());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,54 +1,128 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Leaves;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
|
||||
public class B
|
||||
{
|
||||
private static final BlockData AIR = Material.AIR.createBlockData();
|
||||
private static final KMap<String, BlockData> bdc = new KMap<>();
|
||||
private static final FastBlockData AIR = FastBlockData.of(Material.AIR);
|
||||
private static final LoadingCache<String, FastBlockData> bdc = Caffeine.newBuilder().expireAfterAccess(60000, TimeUnit.MILLISECONDS).build((c) -> null);
|
||||
private static final KList<String> nulls = new KList<>();
|
||||
private static final KList<Material> storage = new KList<>();
|
||||
private static final KList<Material> storageChest = new KList<>();
|
||||
private static final KList<Material> lit = new KList<>();
|
||||
private static final KList<Material> updatable = new KList<>();
|
||||
private static final KList<Material> notUpdatable = new KList<>();
|
||||
private static final KList<FastBlockData> storage = new KList<>();
|
||||
private static final KList<FastBlockData> storageChest = new KList<>();
|
||||
private static final KList<FastBlockData> lit = new KList<>();
|
||||
private static final KList<FastBlockData> updatable = new KList<>();
|
||||
private static final KList<FastBlockData> notUpdatable = new KList<>();
|
||||
private static final KList<String> canPlaceOn = new KList<>();
|
||||
private static final KList<Material> decorant = new KList<>();
|
||||
private static final KList<FastBlockData> decorant = new KList<>();
|
||||
private static final IrisDimension defaultCompat = new IrisDimension();
|
||||
private static final KMap<Material, Boolean> solid = new KMap<>();
|
||||
private static final KMap<String, Material> types = new KMap<>();
|
||||
private static final KMap<String, Material> typesb = new KMap<>();
|
||||
private static final LoadingCache<String, FastBlockData> types = Caffeine.newBuilder().expireAfterAccess(30000, TimeUnit.MILLISECONDS).build((c) -> null);
|
||||
private static final LoadingCache<String, FastBlockData> typesb = Caffeine.newBuilder().expireAfterAccess(30000, TimeUnit.MILLISECONDS).build((c) -> null);
|
||||
private static IrisLock lock = new IrisLock("Typelock");
|
||||
|
||||
public static BlockData get(String bd)
|
||||
public static FastBlockData get(String bd)
|
||||
{
|
||||
return getBlockData(bd);
|
||||
}
|
||||
|
||||
public static boolean isWater(BlockData b)
|
||||
public static boolean isWater(FastBlockData b)
|
||||
{
|
||||
return b.getMaterial().equals(Material.WATER);
|
||||
}
|
||||
|
||||
public static FastBlockData getAir()
|
||||
{
|
||||
return AIR;
|
||||
}
|
||||
|
||||
public static LoadingCache<String, FastBlockData> getBdc()
|
||||
{
|
||||
return bdc;
|
||||
}
|
||||
|
||||
public static KList<String> getNulls()
|
||||
{
|
||||
return nulls;
|
||||
}
|
||||
|
||||
public static KList<FastBlockData> getStorage()
|
||||
{
|
||||
return storage;
|
||||
}
|
||||
|
||||
public static KList<FastBlockData> getStoragechest()
|
||||
{
|
||||
return storageChest;
|
||||
}
|
||||
|
||||
public static KList<FastBlockData> getLit()
|
||||
{
|
||||
return lit;
|
||||
}
|
||||
|
||||
public static KList<FastBlockData> getUpdatable()
|
||||
{
|
||||
return updatable;
|
||||
}
|
||||
|
||||
public static KList<FastBlockData> getNotupdatable()
|
||||
{
|
||||
return notUpdatable;
|
||||
}
|
||||
|
||||
public static KList<String> getCanplaceon()
|
||||
{
|
||||
return canPlaceOn;
|
||||
}
|
||||
|
||||
public static KList<FastBlockData> getDecorant()
|
||||
{
|
||||
return decorant;
|
||||
}
|
||||
|
||||
public static IrisDimension getDefaultcompat()
|
||||
{
|
||||
return defaultCompat;
|
||||
}
|
||||
|
||||
public static KMap<Material, Boolean> getSolid()
|
||||
{
|
||||
return solid;
|
||||
}
|
||||
|
||||
public static LoadingCache<String, FastBlockData> getTypes()
|
||||
{
|
||||
return types;
|
||||
}
|
||||
|
||||
public static LoadingCache<String, FastBlockData> getTypesb()
|
||||
{
|
||||
return typesb;
|
||||
}
|
||||
|
||||
public static IrisLock getLock()
|
||||
{
|
||||
return lock;
|
||||
}
|
||||
|
||||
public static Material getMaterial(String bdx)
|
||||
{
|
||||
String bd = bdx.trim().toUpperCase();
|
||||
return typesb.compute(bd, (k, v) ->
|
||||
{
|
||||
if(k != null && v != null)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
return typesb.get(bd, (k) ->
|
||||
{
|
||||
try
|
||||
{
|
||||
return Material.valueOf(k);
|
||||
return FastBlockData.of(Material.valueOf(k));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
@@ -56,23 +130,19 @@ public class B
|
||||
|
||||
}
|
||||
|
||||
return defaultCompat.resolveItem(bdx);
|
||||
});
|
||||
return FastBlockData.of(defaultCompat.resolveItem(bdx));
|
||||
}).getType();
|
||||
}
|
||||
|
||||
public static Material getMaterialOrNull(String bdx)
|
||||
{
|
||||
String bd = bdx.trim().toUpperCase();
|
||||
return types.compute(bd, (k, v) ->
|
||||
{
|
||||
if(k != null && v != null)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
return typesb.get(bd, (k) ->
|
||||
{
|
||||
try
|
||||
{
|
||||
return Material.valueOf(k);
|
||||
return FastBlockData.of(Material.valueOf(k));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
@@ -81,10 +151,10 @@ public class B
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}).getType();
|
||||
}
|
||||
|
||||
public static boolean isSolid(BlockData mat)
|
||||
public static boolean isSolid(FastBlockData mat)
|
||||
{
|
||||
return isSolid(mat.getMaterial());
|
||||
}
|
||||
@@ -99,14 +169,14 @@ public class B
|
||||
return solid.get(mat);
|
||||
}
|
||||
|
||||
public static Material mat(String bd)
|
||||
public static FastBlockData mat(String bd)
|
||||
{
|
||||
return getBlockData(bd).getMaterial();
|
||||
return getBlockData(bd);
|
||||
}
|
||||
|
||||
public static BlockData getBlockData(String bd)
|
||||
public static FastBlockData getBlockData(String bd)
|
||||
{
|
||||
return getBlockData(bd, defaultCompat);
|
||||
return getBlockData(bd, defaultCompat).optimize();
|
||||
}
|
||||
|
||||
public static String[] getBlockTypes()
|
||||
@@ -149,18 +219,18 @@ public class B
|
||||
return bt.toArray(new String[bt.size()]);
|
||||
}
|
||||
|
||||
public static BlockData getBlockData(String bdxf, IrisDimension resolver)
|
||||
public static FastBlockData getBlockData(String bdxf, IrisDimension resolver)
|
||||
{
|
||||
try
|
||||
{
|
||||
String bd = bdxf.trim();
|
||||
|
||||
if(bdc.containsKey(bd))
|
||||
FastBlockData fff = bdc.get(bd);
|
||||
if(fff != null)
|
||||
{
|
||||
return bdc.get(bd).clone();
|
||||
return fff.clone();
|
||||
}
|
||||
|
||||
BlockData bdx = parseBlockData(bd);
|
||||
FastBlockData bdx = parseBlockData(bd);
|
||||
|
||||
if(bdx == null)
|
||||
{
|
||||
@@ -192,11 +262,11 @@ public class B
|
||||
return AIR;
|
||||
}
|
||||
|
||||
public static BlockData parseBlockDataOrNull(String ix)
|
||||
public static FastBlockData parseBlockDataOrNull(String ix)
|
||||
{
|
||||
try
|
||||
{
|
||||
BlockData bx = Bukkit.createBlockData(ix);
|
||||
FastBlockData bx = FastBlockData.of(Bukkit.createBlockData(ix));
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -215,9 +285,7 @@ public class B
|
||||
|
||||
try
|
||||
{
|
||||
Material m = Material.valueOf(i);
|
||||
|
||||
return m.createBlockData();
|
||||
return FastBlockData.of(Material.valueOf(i));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
@@ -228,11 +296,11 @@ public class B
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BlockData parseBlockData(String ix)
|
||||
public static FastBlockData parseBlockData(String ix)
|
||||
{
|
||||
try
|
||||
{
|
||||
BlockData bx = Bukkit.createBlockData(ix);
|
||||
FastBlockData bx = FastBlockData.of(Bukkit.createBlockData(ix));
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -251,9 +319,7 @@ public class B
|
||||
|
||||
try
|
||||
{
|
||||
Material m = Material.valueOf(i);
|
||||
|
||||
return m.createBlockData();
|
||||
return FastBlockData.of(Material.valueOf(i));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
@@ -264,12 +330,7 @@ public class B
|
||||
return AIR;
|
||||
}
|
||||
|
||||
public static boolean isUpdatable(BlockData mat)
|
||||
{
|
||||
return isUpdatable(mat.getMaterial());
|
||||
}
|
||||
|
||||
public static boolean isStorage(Material mat)
|
||||
public static boolean isStorage(FastBlockData mat)
|
||||
{
|
||||
if(storage.contains(mat))
|
||||
{
|
||||
@@ -291,7 +352,7 @@ public class B
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isStorageChest(Material mat)
|
||||
public static boolean isStorageChest(FastBlockData mat)
|
||||
{
|
||||
if(storageChest.contains(mat))
|
||||
{
|
||||
@@ -313,7 +374,7 @@ public class B
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isLit(Material mat)
|
||||
public static boolean isLit(FastBlockData mat)
|
||||
{
|
||||
if(lit.contains(mat))
|
||||
{
|
||||
@@ -321,7 +382,7 @@ public class B
|
||||
}
|
||||
|
||||
// @NoArgsConstructor
|
||||
boolean str = mat.equals(B.mat("GLOWSTONE")) || mat.equals(B.mat("END_ROD")) || mat.equals(B.mat("SOUL_SAND")) || mat.equals(B.mat("TORCH")) || mat.equals(Material.REDSTONE_TORCH) || mat.equals(B.mat("SOUL_TORCH")) || mat.equals(Material.REDSTONE_WALL_TORCH) || mat.equals(Material.WALL_TORCH) || mat.equals(B.mat("SOUL_WALL_TORCH")) || mat.equals(B.mat("LANTERN")) || mat.equals(Material.JACK_O_LANTERN) || mat.equals(Material.REDSTONE_LAMP) || mat.equals(Material.MAGMA_BLOCK) || mat.equals(B.mat("SHROOMLIGHT")) || mat.equals(B.mat("SEA_LANTERN")) || mat.equals(B.mat("SOUL_LANTERN")) || mat.equals(Material.FIRE) || mat.equals(B.mat("SOUL_FIRE")) || mat.equals(B.mat("SEA_PICKLE")) || mat.equals(Material.BREWING_STAND) || mat.equals(Material.REDSTONE_ORE);
|
||||
boolean str = mat.equals(B.mat("GLOWSTONE")) || mat.equals(B.mat("END_ROD")) || mat.equals(B.mat("SOUL_SAND")) || mat.equals(B.mat("TORCH")) || mat.getType().equals(Material.REDSTONE_TORCH) || mat.equals(B.mat("SOUL_TORCH")) || mat.getType().equals(Material.REDSTONE_WALL_TORCH) || mat.getType().equals(Material.WALL_TORCH) || mat.equals(B.mat("SOUL_WALL_TORCH")) || mat.equals(B.mat("LANTERN")) || mat.getType().equals(Material.JACK_O_LANTERN) || mat.getType().equals(Material.REDSTONE_LAMP) || mat.getType().equals(Material.MAGMA_BLOCK) || mat.equals(B.mat("SHROOMLIGHT")) || mat.equals(B.mat("SEA_LANTERN")) || mat.equals(B.mat("SOUL_LANTERN")) || mat.getType().equals(Material.FIRE) || mat.equals(B.mat("SOUL_FIRE")) || mat.equals(B.mat("SEA_PICKLE")) || mat.getType().equals(Material.BREWING_STAND) || mat.getType().equals(Material.REDSTONE_ORE);
|
||||
//@done
|
||||
if(str)
|
||||
{
|
||||
@@ -334,7 +395,7 @@ public class B
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isUpdatable(Material mat)
|
||||
public static boolean isUpdatable(FastBlockData mat)
|
||||
{
|
||||
if(updatable.contains(mat))
|
||||
{
|
||||
@@ -362,16 +423,16 @@ public class B
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isFoliage(BlockData d)
|
||||
public static boolean isFoliage(FastBlockData d)
|
||||
{
|
||||
if(isFluid(d) || isAir(d) || isSolid(d))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Material mat = d.getMaterial();
|
||||
FastBlockData mat = d;
|
||||
// @NoArgsConstructor
|
||||
return mat.equals(Material.POPPY) || mat.equals(Material.DANDELION) || mat.equals(B.mat("CORNFLOWER")) || mat.equals(B.mat("SWEET_BERRY_BUSH")) || mat.equals(B.mat("CRIMSON_ROOTS")) || mat.equals(B.mat("WARPED_ROOTS")) || mat.equals(B.mat("NETHER_SPROUTS")) || mat.equals(B.mat("ALLIUM")) || mat.equals(B.mat("AZURE_BLUET")) || mat.equals(B.mat("BLUE_ORCHID")) || mat.equals(B.mat("POPPY")) || mat.equals(B.mat("DANDELION")) || mat.equals(B.mat("OXEYE_DAISY")) || mat.equals(B.mat("LILY_OF_THE_VALLEY")) || mat.equals(B.mat("WITHER_ROSE")) || mat.equals(Material.DARK_OAK_SAPLING) || mat.equals(Material.ACACIA_SAPLING) || mat.equals(Material.JUNGLE_SAPLING) || mat.equals(Material.BIRCH_SAPLING) || mat.equals(Material.SPRUCE_SAPLING) || mat.equals(Material.OAK_SAPLING) || mat.equals(Material.ORANGE_TULIP) || mat.equals(Material.PINK_TULIP) || mat.equals(Material.RED_TULIP) || mat.equals(Material.WHITE_TULIP) || mat.equals(Material.FERN) || mat.equals(Material.LARGE_FERN) || mat.equals(Material.GRASS) || mat.equals(Material.TALL_GRASS);
|
||||
return mat.getType().equals(Material.POPPY) || mat.getType().equals(Material.DANDELION) || mat.equals(B.mat("CORNFLOWER")) || mat.equals(B.mat("SWEET_BERRY_BUSH")) || mat.equals(B.mat("CRIMSON_ROOTS")) || mat.equals(B.mat("WARPED_ROOTS")) || mat.equals(B.mat("NETHER_SPROUTS")) || mat.equals(B.mat("ALLIUM")) || mat.equals(B.mat("AZURE_BLUET")) || mat.equals(B.mat("BLUE_ORCHID")) || mat.equals(B.mat("POPPY")) || mat.equals(B.mat("DANDELION")) || mat.equals(B.mat("OXEYE_DAISY")) || mat.equals(B.mat("LILY_OF_THE_VALLEY")) || mat.equals(B.mat("WITHER_ROSE")) || mat.getType().equals(Material.DARK_OAK_SAPLING) || mat.getType().equals(Material.ACACIA_SAPLING) || mat.getType().equals(Material.JUNGLE_SAPLING) || mat.getType().equals(Material.BIRCH_SAPLING) || mat.getType().equals(Material.SPRUCE_SAPLING) || mat.getType().equals(Material.OAK_SAPLING) || mat.getType().equals(Material.ORANGE_TULIP) || mat.getType().equals(Material.PINK_TULIP) || mat.getType().equals(Material.RED_TULIP) || mat.getType().equals(Material.WHITE_TULIP) || mat.getType().equals(Material.FERN) || mat.getType().equals(Material.LARGE_FERN) || mat.getType().equals(Material.GRASS) || mat.getType().equals(Material.TALL_GRASS);
|
||||
//@done
|
||||
}
|
||||
|
||||
@@ -395,7 +456,7 @@ public class B
|
||||
}
|
||||
}
|
||||
|
||||
if(onto.equals(Material.AIR) || onto.equals(B.mat("CAVE_AIR")))
|
||||
if(onto.equals(Material.AIR) || onto.equals(B.mat("CAVE_AIR").getMaterial()))
|
||||
{
|
||||
lock.lock();
|
||||
canPlaceOn.add(key);
|
||||
@@ -436,7 +497,7 @@ public class B
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isDecorant(Material m)
|
||||
public static boolean isDecorant(FastBlockData m)
|
||||
{
|
||||
if(decorant.contains(m))
|
||||
{
|
||||
@@ -444,7 +505,7 @@ public class B
|
||||
}
|
||||
|
||||
// @NoArgsConstructor
|
||||
boolean str = m.equals(Material.GRASS) || m.equals(Material.TALL_GRASS) || m.equals(B.mat("CORNFLOWER")) || m.equals(Material.SUNFLOWER) || m.equals(Material.CHORUS_FLOWER) || m.equals(Material.POPPY) || m.equals(Material.DANDELION) || m.equals(Material.OXEYE_DAISY) || m.equals(Material.ORANGE_TULIP) || m.equals(Material.PINK_TULIP) || m.equals(Material.RED_TULIP) || m.equals(Material.WHITE_TULIP) || m.equals(Material.LILAC) || m.equals(Material.DEAD_BUSH) || m.equals(B.mat("SWEET_BERRY_BUSH")) || m.equals(Material.ROSE_BUSH) || m.equals(B.mat("WITHER_ROSE")) || m.equals(Material.ALLIUM) || m.equals(Material.BLUE_ORCHID) || m.equals(B.mat("LILY_OF_THE_VALLEY")) || m.equals(B.mat("CRIMSON_FUNGUS")) || m.equals(B.mat("WARPED_FUNGUS")) || m.equals(Material.RED_MUSHROOM) || m.equals(Material.BROWN_MUSHROOM) || m.equals(B.mat("CRIMSON_ROOTS")) || m.equals(B.mat("AZURE_BLUET")) || m.equals(B.mat("WEEPING_VINES")) || m.equals(B.mat("WEEPING_VINES_PLANT")) || m.equals(B.mat("WARPED_ROOTS")) || m.equals(B.mat("NETHER_SPROUTS")) || m.equals(B.mat("TWISTING_VINES")) || m.equals(B.mat("TWISTING_VINES_PLANT")) || m.equals(Material.SUGAR_CANE) || m.equals(Material.WHEAT) || m.equals(Material.POTATOES) || m.equals(Material.CARROTS) || m.equals(Material.BEETROOTS) || m.equals(Material.NETHER_WART) || m.equals(B.mat("SEA_PICKLE")) || m.equals(B.mat("SEAGRASS")) || m.equals(B.mat("ACACIA_BUTTON")) || m.equals(B.mat("BIRCH_BUTTON")) || m.equals(B.mat("CRIMSON_BUTTON")) || m.equals(B.mat("DARK_OAK_BUTTON")) || m.equals(B.mat("JUNGLE_BUTTON")) || m.equals(B.mat("OAK_BUTTON")) || m.equals(B.mat("POLISHED_BLACKSTONE_BUTTON")) || m.equals(B.mat("SPRUCE_BUTTON")) || m.equals(B.mat("STONE_BUTTON")) || m.equals(B.mat("WARPED_BUTTON")) || m.equals(Material.TORCH) || m.equals(B.mat("SOUL_TORCH"));
|
||||
boolean str = m.getType().equals(Material.GRASS) || m.getType().equals(Material.TALL_GRASS) || m.equals(B.mat("CORNFLOWER")) || m.getType().equals(Material.SUNFLOWER) || m.getType().equals(Material.CHORUS_FLOWER) || m.getType().equals(Material.POPPY) || m.getType().equals(Material.DANDELION) || m.getType().equals(Material.OXEYE_DAISY) || m.getType().equals(Material.ORANGE_TULIP) || m.getType().equals(Material.PINK_TULIP) || m.getType().equals(Material.RED_TULIP) || m.getType().equals(Material.WHITE_TULIP) || m.getType().equals(Material.LILAC) || m.getType().equals(Material.DEAD_BUSH) || m.equals(B.mat("SWEET_BERRY_BUSH")) || m.getType().equals(Material.ROSE_BUSH) || m.equals(B.mat("WITHER_ROSE")) || m.getType().equals(Material.ALLIUM) || m.getType().equals(Material.BLUE_ORCHID) || m.equals(B.mat("LILY_OF_THE_VALLEY")) || m.equals(B.mat("CRIMSON_FUNGUS")) || m.equals(B.mat("WARPED_FUNGUS")) || m.getType().equals(Material.RED_MUSHROOM) || m.getType().equals(Material.BROWN_MUSHROOM) || m.equals(B.mat("CRIMSON_ROOTS")) || m.equals(B.mat("AZURE_BLUET")) || m.equals(B.mat("WEEPING_VINES")) || m.equals(B.mat("WEEPING_VINES_PLANT")) || m.equals(B.mat("WARPED_ROOTS")) || m.equals(B.mat("NETHER_SPROUTS")) || m.equals(B.mat("TWISTING_VINES")) || m.equals(B.mat("TWISTING_VINES_PLANT")) || m.getType().equals(Material.SUGAR_CANE) || m.getType().equals(Material.WHEAT) || m.getType().equals(Material.POTATOES) || m.getType().equals(Material.CARROTS) || m.getType().equals(Material.BEETROOTS) || m.getType().equals(Material.NETHER_WART) || m.equals(B.mat("SEA_PICKLE")) || m.equals(B.mat("SEAGRASS")) || m.equals(B.mat("ACACIA_BUTTON")) || m.equals(B.mat("BIRCH_BUTTON")) || m.equals(B.mat("CRIMSON_BUTTON")) || m.equals(B.mat("DARK_OAK_BUTTON")) || m.equals(B.mat("JUNGLE_BUTTON")) || m.equals(B.mat("OAK_BUTTON")) || m.equals(B.mat("POLISHED_BLACKSTONE_BUTTON")) || m.equals(B.mat("SPRUCE_BUTTON")) || m.equals(B.mat("STONE_BUTTON")) || m.equals(B.mat("WARPED_BUTTON")) || m.getType().equals(Material.TORCH) || m.equals(B.mat("SOUL_TORCH"));
|
||||
//@done
|
||||
|
||||
if(str)
|
||||
@@ -456,13 +517,13 @@ public class B
|
||||
return false;
|
||||
}
|
||||
|
||||
public static KList<BlockData> getBlockData(KList<String> find)
|
||||
public static KList<FastBlockData> getBlockData(KList<String> find)
|
||||
{
|
||||
KList<BlockData> b = new KList<>();
|
||||
KList<FastBlockData> b = new KList<>();
|
||||
|
||||
for(String i : find)
|
||||
{
|
||||
BlockData bd = getBlockData(i);
|
||||
FastBlockData bd = getBlockData(i);
|
||||
|
||||
if(bd != null)
|
||||
{
|
||||
@@ -473,22 +534,22 @@ public class B
|
||||
return b;
|
||||
}
|
||||
|
||||
public static boolean isFoliagePlantable(BlockData d)
|
||||
public static boolean isFoliagePlantable(FastBlockData d)
|
||||
{
|
||||
return d.getMaterial().equals(Material.GRASS_BLOCK) || d.getMaterial().equals(Material.DIRT) || d.getMaterial().equals(Material.COARSE_DIRT) || d.getMaterial().equals(Material.PODZOL);
|
||||
}
|
||||
|
||||
public static boolean isFluid(BlockData d)
|
||||
public static boolean isFluid(FastBlockData d)
|
||||
{
|
||||
return d.getMaterial().equals(Material.WATER) || d.getMaterial().equals(Material.LAVA);
|
||||
}
|
||||
|
||||
public static boolean isAirOrFluid(BlockData d)
|
||||
public static boolean isAirOrFluid(FastBlockData d)
|
||||
{
|
||||
return isAir(d) || isFluid(d);
|
||||
}
|
||||
|
||||
public static boolean isAir(BlockData d)
|
||||
public static boolean isAir(FastBlockData d)
|
||||
{
|
||||
if(d == null)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ public class FastBlockData
|
||||
{
|
||||
this.blockData = d;
|
||||
this.type = null;
|
||||
optimize();
|
||||
}
|
||||
|
||||
private FastBlockData(Material m)
|
||||
@@ -21,6 +22,11 @@ public class FastBlockData
|
||||
this.blockData = null;
|
||||
}
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return type != null ? type : blockData.getMaterial();
|
||||
}
|
||||
|
||||
public static FastBlockData of(Material type)
|
||||
{
|
||||
return new FastBlockData(type);
|
||||
@@ -40,7 +46,7 @@ public class FastBlockData
|
||||
{
|
||||
if(hasBlockData())
|
||||
{
|
||||
BlockData f = getDefaultBlockData(type);
|
||||
BlockData f = getDefaultBlockData(getMaterial());
|
||||
|
||||
if(f.hashCode() == getBlockData().hashCode())
|
||||
{
|
||||
@@ -63,7 +69,7 @@ public class FastBlockData
|
||||
return blockData != null;
|
||||
}
|
||||
|
||||
public BlockData getBlockData()
|
||||
public BlockData createBlockData()
|
||||
{
|
||||
if(blockData != null)
|
||||
{
|
||||
@@ -72,4 +78,60 @@ public class FastBlockData
|
||||
|
||||
return type.createBlockData();
|
||||
}
|
||||
|
||||
public BlockData getBlockData()
|
||||
{
|
||||
if(blockData == null)
|
||||
{
|
||||
blockData = createBlockData();
|
||||
}
|
||||
|
||||
return blockData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
if(hasBlockData())
|
||||
{
|
||||
return getBlockData().hashCode();
|
||||
}
|
||||
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
FastBlockData other = (FastBlockData) obj;
|
||||
|
||||
if(other.hashCode() == hashCode())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public FastBlockData clone()
|
||||
{
|
||||
return hasBlockData() ? new FastBlockData(blockData.clone()) : new FastBlockData(getType());
|
||||
}
|
||||
|
||||
public boolean matches(FastBlockData data)
|
||||
{
|
||||
return (data.hasBlockData() && hasBlockData() && getBlockData().matches(data.getBlockData())) || (!data.hasBlockData() && !hasBlockData() && getType().equals(data.getType()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public interface IObjectPlacer
|
||||
{
|
||||
public int getHighest(int x, int z);
|
||||
|
||||
public int getHighest(int x, int z, boolean ignoreFluid);
|
||||
|
||||
public void set(int x, int y, int z, BlockData d);
|
||||
public void set(int x, int y, int z, FastBlockData d);
|
||||
|
||||
public BlockData get(int x, int y, int z);
|
||||
public FastBlockData get(int x, int y, int z);
|
||||
|
||||
public boolean isPreventingDecay();
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
public interface IPostBlockAccess
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
public int highestTerrainOrFluidBlock(int x, int z);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Levelled;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
@@ -33,13 +32,13 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess
|
||||
public abstract void onPost(int x, int z, int currentPostX, int currentPostZ, ChunkData currentData, KList<Runnable> q);
|
||||
|
||||
@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)
|
||||
{
|
||||
return gen.getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
gen.setPostBlock(x, y, z, d, currentPostX, currentPostZ, currentData);
|
||||
}
|
||||
@@ -63,62 +62,62 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess
|
||||
|
||||
public boolean isAir(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR);
|
||||
}
|
||||
|
||||
public boolean hasGravity(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().equals(Material.SAND) || d.getMaterial().equals(Material.RED_SAND) || d.getMaterial().equals(Material.BLACK_CONCRETE_POWDER) || d.getMaterial().equals(Material.BLUE_CONCRETE_POWDER) || d.getMaterial().equals(Material.BROWN_CONCRETE_POWDER) || d.getMaterial().equals(Material.CYAN_CONCRETE_POWDER) || d.getMaterial().equals(Material.GRAY_CONCRETE_POWDER) || d.getMaterial().equals(Material.GREEN_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIGHT_BLUE_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIGHT_GRAY_CONCRETE_POWDER) || d.getMaterial().equals(Material.LIME_CONCRETE_POWDER) || d.getMaterial().equals(Material.MAGENTA_CONCRETE_POWDER) || d.getMaterial().equals(Material.ORANGE_CONCRETE_POWDER) || d.getMaterial().equals(Material.PINK_CONCRETE_POWDER) || d.getMaterial().equals(Material.PURPLE_CONCRETE_POWDER) || d.getMaterial().equals(Material.RED_CONCRETE_POWDER) || d.getMaterial().equals(Material.WHITE_CONCRETE_POWDER) || d.getMaterial().equals(Material.YELLOW_CONCRETE_POWDER);
|
||||
}
|
||||
|
||||
public boolean isSolid(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().isSolid();
|
||||
}
|
||||
|
||||
public boolean isSolidNonSlab(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().isSolid() && !(d instanceof Slab);
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().isSolid() && !(d.getBlockData() instanceof Slab);
|
||||
}
|
||||
|
||||
public boolean isAirOrWater(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().equals(Material.WATER) || d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR);
|
||||
}
|
||||
|
||||
public boolean isSlab(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d instanceof Slab;
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getBlockData() instanceof Slab;
|
||||
}
|
||||
|
||||
public boolean isSnowLayer(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().equals(Material.SNOW);
|
||||
}
|
||||
|
||||
public boolean isWater(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().equals(Material.WATER);
|
||||
}
|
||||
|
||||
public boolean isWaterOrWaterlogged(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().equals(Material.WATER) || (d instanceof Waterlogged && ((Waterlogged) d).isWaterlogged());
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getMaterial().equals(Material.WATER) || (d.getBlockData() instanceof Waterlogged && ((Waterlogged) d.getBlockData()).isWaterlogged());
|
||||
}
|
||||
|
||||
public boolean isLiquid(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
|
||||
{
|
||||
BlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d instanceof Levelled;
|
||||
FastBlockData d = getPostBlock(x, y, z, currentPostX, currentPostZ, currentData);
|
||||
return d.getBlockData() instanceof Levelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ParallaxSection implements Writable
|
||||
public ParallaxSection()
|
||||
{
|
||||
updates = new KSet<Short>();
|
||||
this.block = new DataPalette<BlockData>(B.get("AIR"))
|
||||
this.block = new DataPalette<BlockData>(B.get("AIR").getBlockData())
|
||||
{
|
||||
@Override
|
||||
public void writeType(BlockData t, DataOutputStream o) throws IOException
|
||||
@@ -31,7 +31,7 @@ public class ParallaxSection implements Writable
|
||||
@Override
|
||||
public BlockData readType(DataInputStream i) throws IOException
|
||||
{
|
||||
return B.get(i.readUTF());
|
||||
return B.get(i.readUTF()).getBlockData();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class ParallaxSection implements Writable
|
||||
{
|
||||
block.set(x, y, z, d);
|
||||
|
||||
if(B.isUpdatable(d))
|
||||
if(B.isUpdatable(FastBlockData.of(d)))
|
||||
{
|
||||
update(x, y, z);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user