mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-01-04 15:41:30 +00:00
REMOVE FBD
This commit is contained in:
@@ -30,6 +30,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -349,14 +350,14 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return childrenCell.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137)).bake().scale(scale).bake());
|
||||
}
|
||||
|
||||
public KList<FastBlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height, IrisDataManager rdata)
|
||||
public KList<BlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height, IrisDataManager rdata)
|
||||
{
|
||||
if(isLockLayers())
|
||||
{
|
||||
return generateLockedLayers(wx, wz, random, maxDepth, height, rdata);
|
||||
}
|
||||
|
||||
KList<FastBlockData> data = new KList<>();
|
||||
KList<BlockData> data = new KList<>();
|
||||
|
||||
if(maxDepth <= 0)
|
||||
{
|
||||
@@ -400,10 +401,10 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return data;
|
||||
}
|
||||
|
||||
public KList<FastBlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisDataManager rdata)
|
||||
public KList<BlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisDataManager rdata)
|
||||
{
|
||||
KList<FastBlockData> data = new KList<>();
|
||||
KList<FastBlockData> real = new KList<>();
|
||||
KList<BlockData> data = new KList<>();
|
||||
KList<BlockData> real = new KList<>();
|
||||
int maxDepth = Math.min(maxDepthf, getLockLayersMax());
|
||||
if(maxDepth <= 0)
|
||||
{
|
||||
@@ -470,9 +471,9 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return this;
|
||||
}
|
||||
|
||||
public KList<FastBlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisDataManager rdata)
|
||||
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisDataManager rdata)
|
||||
{
|
||||
KList<FastBlockData> data = new KList<>();
|
||||
KList<BlockData> data = new KList<>();
|
||||
|
||||
for(int i = 0; i < seaLayers.size(); i++)
|
||||
{
|
||||
@@ -660,7 +661,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return getBiomeGenerator(rng).fit(biomeScatter, x, y, z);
|
||||
}
|
||||
|
||||
public FastBlockData getSurfaceBlock(int x, int z, RNG rng, IrisDataManager idm)
|
||||
public BlockData getSurfaceBlock(int x, int z, RNG rng, IrisDataManager idm)
|
||||
{
|
||||
if(getLayers().isEmpty())
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -54,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<FastBlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
|
||||
@@ -63,7 +64,7 @@ public class IrisBiomePaletteLayer
|
||||
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
|
||||
}
|
||||
|
||||
public FastBlockData get(RNG rng, double x, double y, double z, IrisDataManager data)
|
||||
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockData(data).isEmpty())
|
||||
{
|
||||
@@ -94,14 +95,14 @@ public class IrisBiomePaletteLayer
|
||||
return palette;
|
||||
}
|
||||
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager data)
|
||||
public KList<BlockData> getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
FastBlockData bx = ix.getBlockData(data);
|
||||
BlockData bx = ix.getBlockData(data);
|
||||
if(bx != null)
|
||||
{
|
||||
for(int i = 0; i < ix.getWeight(); i++)
|
||||
|
||||
@@ -18,6 +18,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -55,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<FastBlockData> blockdata = new AtomicCache<>();
|
||||
private final transient AtomicCache<BlockData> blockdata = new AtomicCache<>();
|
||||
private final transient AtomicCache<String> realProperties = new AtomicCache<>();
|
||||
|
||||
public IrisBlockData(String b)
|
||||
@@ -85,11 +86,11 @@ public class IrisBlockData extends IrisRegistrant
|
||||
return computeProperties(getData());
|
||||
}
|
||||
|
||||
public FastBlockData getBlockData(IrisDataManager data)
|
||||
public BlockData getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockdata.aquire(() ->
|
||||
{
|
||||
FastBlockData b = null;
|
||||
BlockData b = null;
|
||||
|
||||
IrisBlockData customData = data.getBlockLoader().load(getBlock(), false);
|
||||
|
||||
@@ -101,7 +102,7 @@ public class IrisBlockData extends IrisRegistrant
|
||||
{
|
||||
b = b.clone();
|
||||
|
||||
String st = b.getBlockData().getAsString(true);
|
||||
String st = b.getAsString(true);
|
||||
|
||||
if(st.contains("["))
|
||||
{
|
||||
@@ -122,7 +123,7 @@ public class IrisBlockData extends IrisRegistrant
|
||||
Iris.warn("Debug block data " + sx + " (CUSTOM)");
|
||||
}
|
||||
|
||||
FastBlockData bx = B.get(sx);
|
||||
BlockData bx = B.get(sx);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
@@ -45,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<FastBlockData>> data = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> data = new AtomicCache<>();
|
||||
|
||||
public boolean shouldDropFor(FastBlockData data, IrisDataManager rdata)
|
||||
public boolean shouldDropFor(BlockData data, IrisDataManager rdata)
|
||||
{
|
||||
KList<FastBlockData> list = this.data.aquire(() ->
|
||||
KList<BlockData> list = this.data.aquire(() ->
|
||||
{
|
||||
KList<FastBlockData> b = new KList<>();
|
||||
KList<BlockData> b = new KList<>();
|
||||
|
||||
for(IrisBlockData i : getBlocks())
|
||||
{
|
||||
FastBlockData dd = i.getBlockData(rdata);
|
||||
BlockData dd = i.getBlockData(rdata);
|
||||
|
||||
if(dd != null)
|
||||
{
|
||||
@@ -66,7 +67,7 @@ public class IrisBlockDrops
|
||||
return b.removeDuplicates();
|
||||
});
|
||||
|
||||
for(FastBlockData i : list)
|
||||
for(BlockData i : list)
|
||||
{
|
||||
if(exactBlocks ? i.equals(data) : i.getMaterial().equals(data.getMaterial()))
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -37,18 +38,18 @@ public class IrisCaveFluid
|
||||
@Desc("The fluid type that should spawn here")
|
||||
private IrisBlockData fluidType = new IrisBlockData("CAVE_AIR");
|
||||
|
||||
private final transient AtomicCache<FastBlockData> fluidData = new AtomicCache<>();
|
||||
private final transient AtomicCache<BlockData> fluidData = new AtomicCache<>();
|
||||
|
||||
public boolean hasFluid(IrisDataManager rdata)
|
||||
{
|
||||
return !B.isAir(getFluid(rdata));
|
||||
}
|
||||
|
||||
public FastBlockData getFluid(IrisDataManager rdata)
|
||||
public BlockData getFluid(IrisDataManager rdata)
|
||||
{
|
||||
return fluidData.aquire(() ->
|
||||
{
|
||||
FastBlockData b = getFluidType().getBlockData(rdata);
|
||||
BlockData b = getFluidType().getBlockData(rdata);
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
|
||||
@@ -13,13 +13,14 @@ import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
|
||||
import lombok.Data;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Data
|
||||
public class IrisCompat
|
||||
{
|
||||
private KList<IrisCompatabilityBlockFilter> blockFilters = new KList<>();
|
||||
private KList<IrisCompatabilityItemFilter> itemFilters = new KList<>();
|
||||
private transient KMap<String, FastBlockData> blockResolves = new KMap<>();
|
||||
private transient KMap<String, BlockData> blockResolves = new KMap<>();
|
||||
private transient KMap<String, Material> itemResolves = new KMap<>();
|
||||
|
||||
public IrisCompat()
|
||||
@@ -28,7 +29,7 @@ public class IrisCompat
|
||||
itemFilters = getDefaultItemCompatabilityFilters();
|
||||
}
|
||||
|
||||
public FastBlockData getBlock(String n)
|
||||
public BlockData getBlock(String n)
|
||||
{
|
||||
return blockResolves.compute(n, (k, v) ->
|
||||
{
|
||||
@@ -40,7 +41,7 @@ public class IrisCompat
|
||||
String buf = k;
|
||||
int err = 16;
|
||||
|
||||
FastBlockData tx = B.parseBlockDataOrNull(buf);
|
||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
{
|
||||
@@ -58,7 +59,7 @@ public class IrisCompat
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
FastBlockData b = i.getReplace();
|
||||
BlockData b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
@@ -99,7 +100,7 @@ public class IrisCompat
|
||||
{
|
||||
if(nomore < 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
}
|
||||
|
||||
nomore--;
|
||||
@@ -128,11 +129,11 @@ public class IrisCompat
|
||||
}
|
||||
|
||||
buf = k;
|
||||
FastBlockData tx = B.parseBlockDataOrNull(buf);
|
||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
{
|
||||
return tx.getType();
|
||||
return tx.getMaterial();
|
||||
}
|
||||
nomore = 64;
|
||||
|
||||
@@ -140,25 +141,25 @@ public class IrisCompat
|
||||
{
|
||||
if(nomore < 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
}
|
||||
|
||||
nomore--;
|
||||
|
||||
if(err-- <= 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
}
|
||||
|
||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
FastBlockData b = i.getReplace();
|
||||
BlockData b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
return b.getType();
|
||||
return b.getMaterial();
|
||||
}
|
||||
|
||||
buf = i.getSupplement();
|
||||
@@ -166,7 +167,7 @@ public class IrisCompat
|
||||
}
|
||||
}
|
||||
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -33,24 +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<FastBlockData> findData = new AtomicCache<>(true);
|
||||
private final transient AtomicCache<FastBlockData> replaceData = new AtomicCache<>(true);
|
||||
private final transient AtomicCache<BlockData> findData = new AtomicCache<>(true);
|
||||
private final transient AtomicCache<BlockData> replaceData = new AtomicCache<>(true);
|
||||
|
||||
public IrisCompatabilityBlockFilter(String when, String supplement)
|
||||
{
|
||||
this(when, supplement, false);
|
||||
}
|
||||
|
||||
public FastBlockData getFind()
|
||||
public BlockData getFind()
|
||||
{
|
||||
return findData.aquire(() -> B.getBlockData(when));
|
||||
}
|
||||
|
||||
public FastBlockData getReplace()
|
||||
public BlockData getReplace()
|
||||
{
|
||||
return replaceData.aquire(() ->
|
||||
{
|
||||
FastBlockData b = B.parseBlockDataOrNull(supplement);
|
||||
BlockData b = B.parseBlockDataOrNull(supplement);
|
||||
|
||||
if(b == null)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -94,8 +95,8 @@ public class IrisDecorator
|
||||
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<FastBlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> blockDataTops = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockDataTops = new AtomicCache<>();
|
||||
|
||||
public int getHeight(RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
@@ -131,7 +132,7 @@ public class IrisDecorator
|
||||
return palette;
|
||||
}
|
||||
|
||||
public FastBlockData getBlockData(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
public BlockData getBlockData(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockData(data).isEmpty())
|
||||
{
|
||||
@@ -155,7 +156,7 @@ public class IrisDecorator
|
||||
return null;
|
||||
}
|
||||
|
||||
public FastBlockData getBlockData100(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
public BlockData getBlockData100(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockData(data).isEmpty())
|
||||
{
|
||||
@@ -174,7 +175,7 @@ public class IrisDecorator
|
||||
return getVarianceGenerator(rng, data).fit(getBlockData(data), xx, zz);
|
||||
}
|
||||
|
||||
public FastBlockData getBlockDataForTop(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
public BlockData getBlockDataForTop(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockDataTops(data).isEmpty())
|
||||
{
|
||||
@@ -197,14 +198,14 @@ public class IrisDecorator
|
||||
return null;
|
||||
}
|
||||
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager data)
|
||||
public KList<BlockData> getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
for(IrisBlockData i : palette)
|
||||
{
|
||||
FastBlockData bx = i.getBlockData(data);
|
||||
BlockData bx = i.getBlockData(data);
|
||||
if(bx != null)
|
||||
{
|
||||
blockData.add(bx);
|
||||
@@ -215,14 +216,14 @@ public class IrisDecorator
|
||||
});
|
||||
}
|
||||
|
||||
public KList<FastBlockData> getBlockDataTops(IrisDataManager data)
|
||||
public KList<BlockData> getBlockDataTops(IrisDataManager data)
|
||||
{
|
||||
return blockDataTops.aquire(() ->
|
||||
{
|
||||
KList<FastBlockData> blockDataTops = new KList<>();
|
||||
KList<BlockData> blockDataTops = new KList<>();
|
||||
for(IrisBlockData i : topPalette)
|
||||
{
|
||||
FastBlockData bx = i.getBlockData(data);
|
||||
BlockData bx = i.getBlockData(data);
|
||||
if(bx != null)
|
||||
{
|
||||
blockDataTops.add(bx);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class IrisDepositGenerator
|
||||
private int varience = 3;
|
||||
|
||||
private final transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
|
||||
public IrisObject getClump(RNG rng, IrisDataManager rdata)
|
||||
{
|
||||
@@ -136,20 +136,20 @@ public class IrisDepositGenerator
|
||||
return o;
|
||||
}
|
||||
|
||||
private FastBlockData nextBlock(RNG rngv, IrisDataManager rdata)
|
||||
private BlockData nextBlock(RNG rngv, IrisDataManager rdata)
|
||||
{
|
||||
return getBlockData(rdata).get(rngv.i(0, getBlockData(rdata).size() - 1));
|
||||
}
|
||||
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager rdata)
|
||||
public KList<BlockData> getBlockData(IrisDataManager rdata)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
FastBlockData bx = ix.getBlockData(rdata);
|
||||
BlockData bx = ix.getBlockData(rdata);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -220,8 +220,8 @@ public class IrisDepositGenerator
|
||||
|
||||
if(!allow)
|
||||
{
|
||||
FastBlockData b = FastBlockData.of(data.getBlockData(nx, ny, nz));
|
||||
for(FastBlockData f : g.getDimension().getRockPalette().getBlockData(g.getData()))
|
||||
BlockData b = data.getBlockData(nx, ny, nz);
|
||||
for(BlockData f : g.getDimension().getRockPalette().getBlockData(g.getData()))
|
||||
{
|
||||
if(f.getMaterial().equals(b.getMaterial()))
|
||||
{
|
||||
@@ -243,7 +243,7 @@ public class IrisDepositGenerator
|
||||
|
||||
if(allow)
|
||||
{
|
||||
data.setBlock(nx, ny, nz, clump.getBlocks().get(j).getBlockData());
|
||||
data.setBlock(nx, ny, nz, clump.getBlocks().get(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
});
|
||||
}
|
||||
|
||||
public FastBlockData resolveBlock(String bd)
|
||||
public BlockData resolveBlock(String bd)
|
||||
{
|
||||
return Iris.compat.getBlock(bd);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -38,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<FastBlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
|
||||
public FastBlockData get(RNG rng, double x, double y, double z, IrisDataManager rdata)
|
||||
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager rdata)
|
||||
{
|
||||
if(getBlockData(rdata).isEmpty())
|
||||
{
|
||||
@@ -86,14 +87,14 @@ public class IrisMaterialPalette
|
||||
return this;
|
||||
}
|
||||
|
||||
public KList<FastBlockData> getBlockData(IrisDataManager rdata)
|
||||
public KList<BlockData> getBlockData(IrisDataManager rdata)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<FastBlockData> blockData = new KList<>();
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
FastBlockData bx = ix.getBlockData(rdata);
|
||||
BlockData bx = ix.getBlockData(rdata);
|
||||
if(bx != null)
|
||||
{
|
||||
for(int i = 0; i < ix.getWeight(); i++)
|
||||
|
||||
@@ -12,6 +12,7 @@ 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;
|
||||
@@ -36,12 +37,12 @@ import lombok.experimental.Accessors;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
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]")};
|
||||
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]")};
|
||||
public static boolean shitty = false;
|
||||
private KMap<BlockVector, FastBlockData> blocks;
|
||||
private KMap<BlockVector, BlockData> blocks;
|
||||
private int w;
|
||||
private int d;
|
||||
private int h;
|
||||
@@ -276,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).getBlockData().getAsString(true));
|
||||
dos.writeUTF(blocks.get(i).getAsString(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +287,7 @@ public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
return;
|
||||
}
|
||||
KMap<BlockVector, FastBlockData> d = blocks.copy();
|
||||
KMap<BlockVector, BlockData> d = blocks.copy();
|
||||
blocks.clear();
|
||||
|
||||
for(BlockVector i : d.k())
|
||||
@@ -295,7 +296,7 @@ public class IrisObject extends IrisRegistrant
|
||||
}
|
||||
}
|
||||
|
||||
public void setUnsigned(int x, int y, int z, FastBlockData block)
|
||||
public void setUnsigned(int x, int y, int z, BlockData block)
|
||||
{
|
||||
if(shitty)
|
||||
{
|
||||
@@ -507,21 +508,21 @@ 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();
|
||||
FastBlockData data = blocks.get(g).clone();
|
||||
BlockData data = blocks.get(g).clone();
|
||||
|
||||
if(stilting && i.getBlockY() < lowest && !B.isAir(data))
|
||||
{
|
||||
lowest = i.getBlockY();
|
||||
}
|
||||
|
||||
if(placer.isPreventingDecay() && (data.getBlockData()) instanceof Leaves && !((Leaves) (data.getBlockData())).isPersistent())
|
||||
if(placer.isPreventingDecay() && (data) instanceof Leaves && !((Leaves) (data)).isPersistent())
|
||||
{
|
||||
((Leaves) data.getBlockData()).setPersistent(true);
|
||||
((Leaves) data).setPersistent(true);
|
||||
}
|
||||
|
||||
for(IrisObjectReplace j : config.getEdit())
|
||||
{
|
||||
for(FastBlockData k : j.getFind(rdata))
|
||||
for(BlockData k : j.getFind(rdata))
|
||||
{
|
||||
if(j.isExact() ? k.matches(data) : k.getMaterial().equals(data.getMaterial()))
|
||||
{
|
||||
@@ -595,7 +596,7 @@ public class IrisObject extends IrisRegistrant
|
||||
continue;
|
||||
}
|
||||
|
||||
FastBlockData d = blocks.get(i);
|
||||
BlockData d = blocks.get(i);
|
||||
|
||||
if(d == null || B.isAir(d))
|
||||
{
|
||||
@@ -653,7 +654,7 @@ public class IrisObject extends IrisRegistrant
|
||||
return;
|
||||
}
|
||||
|
||||
KMap<BlockVector, FastBlockData> v = blocks.copy();
|
||||
KMap<BlockVector, BlockData> v = blocks.copy();
|
||||
blocks.clear();
|
||||
|
||||
for(BlockVector i : v.keySet())
|
||||
@@ -671,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).getBlockData(), false);
|
||||
at.clone().add(0, getCenter().getY(), 0).add(i).getBlock().setBlockData(blocks.get(i), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@@ -38,18 +39,18 @@ public class IrisObjectReplace
|
||||
private boolean exact = false;
|
||||
|
||||
private final transient AtomicCache<CNG> replaceGen = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> findData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<FastBlockData>> replaceData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> findData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> replaceData = new AtomicCache<>();
|
||||
|
||||
public KList<FastBlockData> getFind(IrisDataManager rdata)
|
||||
public KList<BlockData> getFind(IrisDataManager rdata)
|
||||
{
|
||||
return findData.aquire(() ->
|
||||
{
|
||||
KList<FastBlockData> b = new KList<>();
|
||||
KList<BlockData> b = new KList<>();
|
||||
|
||||
for(IrisBlockData i : find)
|
||||
{
|
||||
FastBlockData bx = i.getBlockData(rdata);
|
||||
BlockData bx = i.getBlockData(rdata);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -61,7 +62,7 @@ public class IrisObjectReplace
|
||||
});
|
||||
}
|
||||
|
||||
public FastBlockData getReplace(RNG seed, double x, double y, double z, IrisDataManager rdata)
|
||||
public BlockData getReplace(RNG seed, double x, double y, double z, IrisDataManager rdata)
|
||||
{
|
||||
return getReplace().get(seed, x, y, z, rdata);
|
||||
}
|
||||
|
||||
@@ -111,16 +111,16 @@ public class IrisObjectRotation
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
|
||||
public FastBlockData rotate(FastBlockData dd, int spinxx, int spinyy, int spinzz)
|
||||
public BlockData rotate(BlockData dd, int spinxx, int spinyy, int spinzz)
|
||||
{
|
||||
BlockData d = dd.getBlockData();
|
||||
BlockData d = dd;
|
||||
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 FastBlockData.of(d);
|
||||
return d;
|
||||
}
|
||||
|
||||
if(d instanceof Directional)
|
||||
@@ -180,7 +180,7 @@ public class IrisObjectRotation
|
||||
}
|
||||
}
|
||||
|
||||
return FastBlockData.of(d);
|
||||
return d;
|
||||
}
|
||||
|
||||
public BlockVector rotate(BlockVector b, int spinx, int spiny, int spinz)
|
||||
|
||||
Reference in New Issue
Block a user