mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Woo fixes
This commit is contained in:
parent
0a7b485514
commit
d52d70a014
@ -49,6 +49,7 @@ import com.volmit.iris.util.io.JarScanner;
|
|||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.nbt.mca.*;
|
import com.volmit.iris.util.nbt.mca.*;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.BiomeContainer;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.*;
|
import com.volmit.iris.util.plugin.*;
|
||||||
import com.volmit.iris.util.reflect.ShadeFix;
|
import com.volmit.iris.util.reflect.ShadeFix;
|
||||||
@ -77,6 +78,7 @@ import org.checkerframework.checker.units.qual.K;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -126,129 +128,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testmca() {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int forceBits = 5;
|
|
||||||
int possibilities = (int) (Math.pow(2, forceBits) - 1);
|
|
||||||
KList<BlockData> bp = new KList<>();
|
|
||||||
Set<BlockData> bf = new KSet<>();
|
|
||||||
|
|
||||||
while(bp.size() < possibilities)
|
|
||||||
{
|
|
||||||
BlockData b = null;
|
|
||||||
|
|
||||||
while(b == null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
b = Material.values()[RNG.r.i(Material.values().length-1)].createBlockData();
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bp.addIfMissing(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
MCAFile file = new MCAFile(0, 0);
|
|
||||||
for(int cx = 0; cx < 32; cx++)
|
|
||||||
{
|
|
||||||
for(int cz = 0; cz < 32; cz++)
|
|
||||||
{
|
|
||||||
Chunk c = Chunk.newChunk();
|
|
||||||
|
|
||||||
for(int i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < 16; j++)
|
|
||||||
{
|
|
||||||
for(int k = 0; k < 16; k++)
|
|
||||||
{
|
|
||||||
BlockData b = bp.getRandom();
|
|
||||||
c.setBlockStateAt(i,j,k, NBTWorld.getCompound(b), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file.setChunk(cx, cz, c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
File f = new File("r.0.0.mca");
|
|
||||||
Iris.info("Write " + MCAUtil.write(file, f) + " chunks");
|
|
||||||
file = MCAUtil.read(f);
|
|
||||||
|
|
||||||
for(int i = 0; i < 1024; i++) {
|
|
||||||
Chunk c = file.getChunks().get(i);
|
|
||||||
|
|
||||||
if (c == null) {
|
|
||||||
Iris.error("Missing Chunk: " + i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Section s = c.getSection(0);
|
|
||||||
|
|
||||||
if (s == null)
|
|
||||||
{
|
|
||||||
Iris.error("Missing section 0 in chunk: " + i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int a = 0; a < 16; a++)
|
|
||||||
{
|
|
||||||
for(int b = 0; b < 16; b++)
|
|
||||||
{
|
|
||||||
for(int ca = 0; ca < 16; ca++)
|
|
||||||
{
|
|
||||||
BlockData data = NBTWorld.getBlockData(s.getBlockStateAt(a, b, ca));
|
|
||||||
bf.add(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.info("Read .. OK?");
|
|
||||||
|
|
||||||
Iris.info("Possibilities: " + bp.size());
|
|
||||||
Iris.info("Read Possibss: " + bf.size());
|
|
||||||
int match = 0;
|
|
||||||
for(BlockData i : bp)
|
|
||||||
{
|
|
||||||
if(bf.contains(i))
|
|
||||||
{
|
|
||||||
match++;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Iris.warn("Couldn't find preset " + i.getAsString(true) + " in any section");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(BlockData i : bf)
|
|
||||||
{
|
|
||||||
if(!bp.contains(i))
|
|
||||||
{
|
|
||||||
Iris.warn("Forign block data " + i.getAsString(true) + "! (ignore leaves, they are modded by us)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Iris.info("Matched: " + match);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable ee)
|
|
||||||
{
|
|
||||||
ee.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void enable() {
|
private void enable() {
|
||||||
audiences = BukkitAudiences.create(this);
|
audiences = BukkitAudiences.create(this);
|
||||||
sender = new VolmitSender(Bukkit.getConsoleSender());
|
sender = new VolmitSender(Bukkit.getConsoleSender());
|
||||||
@ -261,7 +140,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
||||||
services.values().forEach(IrisService::onEnable);
|
services.values().forEach(IrisService::onEnable);
|
||||||
services.values().forEach(this::registerListener);
|
services.values().forEach(this::registerListener);
|
||||||
J.s(this::testmca, 20);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postShutdown(Runnable r) {
|
public void postShutdown(Runnable r) {
|
||||||
|
@ -397,19 +397,21 @@ public class IrisEngine implements Engine {
|
|||||||
context.touch();
|
context.touch();
|
||||||
getEngineData().getStatistics().generatedChunk();
|
getEngineData().getStatistics().generatedChunk();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
||||||
|
|
||||||
if (multicore) {
|
if(getDimension().isDebugChunkCrossSections() && ((x >> 4) % getDimension().getDebugCrossSectionsMod() == 0 || (z >> 4) % getDimension().getDebugCrossSectionsMod() == 0))
|
||||||
|
{
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
blocks.set(i, 0, j, Material.RED_GLAZED_TERRACOTTA.createBlockData());
|
blocks.set(i, 0, j, Material.CRYING_OBSIDIAN.createBlockData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
getMantle().generateMatter(x >> 4, z >> 4, multicore);
|
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getMantle().generateMatter(x >> 4, z >> 4, true);
|
||||||
burst().burst(multicore,
|
burst().burst(multicore,
|
||||||
() -> getTerrainActuator().actuate(x, z, vblocks, multicore),
|
() -> getTerrainActuator().actuate(x, z, vblocks, multicore),
|
||||||
() -> getBiomeActuator().actuate(x, z, vbiomes, multicore)
|
() -> getBiomeActuator().actuate(x, z, vbiomes, multicore)
|
||||||
@ -419,16 +421,12 @@ public class IrisEngine implements Engine {
|
|||||||
() -> getDecorantActuator().actuate(x, z, blocks, multicore),
|
() -> getDecorantActuator().actuate(x, z, blocks, multicore),
|
||||||
() -> getRavineModifier().modify(x, z, vblocks, multicore)
|
() -> getRavineModifier().modify(x, z, vblocks, multicore)
|
||||||
);
|
);
|
||||||
|
|
||||||
getPostModifier().modify(x, z, vblocks, multicore);
|
getPostModifier().modify(x, z, vblocks, multicore);
|
||||||
|
|
||||||
burst().burst(multicore,
|
burst().burst(multicore,
|
||||||
() -> getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore),
|
() -> getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, true),
|
||||||
() -> getDepositModifier().modify(x, z, vblocks, multicore)
|
() -> getDepositModifier().modify(x, z, vblocks, multicore)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getMetrics().getTotal().put(p.getMilliseconds());
|
getMetrics().getTotal().put(p.getMilliseconds());
|
||||||
generated.incrementAndGet();
|
generated.incrementAndGet();
|
||||||
recycle();
|
recycle();
|
||||||
|
@ -136,7 +136,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
|||||||
if (i <= he) {
|
if (i <= he) {
|
||||||
depth = he - i;
|
depth = he - i;
|
||||||
if (blocks == null) {
|
if (blocks == null) {
|
||||||
blocks = biome.generateLayers(realX, realZ, rng,
|
blocks = biome.generateLayers(getDimension(), realX, realZ, rng,
|
||||||
he,
|
he,
|
||||||
he,
|
he,
|
||||||
getData(),
|
getData(),
|
||||||
|
@ -81,8 +81,8 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
KList<BlockData> floor = cave.generateLayers(x + finalI, z + j, rng, cl.getFloor(), cl.getFloor(), getData(), getComplex());
|
KList<BlockData> floor = cave.generateLayers(getDimension(), x + finalI, z + j, rng, cl.getFloor(), cl.getFloor(), getData(), getComplex());
|
||||||
KList<BlockData> ceiling = cave.generateLayers(x + finalI + 656, z + j - 656, rng,
|
KList<BlockData> ceiling = cave.generateLayers(getDimension(), x + finalI + 656, z + j - 656, rng,
|
||||||
he - cl.getCeiling(),
|
he - cl.getCeiling(),
|
||||||
he - cl.getCeiling(), getData(), getComplex());
|
he - cl.getCeiling(), getData(), getComplex());
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import com.volmit.iris.engine.object.block.IrisBlockDrops;
|
|||||||
import com.volmit.iris.engine.object.common.IRare;
|
import com.volmit.iris.engine.object.common.IRare;
|
||||||
import com.volmit.iris.engine.object.decoration.IrisDecorator;
|
import com.volmit.iris.engine.object.decoration.IrisDecorator;
|
||||||
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
|
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
|
||||||
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.engine.object.feature.IrisFeaturePotential;
|
import com.volmit.iris.engine.object.feature.IrisFeaturePotential;
|
||||||
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructurePlacement;
|
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructurePlacement;
|
||||||
import com.volmit.iris.engine.object.loot.IrisLootReference;
|
import com.volmit.iris.engine.object.loot.IrisLootReference;
|
||||||
@ -43,6 +44,7 @@ import com.volmit.iris.engine.object.spawners.IrisSpawner;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
import com.volmit.iris.util.data.VanillaBiomeMap;
|
import com.volmit.iris.util.data.VanillaBiomeMap;
|
||||||
@ -56,6 +58,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
@ -65,7 +68,6 @@ import java.awt.*;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
||||||
@Desc("Represents a biome in iris. Biomes are placed inside of regions and hold objects.\nA biome consists of layers (block palletes), decorations, objects & generators.")
|
@Desc("Represents a biome in iris. Biomes are placed inside of regions and hold objects.\nA biome consists of layers (block palletes), decorations, objects & generators.")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ -88,7 +90,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
@ArrayType(min = 1, type = IrisFeaturePotential.class)
|
@ArrayType(min = 1, type = IrisFeaturePotential.class)
|
||||||
private KList<IrisFeaturePotential> features = new KList<>();
|
private KList<IrisFeaturePotential> features = new KList<>();
|
||||||
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisEffect.class)
|
@ArrayType(min = 1, type = IrisEffect.class)
|
||||||
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play around the player even if where the effect was played is no longer in the biome the player is in.")
|
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play around the player even if where the effect was played is no longer in the biome the player is in.")
|
||||||
private KList<IrisEffect> effects = new KList<>();
|
private KList<IrisEffect> effects = new KList<>();
|
||||||
@ -194,6 +195,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
|
|
||||||
private transient InferredType inferredType;
|
private transient InferredType inferredType;
|
||||||
|
|
||||||
|
private static final BlockData BARRIER = Material.BARRIER.createBlockData();
|
||||||
private final transient AtomicCache<KMap<String, IrisBiomeGeneratorLink>> genCache = new AtomicCache<>();
|
private final transient AtomicCache<KMap<String, IrisBiomeGeneratorLink>> genCache = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KMap<String, Integer>> genCacheMax = new AtomicCache<>();
|
private final transient AtomicCache<KMap<String, Integer>> genCacheMax = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KMap<String, Integer>> genCacheMin = new AtomicCache<>();
|
private final transient AtomicCache<KMap<String, Integer>> genCacheMin = new AtomicCache<>();
|
||||||
@ -326,7 +328,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
return childrenCell.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137), getLoader()).bake().scale(scale).bake());
|
return childrenCell.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137), getLoader()).bake().scale(scale).bake());
|
||||||
}
|
}
|
||||||
|
|
||||||
public KList<BlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
public KList<BlockData> generateLayers(IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||||
if (isLockLayers()) {
|
if (isLockLayers()) {
|
||||||
return generateLockedLayers(wx, wz, random, maxDepth, height, rdata, complex);
|
return generateLockedLayers(wx, wz, random, maxDepth, height, rdata, complex);
|
||||||
}
|
}
|
||||||
@ -369,6 +371,18 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
if (data.size() >= maxDepth) {
|
if (data.size() >= maxDepth) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(dim.isExplodeBiomePalettes())
|
||||||
|
{
|
||||||
|
for(int j = 0; j < dim.getExplodeBiomePaletteSize(); j++)
|
||||||
|
{
|
||||||
|
data.add(BARRIER);
|
||||||
|
|
||||||
|
if (data.size() >= maxDepth) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -86,6 +86,22 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
||||||
private String stronghold;
|
private String stronghold;
|
||||||
|
|
||||||
|
@Desc("If set to true, Iris will remove chunks to allow visualizing cross sections of chunks easily")
|
||||||
|
private boolean debugChunkCrossSections = false;
|
||||||
|
|
||||||
|
@Desc("Vertically split up the biome palettes with 3 air blocks in between to visualize them")
|
||||||
|
private boolean explodeBiomePalettes = false;
|
||||||
|
|
||||||
|
@MinNumber(1)
|
||||||
|
@MaxNumber(16)
|
||||||
|
@Desc("Customize the palette height explosion")
|
||||||
|
private int explodeBiomePaletteSize = 3;
|
||||||
|
|
||||||
|
@MinNumber(2)
|
||||||
|
@MaxNumber(16)
|
||||||
|
@Desc("Every X/Z % debugCrossSectionsMod == 0 cuts the chunk")
|
||||||
|
private int debugCrossSectionsMod = 3;
|
||||||
|
|
||||||
@Desc("The average distance between strongholds")
|
@Desc("The average distance between strongholds")
|
||||||
private int strongholdJumpDistance = 1280;
|
private int strongholdJumpDistance = 1280;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user