mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 18:55:18 +00:00
Performance & Fixes
This commit is contained in:
parent
ec39d7146c
commit
4c44957764
@ -170,6 +170,33 @@ public class Iris extends VolmitPlugin
|
|||||||
super.onEnable();
|
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)
|
public static void sq(Runnable r)
|
||||||
{
|
{
|
||||||
synchronized(syncJobs)
|
synchronized(syncJobs)
|
||||||
@ -206,10 +233,10 @@ public class Iris extends VolmitPlugin
|
|||||||
|
|
||||||
private void bstats()
|
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()
|
public static File getTemp()
|
||||||
@ -217,33 +244,6 @@ public class Iris extends VolmitPlugin
|
|||||||
return instance.getDataFolder("cache", "temp");
|
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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||||
{
|
{
|
||||||
@ -410,6 +410,11 @@ public class Iris extends VolmitPlugin
|
|||||||
|
|
||||||
public void splash()
|
public void splash()
|
||||||
{
|
{
|
||||||
|
if(!IrisSettings.get().isSplash())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// @NoArgsConstructor
|
// @NoArgsConstructor
|
||||||
String padd = Form.repeat(" ", 8);
|
String padd = Form.repeat(" ", 8);
|
||||||
String padd2 = Form.repeat(" ", 4);
|
String padd2 = Form.repeat(" ", 4);
|
||||||
|
@ -1,18 +1,12 @@
|
|||||||
package com.volmit.iris;
|
package com.volmit.iris;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.volmit.iris.util.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
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
|
@Data
|
||||||
public class IrisSettings
|
public class IrisSettings
|
||||||
{
|
{
|
||||||
@ -114,6 +108,10 @@ public class IrisSettings
|
|||||||
@Desc("Collects anonymous metrics for bstats")
|
@Desc("Collects anonymous metrics for bstats")
|
||||||
public boolean metrics = true;
|
public boolean metrics = true;
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("Splash the screen")
|
||||||
|
public boolean splash = true;
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("Skips preparing spawn by using nms to hijack the world init phase")
|
@Desc("Skips preparing spawn by using nms to hijack the world init phase")
|
||||||
public boolean skipPrepareSpawnNMS = true;
|
public boolean skipPrepareSpawnNMS = true;
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
package com.volmit.iris.generator;
|
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.object.*;
|
||||||
import com.volmit.iris.util.*;
|
|
||||||
import com.volmit.iris.scaffold.data.DataProvider;
|
import com.volmit.iris.scaffold.data.DataProvider;
|
||||||
import com.volmit.iris.scaffold.engine.Engine;
|
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.Material;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
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
|
@Data
|
||||||
public class IrisComplex implements DataProvider
|
public class IrisComplex implements DataProvider
|
||||||
{
|
{
|
||||||
@ -37,6 +37,7 @@ public class IrisComplex implements DataProvider
|
|||||||
private ProceduralStream<Double> maxHeightStream;
|
private ProceduralStream<Double> maxHeightStream;
|
||||||
private ProceduralStream<Double> overlayStream;
|
private ProceduralStream<Double> overlayStream;
|
||||||
private ProceduralStream<Double> heightFluidStream;
|
private ProceduralStream<Double> heightFluidStream;
|
||||||
|
private ProceduralStream<Integer> trueHeightStream;
|
||||||
private ProceduralStream<Double> slopeStream;
|
private ProceduralStream<Double> slopeStream;
|
||||||
private ProceduralStream<RNG> rngStream;
|
private ProceduralStream<RNG> rngStream;
|
||||||
private ProceduralStream<RNG> chunkRngStream;
|
private ProceduralStream<RNG> chunkRngStream;
|
||||||
@ -77,8 +78,8 @@ public class IrisComplex implements DataProvider
|
|||||||
|
|
||||||
public IrisComplex(Engine engine)
|
public IrisComplex(Engine engine)
|
||||||
{
|
{
|
||||||
int cacheSize = 1024;
|
int cacheSize = 8192;
|
||||||
BlockData glass = B.getBlockData("GLASS");
|
BlockData glass = B.get("GLASS");
|
||||||
this.rng = new RNG(engine.getWorld().getSeed());
|
this.rng = new RNG(engine.getWorld().getSeed());
|
||||||
this.data = engine.getData();
|
this.data = engine.getData();
|
||||||
double height = engine.getHeight();
|
double height = engine.getHeight();
|
||||||
@ -169,6 +170,46 @@ public class IrisComplex implements DataProvider
|
|||||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
||||||
seaSurfaceDecoration = trueBiomeStream
|
seaSurfaceDecoration = trueBiomeStream
|
||||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SEA_SURFACE));
|
.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
|
//@done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class IrisEngine extends BlockPopulator implements Engine
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate(int x, int z, Hunk<BlockData> vblocks, Hunk<Biome> vbiomes) {
|
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));
|
Hunk<BlockData> blocks = vblocks.synchronize().listen((xx,y,zz,t) -> catchBlockUpdates(x+xx,y+getMinHeight(),z+zz, t));
|
||||||
|
|
||||||
MultiBurst.burst.burst(
|
MultiBurst.burst.burst(
|
||||||
|
@ -20,7 +20,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome>
|
|||||||
{
|
{
|
||||||
for(zf = 0; zf < h.getDepth(); zf++)
|
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++)
|
for(i = 0; i < h.getHeight(); i++)
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,8 @@ import java.util.function.Function;
|
|||||||
|
|
||||||
public class IrisCaveModifier extends EngineAssignedModifier<BlockData>
|
public class IrisCaveModifier extends EngineAssignedModifier<BlockData>
|
||||||
{
|
{
|
||||||
public static final BlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
|
public static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
||||||
public static final BlockData AIR = B.getBlockData("AIR");
|
public static final BlockData AIR = B.get("AIR");
|
||||||
private static final KList<CaveResult> EMPTY = new KList<>();
|
private static final KList<CaveResult> EMPTY = new KList<>();
|
||||||
private final FastNoiseDouble gg;
|
private final FastNoiseDouble gg;
|
||||||
private final RNG rng;
|
private final RNG rng;
|
||||||
@ -237,7 +237,11 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData>
|
|||||||
|
|
||||||
public boolean canAir(Material m, BlockData caveFluid)
|
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)
|
public boolean canWater(Material m)
|
||||||
|
@ -14,8 +14,8 @@ import org.bukkit.block.data.Waterlogged;
|
|||||||
import org.bukkit.block.data.type.Slab;
|
import org.bukkit.block.data.type.Slab;
|
||||||
|
|
||||||
public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
||||||
private static final BlockData AIR = B.getBlockData("CAVE_AIR");
|
private static final BlockData AIR = B.get("CAVE_AIR");
|
||||||
private static final BlockData WATER = B.getBlockData("WATER");
|
private static final BlockData WATER = B.get("WATER");
|
||||||
private final RNG rng;
|
private final RNG rng;
|
||||||
|
|
||||||
public IrisPostModifier(Engine engine) {
|
public IrisPostModifier(Engine engine) {
|
||||||
|
@ -1,27 +1,20 @@
|
|||||||
package com.volmit.iris.object;
|
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.File;
|
||||||
import java.io.IOException;
|
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
|
@Data
|
||||||
public class IrisCompat
|
public class IrisCompat
|
||||||
{
|
{
|
||||||
private KList<IrisCompatabilityBlockFilter> blockFilters = new KList<>();
|
private KList<IrisCompatabilityBlockFilter> blockFilters;
|
||||||
private KList<IrisCompatabilityItemFilter> itemFilters = new KList<>();
|
private KList<IrisCompatabilityItemFilter> itemFilters;
|
||||||
private transient KMap<String, BlockData> blockResolves = new KMap<>();
|
|
||||||
private transient KMap<String, Material> itemResolves = new KMap<>();
|
|
||||||
|
|
||||||
public IrisCompat()
|
public IrisCompat()
|
||||||
{
|
{
|
||||||
@ -31,17 +24,10 @@ public class IrisCompat
|
|||||||
|
|
||||||
public BlockData getBlock(String n)
|
public BlockData getBlock(String n)
|
||||||
{
|
{
|
||||||
return blockResolves.compute(n, (k, v) ->
|
String buf = n;
|
||||||
{
|
|
||||||
if(k != null && v != null)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
String buf = k;
|
|
||||||
int err = 16;
|
int err = 16;
|
||||||
|
|
||||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
BlockData tx = B.getOrNull(buf);
|
||||||
|
|
||||||
if(tx != null)
|
if(tx != null)
|
||||||
{
|
{
|
||||||
@ -52,7 +38,7 @@ public class IrisCompat
|
|||||||
{
|
{
|
||||||
if(err-- <= 0)
|
if(err-- <= 0)
|
||||||
{
|
{
|
||||||
return B.parseBlockDataOrNull("STONE");
|
return B.get("STONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||||
@ -71,21 +57,13 @@ public class IrisCompat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return B.parseBlockDataOrNull("STONE");
|
return B.get("STONE");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getItem(String n)
|
public Material getItem(String n)
|
||||||
{
|
{
|
||||||
return itemResolves.compute(n, (k, v) ->
|
String buf = n;
|
||||||
{
|
|
||||||
if(k != null && v != null)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
String buf = k;
|
|
||||||
int err = 16;
|
int err = 16;
|
||||||
Material txf = B.getMaterialOrNull(buf);
|
Material txf = B.getMaterialOrNull(buf);
|
||||||
|
|
||||||
@ -100,7 +78,7 @@ public class IrisCompat
|
|||||||
{
|
{
|
||||||
if(nomore < 0)
|
if(nomore < 0)
|
||||||
{
|
{
|
||||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
return B.getMaterial("STONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
nomore--;
|
nomore--;
|
||||||
@ -128,8 +106,8 @@ public class IrisCompat
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = k;
|
buf = n;
|
||||||
BlockData tx = B.parseBlockDataOrNull(buf);
|
BlockData tx = B.getOrNull(buf);
|
||||||
|
|
||||||
if(tx != null)
|
if(tx != null)
|
||||||
{
|
{
|
||||||
@ -141,14 +119,14 @@ public class IrisCompat
|
|||||||
{
|
{
|
||||||
if(nomore < 0)
|
if(nomore < 0)
|
||||||
{
|
{
|
||||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
return B.getMaterial("STONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
nomore--;
|
nomore--;
|
||||||
|
|
||||||
if(err-- <= 0)
|
if(err-- <= 0)
|
||||||
{
|
{
|
||||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
return B.getMaterial("STONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(IrisCompatabilityBlockFilter i : blockFilters)
|
for(IrisCompatabilityBlockFilter i : blockFilters)
|
||||||
@ -167,26 +145,19 @@ public class IrisCompat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return B.parseBlockDataOrNull("STONE").getMaterial();
|
return B.getMaterial("STONE");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisCompat configured(File f)
|
public static IrisCompat configured(File f)
|
||||||
{
|
{
|
||||||
IrisCompat def = new IrisCompat();
|
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())
|
if(!f.exists())
|
||||||
{
|
{
|
||||||
try
|
J.attemptAsync(() -> IO.writeAll(f, defa));
|
||||||
{
|
|
||||||
IO.writeAll(f, new Gson().toJson(def));
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -195,12 +166,12 @@ public class IrisCompat
|
|||||||
|
|
||||||
for(IrisCompatabilityBlockFilter i : rea.getBlockFilters())
|
for(IrisCompatabilityBlockFilter i : rea.getBlockFilters())
|
||||||
{
|
{
|
||||||
def.getBlockFilters().add(0, i);
|
def.getBlockFilters().add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(IrisCompatabilityItemFilter i : rea.getItemFilters())
|
for(IrisCompatabilityItemFilter i : rea.getItemFilters())
|
||||||
{
|
{
|
||||||
def.getItemFilters().add(0, i);
|
def.getItemFilters().add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ public class IrisCompatabilityBlockFilter
|
|||||||
|
|
||||||
public BlockData getFind()
|
public BlockData getFind()
|
||||||
{
|
{
|
||||||
return findData.aquire(() -> B.getBlockData(when));
|
return findData.aquire(() -> B.get(when));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockData getReplace()
|
public BlockData getReplace()
|
||||||
{
|
{
|
||||||
return replaceData.aquire(() ->
|
return replaceData.aquire(() ->
|
||||||
{
|
{
|
||||||
BlockData b = B.parseBlockDataOrNull(supplement);
|
BlockData b = B.getOrNull(supplement);
|
||||||
|
|
||||||
if(b == null)
|
if(b == null)
|
||||||
{
|
{
|
||||||
|
@ -401,16 +401,6 @@ public class IrisDimension extends IrisRegistrant
|
|||||||
return r;
|
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)
|
public IrisGeneratorStyle getBiomeStyle(InferredType type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
|
@ -37,10 +37,10 @@ import lombok.experimental.Accessors;
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisObject extends IrisRegistrant
|
public class IrisObject extends IrisRegistrant
|
||||||
{
|
{
|
||||||
private static final BlockData AIR = B.getBlockData("CAVE_AIR");
|
private static final BlockData AIR = B.get("CAVE_AIR");
|
||||||
private static final BlockData VAIR = B.getBlockData("VOID_AIR");
|
private static final BlockData VAIR = B.get("VOID_AIR");
|
||||||
private static final BlockData VAIR_DEBUG = B.getBlockData("COBWEB");
|
private static final BlockData VAIR_DEBUG = B.get("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[] 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;
|
public static boolean shitty = false;
|
||||||
private KMap<BlockVector, BlockData> blocks;
|
private KMap<BlockVector, BlockData> blocks;
|
||||||
private int w;
|
private int w;
|
||||||
@ -234,7 +234,7 @@ public class IrisObject extends IrisRegistrant
|
|||||||
|
|
||||||
for(int i = 0; i < s; i++)
|
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.data.DataProvider;
|
||||||
import com.volmit.iris.scaffold.hunk.Hunk;
|
import com.volmit.iris.scaffold.hunk.Hunk;
|
||||||
import com.volmit.iris.scaffold.parallax.ParallaxAccess;
|
import com.volmit.iris.scaffold.parallax.ParallaxAccess;
|
||||||
import com.volmit.iris.util.B;
|
import com.volmit.iris.util.*;
|
||||||
import com.volmit.iris.util.KList;
|
|
||||||
import com.volmit.iris.util.RNG;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
@ -2,8 +2,6 @@ package com.volmit.iris.scaffold.engine;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.generator.IrisComplex;
|
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.manager.IrisDataManager;
|
||||||
import com.volmit.iris.object.*;
|
import com.volmit.iris.object.*;
|
||||||
import com.volmit.iris.scaffold.cache.Cache;
|
import com.volmit.iris.scaffold.cache.Cache;
|
||||||
@ -332,44 +330,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer
|
|||||||
|
|
||||||
default int trueHeight(int x, int z)
|
default int trueHeight(int x, int z)
|
||||||
{
|
{
|
||||||
int rx = (int) Math.round(getEngine().modifyX(x));
|
return getComplex().getTrueHeightStream().get(x, z);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package com.volmit.iris.scaffold.hunk.io;
|
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.Iris;
|
||||||
import com.volmit.iris.scaffold.hunk.Hunk;
|
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 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 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::newAtomicHunk, new StringHunkIOAdapter(), c, t);
|
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::newAtomicHunk, new BooleanHunkIOAdapter(), 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 Function3<Integer, Integer, Integer, Hunk<T>> factory;
|
||||||
private final HunkIOAdapter<T> adapter;
|
private final HunkIOAdapter<T> adapter;
|
||||||
private final CompoundTag compound;
|
private final CompoundTag compound;
|
||||||
|
@ -18,7 +18,7 @@ public abstract class PaletteHunkIOAdapter<T> implements HunkIOAdapter<T> {
|
|||||||
AtomicInteger nonNull = new AtomicInteger(0);
|
AtomicInteger nonNull = new AtomicInteger(0);
|
||||||
DataPalette<T> palette = new DataPalette<T>();
|
DataPalette<T> palette = new DataPalette<T>();
|
||||||
|
|
||||||
t.iterate(0, (x,y,z,w) -> {
|
t.iterateSync((x,y,z,w) -> {
|
||||||
if(w != null)
|
if(w != null)
|
||||||
{
|
{
|
||||||
palette.getIndex(w);
|
palette.getIndex(w);
|
||||||
@ -29,7 +29,7 @@ public abstract class PaletteHunkIOAdapter<T> implements HunkIOAdapter<T> {
|
|||||||
palette.write(this, dos);
|
palette.write(this, dos);
|
||||||
dos.writeInt(nonNull.get() + Integer.MIN_VALUE);
|
dos.writeInt(nonNull.get() + Integer.MIN_VALUE);
|
||||||
AtomicBoolean failure = new AtomicBoolean(false);
|
AtomicBoolean failure = new AtomicBoolean(false);
|
||||||
t.iterate(0, (x,y,z,w) -> {
|
t.iterateSync((x,y,z,w) -> {
|
||||||
if(w != null)
|
if(w != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
package com.volmit.iris.scaffold.parallax;
|
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.Hunk;
|
||||||
import com.volmit.iris.scaffold.hunk.io.HunkIOAdapter;
|
import com.volmit.iris.scaffold.hunk.io.HunkIOAdapter;
|
||||||
import com.volmit.iris.scaffold.hunk.io.HunkRegion;
|
import com.volmit.iris.scaffold.hunk.io.HunkRegion;
|
||||||
import com.volmit.iris.scaffold.hunk.io.HunkRegionSlice;
|
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 org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ParallaxRegion extends HunkRegion
|
public class ParallaxRegion extends HunkRegion
|
||||||
{
|
{
|
||||||
private boolean dirtyMeta;
|
private boolean dirtyMeta;
|
||||||
|
@ -194,7 +194,7 @@ public class ParallaxWorld implements ParallaxAccess
|
|||||||
|
|
||||||
public void cleanup()
|
public void cleanup()
|
||||||
{
|
{
|
||||||
cleanup(10000, 1000);
|
cleanup(15000, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user