mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-02 07:56:48 +00:00
Fix decorator determinism (#1144)
This commit is contained in:
parent
1c3bff7559
commit
d4986f42a6
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.decorator;
|
package com.volmit.iris.engine.decorator;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||||
import com.volmit.iris.engine.object.IrisDecorator;
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -38,12 +38,14 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
|||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@Override
|
@Override
|
||||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
|
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
|
||||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
RNG rng = getRNG(realX, realZ);
|
||||||
|
IrisDecorator decorator = getDecorator(rng, biome, realX, realZ);
|
||||||
|
|
||||||
if (decorator != null) {
|
if (decorator != null) {
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
data.set(x, height, z, fixFaces(decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()), data, x, z, realX, height, realZ));
|
data.set(x, height, z, fixFaces(decorator.getBlockData100(biome, rng, realX, height, realZ, getData()), data, x, z, realX, height, realZ));
|
||||||
} else {
|
} else {
|
||||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
int stack = decorator.getHeight(rng, realX, realZ, getData());
|
||||||
if (decorator.isScaleStack()) {
|
if (decorator.isScaleStack()) {
|
||||||
stack = Math.min((int) Math.ceil((double) max * ((double) stack / 100)), decorator.getAbsoluteMaxStack());
|
stack = Math.min((int) Math.ceil((double) max * ((double) stack / 100)), decorator.getAbsoluteMaxStack());
|
||||||
} else {
|
} else {
|
||||||
@ -51,7 +53,7 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack == 1) {
|
if (stack == 1) {
|
||||||
data.set(x, height, z, decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockDataForTop(biome, rng, realX, height, realZ, getData()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,8 +66,8 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
|||||||
double threshold = (((double) i) / (double) (stack - 1));
|
double threshold = (((double) i) / (double) (stack - 1));
|
||||||
|
|
||||||
BlockData bd = threshold >= decorator.getTopThreshold() ?
|
BlockData bd = threshold >= decorator.getTopThreshold() ?
|
||||||
decorator.getBlockDataForTop(biome, getRng(), realX, h, realZ, getData()) :
|
decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData()) :
|
||||||
decorator.getBlockData100(biome, getRng(), realX, h, realZ, getData());
|
decorator.getBlockData100(biome, rng, realX, h, realZ, getData());
|
||||||
|
|
||||||
if (bd instanceof PointedDripstone) {
|
if (bd instanceof PointedDripstone) {
|
||||||
PointedDripstone.Thickness th = PointedDripstone.Thickness.BASE;
|
PointedDripstone.Thickness th = PointedDripstone.Thickness.BASE;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package com.volmit.iris.engine.decorator;
|
package com.volmit.iris.engine.decorator;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineAssignedComponent;
|
import com.volmit.iris.engine.framework.EngineAssignedComponent;
|
||||||
import com.volmit.iris.engine.framework.EngineDecorator;
|
import com.volmit.iris.engine.framework.EngineDecorator;
|
||||||
@ -29,6 +28,7 @@ import com.volmit.iris.engine.object.IrisDecorator;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -37,26 +37,31 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.block.data.MultipleFacing;
|
import org.bukkit.block.data.MultipleFacing;
|
||||||
|
|
||||||
public abstract class IrisEngineDecorator extends EngineAssignedComponent implements EngineDecorator {
|
public abstract class IrisEngineDecorator extends EngineAssignedComponent implements EngineDecorator {
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final RNG rng;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final IrisDecorationPart part;
|
private final IrisDecorationPart part;
|
||||||
|
private final long seed;
|
||||||
|
private final long modX, modZ;
|
||||||
|
|
||||||
public IrisEngineDecorator(Engine engine, String name, IrisDecorationPart part) {
|
public IrisEngineDecorator(Engine engine, String name, IrisDecorationPart part) {
|
||||||
super(engine, name + " Decorator");
|
super(engine, name + " Decorator");
|
||||||
this.part = part;
|
this.part = part;
|
||||||
this.rng = new RNG(getSeed() + 29356788 - (part.ordinal() * 10439677L));
|
this.seed = getSeed() + 29356788 - (part.ordinal() * 10439677L);
|
||||||
|
this.modX = 29356788 ^ (part.ordinal() + 6);
|
||||||
|
this.modZ = 10439677 ^ (part.ordinal() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IrisDecorator getDecorator(IrisBiome biome, double realX, double realZ) {
|
@BlockCoordinates
|
||||||
KList<IrisDecorator> v = new KList<>();
|
protected RNG getRNG(int x, int z) {
|
||||||
RNG rng = new RNG(Cache.key((int) realX, (int) realZ));
|
return new RNG(x * modX + z * modZ + seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IrisDecorator getDecorator(RNG rng, IrisBiome biome, double realX, double realZ) {
|
||||||
|
KList<IrisDecorator> v = new KList<>();
|
||||||
|
|
||||||
|
RNG gRNG = new RNG(seed);
|
||||||
for (IrisDecorator i : biome.getDecorators()) {
|
for (IrisDecorator i : biome.getDecorators()) {
|
||||||
try {
|
try {
|
||||||
if (i.getPartOf().equals(part) && i.getBlockData(biome, this.rng, realX, realZ, getData()) != null) {
|
if (i.getPartOf().equals(part) && i.getBlockData(biome, gRNG, realX, realZ, getData()) != null) {
|
||||||
v.add(i);
|
v.add(i);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.decorator;
|
package com.volmit.iris.engine.decorator;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||||
import com.volmit.iris.engine.object.IrisDecorator;
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
||||||
@ -35,7 +35,8 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
|||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@Override
|
@Override
|
||||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
|
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
|
||||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
RNG rng = getRNG(realX, realZ);
|
||||||
|
IrisDecorator decorator = getDecorator(rng, biome, realX, realZ);
|
||||||
|
|
||||||
if (decorator != null) {
|
if (decorator != null) {
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
@ -44,17 +45,17 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (height >= 0 || height < getEngine().getHeight()) {
|
if (height >= 0 || height < getEngine().getHeight()) {
|
||||||
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockData100(biome, rng, realX, height, realZ, getData()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
int stack = decorator.getHeight(rng, realX, realZ, getData());
|
||||||
if (decorator.isScaleStack()) {
|
if (decorator.isScaleStack()) {
|
||||||
int maxStack = max - height;
|
int maxStack = max - height;
|
||||||
stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
|
stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
|
||||||
} else stack = Math.min(stack, max - height);
|
} else stack = Math.min(stack, max - height);
|
||||||
|
|
||||||
if (stack == 1) {
|
if (stack == 1) {
|
||||||
data.set(x, height, z, decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockDataForTop(biome, rng, realX, height, realZ, getData()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,8 +67,8 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
|||||||
|
|
||||||
double threshold = ((double) i) / (stack - 1);
|
double threshold = ((double) i) / (stack - 1);
|
||||||
data.set(x, h, z, threshold >= decorator.getTopThreshold() ?
|
data.set(x, h, z, threshold >= decorator.getTopThreshold() ?
|
||||||
decorator.getBlockDataForTop(biome, getRng(), realX, h, realZ, getData()) :
|
decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData()) :
|
||||||
decorator.getBlockData100(biome, getRng(), realX, h, realZ, getData()));
|
decorator.getBlockData100(biome, rng, realX, h, realZ, getData()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.decorator;
|
package com.volmit.iris.engine.decorator;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||||
import com.volmit.iris.engine.object.IrisDecorator;
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||||
@ -35,22 +35,23 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@Override
|
@Override
|
||||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
|
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
|
||||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
RNG rng = getRNG(realX, realZ);
|
||||||
|
IrisDecorator decorator = getDecorator(rng, biome, realX, realZ);
|
||||||
|
|
||||||
if (decorator != null) {
|
if (decorator != null) {
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
if (height >= 0 || height < getEngine().getHeight()) {
|
if (height >= 0 || height < getEngine().getHeight()) {
|
||||||
data.set(x, height + 1, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height + 1, z, decorator.getBlockData100(biome, rng, realX, height, realZ, getData()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
int stack = decorator.getHeight(rng, realX, realZ, getData());
|
||||||
if (decorator.isScaleStack()) {
|
if (decorator.isScaleStack()) {
|
||||||
int maxStack = max - height;
|
int maxStack = max - height;
|
||||||
stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
|
stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack == 1) {
|
if (stack == 1) {
|
||||||
data.set(x, height, z, decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockDataForTop(biome, rng, realX, height, realZ, getData()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,8 +63,8 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
|
|
||||||
double threshold = ((double) i) / (stack - 1);
|
double threshold = ((double) i) / (stack - 1);
|
||||||
data.set(x, h + 1, z, threshold >= decorator.getTopThreshold() ?
|
data.set(x, h + 1, z, threshold >= decorator.getTopThreshold() ?
|
||||||
decorator.getBlockDataForTop(biome, getRng().nextParallelRNG(i), realX, h, realZ, getData()) :
|
decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData()) :
|
||||||
decorator.getBlockData100(biome, getRng().nextParallelRNG(i), realX, h, realZ, getData()));
|
decorator.getBlockData100(biome, rng, realX, h, realZ, getData()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.decorator;
|
package com.volmit.iris.engine.decorator;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||||
import com.volmit.iris.engine.object.IrisDecorator;
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||||
@ -42,7 +42,8 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
|||||||
Math.round(getComplex().getHeightStream().get(realX, realZ1)) < getComplex().getFluidHeight() ||
|
Math.round(getComplex().getHeightStream().get(realX, realZ1)) < getComplex().getFluidHeight() ||
|
||||||
Math.round(getComplex().getHeightStream().get(realX, realZ_1)) < getComplex().getFluidHeight()
|
Math.round(getComplex().getHeightStream().get(realX, realZ_1)) < getComplex().getFluidHeight()
|
||||||
) {
|
) {
|
||||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
RNG rng = getRNG(realX, realZ);
|
||||||
|
IrisDecorator decorator = getDecorator(rng, biome, realX, realZ);
|
||||||
|
|
||||||
if (decorator != null) {
|
if (decorator != null) {
|
||||||
if (!decorator.isForcePlace() && !decorator.getSlopeCondition().isDefault()
|
if (!decorator.isForcePlace() && !decorator.getSlopeCondition().isDefault()
|
||||||
@ -51,16 +52,16 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
data.set(x, height + 1, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height + 1, z, decorator.getBlockData100(biome, rng, realX, height, realZ, getData()));
|
||||||
} else {
|
} else {
|
||||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
int stack = decorator.getHeight(rng, realX, realZ, getData());
|
||||||
if (decorator.isScaleStack()) {
|
if (decorator.isScaleStack()) {
|
||||||
int maxStack = max - height;
|
int maxStack = max - height;
|
||||||
stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
|
stack = (int) Math.ceil((double) maxStack * ((double) stack / 100));
|
||||||
} else stack = Math.min(max - height, stack);
|
} else stack = Math.min(max - height, stack);
|
||||||
|
|
||||||
if (stack == 1) {
|
if (stack == 1) {
|
||||||
data.set(x, height, z, decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockDataForTop(biome, rng, realX, height, realZ, getData()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +69,8 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
|||||||
int h = height + i;
|
int h = height + i;
|
||||||
double threshold = ((double) i) / (stack - 1);
|
double threshold = ((double) i) / (stack - 1);
|
||||||
data.set(x, h + 1, z, threshold >= decorator.getTopThreshold() ?
|
data.set(x, h + 1, z, threshold >= decorator.getTopThreshold() ?
|
||||||
decorator.getBlockDataForTop(biome, getRng(), realX, h, realZ, getData()) :
|
decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData()) :
|
||||||
decorator.getBlockData100(biome, getRng(), realX, h, realZ, getData()));
|
decorator.getBlockData100(biome, rng, realX, h, realZ, getData()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package com.volmit.iris.engine.decorator;
|
package com.volmit.iris.engine.decorator;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.InferredType;
|
import com.volmit.iris.engine.object.InferredType;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
@ -28,6 +27,7 @@ import com.volmit.iris.engine.object.IrisDecorator;
|
|||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.Bisected;
|
import org.bukkit.block.data.Bisected;
|
||||||
@ -47,7 +47,8 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockData bd, bdx;
|
BlockData bd, bdx;
|
||||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
RNG rng = getRNG(realX, realZ);
|
||||||
|
IrisDecorator decorator = getDecorator(rng, biome, realX, realZ);
|
||||||
bdx = data.get(x, height, z);
|
bdx = data.get(x, height, z);
|
||||||
boolean underwater = height < getDimension().getFluidHeight();
|
boolean underwater = height < getDimension().getFluidHeight();
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
bd = decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData());
|
bd = decorator.getBlockData100(biome, rng, realX, height, realZ, getData());
|
||||||
|
|
||||||
if (!underwater) {
|
if (!underwater) {
|
||||||
if (!canGoOn(bd, bdx) && (!decorator.isForcePlace() && decorator.getForceBlock() == null)) {
|
if (!canGoOn(bd, bdx) && (!decorator.isForcePlace() && decorator.getForceBlock() == null)) {
|
||||||
@ -72,7 +73,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
if (decorator.getWhitelist() != null && decorator.getWhitelist().stream().noneMatch(d -> d.getBlockData(getData()).equals(bdx))) {
|
if (decorator.getWhitelist() != null && decorator.getWhitelist().stream().noneMatch(d -> d.getBlockData(getData()).equals(bdx))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (decorator.getBlacklist() != null && decorator.getWhitelist().stream().anyMatch(d -> d.getBlockData(getData()).equals(bdx))) {
|
if (decorator.getBlacklist() != null && decorator.getBlacklist().stream().anyMatch(d -> d.getBlockData(getData()).equals(bdx))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
max = getDimension().getFluidHeight();
|
max = getDimension().getFluidHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
int stack = decorator.getHeight(rng, realX, realZ, getData());
|
||||||
|
|
||||||
if (decorator.isScaleStack()) {
|
if (decorator.isScaleStack()) {
|
||||||
stack = Math.min((int) Math.ceil((double) max * ((double) stack / 100)), decorator.getAbsoluteMaxStack());
|
stack = Math.min((int) Math.ceil((double) max * ((double) stack / 100)), decorator.getAbsoluteMaxStack());
|
||||||
@ -106,7 +107,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack == 1) {
|
if (stack == 1) {
|
||||||
data.set(x, height, z, decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockDataForTop(biome, rng, realX, height, realZ, getData()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,8 +115,8 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
int h = height + i;
|
int h = height + i;
|
||||||
double threshold = ((double) i) / (stack - 1);
|
double threshold = ((double) i) / (stack - 1);
|
||||||
bd = threshold >= decorator.getTopThreshold() ?
|
bd = threshold >= decorator.getTopThreshold() ?
|
||||||
decorator.getBlockDataForTop(biome, getRng(), realX, h, realZ, getData()) :
|
decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData()) :
|
||||||
decorator.getBlockData100(biome, getRng(), realX, h, realZ, getData());
|
decorator.getBlockData100(biome, rng, realX, h, realZ, getData());
|
||||||
|
|
||||||
if (bd == null) {
|
if (bd == null) {
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user