mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Performance & Fixes
This commit is contained in:
parent
ec39d7146c
commit
4c44957764
@ -170,6 +170,33 @@ public class Iris extends VolmitPlugin
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
public void onDisable()
|
||||
{
|
||||
if(IrisSettings.get().isStudio())
|
||||
{
|
||||
proj.close();
|
||||
|
||||
for(World i : Bukkit.getWorlds())
|
||||
{
|
||||
if(IrisWorlds.isIrisWorld(i))
|
||||
{
|
||||
IrisWorlds.access(i).close();
|
||||
}
|
||||
}
|
||||
|
||||
for(GroupedExecutor i : executors)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
|
||||
executors.clear();
|
||||
board.disable();
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
HandlerList.unregisterAll((Plugin) this);
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
public static void sq(Runnable r)
|
||||
{
|
||||
synchronized(syncJobs)
|
||||
@ -206,10 +233,10 @@ public class Iris extends VolmitPlugin
|
||||
|
||||
private void bstats()
|
||||
{
|
||||
J.s(() ->
|
||||
if(IrisSettings.get().isMetrics())
|
||||
{
|
||||
new MetricsLite(Iris.instance, 8757);
|
||||
});
|
||||
J.s(() ->new MetricsLite(Iris.instance, 8757));
|
||||
}
|
||||
}
|
||||
|
||||
public static File getTemp()
|
||||
@ -217,33 +244,6 @@ public class Iris extends VolmitPlugin
|
||||
return instance.getDataFolder("cache", "temp");
|
||||
}
|
||||
|
||||
public void onDisable()
|
||||
{
|
||||
if(IrisSettings.get().isStudio())
|
||||
{
|
||||
proj.close();
|
||||
|
||||
for(World i : Bukkit.getWorlds())
|
||||
{
|
||||
if(IrisWorlds.isIrisWorld(i))
|
||||
{
|
||||
IrisWorlds.access(i).close();
|
||||
}
|
||||
}
|
||||
|
||||
for(GroupedExecutor i : executors)
|
||||
{
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
|
||||
executors.clear();
|
||||
board.disable();
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
HandlerList.unregisterAll((Plugin) this);
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
@ -410,6 +410,11 @@ public class Iris extends VolmitPlugin
|
||||
|
||||
public void splash()
|
||||
{
|
||||
if(!IrisSettings.get().isSplash())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// @NoArgsConstructor
|
||||
String padd = Form.repeat(" ", 8);
|
||||
String padd2 = Form.repeat(" ", 4);
|
||||
|
@ -1,18 +1,12 @@
|
||||
package com.volmit.iris;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.util.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.JSONException;
|
||||
import com.volmit.iris.util.JSONObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IrisSettings
|
||||
{
|
||||
@ -114,6 +108,10 @@ public class IrisSettings
|
||||
@Desc("Collects anonymous metrics for bstats")
|
||||
public boolean metrics = true;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Splash the screen")
|
||||
public boolean splash = true;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Skips preparing spawn by using nms to hijack the world init phase")
|
||||
public boolean skipPrepareSpawnNMS = true;
|
||||
|
@ -1,21 +1,21 @@
|
||||
package com.volmit.iris.generator;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.generator.actuator.IrisTerrainActuator;
|
||||
import com.volmit.iris.generator.modifier.IrisCaveModifier;
|
||||
import com.volmit.iris.generator.noise.CNG;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.object.*;
|
||||
import com.volmit.iris.util.*;
|
||||
import com.volmit.iris.scaffold.data.DataProvider;
|
||||
import com.volmit.iris.scaffold.engine.Engine;
|
||||
import com.volmit.iris.scaffold.stream.ProceduralStream;
|
||||
import com.volmit.iris.scaffold.stream.interpolation.Interpolated;
|
||||
import com.volmit.iris.util.*;
|
||||
import lombok.Data;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.scaffold.stream.ProceduralStream;
|
||||
import com.volmit.iris.scaffold.stream.interpolation.Interpolated;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.generator.noise.CNG;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IrisComplex implements DataProvider
|
||||
{
|
||||
@ -37,6 +37,7 @@ public class IrisComplex implements DataProvider
|
||||
private ProceduralStream<Double> maxHeightStream;
|
||||
private ProceduralStream<Double> overlayStream;
|
||||
private ProceduralStream<Double> heightFluidStream;
|
||||
private ProceduralStream<Integer> trueHeightStream;
|
||||
private ProceduralStream<Double> slopeStream;
|
||||
private ProceduralStream<RNG> rngStream;
|
||||
private ProceduralStream<RNG> chunkRngStream;
|
||||
@ -77,8 +78,8 @@ public class IrisComplex implements DataProvider
|
||||
|
||||
public IrisComplex(Engine engine)
|
||||
{
|
||||
int cacheSize = 1024;
|
||||
BlockData glass = B.getBlockData("GLASS");
|
||||
int cacheSize = 8192;
|
||||
BlockData glass = B.get("GLASS");
|
||||
this.rng = new RNG(engine.getWorld().getSeed());
|
||||
this.data = engine.getData();
|
||||
double height = engine.getHeight();
|
||||
@ -169,6 +170,46 @@ public class IrisComplex implements DataProvider
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
||||
seaSurfaceDecoration = trueBiomeStream
|
||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SEA_SURFACE));
|
||||
trueHeightStream = ProceduralStream.of((x, z) -> {
|
||||
int rx = (int) Math.round(engine.modifyX(x));
|
||||
int rz = (int) Math.round(engine.modifyZ(z));
|
||||
int heightf = (int) Math.round(getHeightStream().get(rx, rz));
|
||||
int m = heightf;
|
||||
|
||||
if(engine.getDimension().isCarving())
|
||||
{
|
||||
if(engine.getDimension().isCarved(rx, m, rz, ((IrisTerrainActuator)engine.getFramework().getTerrainActuator()).getRng(), heightf))
|
||||
{
|
||||
m--;
|
||||
|
||||
while(engine.getDimension().isCarved(rx, m, rz, ((IrisTerrainActuator)engine.getFramework().getTerrainActuator()).getRng(), heightf))
|
||||
{
|
||||
m--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(engine.getDimension().isCaves())
|
||||
{
|
||||
KList<CaveResult> caves = ((IrisCaveModifier)engine.getFramework().getCaveModifier()).genCaves(rx, rz, 0, 0, null);
|
||||
boolean again = true;
|
||||
|
||||
while(again)
|
||||
{
|
||||
again = false;
|
||||
for(CaveResult i : caves)
|
||||
{
|
||||
if(i.getCeiling() > m && i.getFloor() < m)
|
||||
{
|
||||
m = i.getFloor();
|
||||
again = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
}, Interpolated.INT).cache2D(cacheSize);
|
||||
//@done
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class IrisEngine extends BlockPopulator implements Engine
|
||||
|
||||
@Override
|
||||
public void generate(int x, int z, Hunk<BlockData> vblocks, Hunk<Biome> vbiomes) {
|
||||
Hunk<Biome> biomes = vbiomes.synchronize();
|
||||
Hunk<Biome> biomes = vbiomes;
|
||||
Hunk<BlockData> blocks = vblocks.synchronize().listen((xx,y,zz,t) -> catchBlockUpdates(x+xx,y+getMinHeight(),z+zz, t));
|
||||
|
||||
MultiBurst.burst.burst(
|
||||
|
@ -20,7 +20,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome>
|
||||
{
|
||||
for(zf = 0; zf < h.getDepth(); zf++)
|
||||
{
|
||||
v = getComplex().getTrueBiomeDerivativeStream().get(modX(xf+x), modZ(zf+z));
|
||||
v = getComplex().getTrueBiomeStream().get(modX(xf+x), modZ(zf+z)).getDerivative();
|
||||
|
||||
for(i = 0; i < h.getHeight(); i++)
|
||||
{
|
||||
|
@ -17,8 +17,8 @@ import java.util.function.Function;
|
||||
|
||||
public class IrisCaveModifier extends EngineAssignedModifier<BlockData>
|
||||
{
|
||||
public static final BlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
public static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||
public static final BlockData AIR = B.get("AIR");
|
||||
private static final KList<CaveResult> EMPTY = new KList<>();
|
||||
private final FastNoiseDouble gg;
|
||||
private final RNG rng;
|
||||
@ -237,7 +237,11 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData>
|
||||
|
||||
public boolean canAir(Material m, BlockData caveFluid)
|
||||
{
|
||||
return (B.isSolid(m) || (B.isDecorant(m.createBlockData())) || m.equals(Material.AIR) || m.equals(caveFluid.getMaterial()) || m.equals(B.mat("CAVE_AIR").getMaterial())) && !m.equals(Material.BEDROCK);
|
||||
return (B.isSolid(m) ||
|
||||
(B.isDecorant(m.createBlockData())) || m.equals(Material.AIR)
|
||||
|| m.equals(caveFluid.getMaterial()) ||
|
||||
m.equals(B.getMaterial("CAVE_AIR")))
|
||||
&& !m.equals(Material.BEDROCK);
|
||||
}
|
||||
|
||||
public boolean canWater(Material m)
|
||||
|
@ -14,8 +14,8 @@ import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
|
||||
public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
||||
private static final BlockData AIR = B.getBlockData("CAVE_AIR");
|
||||
private static final BlockData WATER = B.getBlockData("WATER");
|
||||
private static final BlockData AIR = B.get("CAVE_AIR");
|
||||
private static final BlockData WATER = B.get("WATER");
|
||||
private final RNG rng;
|
||||
|
||||
public IrisPostModifier(Engine engine) {
|
||||
|
@ -1,27 +1,20 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.volmit.iris.util.*;
|
||||
import lombok.Data;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
|
||||
import lombok.Data;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@Data
|
||||
public class IrisCompat
|
||||
{
|
||||
private KList<IrisCompatabilityBlockFilter> blockFilters = new KList<>();
|
||||
private KList<IrisCompatabilityItemFilter> itemFilters = new KList<>();
|
||||
private transient KMap<String, BlockData> blockResolves = new KMap<>();
|
||||
private transient KMap<String, Material> itemResolves = new KMap<>();
|
||||
private KList<IrisCompatabilityBlockFilter> blockFilters;
|
||||
private KList<IrisCompatabilityItemFilter> itemFilters;
|
||||
|
||||
public IrisCompat()
|
||||
{
|
||||
@ -31,162 +24,140 @@ public class IrisCompat
|
||||
|
||||
public BlockData getBlock(String n)
|
||||
{
|
||||
return blockResolves.compute(n, (k, v) ->
|
||||
String buf = n;
|
||||
int err = 16;
|
||||
|
||||
BlockData tx = B.getOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
{
|
||||
if(k != null && v != null)
|
||||
return tx;
|
||||
}
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(err-- <= 0)
|
||||
{
|
||||
return v;
|
||||
return B.get("STONE");
|
||||
}
|
||||
|
||||
String buf = k;
|
||||
int err = 16;
|
||||
|
||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||
{
|
||||
return tx;
|
||||
}
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(err-- <= 0)
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE");
|
||||
}
|
||||
BlockData b = i.getReplace();
|
||||
|
||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
if(b != null)
|
||||
{
|
||||
BlockData b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
buf = i.getSupplement();
|
||||
continue searching;
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
return B.parseBlockDataOrNull("STONE");
|
||||
buf = i.getSupplement();
|
||||
continue searching;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return B.get("STONE");
|
||||
}
|
||||
}
|
||||
|
||||
public Material getItem(String n)
|
||||
{
|
||||
return itemResolves.compute(n, (k, v) ->
|
||||
String buf = n;
|
||||
int err = 16;
|
||||
Material txf = B.getMaterialOrNull(buf);
|
||||
|
||||
if(txf != null)
|
||||
{
|
||||
if(k != null && v != null)
|
||||
return txf;
|
||||
}
|
||||
|
||||
int nomore = 64;
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(nomore < 0)
|
||||
{
|
||||
return v;
|
||||
return B.getMaterial("STONE");
|
||||
}
|
||||
|
||||
String buf = k;
|
||||
int err = 16;
|
||||
Material txf = B.getMaterialOrNull(buf);
|
||||
|
||||
if(txf != null)
|
||||
nomore--;
|
||||
if(err-- <= 0)
|
||||
{
|
||||
return txf;
|
||||
}
|
||||
|
||||
int nomore = 64;
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(nomore < 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
}
|
||||
|
||||
nomore--;
|
||||
if(err-- <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
for(IrisCompatabilityItemFilter i : itemFilters)
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
Material b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
buf = i.getSupplement();
|
||||
continue searching;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
buf = k;
|
||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
for(IrisCompatabilityItemFilter i : itemFilters)
|
||||
{
|
||||
return tx.getMaterial();
|
||||
}
|
||||
nomore = 64;
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(nomore < 0)
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
}
|
||||
Material b = i.getReplace();
|
||||
|
||||
nomore--;
|
||||
|
||||
if(err-- <= 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
}
|
||||
|
||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
if(b != null)
|
||||
{
|
||||
BlockData b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
return b.getMaterial();
|
||||
}
|
||||
|
||||
buf = i.getSupplement();
|
||||
continue searching;
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
||||
buf = i.getSupplement();
|
||||
continue searching;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
buf = n;
|
||||
BlockData tx = B.getOrNull(buf);
|
||||
|
||||
if(tx != null)
|
||||
{
|
||||
return tx.getMaterial();
|
||||
}
|
||||
nomore = 64;
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(nomore < 0)
|
||||
{
|
||||
return B.getMaterial("STONE");
|
||||
}
|
||||
|
||||
nomore--;
|
||||
|
||||
if(err-- <= 0)
|
||||
{
|
||||
return B.getMaterial("STONE");
|
||||
}
|
||||
|
||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||
{
|
||||
if(i.getWhen().equalsIgnoreCase(buf))
|
||||
{
|
||||
BlockData b = i.getReplace();
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
return b.getMaterial();
|
||||
}
|
||||
|
||||
buf = i.getSupplement();
|
||||
continue searching;
|
||||
}
|
||||
}
|
||||
|
||||
return B.getMaterial("STONE");
|
||||
}
|
||||
}
|
||||
|
||||
public static IrisCompat configured(File f)
|
||||
{
|
||||
IrisCompat def = new IrisCompat();
|
||||
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
|
||||
J.attemptAsync(() -> IO.writeAll(new File(f.getParentFile(), "compat.default.json"), defa));
|
||||
|
||||
if(!f.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
IO.writeAll(f, new Gson().toJson(def));
|
||||
}
|
||||
|
||||
catch(IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
J.attemptAsync(() -> IO.writeAll(f, defa));
|
||||
}
|
||||
|
||||
try
|
||||
@ -195,12 +166,12 @@ public class IrisCompat
|
||||
|
||||
for(IrisCompatabilityBlockFilter i : rea.getBlockFilters())
|
||||
{
|
||||
def.getBlockFilters().add(0, i);
|
||||
def.getBlockFilters().add(i);
|
||||
}
|
||||
|
||||
for(IrisCompatabilityItemFilter i : rea.getItemFilters())
|
||||
{
|
||||
def.getItemFilters().add(0, i);
|
||||
def.getItemFilters().add(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,14 +44,14 @@ public class IrisCompatabilityBlockFilter
|
||||
|
||||
public BlockData getFind()
|
||||
{
|
||||
return findData.aquire(() -> B.getBlockData(when));
|
||||
return findData.aquire(() -> B.get(when));
|
||||
}
|
||||
|
||||
public BlockData getReplace()
|
||||
{
|
||||
return replaceData.aquire(() ->
|
||||
{
|
||||
BlockData b = B.parseBlockDataOrNull(supplement);
|
||||
BlockData b = B.getOrNull(supplement);
|
||||
|
||||
if(b == null)
|
||||
{
|
||||
|
@ -401,16 +401,6 @@ public class IrisDimension extends IrisRegistrant
|
||||
return r;
|
||||
}
|
||||
|
||||
public BlockData resolveBlock(String bd)
|
||||
{
|
||||
return Iris.compat.getBlock(bd);
|
||||
}
|
||||
|
||||
public Material resolveItem(String bd)
|
||||
{
|
||||
return Iris.compat.getItem(bd);
|
||||
}
|
||||
|
||||
public IrisGeneratorStyle getBiomeStyle(InferredType type)
|
||||
{
|
||||
switch(type)
|
||||
|
@ -37,10 +37,10 @@ import lombok.experimental.Accessors;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
private static final BlockData AIR = B.getBlockData("CAVE_AIR");
|
||||
private static final BlockData VAIR = B.getBlockData("VOID_AIR");
|
||||
private static final BlockData VAIR_DEBUG = B.getBlockData("COBWEB");
|
||||
private static final BlockData[] SNOW_LAYERS = new BlockData[] {B.getBlockData("minecraft:snow[layers=1]"), B.getBlockData("minecraft:snow[layers=2]"), B.getBlockData("minecraft:snow[layers=3]"), B.getBlockData("minecraft:snow[layers=4]"), B.getBlockData("minecraft:snow[layers=5]"), B.getBlockData("minecraft:snow[layers=6]"), B.getBlockData("minecraft:snow[layers=7]"), B.getBlockData("minecraft:snow[layers=8]")};
|
||||
private static final BlockData AIR = B.get("CAVE_AIR");
|
||||
private static final BlockData VAIR = B.get("VOID_AIR");
|
||||
private static final BlockData VAIR_DEBUG = B.get("COBWEB");
|
||||
private static final BlockData[] SNOW_LAYERS = new BlockData[] {B.get("minecraft:snow[layers=1]"), B.get("minecraft:snow[layers=2]"), B.get("minecraft:snow[layers=3]"), B.get("minecraft:snow[layers=4]"), B.get("minecraft:snow[layers=5]"), B.get("minecraft:snow[layers=6]"), B.get("minecraft:snow[layers=7]"), B.get("minecraft:snow[layers=8]")};
|
||||
public static boolean shitty = false;
|
||||
private KMap<BlockVector, BlockData> blocks;
|
||||
private int w;
|
||||
@ -234,7 +234,7 @@ public class IrisObject extends IrisRegistrant
|
||||
|
||||
for(int i = 0; i < s; i++)
|
||||
{
|
||||
blocks.put(new BlockVector(din.readShort(), din.readShort(), din.readShort()), B.getBlockData(din.readUTF()));
|
||||
blocks.put(new BlockVector(din.readShort(), din.readShort(), din.readShort()), B.get(din.readUTF()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,7 @@ import com.volmit.iris.scaffold.cache.Cache;
|
||||
import com.volmit.iris.scaffold.data.DataProvider;
|
||||
import com.volmit.iris.scaffold.hunk.Hunk;
|
||||
import com.volmit.iris.scaffold.parallax.ParallaxAccess;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.*;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
|
@ -2,8 +2,6 @@ package com.volmit.iris.scaffold.engine;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.generator.IrisComplex;
|
||||
import com.volmit.iris.generator.actuator.IrisTerrainActuator;
|
||||
import com.volmit.iris.generator.modifier.IrisCaveModifier;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.object.*;
|
||||
import com.volmit.iris.scaffold.cache.Cache;
|
||||
@ -332,44 +330,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer
|
||||
|
||||
default int trueHeight(int x, int z)
|
||||
{
|
||||
int rx = (int) Math.round(getEngine().modifyX(x));
|
||||
int rz = (int) Math.round(getEngine().modifyZ(z));
|
||||
int height = (int) Math.round(getComplex().getHeightStream().get(rx, rz));
|
||||
int m = height;
|
||||
|
||||
if(getEngine().getDimension().isCarving())
|
||||
{
|
||||
if(getEngine().getDimension().isCarved(rx, m, rz, ((IrisTerrainActuator)getFramework().getTerrainActuator()).getRng(), height))
|
||||
{
|
||||
m--;
|
||||
|
||||
while(getEngine().getDimension().isCarved(rx, m, rz, ((IrisTerrainActuator)getFramework().getTerrainActuator()).getRng(), height))
|
||||
{
|
||||
m--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(getEngine().getDimension().isCaves())
|
||||
{
|
||||
KList<CaveResult> caves = ((IrisCaveModifier)getFramework().getCaveModifier()).genCaves(rx, rz, 0, 0, null);
|
||||
boolean again = true;
|
||||
|
||||
while(again)
|
||||
{
|
||||
again = false;
|
||||
for(CaveResult i : caves)
|
||||
{
|
||||
if(i.getCeiling() > m && i.getFloor() < m)
|
||||
{
|
||||
m = i.getFloor();
|
||||
again = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
return getComplex().getTrueHeightStream().get(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,18 +1,17 @@
|
||||
package com.volmit.iris.scaffold.hunk.io;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.volmit.iris.util.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.scaffold.hunk.Hunk;
|
||||
import com.volmit.iris.util.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HunkRegionSlice<T>
|
||||
{
|
||||
public static final Function2<Integer, CompoundTag, HunkRegionSlice<BlockData>> BLOCKDATA = (h, c) -> new HunkRegionSlice<>(h, Hunk::newAtomicHunk, new BlockDataHunkIOAdapter(), c, "blockdata");
|
||||
public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<String>> STRING = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newAtomicHunk, new StringHunkIOAdapter(), c, t);
|
||||
public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<Boolean>> BOOLEAN = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newAtomicHunk, new BooleanHunkIOAdapter(), c, t);
|
||||
public static final Function2<Integer, CompoundTag, HunkRegionSlice<BlockData>> BLOCKDATA = (h, c) -> new HunkRegionSlice<>(h, Hunk::newMappedHunk, new BlockDataHunkIOAdapter(), c, "blockdata");
|
||||
public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<String>> STRING = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newMappedHunk, new StringHunkIOAdapter(), c, t);
|
||||
public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<Boolean>> BOOLEAN = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newMappedHunk, new BooleanHunkIOAdapter(), c, t);
|
||||
private final Function3<Integer, Integer, Integer, Hunk<T>> factory;
|
||||
private final HunkIOAdapter<T> adapter;
|
||||
private final CompoundTag compound;
|
||||
|
@ -18,7 +18,7 @@ public abstract class PaletteHunkIOAdapter<T> implements HunkIOAdapter<T> {
|
||||
AtomicInteger nonNull = new AtomicInteger(0);
|
||||
DataPalette<T> palette = new DataPalette<T>();
|
||||
|
||||
t.iterate(0, (x,y,z,w) -> {
|
||||
t.iterateSync((x,y,z,w) -> {
|
||||
if(w != null)
|
||||
{
|
||||
palette.getIndex(w);
|
||||
@ -29,7 +29,7 @@ public abstract class PaletteHunkIOAdapter<T> implements HunkIOAdapter<T> {
|
||||
palette.write(this, dos);
|
||||
dos.writeInt(nonNull.get() + Integer.MIN_VALUE);
|
||||
AtomicBoolean failure = new AtomicBoolean(false);
|
||||
t.iterate(0, (x,y,z,w) -> {
|
||||
t.iterateSync((x,y,z,w) -> {
|
||||
if(w != null)
|
||||
{
|
||||
try
|
||||
|
@ -1,15 +1,18 @@
|
||||
package com.volmit.iris.scaffold.parallax;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.volmit.iris.scaffold.hunk.Hunk;
|
||||
import com.volmit.iris.scaffold.hunk.io.HunkIOAdapter;
|
||||
import com.volmit.iris.scaffold.hunk.io.HunkRegion;
|
||||
import com.volmit.iris.scaffold.hunk.io.HunkRegionSlice;
|
||||
import com.volmit.iris.util.*;
|
||||
import com.volmit.iris.util.ByteArrayTag;
|
||||
import com.volmit.iris.util.CompoundTag;
|
||||
import com.volmit.iris.util.M;
|
||||
import com.volmit.iris.util.Tag;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ParallaxRegion extends HunkRegion
|
||||
{
|
||||
private boolean dirtyMeta;
|
||||
|
@ -194,7 +194,7 @@ public class ParallaxWorld implements ParallaxAccess
|
||||
|
||||
public void cleanup()
|
||||
{
|
||||
cleanup(10000, 1000);
|
||||
cleanup(15000, 5000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user