mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-24 09:39:16 +00:00
BLOCK DATA CUSTOM SUPPORT & FIX DECAYS
This commit is contained in:
@@ -142,7 +142,7 @@ public class CommandIrisCreate extends MortarCommand
|
||||
}
|
||||
|
||||
sender.sendMessage(worldName + " type installed. Generating Spawn Area...");
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
ProvisionBukkit gen = Iris.instance.createProvisionBukkit(
|
||||
IrisGenConfiguration.builder()
|
||||
.threads(IrisSettings.get().threads)
|
||||
|
||||
@@ -329,7 +329,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
|
||||
{
|
||||
for(IrisBlockDrops i : cbio.getBlockDrops())
|
||||
{
|
||||
if(i.shouldDropFor(data))
|
||||
if(i.shouldDropFor(data, getData()))
|
||||
{
|
||||
if(!skipParents && i.isSkipParents())
|
||||
{
|
||||
@@ -350,7 +350,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
|
||||
{
|
||||
for(IrisBlockDrops i : bio.getBlockDrops())
|
||||
{
|
||||
if(i.shouldDropFor(data))
|
||||
if(i.shouldDropFor(data, getData()))
|
||||
{
|
||||
if(!skipParents && i.isSkipParents())
|
||||
{
|
||||
@@ -371,7 +371,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
|
||||
{
|
||||
for(IrisBlockDrops i : reg.getBlockDrops())
|
||||
{
|
||||
if(i.shouldDropFor(data))
|
||||
if(i.shouldDropFor(data, getData()))
|
||||
{
|
||||
if(!skipParents && i.isSkipParents())
|
||||
{
|
||||
@@ -392,7 +392,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
|
||||
{
|
||||
for(IrisBlockDrops i : dim.getBlockDrops())
|
||||
{
|
||||
if(i.shouldDropFor(data))
|
||||
if(i.shouldDropFor(data, getData()))
|
||||
{
|
||||
if(i.isReplaceVanillaDrops())
|
||||
{
|
||||
|
||||
@@ -405,7 +405,7 @@ public abstract class ParallaxTerrainProvider extends TopographicTerrainProvider
|
||||
for(int i = 0; i < o.getTriesForChunk(rng); i++)
|
||||
{
|
||||
rng = rng.nextParallelRNG((i * 3 + 8) - 23040);
|
||||
o.getSchematic(this, rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng);
|
||||
o.getSchematic(this, rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng, getData());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ public abstract class ParallaxTerrainProvider extends TopographicTerrainProvider
|
||||
for(int i = 0; i < o.getTriesForChunk(rng); i++)
|
||||
{
|
||||
rng = rng.nextParallelRNG((i * 3 + 8) - 23040);
|
||||
o.getSchematic(this, rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng, c);
|
||||
o.getSchematic(this, rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng, c, getData());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ public abstract class ParallaxTerrainProvider extends TopographicTerrainProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
o.getSchematic(this, rng).place(xx, res.get(rng.nextParallelRNG(29345 * (i + 234)).nextInt(res.size())).getFloor() + 2, zz, this, o, rng);
|
||||
o.getSchematic(this, rng).place(xx, res.get(rng.nextParallelRNG(29345 * (i + 234)).nextInt(res.size())).getFloor() + 2, zz, this, o, rng, getData());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,9 +140,9 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
throw new RuntimeException("Null Biome!");
|
||||
}
|
||||
|
||||
KList<BlockData> layers = biome.generateLayers(rx, rz, getMasterRandom(), height, height - getFluidHeight());
|
||||
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) : new KList<>();
|
||||
KList<BlockData> seaLayers = biome.isAquatic() || biome.isShore() ? biome.generateSeaLayers(rx, rz, getMasterRandom(), fluidHeight - height, getData()) : new KList<>();
|
||||
BlockData biomeFluid = biome.getFluidType().isEmpty() ? null : B.get(biome.getFluidType());
|
||||
|
||||
boolean caverning = false;
|
||||
@@ -229,7 +229,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
// Set Sea Material (water/lava)
|
||||
if(underwater)
|
||||
{
|
||||
block = seaLayers.hasIndex(fluidHeight - k) ? seaLayers.get(depth) : biomeFluid != null ? biomeFluid : getDimension().getFluidPalette().get(rockRandom, wx, k, wz);
|
||||
block = seaLayers.hasIndex(fluidHeight - k) ? seaLayers.get(depth) : biomeFluid != null ? biomeFluid : getDimension().getFluidPalette().get(rockRandom, wx, k, wz, getData());
|
||||
}
|
||||
|
||||
// Set Surface Material for cavern layer surfaces
|
||||
@@ -242,7 +242,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
|
||||
if(cavernLayers == null)
|
||||
{
|
||||
cavernLayers = carveBiome.generateLayers(rx, rz, getMasterRandom(), 5, height - getFluidHeight());
|
||||
cavernLayers = carveBiome.generateLayers(rx, rz, getMasterRandom(), 5, height - getFluidHeight(), getData());
|
||||
}
|
||||
|
||||
block = cavernLayers.hasIndex(lastCavernHeight - k) ? cavernLayers.get(lastCavernHeight - k) : cavernLayers.get(0);
|
||||
@@ -251,7 +251,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
// Set Surface Material for true surface
|
||||
else
|
||||
{
|
||||
block = layers.hasIndex(depth) ? layers.get(depth) : getDimension().getRockPalette().get(rockRandom, wx, k, wz);
|
||||
block = layers.hasIndex(depth) ? layers.get(depth) : getDimension().getRockPalette().get(rockRandom, wx, k, wz, getData());
|
||||
depth++;
|
||||
}
|
||||
|
||||
@@ -300,8 +300,8 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
}
|
||||
}
|
||||
|
||||
KList<BlockData> floor = caveBiome.generateLayers(wx, wz, rockRandom, i.getFloor() - 2, i.getFloor() - 2);
|
||||
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);
|
||||
KList<BlockData> floor = caveBiome.generateLayers(wx, wz, rockRandom, i.getFloor() - 2, i.getFloor() - 2, getData());
|
||||
KList<BlockData> ceiling = caveBiome.generateLayers(wx + 256, wz + 256, rockRandom, (carvable ? getCarvedWaterHeight(rx, rz) : height) - i.getCeiling() - 2, (carvable ? getCarvedWaterHeight(rx, rz) : height) - i.getCeiling() - 2, getData());
|
||||
BlockData blockc = null;
|
||||
for(int j = 0; j < floor.size(); j++)
|
||||
{
|
||||
@@ -361,7 +361,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData d = i.getBlockData(biome, rng.nextParallelRNG((int) (38888 + biome.getRarity() + biome.getName().length() + j++)), rx, rz);
|
||||
BlockData d = i.getBlockData(biome, rng.nextParallelRNG((int) (38888 + biome.getRarity() + biome.getName().length() + j++)), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -398,7 +398,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
|
||||
else
|
||||
{
|
||||
int stack = i.getHeight(rng.nextParallelRNG((int) (39456 + (10000 * i.getChance()) + i.getStackMax() + i.getStackMin() + i.getZoom())), rx, rz);
|
||||
int stack = i.getHeight(rng.nextParallelRNG((int) (39456 + (10000 * i.getChance()) + i.getStackMax() + i.getStackMin() + i.getZoom())), rx, rz, getData());
|
||||
|
||||
if(stack == 1)
|
||||
{
|
||||
@@ -430,7 +430,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);
|
||||
BlockData d = i.getBlockData(biome, rng.nextParallelRNG(2333877 + biome.getRarity() + biome.getName().length() + +j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -459,7 +459,7 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
|
||||
else
|
||||
{
|
||||
int stack = i.getHeight(rng.nextParallelRNG((int) (39456 + (1000 * i.getChance()) + i.getZoom() * 10)), rx, rz);
|
||||
int stack = i.getHeight(rng.nextParallelRNG((int) (39456 + (1000 * i.getChance()) + i.getZoom() * 10)), rx, rz, getData());
|
||||
|
||||
if(stack == 1)
|
||||
{
|
||||
@@ -501,11 +501,11 @@ public abstract class TopographicTerrainProvider extends ParallelTerrainProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData d = i.getBlockData(biome, getMasterRandom().nextParallelRNG(2555 + biome.getRarity() + biome.getName().length() + j++), rx, rz);
|
||||
BlockData d = i.getBlockData(biome, getMasterRandom().nextParallelRNG(2555 + biome.getRarity() + biome.getName().length() + j++), rx, rz, getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
int stack = i.getHeight(random.nextParallelRNG((int) (239456 + i.getStackMax() + i.getStackMin() + i.getVerticalZoom() + i.getZoom() + i.getBlockData().size() + j)), rx, rz);
|
||||
int stack = i.getHeight(random.nextParallelRNG((int) (239456 + i.getStackMax() + i.getStackMin() + i.getVerticalZoom() + i.getZoom() + i.getBlockData(getData()).size() + j)), rx, rz, getData());
|
||||
|
||||
if(stack == 1)
|
||||
{
|
||||
|
||||
@@ -29,10 +29,8 @@ public class GenLayerCave extends GenLayer
|
||||
|
||||
public GenLayerCave(TopographicTerrainProvider iris, RNG rng)
|
||||
{
|
||||
// @NoArgsConstructor
|
||||
super(iris, rng);
|
||||
gg = new FastNoiseDouble(324895 * rng.nextParallelRNG(49678).imax());
|
||||
//@done
|
||||
}
|
||||
|
||||
public KList<CaveResult> genCaves(double wxx, double wzz, int x, int z, AtomicSliver data)
|
||||
@@ -61,19 +59,19 @@ public class GenLayerCave extends GenLayer
|
||||
double scale = layer.getCaveZoom();
|
||||
Function<Integer, BlockData> fluid = (height) ->
|
||||
{
|
||||
if(!layer.getFluid().hasFluid())
|
||||
if(!layer.getFluid().hasFluid(iris.getData()))
|
||||
{
|
||||
return CAVE_AIR;
|
||||
}
|
||||
|
||||
if(layer.getFluid().isInverseHeight() && height >= layer.getFluid().getFluidHeight())
|
||||
{
|
||||
return layer.getFluid().getFluid();
|
||||
return layer.getFluid().getFluid(iris.getData());
|
||||
}
|
||||
|
||||
else if(!layer.getFluid().isInverseHeight() && height <= layer.getFluid().getFluidHeight())
|
||||
{
|
||||
return layer.getFluid().getFluid();
|
||||
return layer.getFluid().getFluid(iris.getData());
|
||||
}
|
||||
|
||||
return CAVE_AIR;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class GenLayerText extends GenLayer
|
||||
{
|
||||
if(bufferedImage.getRGB(x, y) != -16777216)
|
||||
{
|
||||
o.setUnsigned(x, 0, y, palette.get(rng, x, w, y));
|
||||
o.setUnsigned(x, 0, y, palette.get(rng, x, w, y, iris.getData()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class NMSCreator141
|
||||
}
|
||||
DimensionManager actualDimension = DimensionManager.a((int) creator.environment().getId());
|
||||
DimensionManager internalDimension = DimensionManager.register((String) name.toLowerCase(Locale.ENGLISH), (DimensionManager) new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> (WorldProvider) manager.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension));
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
WorldServer internal = new WorldServer(
|
||||
(MinecraftServer)console,
|
||||
console.executorService,
|
||||
|
||||
@@ -106,7 +106,7 @@ public class NMSCreator151
|
||||
}
|
||||
DimensionManager actualDimension = DimensionManager.a((int) creator.environment().getId());
|
||||
DimensionManager internalDimension = DimensionManager.register((String) name.toLowerCase(Locale.ENGLISH), (DimensionManager) new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> (WorldProvider) manager.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension.getGenLayerZoomer(), actualDimension));
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
WorldServer internal = new WorldServer(
|
||||
(MinecraftServer)console,
|
||||
console.executorService,
|
||||
|
||||
@@ -165,7 +165,7 @@ public class NMSCreator161
|
||||
ResourceKey typeKey = (ResourceKey) console.f.a().c(dimensionmanager).orElseThrow(() -> new IllegalStateException("Unregistered dimension type: " + (Object) dimensionmanager));
|
||||
ResourceKey worldKey = ResourceKey.a((ResourceKey) IRegistry.ae, (MinecraftKey) new MinecraftKey(name.toLowerCase(Locale.ENGLISH)));
|
||||
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
WorldServer internal = new WorldServer(
|
||||
(MinecraftServer)console,
|
||||
console.executorService,
|
||||
|
||||
@@ -160,7 +160,7 @@ public class NMSCreator162
|
||||
}
|
||||
|
||||
final ResourceKey<net.minecraft.server.v1_16_R2.World> worldKey = (ResourceKey<net.minecraft.server.v1_16_R2.World>) ResourceKey.a(IRegistry.L, new MinecraftKey(name.toLowerCase(Locale.ENGLISH)));
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
final WorldServer internal = new WorldServer((MinecraftServer) console,
|
||||
console.executorService, worldSession,
|
||||
(IWorldDataServer) worlddata,
|
||||
|
||||
@@ -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);
|
||||
BlockData d = biome.getWall().get(rng, x + i, i + h, z + i, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -163,14 +163,14 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
// Slab
|
||||
if(gen.getDimension().isPostProcessingSlabs())
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
if((ha == h + 1 && isSolidNonSlab(x + 1, ha, z, currentPostX, currentPostZ, currentData))
|
||||
|| (hb == h + 1 && isSolidNonSlab(x, hb, z + 1, currentPostX, currentPostZ, currentData))
|
||||
|| (hc == h + 1 && isSolidNonSlab(x - 1, hc, z, currentPostX, currentPostZ, currentData))
|
||||
|| (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, currentPostX, currentPostZ, currentData)))
|
||||
//@done
|
||||
{
|
||||
BlockData d = biome.getSlab().get(rng, x, h, z);
|
||||
BlockData d = biome.getSlab().get(rng, x, h, z, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -323,14 +323,14 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
|
||||
if(gen.getDimension().isPostProcessingSlabs())
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
if((fa == f + 1 && isSolidNonSlab(x + 1, fa, z, currentPostX, currentPostZ, currentData))
|
||||
|| (fb == f + 1 && isSolidNonSlab(x, fb, z + 1, currentPostX, currentPostZ, currentData))
|
||||
|| (fc == f + 1 && isSolidNonSlab(x - 1, fc, z, currentPostX, currentPostZ, currentData))
|
||||
|| (fd == f + 1 && isSolidNonSlab(x, fd, z - 1, currentPostX, currentPostZ, currentData)))
|
||||
//@done
|
||||
{
|
||||
BlockData d = cave.getSlab().get(rng, x, f, z);
|
||||
BlockData d = cave.getSlab().get(rng, x, f, z, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -358,14 +358,14 @@ public class PostMasterPatcher extends IrisPostBlockFilter
|
||||
}
|
||||
}
|
||||
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
if((ca == c - 1 && isSolidNonSlab(x + 1, ca, z, currentPostX, currentPostZ, currentData))
|
||||
|| (cb == c - 1 && isSolidNonSlab(x, cb, z + 1, currentPostX, currentPostZ, currentData))
|
||||
|| (cc == c - 1 && isSolidNonSlab(x - 1, cc, z, currentPostX, currentPostZ, currentData))
|
||||
|| (cd == c - 1 && isSolidNonSlab(x, cd, z - 1, currentPostX, currentPostZ, currentData)))
|
||||
//@done
|
||||
{
|
||||
BlockData d = cave.getSlab().get(rng, x, c, z);
|
||||
BlockData d = cave.getSlab().get(rng, x, c, z, gen.getData());
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ public class IrisBoardManager implements BoardProvider, Listener
|
||||
public IrisBoardManager()
|
||||
{
|
||||
Iris.instance.registerListener(this);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
manager = new BoardManager(Iris.instance, BoardSettings.builder()
|
||||
.boardProvider(this)
|
||||
.scoreDirection(ScoreDirection.DOWN)
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.block.Biome;
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeDecorator;
|
||||
import com.volmit.iris.object.IrisBlockData;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisEntity;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
@@ -36,6 +37,7 @@ public class IrisDataManager
|
||||
private ResourceLoader<IrisGenerator> generatorLoader;
|
||||
private ResourceLoader<IrisStructure> structureLoader;
|
||||
private ResourceLoader<IrisEntity> entityLoader;
|
||||
private ResourceLoader<IrisBlockData> blockLoader;
|
||||
private ObjectResourceLoader objectLoader;
|
||||
|
||||
public void hotloaded()
|
||||
@@ -54,6 +56,7 @@ public class IrisDataManager
|
||||
this.dimensionLoader = new ResourceLoader<>(packs, "dimensions", "Dimension", IrisDimension.class);
|
||||
this.structureLoader = new ResourceLoader<>(packs, "structures", "Structure", IrisStructure.class);
|
||||
this.generatorLoader = new ResourceLoader<>(packs, "generators", "Generator", IrisGenerator.class);
|
||||
this.blockLoader = new ResourceLoader<>(packs, "blocks", "Block", IrisBlockData.class);
|
||||
this.objectLoader = new ObjectResourceLoader(packs, "objects", "Object");
|
||||
|
||||
if(packs.getName().equals("packs"))
|
||||
@@ -83,6 +86,7 @@ public class IrisDataManager
|
||||
public void dump()
|
||||
{
|
||||
biomeLoader.clearCache();
|
||||
blockLoader.clearCache();
|
||||
lootLoader.clearCache();
|
||||
regionLoader.clearCache();
|
||||
dimensionLoader.clearCache();
|
||||
@@ -168,6 +172,7 @@ public class IrisDataManager
|
||||
public void preferFolder(String name)
|
||||
{
|
||||
biomeLoader.preferFolder(name);
|
||||
blockLoader.preferFolder(name);
|
||||
lootLoader.preferFolder(name);
|
||||
regionLoader.preferFolder(name);
|
||||
entityLoader.preferFolder(name);
|
||||
@@ -179,6 +184,7 @@ public class IrisDataManager
|
||||
public void clearLists()
|
||||
{
|
||||
lootLoader.clearList();
|
||||
blockLoader.clearList();
|
||||
entityLoader.clearList();
|
||||
biomeLoader.clearList();
|
||||
regionLoader.clearList();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.volmit.iris.manager;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
@@ -19,7 +18,6 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
import org.zeroturnaround.zip.commons.FileUtils;
|
||||
@@ -38,6 +36,7 @@ import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeGeneratorLink;
|
||||
import com.volmit.iris.object.IrisBiomeMutation;
|
||||
import com.volmit.iris.object.IrisBlockData;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisEntity;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
@@ -50,12 +49,8 @@ import com.volmit.iris.object.IrisStructure;
|
||||
import com.volmit.iris.object.IrisStructureTile;
|
||||
import com.volmit.iris.object.NoiseStyle;
|
||||
import com.volmit.iris.object.StructureTileCondition;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.C;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.DependsOn;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.J;
|
||||
@@ -66,23 +61,9 @@ import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.M;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
import com.volmit.iris.util.O;
|
||||
import com.volmit.iris.util.PrecisionStopwatch;
|
||||
import com.volmit.iris.util.RegistryListBiome;
|
||||
import com.volmit.iris.util.RegistryListBlockType;
|
||||
import com.volmit.iris.util.RegistryListDimension;
|
||||
import com.volmit.iris.util.RegistryListEntity;
|
||||
import com.volmit.iris.util.RegistryListFont;
|
||||
import com.volmit.iris.util.RegistryListGenerator;
|
||||
import com.volmit.iris.util.RegistryListItemType;
|
||||
import com.volmit.iris.util.RegistryListLoot;
|
||||
import com.volmit.iris.util.RegistryListObject;
|
||||
import com.volmit.iris.util.RegistryListRegion;
|
||||
import com.volmit.iris.util.RegistryListStructure;
|
||||
import com.volmit.iris.util.Required;
|
||||
import com.volmit.iris.util.TaskExecutor;
|
||||
import com.volmit.iris.util.TaskExecutor.TaskGroup;
|
||||
|
||||
@@ -432,6 +413,15 @@ public class ProjectManager
|
||||
KSet<IrisStructure> structures = new KSet<>();
|
||||
KSet<IrisGenerator> generators = new KSet<>();
|
||||
KSet<IrisLootTable> loot = new KSet<>();
|
||||
KSet<IrisBlockData> blocks = new KSet<>();
|
||||
Iris.globaldata.preferFolder(dim);
|
||||
|
||||
for(String i : Iris.globaldata.getBlockLoader().getPreferredKeys())
|
||||
{
|
||||
blocks.add(Iris.globaldata.getBlockLoader().load(i));
|
||||
}
|
||||
|
||||
Iris.globaldata.preferFolder(null);
|
||||
dimension.getRegions().forEach((i) -> regions.add(Iris.globaldata.getRegionLoader().load(i)));
|
||||
dimension.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i)));
|
||||
regions.forEach((i) -> biomes.addAll(i.getAllBiomes(null)));
|
||||
@@ -637,6 +627,13 @@ public class ProjectManager
|
||||
b.append(IO.hash(a));
|
||||
}
|
||||
|
||||
for(IrisBlockData i : blocks)
|
||||
{
|
||||
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
|
||||
IO.writeAll(new File(folder, "blocks/" + i.getLoadKey() + ".json"), a);
|
||||
b.append(IO.hash(a));
|
||||
}
|
||||
|
||||
for(IrisStructure i : structures)
|
||||
{
|
||||
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
|
||||
@@ -1015,6 +1012,7 @@ public class ProjectManager
|
||||
g.queue(() -> ex(schemas, IrisRegion.class, dat, "/regions/*.json", pack));
|
||||
g.queue(() -> ex(schemas, IrisGenerator.class, dat, "/generators/*.json", pack));
|
||||
g.queue(() -> ex(schemas, IrisStructure.class, dat, "/structures/*.json", pack));
|
||||
g.queue(() -> ex(schemas, IrisBlockData.class, dat, "/blocks/*.json", pack));
|
||||
g.queue(() -> ex(schemas, IrisLootTable.class, dat, "/loot/*.json", pack));
|
||||
g.execute();
|
||||
dat.preferFolder(gg);
|
||||
@@ -1032,719 +1030,6 @@ public class ProjectManager
|
||||
return o;
|
||||
}
|
||||
|
||||
public JSONObject getSchemaFor(Class<?> i, IrisDataManager dat)
|
||||
{
|
||||
Iris.verbose("Processing " + i.getSimpleName());
|
||||
KMap<String, JSONObject> def = new KMap<>();
|
||||
JSONObject s = getSchemaFor(i, 7, def, dat);
|
||||
JSONObject defx = new JSONObject();
|
||||
for(String v : def.k())
|
||||
{
|
||||
defx.put(v, def.get(v));
|
||||
}
|
||||
|
||||
s.put("definitions", defx);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public JSONObject getSchemaFor(Class<?> i, int step, KMap<String, JSONObject> def, IrisDataManager dat)
|
||||
{
|
||||
Object dummy = tryCreate(i);
|
||||
if(step <= 0)
|
||||
{
|
||||
JSONObject m = new JSONObject();
|
||||
m.put("properties", new JSONObject());
|
||||
return m;
|
||||
}
|
||||
|
||||
JSONObject schema = new JSONObject();
|
||||
if(i.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
|
||||
schema.put("$id", "http://volmit.com/iris-schema/" + i.getSimpleName().toLowerCase() + ".json");
|
||||
schema.put("title", i.getSimpleName().replaceAll("\\QIris\\E", ""));
|
||||
schema.put("type", "object");
|
||||
|
||||
Desc d = i.getAnnotation(Desc.class);
|
||||
String dsc = i.getSimpleName().replaceAll("\\QIris\\E", "") + "\n\n" + d.value();
|
||||
schema.put("description", dsc);
|
||||
|
||||
JSONObject properties = new JSONObject();
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject deps = new JSONObject();
|
||||
|
||||
for(java.lang.reflect.Field k : i.getDeclaredFields())
|
||||
{
|
||||
k.setAccessible(true);
|
||||
JSONObject prop = new JSONObject();
|
||||
if(k.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
if(k.isAnnotationPresent(DependsOn.class))
|
||||
{
|
||||
deps.put(k.getName(), new JSONArray(k.getDeclaredAnnotation(DependsOn.class).value()));
|
||||
}
|
||||
|
||||
String tp = "object";
|
||||
|
||||
if(k.getType().equals(int.class) || k.getType().equals(long.class))
|
||||
{
|
||||
tp = "integer";
|
||||
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("minimum", (int) k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("maximum", (int) k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
}
|
||||
|
||||
if(k.getType().equals(double.class) || k.getType().equals(float.class))
|
||||
{
|
||||
tp = "number";
|
||||
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("minimum", k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("maximum", k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
}
|
||||
|
||||
if(k.getType().equals(boolean.class))
|
||||
{
|
||||
tp = "boolean";
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class))
|
||||
{
|
||||
tp = "string";
|
||||
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("minLength", (int) k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("maxLength", (int) k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListBiome.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getBiomeList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListBlockType.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getBlockTypeList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListItemType.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getItemTypeList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListEntity.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getEntityList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListFont.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getFontList()));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListLoot.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getLootList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListDimension.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getDimensionList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListGenerator.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getGeneratorList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListObject.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getObjectList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListRegion.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getRegionList(dat)));
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListStructure.class))
|
||||
{
|
||||
prop.put("enum", new JSONArray(getStructureList(dat)));
|
||||
}
|
||||
}
|
||||
|
||||
if(k.getType().isEnum())
|
||||
{
|
||||
tp = "string";
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(Object gg : k.getType().getEnumConstants())
|
||||
{
|
||||
a.put(((Enum<?>) gg).name());
|
||||
}
|
||||
|
||||
prop.put("enum", a);
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class) && k.getName().equals("potionEffect"))
|
||||
{
|
||||
tp = "string";
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(PotionEffectType gg : PotionEffectType.values())
|
||||
{
|
||||
a.put(gg.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
|
||||
}
|
||||
|
||||
prop.put("enum", a);
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class) && k.getName().equals("enchantment"))
|
||||
{
|
||||
tp = "string";
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(Field gg : Enchantment.class.getDeclaredFields())
|
||||
{
|
||||
a.put(gg.getName());
|
||||
}
|
||||
|
||||
prop.put("enum", a);
|
||||
}
|
||||
|
||||
if(k.getType().equals(KList.class))
|
||||
{
|
||||
tp = "array";
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(Required.class))
|
||||
{
|
||||
req.put(k.getName());
|
||||
}
|
||||
|
||||
if(tp.equals("object"))
|
||||
{
|
||||
if(k.getType().isAnnotationPresent(Desc.class))
|
||||
{
|
||||
prop.put("additionalProperties", false);
|
||||
prop.put("properties", getSchemaFor(k.getType(), step - 1, def, Iris.globaldata).getJSONObject("properties"));
|
||||
}
|
||||
}
|
||||
|
||||
if(tp.equals("array"))
|
||||
{
|
||||
ArrayType t = k.getDeclaredAnnotation(ArrayType.class);
|
||||
|
||||
if(t == null)
|
||||
{
|
||||
Iris.warn("Expected " + ArrayType.class.getSimpleName() + " in " + k.getName() + " in " + i.getSimpleName());
|
||||
}
|
||||
|
||||
if(t.min() > 0)
|
||||
{
|
||||
prop.put("minItems", t.min());
|
||||
}
|
||||
|
||||
if(t != null)
|
||||
{
|
||||
String tx = "object";
|
||||
|
||||
if(t.type().equals(int.class) || k.getType().equals(long.class))
|
||||
{
|
||||
tx = "integer";
|
||||
}
|
||||
|
||||
if(t.type().equals(double.class) || k.getType().equals(float.class))
|
||||
{
|
||||
tx = "number";
|
||||
}
|
||||
|
||||
if(t.type().equals(boolean.class))
|
||||
{
|
||||
tx = "boolean";
|
||||
}
|
||||
|
||||
if(t.type().equals(String.class))
|
||||
{
|
||||
tx = "string";
|
||||
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("minLength", (int) k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("maxLength", (int) k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListBiome.class))
|
||||
{
|
||||
String name = "enbiom" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getBiomeList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListBlockType.class))
|
||||
{
|
||||
String name = "enblk" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getBlockTypeList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListItemType.class))
|
||||
{
|
||||
String name = "enitmty" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getItemTypeList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListEntity.class))
|
||||
{
|
||||
String name = "enent" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getEntityList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListFont.class))
|
||||
{
|
||||
String name = "enfong" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getFontList()));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListLoot.class))
|
||||
{
|
||||
String name = "enloot" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getLootList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListDimension.class))
|
||||
{
|
||||
String name = "endim" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getDimensionList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListGenerator.class))
|
||||
{
|
||||
String name = "engen" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getGeneratorList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListObject.class))
|
||||
{
|
||||
String name = "enobj" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getObjectList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListRegion.class))
|
||||
{
|
||||
String name = "enreg" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getRegionList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(RegistryListStructure.class))
|
||||
{
|
||||
String name = "enstruct" + t.type().getSimpleName().toLowerCase();
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", new JSONArray(getStructureList(dat)));
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(t.type().isEnum())
|
||||
{
|
||||
tx = "string";
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(Object gg : t.type().getEnumConstants())
|
||||
{
|
||||
a.put(((Enum<?>) gg).name());
|
||||
}
|
||||
|
||||
String name = "enum" + t.type().getSimpleName().toLowerCase();
|
||||
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", a);
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
prop.put("description", tp + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(t.type().isEnum())
|
||||
{
|
||||
tx = "string";
|
||||
}
|
||||
|
||||
if(t.type().equals(KList.class))
|
||||
{
|
||||
tx = "array";
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
|
||||
if(tx.equals("object"))
|
||||
{
|
||||
if(t.type().isAnnotationPresent(Desc.class))
|
||||
{
|
||||
String name = t.type().getSimpleName().toLowerCase();
|
||||
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
JSONObject scv = getSchemaFor(t.type(), step - 1, def, Iris.globaldata);
|
||||
deff.put("type", tx);
|
||||
deff.put("description", tx + "\n\n" + t.type().getDeclaredAnnotation(Desc.class).value());
|
||||
deff.put("additionalProperties", false);
|
||||
deff.put("properties", scv.getJSONObject("properties"));
|
||||
|
||||
if(deff.getJSONObject("properties").length() == 0)
|
||||
{
|
||||
Iris.warn("Schema Def for " + name + " has " + deff.getJSONObject("properties").length() + " Entries" + " (Step " + step + ")");
|
||||
}
|
||||
|
||||
if(scv.has("required"))
|
||||
{
|
||||
deff.put("required", scv.getJSONArray("required"));
|
||||
}
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
items.put("type", tx);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
items.put("type", tx);
|
||||
}
|
||||
|
||||
prop.put("items", items);
|
||||
}
|
||||
|
||||
if(tp.getClass().isAnnotationPresent(Desc.class))
|
||||
{
|
||||
prop.put("properties", getSchemaFor(tp.getClass(), step - 1, def, Iris.globaldata).getJSONObject("properties"));
|
||||
}
|
||||
}
|
||||
|
||||
String tpx = tp;
|
||||
|
||||
if(tp.equals("array") || tp.equals("enum"))
|
||||
{
|
||||
tpx = "List of " + k.getDeclaredAnnotation(ArrayType.class).type().getSimpleName().replaceAll("\\QIris\\E", "") + "s";
|
||||
}
|
||||
|
||||
prop.put("description", tpx + "\n\n" + k.getAnnotation(Desc.class).value());
|
||||
|
||||
if(tp.equals("integer"))
|
||||
{
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("description", prop.getString("description") + "\n" + "Min: " + (int) k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("description", prop.getString("description") + "\n" + "Max: " + (int) k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
}
|
||||
|
||||
if(tp.equals("number"))
|
||||
{
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("description", prop.getString("description") + "\n" + "Min: " + k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("description", prop.getString("description") + "\n" + "Max: " + k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
}
|
||||
|
||||
if(!tp.equals("array") && !tp.equals("object") && !tp.equals("enum"))
|
||||
{
|
||||
if(dummy != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
prop.put("description", prop.getString("description") + "\n" + "Default Value: " + k.get(dummy));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
prop.put("description", prop.getString("description") + "\n" + "Default Value: NONE");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
}
|
||||
}
|
||||
|
||||
schema.put("additionalProperties", false);
|
||||
schema.put("properties", properties);
|
||||
schema.put("required", req);
|
||||
schema.put("dependencies", deps);
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
private Object tryCreate(Class<?> i)
|
||||
{
|
||||
try
|
||||
{
|
||||
return i.newInstance();
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String[] getFontList()
|
||||
{
|
||||
return GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
|
||||
}
|
||||
|
||||
private String[] getBiomeList(IrisDataManager data)
|
||||
{
|
||||
return data.getBiomeLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
private String[] getBlockTypeList(IrisDataManager data)
|
||||
{
|
||||
return B.getBlockTypes();
|
||||
}
|
||||
|
||||
private String[] getItemTypeList(IrisDataManager data)
|
||||
{
|
||||
return B.getItemTypes();
|
||||
}
|
||||
|
||||
private String[] getEntityList(IrisDataManager data)
|
||||
{
|
||||
return data.getEntityLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
private String[] getLootList(IrisDataManager data)
|
||||
{
|
||||
return data.getLootLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
private String[] getDimensionList(IrisDataManager data)
|
||||
{
|
||||
return data.getDimensionLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
private String[] getRegionList(IrisDataManager data)
|
||||
{
|
||||
return data.getRegionLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
private String[] getObjectList(IrisDataManager data)
|
||||
{
|
||||
return data.getObjectLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
private String[] getStructureList(IrisDataManager data)
|
||||
{
|
||||
return data.getStructureLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
private String[] getGeneratorList(IrisDataManager data)
|
||||
{
|
||||
return data.getGeneratorLoader().getPossibleKeys();
|
||||
}
|
||||
|
||||
public KList<String> analyzeFolder(File folder, String fn, Object t)
|
||||
{
|
||||
KList<String> a = new KList<String>();
|
||||
|
||||
@@ -37,7 +37,6 @@ public class SchemaBuilder
|
||||
private static final String SYMBOL_TYPE__N = "";
|
||||
private static final JSONArray POTION_TYPES = getPotionTypes();
|
||||
private static final JSONArray ENCHANT_TYPES = getEnchantmentTypes();
|
||||
private static final JSONArray BLOCK_TYPES = new JSONArray(B.getBlockTypes());
|
||||
private static final JSONArray ITEM_TYPES = new JSONArray(B.getItemTypes());
|
||||
private static final JSONArray FONT_TYPES = new JSONArray(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
|
||||
private final KMap<String, JSONObject> definitions;
|
||||
@@ -215,7 +214,19 @@ public class SchemaBuilder
|
||||
if(!definitions.containsKey(key))
|
||||
{
|
||||
JSONObject j = new JSONObject();
|
||||
j.put("enum", BLOCK_TYPES);
|
||||
JSONArray ja = new JSONArray();
|
||||
|
||||
for(String i : data.getBlockLoader().getPreferredKeys())
|
||||
{
|
||||
ja.put(i);
|
||||
}
|
||||
|
||||
for(String i : B.getBlockTypes())
|
||||
{
|
||||
ja.put(i);
|
||||
}
|
||||
|
||||
j.put("enum", ja);
|
||||
definitions.put(key, j);
|
||||
}
|
||||
|
||||
@@ -550,7 +561,19 @@ public class SchemaBuilder
|
||||
if(!definitions.containsKey(key))
|
||||
{
|
||||
JSONObject j = new JSONObject();
|
||||
j.put("enum", BLOCK_TYPES);
|
||||
JSONArray ja = new JSONArray();
|
||||
|
||||
for(String i : data.getBlockLoader().getPreferredKeys())
|
||||
{
|
||||
ja.put(i);
|
||||
}
|
||||
|
||||
for(String i : B.getBlockTypes())
|
||||
{
|
||||
ja.put(i);
|
||||
}
|
||||
|
||||
j.put("enum", ja);
|
||||
definitions.put(key, j);
|
||||
}
|
||||
|
||||
|
||||
@@ -299,11 +299,11 @@ 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)
|
||||
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);
|
||||
return generateLockedLayers(wx, wz, random, maxDepth, height, rdata);
|
||||
}
|
||||
|
||||
KList<BlockData> data = new KList<>();
|
||||
@@ -315,7 +315,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
|
||||
for(int i = 0; i < layers.size(); i++)
|
||||
{
|
||||
CNG hgen = getLayerHeightGenerators(random).get(i);
|
||||
CNG hgen = getLayerHeightGenerators(random, rdata).get(i);
|
||||
int d = hgen.fit(layers.get(i).getMinHeight(), layers.get(i).getMaxHeight(), wx / layers.get(i).getZoom(), wz / layers.get(i).getZoom());
|
||||
|
||||
if(d < 0)
|
||||
@@ -332,7 +332,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
|
||||
try
|
||||
{
|
||||
data.add(getLayers().get(i).get(random.nextParallelRNG(i + j), (wx + j) / layers.get(i).getZoom(), j, (wz - j) / layers.get(i).getZoom()));
|
||||
data.add(getLayers().get(i).get(random.nextParallelRNG(i + j), (wx + j) / layers.get(i).getZoom(), j, (wz - j) / layers.get(i).getZoom(), rdata));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
@@ -350,7 +350,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return data;
|
||||
}
|
||||
|
||||
public KList<BlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height)
|
||||
public KList<BlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisDataManager rdata)
|
||||
{
|
||||
KList<BlockData> data = new KList<>();
|
||||
KList<BlockData> real = new KList<>();
|
||||
@@ -362,7 +362,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
|
||||
for(int i = 0; i < layers.size(); i++)
|
||||
{
|
||||
CNG hgen = getLayerHeightGenerators(random).get(i);
|
||||
CNG hgen = getLayerHeightGenerators(random, rdata).get(i);
|
||||
int d = hgen.fit(layers.get(i).getMinHeight(), layers.get(i).getMaxHeight(), wx / layers.get(i).getZoom(), wz / layers.get(i).getZoom());
|
||||
|
||||
if(d < 0)
|
||||
@@ -374,7 +374,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
{
|
||||
try
|
||||
{
|
||||
data.add(getLayers().get(i).get(random.nextParallelRNG(i + j), (wx + j) / layers.get(i).getZoom(), j, (wz - j) / layers.get(i).getZoom()));
|
||||
data.add(getLayers().get(i).get(random.nextParallelRNG(i + j), (wx + j) / layers.get(i).getZoom(), j, (wz - j) / layers.get(i).getZoom(), rdata));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
@@ -420,13 +420,13 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return this;
|
||||
}
|
||||
|
||||
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth)
|
||||
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisDataManager rdata)
|
||||
{
|
||||
KList<BlockData> data = new KList<>();
|
||||
|
||||
for(int i = 0; i < seaLayers.size(); i++)
|
||||
{
|
||||
CNG hgen = getLayerSeaHeightGenerators(random).get(i);
|
||||
CNG hgen = getLayerSeaHeightGenerators(random, rdata).get(i);
|
||||
int d = hgen.fit(seaLayers.get(i).getMinHeight(), seaLayers.get(i).getMaxHeight(), wx / seaLayers.get(i).getZoom(), wz / seaLayers.get(i).getZoom());
|
||||
|
||||
if(d < 0)
|
||||
@@ -443,7 +443,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
|
||||
try
|
||||
{
|
||||
data.add(getSeaLayers().get(i).get(random.nextParallelRNG(i + j), (wx + j) / seaLayers.get(i).getZoom(), j, (wz - j) / seaLayers.get(i).getZoom()));
|
||||
data.add(getSeaLayers().get(i).get(random.nextParallelRNG(i + j), (wx + j) / seaLayers.get(i).getZoom(), j, (wz - j) / seaLayers.get(i).getZoom(), rdata));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
@@ -461,7 +461,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return data;
|
||||
}
|
||||
|
||||
public KList<CNG> getLayerHeightGenerators(RNG rng)
|
||||
public KList<CNG> getLayerHeightGenerators(RNG rng, IrisDataManager rdata)
|
||||
{
|
||||
return layerHeightGenerators.aquire(() ->
|
||||
{
|
||||
@@ -471,14 +471,14 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
|
||||
for(IrisBiomePaletteLayer i : getLayers())
|
||||
{
|
||||
layerHeightGenerators.add(i.getHeightGenerator(rng.nextParallelRNG((m++) * m * m * m)));
|
||||
layerHeightGenerators.add(i.getHeightGenerator(rng.nextParallelRNG((m++) * m * m * m), rdata));
|
||||
}
|
||||
|
||||
return layerHeightGenerators;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<CNG> getLayerSeaHeightGenerators(RNG rng)
|
||||
public KList<CNG> getLayerSeaHeightGenerators(RNG rng, IrisDataManager data)
|
||||
{
|
||||
return layerSeaHeightGenerators.aquire(() ->
|
||||
{
|
||||
@@ -488,7 +488,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
|
||||
for(IrisBiomePaletteLayer i : getSeaLayers())
|
||||
{
|
||||
layerSeaHeightGenerators.add(i.getHeightGenerator(rng.nextParallelRNG((m++) * m * m * m)));
|
||||
layerSeaHeightGenerators.add(i.getHeightGenerator(rng.nextParallelRNG((m++) * m * m * m), data));
|
||||
}
|
||||
|
||||
return layerSeaHeightGenerators;
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.noise.CNG;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.DependsOn;
|
||||
@@ -92,32 +93,32 @@ public class IrisBiomeDecorator
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
|
||||
public int getHeight(RNG rng, double x, double z)
|
||||
public int getHeight(RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
if(stackMin == stackMax)
|
||||
{
|
||||
return stackMin;
|
||||
}
|
||||
|
||||
return getHeightGenerator(rng).fit(stackMin, stackMax, x / verticalZoom, z / verticalZoom);
|
||||
return getHeightGenerator(rng, data).fit(stackMin, stackMax, x / verticalZoom, z / verticalZoom);
|
||||
}
|
||||
|
||||
public CNG getHeightGenerator(RNG rng)
|
||||
public CNG getHeightGenerator(RNG rng, IrisDataManager data)
|
||||
{
|
||||
return heightGenerator.aquire(() ->
|
||||
{
|
||||
return heightVariance.create(rng.nextParallelRNG(getBlockData().size() + stackMax + stackMin));
|
||||
return heightVariance.create(rng.nextParallelRNG(getBlockData(data).size() + stackMax + stackMin));
|
||||
});
|
||||
}
|
||||
|
||||
public CNG getGenerator(RNG rng)
|
||||
public CNG getGenerator(RNG rng, IrisDataManager data)
|
||||
{
|
||||
return layerGenerator.aquire(() -> style.create(rng.nextParallelRNG((int) (getBlockData().size()))));
|
||||
return layerGenerator.aquire(() -> style.create(rng.nextParallelRNG((int) (getBlockData(data).size()))));
|
||||
}
|
||||
|
||||
public CNG getVarianceGenerator(RNG rng)
|
||||
public CNG getVarianceGenerator(RNG rng, IrisDataManager data)
|
||||
{
|
||||
return varianceGenerator.aquire(() -> variance.create(rng.nextParallelRNG((int) (getBlockData().size()))).scale(1D / varianceZoom));
|
||||
return varianceGenerator.aquire(() -> variance.create(rng.nextParallelRNG((int) (getBlockData(data).size()))).scale(1D / varianceZoom));
|
||||
}
|
||||
|
||||
public KList<IrisBlockData> add(String b)
|
||||
@@ -126,9 +127,9 @@ public class IrisBiomeDecorator
|
||||
return palette;
|
||||
}
|
||||
|
||||
public BlockData getBlockData(IrisBiome b, RNG rng, double x, double z)
|
||||
public BlockData getBlockData(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockData().isEmpty())
|
||||
if(getBlockData(data).isEmpty())
|
||||
{
|
||||
Iris.warn("Empty Block Data for " + b.getName());
|
||||
return null;
|
||||
@@ -137,27 +138,27 @@ public class IrisBiomeDecorator
|
||||
double xx = x / getZoom();
|
||||
double zz = z / getZoom();
|
||||
|
||||
if(getGenerator(rng).fitDouble(0D, 1D, xx, zz) <= chance)
|
||||
if(getGenerator(rng, data).fitDouble(0D, 1D, xx, zz) <= chance)
|
||||
{
|
||||
if(getBlockData().size() == 1)
|
||||
if(getBlockData(data).size() == 1)
|
||||
{
|
||||
return getBlockData().get(0);
|
||||
return getBlockData(data).get(0);
|
||||
}
|
||||
|
||||
return getVarianceGenerator(rng).fit(getBlockData(), xx, zz);
|
||||
return getVarianceGenerator(rng, data).fit(getBlockData(data), xx, zz);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData()
|
||||
public KList<BlockData> getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
for(IrisBlockData i : palette)
|
||||
{
|
||||
BlockData bx = i.getBlockData();
|
||||
BlockData bx = i.getBlockData(data);
|
||||
if(bx != null)
|
||||
{
|
||||
blockData.add(bx);
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.DependsOn;
|
||||
@@ -59,31 +60,31 @@ public class IrisBiomePaletteLayer
|
||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
|
||||
public CNG getHeightGenerator(RNG rng)
|
||||
public CNG getHeightGenerator(RNG rng, IrisDataManager data)
|
||||
{
|
||||
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData().size())));
|
||||
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
|
||||
}
|
||||
|
||||
public BlockData get(RNG rng, double x, double y, double z)
|
||||
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager data)
|
||||
{
|
||||
if(getBlockData().isEmpty())
|
||||
if(getBlockData(data).isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(getBlockData().size() == 1)
|
||||
if(getBlockData(data).size() == 1)
|
||||
{
|
||||
return getBlockData().get(0);
|
||||
return getBlockData(data).get(0);
|
||||
}
|
||||
|
||||
return getLayerGenerator(rng).fit(getBlockData(), x / zoom, y / zoom, z / zoom);
|
||||
return getLayerGenerator(rng, data).fit(getBlockData(data), x / zoom, y / zoom, z / zoom);
|
||||
}
|
||||
|
||||
public CNG getLayerGenerator(RNG rng)
|
||||
public CNG getLayerGenerator(RNG rng, IrisDataManager data)
|
||||
{
|
||||
return layerGenerator.aquire(() ->
|
||||
{
|
||||
RNG rngx = rng.nextParallelRNG(minHeight + maxHeight + getBlockData().size());
|
||||
RNG rngx = rng.nextParallelRNG(minHeight + maxHeight + getBlockData(data).size());
|
||||
return style.create(rngx);
|
||||
});
|
||||
}
|
||||
@@ -95,14 +96,14 @@ public class IrisBiomePaletteLayer
|
||||
return palette;
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData()
|
||||
public KList<BlockData> getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
BlockData bx = ix.getBlockData();
|
||||
BlockData bx = ix.getBlockData(data);
|
||||
if(bx != null)
|
||||
{
|
||||
for(int i = 0; i < ix.getWeight(); i++)
|
||||
|
||||
@@ -2,7 +2,9 @@ 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;
|
||||
@@ -15,6 +17,7 @@ import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -23,7 +26,8 @@ import lombok.experimental.Accessors;
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents Block Data")
|
||||
@Data
|
||||
public class IrisBlockData
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisBlockData extends IrisRegistrant
|
||||
{
|
||||
@RegistryListBlockType
|
||||
@Required
|
||||
@@ -31,6 +35,10 @@ public class IrisBlockData
|
||||
@Desc("The cave zoom. Higher values makes caves spread out further and branch less often, but are thicker.")
|
||||
private String block = "air";
|
||||
|
||||
@Desc("Debug this block by printing it to the console when it's used")
|
||||
@DontObfuscate
|
||||
private boolean debug = false;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The resource key. Typically Minecraft")
|
||||
private String key = "minecraft";
|
||||
@@ -57,28 +65,86 @@ public class IrisBlockData
|
||||
this.block = b;
|
||||
}
|
||||
|
||||
public String computeProperties()
|
||||
public String computeProperties(KMap<String, Object> data)
|
||||
{
|
||||
if(getData().isEmpty())
|
||||
if(data.isEmpty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
KList<String> r = new KList<>();
|
||||
|
||||
for(String i : getData().keySet())
|
||||
for(String i : data.keySet())
|
||||
{
|
||||
r.add(i + "=" + getData().get(i));
|
||||
r.add(i + "=" + filter(data.get(i).toString()));
|
||||
}
|
||||
|
||||
return "[" + r.toString(",") + "]";
|
||||
}
|
||||
|
||||
public BlockData getBlockData()
|
||||
public String computeProperties()
|
||||
{
|
||||
return computeProperties(getData());
|
||||
}
|
||||
|
||||
public BlockData getBlockData(IrisDataManager data)
|
||||
{
|
||||
return blockdata.aquire(() ->
|
||||
{
|
||||
BlockData b = B.get(getKey() + ":" + getBlock() + computeProperties());
|
||||
BlockData b = null;
|
||||
|
||||
IrisBlockData customData = data.getBlockLoader().load(getBlock(), false);
|
||||
|
||||
if(customData != null)
|
||||
{
|
||||
b = customData.getBlockData(data);
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
b = b.clone();
|
||||
|
||||
String st = b.getAsString(true);
|
||||
|
||||
if(st.contains("["))
|
||||
{
|
||||
st = st.split("\\Q[\\E")[0];
|
||||
}
|
||||
|
||||
KMap<String, Object> cdata = customData.getData().copy();
|
||||
|
||||
for(String i : getData().keySet())
|
||||
{
|
||||
cdata.put(i, getData().get(i));
|
||||
}
|
||||
|
||||
String sx = getKey() + ":" + st.split("\\Q:\\E")[1] + computeProperties(cdata);
|
||||
|
||||
if(debug)
|
||||
{
|
||||
Iris.warn("Debug block data " + sx + " (CUSTOM)");
|
||||
}
|
||||
|
||||
BlockData bx = B.get(sx);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
return bx;
|
||||
}
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String ss = getKey() + ":" + getBlock() + computeProperties();
|
||||
b = B.get(ss);
|
||||
|
||||
if(debug)
|
||||
{
|
||||
Iris.warn("Debug block data " + ss);
|
||||
}
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
@@ -87,7 +153,7 @@ public class IrisBlockData
|
||||
|
||||
if(backup != null)
|
||||
{
|
||||
return backup.getBlockData();
|
||||
return backup.getBlockData(data);
|
||||
}
|
||||
|
||||
return B.get("AIR");
|
||||
@@ -163,6 +229,16 @@ public class IrisBlockData
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return Double.valueOf(string).intValue();
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
@@ -47,7 +48,7 @@ public class IrisBlockDrops
|
||||
|
||||
private final transient AtomicCache<KList<BlockData>> data = new AtomicCache<>();
|
||||
|
||||
public boolean shouldDropFor(BlockData data)
|
||||
public boolean shouldDropFor(BlockData data, IrisDataManager rdata)
|
||||
{
|
||||
KList<BlockData> list = this.data.aquire(() ->
|
||||
{
|
||||
@@ -55,7 +56,7 @@ public class IrisBlockDrops
|
||||
|
||||
for(IrisBlockData i : getBlocks())
|
||||
{
|
||||
BlockData dd = i.getBlockData();
|
||||
BlockData dd = i.getBlockData(rdata);
|
||||
|
||||
if(dd != null)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -41,16 +42,16 @@ public class IrisCaveFluid
|
||||
|
||||
private final transient AtomicCache<BlockData> fluidData = new AtomicCache<>();
|
||||
|
||||
public boolean hasFluid()
|
||||
public boolean hasFluid(IrisDataManager rdata)
|
||||
{
|
||||
return !B.isAir(getFluid());
|
||||
return !B.isAir(getFluid(rdata));
|
||||
}
|
||||
|
||||
public BlockData getFluid()
|
||||
public BlockData getFluid(IrisDataManager rdata)
|
||||
{
|
||||
return fluidData.aquire(() ->
|
||||
{
|
||||
BlockData b = getFluidType().getBlockData();
|
||||
BlockData b = getFluidType().getBlockData(rdata);
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.gen.TopographicTerrainProvider;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.Desc;
|
||||
@@ -87,7 +88,7 @@ public class IrisDepositGenerator
|
||||
private final transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
|
||||
public IrisObject getClump(RNG rng)
|
||||
public IrisObject getClump(RNG rng, IrisDataManager rdata)
|
||||
{
|
||||
KList<IrisObject> objects = this.objects.aquire(() ->
|
||||
{
|
||||
@@ -96,7 +97,7 @@ public class IrisDepositGenerator
|
||||
|
||||
for(int i = 0; i < varience; i++)
|
||||
{
|
||||
objectsf.add(generateClumpObject(rngv.nextParallelRNG(2349 * i + 3598)));
|
||||
objectsf.add(generateClumpObject(rngv.nextParallelRNG(2349 * i + 3598), rdata));
|
||||
}
|
||||
|
||||
return objectsf;
|
||||
@@ -109,7 +110,7 @@ public class IrisDepositGenerator
|
||||
return Math.min(11, (int) Math.round(Math.pow(maxSize, 1D / 3D)));
|
||||
}
|
||||
|
||||
private IrisObject generateClumpObject(RNG rngv)
|
||||
private IrisObject generateClumpObject(RNG rngv, IrisDataManager rdata)
|
||||
{
|
||||
int s = rngv.i(minSize, maxSize);
|
||||
int dim = Math.min(11, (int) Math.round(Math.pow(maxSize, 1D / 3D)));
|
||||
@@ -118,7 +119,7 @@ public class IrisDepositGenerator
|
||||
|
||||
if(s == 1)
|
||||
{
|
||||
o.getBlocks().put(o.getCenter(), nextBlock(rngv));
|
||||
o.getBlocks().put(o.getCenter(), nextBlock(rngv, rdata));
|
||||
}
|
||||
|
||||
else
|
||||
@@ -128,19 +129,19 @@ public class IrisDepositGenerator
|
||||
s--;
|
||||
BlockVector ang = new BlockVector(rngv.i(-w, w), rngv.i(-w, w), rngv.i(-w, w));
|
||||
BlockVector pos = o.getCenter().clone().add(ang).toBlockVector();
|
||||
o.getBlocks().put(pos, nextBlock(rngv));
|
||||
o.getBlocks().put(pos, nextBlock(rngv, rdata));
|
||||
}
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
private BlockData nextBlock(RNG rngv)
|
||||
private BlockData nextBlock(RNG rngv, IrisDataManager rdata)
|
||||
{
|
||||
return getBlockData().get(rngv.i(0, getBlockData().size() - 1));
|
||||
return getBlockData(rdata).get(rngv.i(0, getBlockData(rdata).size() - 1));
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData()
|
||||
public KList<BlockData> getBlockData(IrisDataManager rdata)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
@@ -148,7 +149,7 @@ public class IrisDepositGenerator
|
||||
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
BlockData bx = ix.getBlockData();
|
||||
BlockData bx = ix.getBlockData(rdata);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -169,7 +170,7 @@ public class IrisDepositGenerator
|
||||
{
|
||||
for(int l = 0; l < rng.i(getMinPerChunk(), getMaxPerChunk()); l++)
|
||||
{
|
||||
IrisObject clump = getClump(rng);
|
||||
IrisObject clump = getClump(rng, g.getData());
|
||||
|
||||
int af = (int) Math.ceil(clump.getW() / 2D);
|
||||
int bf = (int) Math.floor(16D - (clump.getW() / 2D));
|
||||
@@ -220,7 +221,7 @@ public class IrisDepositGenerator
|
||||
if(!allow)
|
||||
{
|
||||
BlockData b = data.getBlockData(nx, ny, nz);
|
||||
for(BlockData f : g.getDimension().getRockPalette().getBlockData())
|
||||
for(BlockData f : g.getDimension().getRockPalette().getBlockData(g.getData()))
|
||||
{
|
||||
if(f.getMaterial().equals(b.getMaterial()))
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -43,26 +44,26 @@ public class IrisMaterialPalette
|
||||
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)
|
||||
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager rdata)
|
||||
{
|
||||
if(getBlockData().isEmpty())
|
||||
if(getBlockData(rdata).isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(getBlockData().size() == 1)
|
||||
if(getBlockData(rdata).size() == 1)
|
||||
{
|
||||
return getBlockData().get(0);
|
||||
return getBlockData(rdata).get(0);
|
||||
}
|
||||
|
||||
return getLayerGenerator(rng).fit(getBlockData(), x / zoom, y / zoom, z / zoom);
|
||||
return getLayerGenerator(rng, rdata).fit(getBlockData(rdata), x / zoom, y / zoom, z / zoom);
|
||||
}
|
||||
|
||||
public CNG getLayerGenerator(RNG rng)
|
||||
public CNG getLayerGenerator(RNG rng, IrisDataManager rdata)
|
||||
{
|
||||
return layerGenerator.aquire(() ->
|
||||
{
|
||||
RNG rngx = rng.nextParallelRNG(-23498896 + getBlockData().size());
|
||||
RNG rngx = rng.nextParallelRNG(-23498896 + getBlockData(rdata).size());
|
||||
return style.create(rngx);
|
||||
});
|
||||
}
|
||||
@@ -81,14 +82,14 @@ public class IrisMaterialPalette
|
||||
return this;
|
||||
}
|
||||
|
||||
public KList<BlockData> getBlockData()
|
||||
public KList<BlockData> getBlockData(IrisDataManager rdata)
|
||||
{
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<BlockData> blockData = new KList<>();
|
||||
for(IrisBlockData ix : palette)
|
||||
{
|
||||
BlockData bx = ix.getBlockData();
|
||||
BlockData bx = ix.getBlockData(rdata);
|
||||
if(bx != null)
|
||||
{
|
||||
for(int i = 0; i < ix.getWeight(); i++)
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.bukkit.block.data.type.Leaves;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.BlockPosition;
|
||||
import com.volmit.iris.util.CarveResult;
|
||||
@@ -320,30 +321,30 @@ public class IrisObject extends IrisRegistrant
|
||||
}
|
||||
}
|
||||
|
||||
public void place(int x, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng)
|
||||
public void place(int x, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, IrisDataManager rdata)
|
||||
{
|
||||
if(shitty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
place(x, -1, z, placer, config, rng);
|
||||
place(x, -1, z, placer, config, rng,rdata);
|
||||
}
|
||||
|
||||
public void place(int x, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, CarveResult c)
|
||||
public void place(int x, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, CarveResult c, IrisDataManager rdata)
|
||||
{
|
||||
if(shitty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
place(x, -1, z, placer, config, rng, null, c);
|
||||
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)
|
||||
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);
|
||||
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)
|
||||
public int place(int x, int yv, int z, IObjectPlacer placer, IrisObjectPlacement config, RNG rng, Consumer<BlockPosition> listener, CarveResult c, IrisDataManager rdata)
|
||||
{
|
||||
if(config.isSmartBore())
|
||||
{
|
||||
@@ -522,11 +523,11 @@ public class IrisObject extends IrisRegistrant
|
||||
|
||||
for(IrisObjectReplace j : config.getEdit())
|
||||
{
|
||||
for(BlockData k : j.getFind())
|
||||
for(BlockData 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).clone();
|
||||
data = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z,rdata).clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -42,7 +43,7 @@ public class IrisObjectReplace
|
||||
private final transient AtomicCache<KList<BlockData>> findData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<BlockData>> replaceData = new AtomicCache<>();
|
||||
|
||||
public KList<BlockData> getFind()
|
||||
public KList<BlockData> getFind(IrisDataManager rdata)
|
||||
{
|
||||
return findData.aquire(() ->
|
||||
{
|
||||
@@ -50,7 +51,7 @@ public class IrisObjectReplace
|
||||
|
||||
for(IrisBlockData i : find)
|
||||
{
|
||||
BlockData bx = i.getBlockData();
|
||||
BlockData bx = i.getBlockData(rdata);
|
||||
|
||||
if(bx != null)
|
||||
{
|
||||
@@ -62,8 +63,8 @@ public class IrisObjectReplace
|
||||
});
|
||||
}
|
||||
|
||||
public BlockData getReplace(RNG seed, double x, double y, double z)
|
||||
public BlockData getReplace(RNG seed, double x, double y, double z, IrisDataManager rdata)
|
||||
{
|
||||
return getReplace().get(seed, x, y, z);
|
||||
return getReplace().get(seed, x, y, z, rdata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,17 @@ public class IrisStructurePlacement
|
||||
}
|
||||
|
||||
o = o != null ? o : load(g, t.getTile().getObjects().get(rnp.nextInt(t.getTile().getObjects().size())));
|
||||
o.place(Math.floorDiv(i, s) * s, height == -1 ? -1 : h, Math.floorDiv(j, s) * s, g, t.getPlacement(), rng, (gg) -> g.getParallaxChunk(gg.getChunkX(), gg.getChunkZ()).setStructure(gg.getY(), t.getStructure(), t.getTile()), null);
|
||||
o.place(
|
||||
Math.floorDiv(i, s) * s,
|
||||
height == -1 ? -1 : h,
|
||||
Math.floorDiv(j, s) * s,
|
||||
g,
|
||||
t.getPlacement(),
|
||||
rng,
|
||||
(gg) -> g.getParallaxChunk(gg.getChunkX(), gg.getChunkZ()).setStructure(gg.getY(), t.getStructure(), t.getTile()),
|
||||
null,
|
||||
g.getData()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,6 @@ public class IrisTextRenderer
|
||||
|
||||
public void place(ParallaxTerrainProvider g, RNG rng, IrisObjectPlacement config, int xb, int zb)
|
||||
{
|
||||
getObjects(g, rng).get(rng.nextInt(getObjects(g, rng).size())).place(xb, zb, g, config, rng);
|
||||
getObjects(g, rng).get(rng.nextInt(getObjects(g, rng).size())).place(xb, zb, g, config, rng, g.getData());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ public class StructureTemplate implements Listener, IObjectPlacer
|
||||
return;
|
||||
}
|
||||
|
||||
r.getTile().getForceObjects().get(getVariant(c, r.getTile())).place(bottomCenter.getBlockX(), bottomCenter.getBlockY(), bottomCenter.getBlockZ(), this, r.getPlacement(), rng);
|
||||
r.getTile().getForceObjects().get(getVariant(c, r.getTile())).place(bottomCenter.getBlockX(), bottomCenter.getBlockY(), bottomCenter.getBlockZ(), this, r.getPlacement(), rng, Iris.globaldata);
|
||||
if(!quiet)
|
||||
{
|
||||
center.getWorld().playSound(center, Sound.ENTITY_SHULKER_BULLET_HIT, 1f, 1.6f);
|
||||
@@ -609,33 +609,15 @@ public class StructureTemplate implements Listener, IObjectPlacer
|
||||
|
||||
public Cuboid getBounds(Location center)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
return new Cuboid(
|
||||
getTileBounds(center.clone().add(
|
||||
((size / 2) * w) + 1,
|
||||
!use3d ? 0 : (((size / 2) * h) + 1),
|
||||
((size / 2) * w) + 1)
|
||||
).getUpperSW(),
|
||||
getTileBounds(center.clone().subtract(
|
||||
((size / 2) * w) + 1,
|
||||
!use3d ? 0 : (((size / 2) * h) + 1),
|
||||
((size / 2) * w) + 1)
|
||||
).getLowerNE());
|
||||
// @NoArgsConstructor
|
||||
return new Cuboid(getTileBounds(center.clone().add(((size / 2) * w) + 1, !use3d ? 0 : (((size / 2) * h) + 1), ((size / 2) * w) + 1)).getUpperSW(), getTileBounds(center.clone().subtract(((size / 2) * w) + 1, !use3d ? 0 : (((size / 2) * h) + 1), ((size / 2) * w) + 1)).getLowerNE());
|
||||
//@done
|
||||
}
|
||||
|
||||
public Cuboid getTileBounds(Location l)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
return new Cuboid(
|
||||
new Location(l.getWorld(),
|
||||
Math.floorDiv(l.getBlockX(), w) * w,
|
||||
Math.floorDiv(l.getBlockY(), h) * h,
|
||||
Math.floorDiv(l.getBlockZ(), w) * w),
|
||||
new Location(l.getWorld(),
|
||||
((Math.floorDiv(l.getBlockX(), w)+1) * w)-1,
|
||||
((Math.floorDiv(l.getBlockY(), h)+1) * h)-1,
|
||||
((Math.floorDiv(l.getBlockZ(), w)+1) * w)-1));
|
||||
// @NoArgsConstructor
|
||||
return new Cuboid(new Location(l.getWorld(), Math.floorDiv(l.getBlockX(), w) * w, Math.floorDiv(l.getBlockY(), h) * h, Math.floorDiv(l.getBlockZ(), w) * w), new Location(l.getWorld(), ((Math.floorDiv(l.getBlockX(), w) + 1) * w) - 1, ((Math.floorDiv(l.getBlockY(), h) + 1) * h) - 1, ((Math.floorDiv(l.getBlockZ(), w) + 1) * w) - 1));
|
||||
//@done
|
||||
}
|
||||
|
||||
@@ -851,256 +833,46 @@ public class StructureTemplate implements Listener, IObjectPlacer
|
||||
{
|
||||
if(use3d)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
structure.getTiles().add(tileFor("Cross Floor",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("T-Connect Floor",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Hall Floor",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
structure.getTiles().add(tileFor("Corner Floor",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Room Floor",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Walled Room Floor",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
|
||||
structure.getTiles().add(tileFor("Cross Ceiling",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("T-Connect Ceiling",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Hall Ceiling",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
structure.getTiles().add(tileFor("Corner Ceiling",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Room Ceiling",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Walled Room Ceiling",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
|
||||
structure.getTiles().add(tileFor("Cross Opening",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("T-Connect Opening",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Hall Opening",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
structure.getTiles().add(tileFor("Corner Opening",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Room Opening",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Walled Room Opening",
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
|
||||
structure.getTiles().add(tileFor("Cross Encased",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("T-Connect Encased",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Hall Encased",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
structure.getTiles().add(tileFor("Corner Encased",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Room Encased",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Walled Room Encased",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
// @NoArgsConstructor
|
||||
structure.getTiles().add(tileFor("Cross Floor", StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("T-Connect Floor", StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Hall Floor", StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED));
|
||||
structure.getTiles().add(tileFor("Corner Floor", StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Room Floor", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Walled Room Floor", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED));
|
||||
|
||||
structure.getTiles().add(tileFor("Cross Ceiling", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("T-Connect Ceiling", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Hall Ceiling", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED));
|
||||
structure.getTiles().add(tileFor("Corner Ceiling", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Room Ceiling", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Walled Room Ceiling", StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED));
|
||||
|
||||
structure.getTiles().add(tileFor("Cross Opening", StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("T-Connect Opening", StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Hall Opening", StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED));
|
||||
structure.getTiles().add(tileFor("Corner Opening", StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Room Opening", StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Walled Room Opening", StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED));
|
||||
|
||||
structure.getTiles().add(tileFor("Cross Encased", StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("T-Connect Encased", StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Hall Encased", StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED));
|
||||
structure.getTiles().add(tileFor("Corner Encased", StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Room Encased", StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Walled Room Encased", StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED));
|
||||
//@done
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
structure.getTiles().add(tileFor("Cross",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.AGNOSTIC,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("T-Connect",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.AGNOSTIC,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Hall",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.AGNOSTIC,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
structure.getTiles().add(tileFor("Corner",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.AGNOSTIC,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Room",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.AGNOSTIC,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.NEVER
|
||||
));
|
||||
structure.getTiles().add(tileFor("Walled Room",
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.AGNOSTIC,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED,
|
||||
StructureTileCondition.REQUIRED
|
||||
));
|
||||
// @NoArgsConstructor
|
||||
structure.getTiles().add(tileFor("Cross", StructureTileCondition.REQUIRED, StructureTileCondition.AGNOSTIC, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("T-Connect", StructureTileCondition.REQUIRED, StructureTileCondition.AGNOSTIC, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Hall", StructureTileCondition.REQUIRED, StructureTileCondition.AGNOSTIC, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER, StructureTileCondition.REQUIRED));
|
||||
structure.getTiles().add(tileFor("Corner", StructureTileCondition.REQUIRED, StructureTileCondition.AGNOSTIC, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Room", StructureTileCondition.REQUIRED, StructureTileCondition.AGNOSTIC, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.NEVER));
|
||||
structure.getTiles().add(tileFor("Walled Room", StructureTileCondition.REQUIRED, StructureTileCondition.AGNOSTIC, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED, StructureTileCondition.REQUIRED));
|
||||
//@done
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.volmit.iris.util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Leaves;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
@@ -143,6 +144,11 @@ public class B
|
||||
return bdx;
|
||||
}
|
||||
|
||||
if(resolver.isPreventLeafDecay() && bdx instanceof Leaves)
|
||||
{
|
||||
((Leaves) bdx).setPersistent(true);
|
||||
}
|
||||
|
||||
bdc.put(bd, bdx);
|
||||
|
||||
return bdx;
|
||||
|
||||
@@ -128,7 +128,7 @@ public class IrisInterpolation
|
||||
|
||||
public static double bihermite(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double tension, double bias)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return hermite(
|
||||
hermite(p00, p01, p02, p03, muy, tension, bias),
|
||||
hermite(p10, p11, p12, p13, muy, tension, bias),
|
||||
@@ -140,7 +140,7 @@ public class IrisInterpolation
|
||||
|
||||
public static double bihermiteBezier(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double tension, double bias)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return hermiteBezier(
|
||||
hermiteBezier(p00, p01, p02, p03, muy, tension, bias),
|
||||
hermiteBezier(p10, p11, p12, p13, muy, tension, bias),
|
||||
@@ -152,7 +152,7 @@ public class IrisInterpolation
|
||||
|
||||
public static double bihermiteParametric(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double tension, double bias, double a)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return hermiteParametric(
|
||||
hermiteParametric(p00, p01, p02, p03, muy, tension, bias, a),
|
||||
hermiteParametric(p10, p11, p12, p13, muy, tension, bias, a),
|
||||
@@ -187,7 +187,7 @@ public class IrisInterpolation
|
||||
|
||||
public static double bicubic(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return cubic(
|
||||
cubic(p00, p01, p02, p03, muy),
|
||||
cubic(p10, p11, p12, p13, muy),
|
||||
@@ -199,7 +199,7 @@ public class IrisInterpolation
|
||||
|
||||
public static double bicubicBezier(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return cubicBezier(
|
||||
cubicBezier(p00, p01, p02, p03, muy),
|
||||
cubicBezier(p10, p11, p12, p13, muy),
|
||||
@@ -211,7 +211,7 @@ public class IrisInterpolation
|
||||
|
||||
public static double bicubicParametric(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double a)
|
||||
{
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return cubicParametric(
|
||||
cubicParametric(p00, p01, p02, p03, muy,a),
|
||||
cubicParametric(p10, p11, p12, p13, muy,a),
|
||||
@@ -239,7 +239,7 @@ public class IrisInterpolation
|
||||
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return blerp(
|
||||
n.noise(x1, z1),
|
||||
n.noise(x2, z1),
|
||||
@@ -276,7 +276,7 @@ public class IrisInterpolation
|
||||
int z2 = (int) Math.round((fz + 1) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return blerpBezier(
|
||||
n.noise(x1, z1),
|
||||
n.noise(x2, z1),
|
||||
@@ -296,7 +296,7 @@ public class IrisInterpolation
|
||||
int z2 = (int) Math.round((fz + 1) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return blerpParametric(
|
||||
n.noise(x1, z1),
|
||||
n.noise(x2, z1),
|
||||
@@ -316,7 +316,7 @@ public class IrisInterpolation
|
||||
int z2 = (int) Math.round((fz + 1) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return blerpSinCenter(
|
||||
n.noise(x1, z1),
|
||||
n.noise(x2, z1),
|
||||
@@ -340,7 +340,7 @@ public class IrisInterpolation
|
||||
int z3 = (int) Math.round((fz + 2) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return bicubic(
|
||||
n.noise(x0, z0),
|
||||
n.noise(x0, z1),
|
||||
@@ -376,7 +376,7 @@ public class IrisInterpolation
|
||||
int z3 = (int) Math.round((fz + 2) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return bicubicBezier(
|
||||
n.noise(x0, z0),
|
||||
n.noise(x0, z1),
|
||||
@@ -412,7 +412,7 @@ public class IrisInterpolation
|
||||
int z3 = (int) Math.round((fz + 2) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return bicubicParametric(
|
||||
n.noise(x0, z0),
|
||||
n.noise(x0, z1),
|
||||
@@ -463,7 +463,7 @@ public class IrisInterpolation
|
||||
int z3 = (int) Math.round((fz + 2) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return bihermite(
|
||||
n.noise(x0, z0),
|
||||
n.noise(x0, z1),
|
||||
@@ -499,7 +499,7 @@ public class IrisInterpolation
|
||||
int z3 = (int) Math.round((fz + 2) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return bihermiteBezier(
|
||||
n.noise(x0, z0),
|
||||
n.noise(x0, z1),
|
||||
@@ -535,7 +535,7 @@ public class IrisInterpolation
|
||||
int z3 = (int) Math.round((fz + 2) * rad);
|
||||
double px = rangeScale(0, 1, x1, x2, x);
|
||||
double pz = rangeScale(0, 1, z1, z2, z);
|
||||
//@NoArgsConstructor
|
||||
//@builder
|
||||
return bihermiteParametric(
|
||||
n.noise(x0, z0),
|
||||
n.noise(x0, z1),
|
||||
|
||||
@@ -235,6 +235,11 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject>
|
||||
}
|
||||
|
||||
public IrisObject load(String name)
|
||||
{
|
||||
return load(name, true);
|
||||
}
|
||||
|
||||
public IrisObject load(String name, boolean warn)
|
||||
{
|
||||
String key = name + "-" + objectClass.getCanonicalName();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ResourceLoader<T extends IrisRegistrant>
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(j.isFile() && j.getName().endsWith(".json"))
|
||||
{
|
||||
m.add(j.getName().replaceAll("\\Q.json\\E", ""));
|
||||
@@ -147,6 +147,11 @@ public class ResourceLoader<T extends IrisRegistrant>
|
||||
}
|
||||
|
||||
public T load(String name)
|
||||
{
|
||||
return load(name, true);
|
||||
}
|
||||
|
||||
public T load(String name, boolean warn)
|
||||
{
|
||||
if(name.trim().isEmpty())
|
||||
{
|
||||
@@ -180,7 +185,10 @@ public class ResourceLoader<T extends IrisRegistrant>
|
||||
}
|
||||
}
|
||||
|
||||
J.a(() -> Iris.warn("Couldn't find " + resourceTypeName + ": " + name));
|
||||
if(warn)
|
||||
{
|
||||
J.a(() -> Iris.warn("Couldn't find " + resourceTypeName + ": " + name));
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user