mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Fixes
This commit is contained in:
parent
19f78f769b
commit
05d3adff36
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>bytecode.ninja</groupId>
|
<groupId>bytecode.ninja</groupId>
|
||||||
<artifactId>Iris</artifactId>
|
<artifactId>Iris</artifactId>
|
||||||
<version>1.0.32</version>
|
<version>1.0.33</version>
|
||||||
<name>Iris</name>
|
<name>Iris</name>
|
||||||
<properties>
|
<properties>
|
||||||
<skip.copy>false</skip.copy>
|
<skip.copy>false</skip.copy>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.volmit.iris.v2.generator;
|
package com.volmit.iris.v2.generator;
|
||||||
|
|
||||||
|
import com.sun.org.apache.xpath.internal.operations.Mult;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.object.*;
|
import com.volmit.iris.object.*;
|
||||||
import com.volmit.iris.util.*;
|
import com.volmit.iris.util.*;
|
||||||
@ -54,15 +55,16 @@ public class IrisEngine extends BlockPopulator implements Engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate(int x, int z, Hunk<BlockData> vblocks, Hunk<Biome> biomes) {
|
public void generate(int x, int z, Hunk<BlockData> vblocks, Hunk<Biome> vbiomes) {
|
||||||
Hunk<BlockData> blocks = vblocks.listen((xx,y,zz,t) -> catchBlockUpdates(x+xx,y+getMinHeight(),z+zz, t));
|
Hunk<Biome> biomes = vbiomes.synchronize();
|
||||||
|
Hunk<BlockData> blocks = vblocks.synchronize().listen((xx,y,zz,t) -> catchBlockUpdates(x+xx,y+getMinHeight(),z+zz, t));
|
||||||
getFramework().getEngineParallax().generateParallaxArea(x, z);
|
getFramework().getEngineParallax().generateParallaxArea(x, z);
|
||||||
getFramework().getBiomeActuator().actuate(x, z, biomes);
|
getFramework().getBiomeActuator().actuate(x, z, biomes);
|
||||||
getFramework().getTerrainActuator().actuate(x, z, blocks);
|
getFramework().getTerrainActuator().actuate(x, z, blocks);
|
||||||
getFramework().getCaveModifier().modify(x, z, blocks);
|
getFramework().getCaveModifier().modify(x, z, blocks);
|
||||||
getFramework().getRavineModifier().modify(x, z, blocks);
|
getFramework().getRavineModifier().modify(x, z, blocks);
|
||||||
getFramework().getDepositModifier().modify(x, z, blocks);
|
|
||||||
getFramework().getDecorantActuator().actuate(x, z, blocks);
|
getFramework().getDecorantActuator().actuate(x, z, blocks);
|
||||||
|
getFramework().getDepositModifier().modify(x, z, blocks);
|
||||||
getFramework().getEngineParallax().insertParallax(x, z, blocks);
|
getFramework().getEngineParallax().insertParallax(x, z, blocks);
|
||||||
getFramework().recycle();
|
getFramework().recycle();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onModify(int x, int z, Hunk<BlockData> output) {
|
public void onModify(int x, int z, Hunk<BlockData> output) {
|
||||||
IrisBiome biome = getComplex().getTrueBiomeStream().get(x, z);
|
|
||||||
generateDeposits(rng, output, Math.floorDiv(x, 16), Math.floorDiv(z, 16));
|
generateDeposits(rng, output, Math.floorDiv(x, 16), Math.floorDiv(z, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,21 +4,35 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import com.volmit.iris.v2.scaffold.hunk.io.HunkIOAdapter;
|
|
||||||
import com.volmit.iris.v2.scaffold.hunk.storage.*;
|
|
||||||
import com.volmit.iris.v2.scaffold.hunk.view.*;
|
import com.volmit.iris.v2.scaffold.hunk.view.*;
|
||||||
import com.volmit.iris.util.*;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.ByteArrayTag;
|
||||||
|
import com.volmit.iris.util.Consumer2;
|
||||||
|
import com.volmit.iris.util.Consumer3;
|
||||||
|
import com.volmit.iris.util.Consumer4;
|
||||||
|
import com.volmit.iris.util.Consumer5;
|
||||||
|
import com.volmit.iris.util.Consumer6;
|
||||||
|
import com.volmit.iris.util.Consumer8;
|
||||||
|
import com.volmit.iris.util.Function3;
|
||||||
|
import com.volmit.iris.util.KList;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.io.HunkIOAdapter;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.storage.ArrayHunk;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.storage.AtomicDoubleHunk;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.storage.AtomicHunk;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.storage.AtomicIntegerHunk;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.storage.AtomicLongHunk;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.storage.MappedHunk;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.storage.SynchronizedArrayHunk;
|
||||||
import com.volmit.iris.v2.scaffold.parallel.BurstExecutor;
|
import com.volmit.iris.v2.scaffold.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.v2.scaffold.parallel.MultiBurst;
|
import com.volmit.iris.v2.scaffold.parallel.MultiBurst;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
|
|
||||||
public interface Hunk<T>
|
public interface Hunk<T>
|
||||||
{
|
{
|
||||||
@ -73,6 +87,11 @@ public interface Hunk<T>
|
|||||||
return new ListeningHunk<>(this, l);
|
return new ListeningHunk<>(this, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Hunk<T> synchronize()
|
||||||
|
{
|
||||||
|
return new SynchronizedHunkView<>(this);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> Hunk<T> newArrayHunk(int w, int h, int d)
|
public static <T> Hunk<T> newArrayHunk(int w, int h, int d)
|
||||||
{
|
{
|
||||||
return new ArrayHunk<>(w, h, d);
|
return new ArrayHunk<>(w, h, d);
|
||||||
@ -562,6 +581,22 @@ public interface Hunk<T>
|
|||||||
return iterate(getIdeal3DParallelism(), c);
|
return iterate(getIdeal3DParallelism(), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Hunk<T> iterateSync(Consumer3<Integer, Integer, Integer> c)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < getWidth(); i++)
|
||||||
|
{
|
||||||
|
for(int j = 0; j < getHeight(); j++)
|
||||||
|
{
|
||||||
|
for(int k = 0; k < getDepth(); k++)
|
||||||
|
{
|
||||||
|
c.accept(i, j, k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
default Hunk<T> iterate(int parallelism, Consumer3<Integer, Integer, Integer> c)
|
default Hunk<T> iterate(int parallelism, Consumer3<Integer, Integer, Integer> c)
|
||||||
{
|
{
|
||||||
compute3D(parallelism, (x, y, z, h) ->
|
compute3D(parallelism, (x, y, z, h) ->
|
||||||
@ -633,7 +668,8 @@ public interface Hunk<T>
|
|||||||
{
|
{
|
||||||
rq.add(r);
|
rq.add(r);
|
||||||
}
|
}
|
||||||
}), (x, y, z, hax, hbx) -> {
|
}), (x, y, z, hax, hbx) ->
|
||||||
|
{
|
||||||
a.insert(x, y, z, hax);
|
a.insert(x, y, z, hax);
|
||||||
b.insert(x, y, z, hbx);
|
b.insert(x, y, z, hbx);
|
||||||
});
|
});
|
||||||
@ -670,9 +706,7 @@ public interface Hunk<T>
|
|||||||
for(j = 0; j < a.getDepth(); j += d)
|
for(j = 0; j < a.getDepth(); j += d)
|
||||||
{
|
{
|
||||||
int jj = j;
|
int jj = j;
|
||||||
getDualSection(i, 0, j, i + w + (i == 0 ? wr : 0), a.getHeight(),
|
getDualSection(i, 0, j, i + w + (i == 0 ? wr : 0), a.getHeight(), j + d + (j == 0 ? dr : 0), a, b, (ha, hr, r) -> v.accept(ii, 0, jj, ha, hr, r), inserterAB);
|
||||||
j + d + (j == 0 ? dr : 0), a, b,
|
|
||||||
(ha, hr, r) -> v.accept(ii, 0, jj, ha, hr, r), inserterAB);
|
|
||||||
i = i == 0 ? i + wr : i;
|
i = i == 0 ? i + wr : i;
|
||||||
j = j == 0 ? j + dr : j;
|
j = j == 0 ? j + dr : j;
|
||||||
}
|
}
|
||||||
@ -695,7 +729,21 @@ public interface Hunk<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
BurstExecutor e = MultiBurst.burst.burst(parallelism);
|
BurstExecutor e = MultiBurst.burst.burst(parallelism);
|
||||||
|
|
||||||
|
if(isAtomic())
|
||||||
|
{
|
||||||
|
getSectionsAtomic2D(parallelism, (xx, yy, zz, h) -> e.queue(() ->
|
||||||
|
{
|
||||||
|
v.accept(xx, yy, zz, h);
|
||||||
|
}));
|
||||||
|
|
||||||
|
e.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
KList<Runnable> rq = new KList<Runnable>(parallelism);
|
KList<Runnable> rq = new KList<Runnable>(parallelism);
|
||||||
|
|
||||||
getSections2D(parallelism, (xx, yy, zz, h, r) -> e.queue(() ->
|
getSections2D(parallelism, (xx, yy, zz, h, r) -> e.queue(() ->
|
||||||
{
|
{
|
||||||
v.accept(xx, yy, zz, h);
|
v.accept(xx, yy, zz, h);
|
||||||
@ -705,8 +753,11 @@ public interface Hunk<T>
|
|||||||
rq.add(r);
|
rq.add(r);
|
||||||
}
|
}
|
||||||
}), this::insert);
|
}), this::insert);
|
||||||
|
|
||||||
e.complete();
|
e.complete();
|
||||||
rq.forEach(Runnable::run);
|
rq.forEach(Runnable::run);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,6 +818,39 @@ public interface Hunk<T>
|
|||||||
return getSections2D(sections, v, this::insert);
|
return getSections2D(sections, v, this::insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Hunk<T> getSectionsAtomic2D(int sections, Consumer4<Integer, Integer, Integer, Hunk<T>> v)
|
||||||
|
{
|
||||||
|
int dim = (int) get2DDimension(sections);
|
||||||
|
|
||||||
|
if(sections <= 1)
|
||||||
|
{
|
||||||
|
getAtomicSection(0, 0, 0, getWidth(), getHeight(), getDepth(), (hh) -> v.accept(0, 0, 0, hh));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
int w = getWidth() / dim;
|
||||||
|
int wr = getWidth() - (w * dim);
|
||||||
|
int d = getDepth() / dim;
|
||||||
|
int dr = getDepth() - (d * dim);
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for(i = 0; i < getWidth(); i += w)
|
||||||
|
{
|
||||||
|
int ii = i;
|
||||||
|
|
||||||
|
for(j = 0; j < getDepth(); j += d)
|
||||||
|
{
|
||||||
|
int jj = j;
|
||||||
|
getAtomicSection(i, 0, j, i + w + (i == 0 ? wr : 0), getHeight(), j + d + (j == 0 ? dr : 0), (h) -> v.accept(ii, 0, jj, h));
|
||||||
|
i = i == 0 ? i + wr : i;
|
||||||
|
j = j == 0 ? j + dr : j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
default Hunk<T> getSections2D(int sections, Consumer5<Integer, Integer, Integer, Hunk<T>, Runnable> v, Consumer4<Integer, Integer, Integer, Hunk<T>> inserter)
|
default Hunk<T> getSections2D(int sections, Consumer5<Integer, Integer, Integer, Hunk<T>, Runnable> v, Consumer4<Integer, Integer, Integer, Hunk<T>> inserter)
|
||||||
{
|
{
|
||||||
int dim = (int) get2DDimension(sections);
|
int dim = (int) get2DDimension(sections);
|
||||||
@ -795,6 +879,7 @@ public interface Hunk<T>
|
|||||||
j = j == 0 ? j + dr : j;
|
j = j == 0 ? j + dr : j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -888,6 +973,13 @@ public interface Hunk<T>
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Hunk<T> getAtomicSection(int x, int y, int z, int x1, int y1, int z1, Consumer<Hunk<T>> v)
|
||||||
|
{
|
||||||
|
Hunk<T> copy = croppedView(x, y, z, x1, y1, z1);
|
||||||
|
v.accept(copy);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
default void enforceBounds(int x, int y, int z)
|
default void enforceBounds(int x, int y, int z)
|
||||||
{
|
{
|
||||||
if(x < 0 || x >= getWidth() || y < 0 || y >= getHeight() || z < 0 || z >= getDepth())
|
if(x < 0 || x >= getWidth() || y < 0 || y >= getHeight() || z < 0 || z >= getDepth())
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.volmit.iris.v2.scaffold.hunk.view;
|
||||||
|
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||||
|
|
||||||
|
public class SynchronizedHunkView<T> implements Hunk<T> {
|
||||||
|
private final Hunk<T> src;
|
||||||
|
|
||||||
|
public SynchronizedHunkView(Hunk<T> src)
|
||||||
|
{
|
||||||
|
this.src = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRaw(int x, int y, int z, T t)
|
||||||
|
{
|
||||||
|
synchronized (src)
|
||||||
|
{
|
||||||
|
src.setRaw(x,y,z,t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T getRaw(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return src.getRaw(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth()
|
||||||
|
{
|
||||||
|
return src.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight()
|
||||||
|
{
|
||||||
|
return src.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDepth()
|
||||||
|
{
|
||||||
|
return src.getDepth();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Hunk<T> getSource()
|
||||||
|
{
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user