Experimentals

This commit is contained in:
Daniel Mills 2020-10-27 01:16:04 -04:00
parent c4536d789b
commit 1b20d3b6ac
4 changed files with 79 additions and 71 deletions

View File

@ -50,6 +50,10 @@ public class IrisSettings
@Desc("Useful information when creating iris worlds. Shows object loads & more.") @Desc("Useful information when creating iris worlds. Shows object loads & more.")
public boolean verbose = false; public boolean verbose = false;
@DontObfuscate
@Desc("Experiments...")
public boolean allowExperimentalV2Generator = false;
@DontObfuscate @DontObfuscate
@Desc("If true, will not use world edit even if its on the server") @Desc("If true, will not use world edit even if its on the server")
public boolean ignoreWorldEdit = false; public boolean ignoreWorldEdit = false;

View File

@ -1,6 +1,7 @@
package com.volmit.iris.command; package com.volmit.iris.command;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.gen.v2.TestGen; import com.volmit.iris.gen.v2.TestGen;
import com.volmit.iris.util.Command; import com.volmit.iris.util.Command;
import com.volmit.iris.util.MortarCommand; import com.volmit.iris.util.MortarCommand;
@ -59,7 +60,7 @@ public class CommandIris extends MortarCommand
@Override @Override
public boolean handle(MortarSender sender, String[] args) public boolean handle(MortarSender sender, String[] args)
{ {
if(args.length == 1 && args[0].equalsIgnoreCase("test!")) if(args.length == 1 && args[0].equalsIgnoreCase("test!") && IrisSettings.get().allowExperimentalV2Generator)
{ {
TestGen.gen(sender.player()); TestGen.gen(sender.player());
return true; return true;

View File

@ -226,7 +226,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void on(EntitySpawnEvent e) public void on(EntitySpawnEvent e)
{ {
onSpawn(e); J.a(() -> onSpawn(e));
} }
protected abstract void onSpawn(EntitySpawnEvent e); protected abstract void onSpawn(EntitySpawnEvent e);
@ -288,15 +288,14 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
{ {
if(getTarget().isWorld(e.getFrom().getWorld()) && !getTarget().isWorld(e.getTo().getWorld())) if(getTarget().isWorld(e.getFrom().getWorld()) && !getTarget().isWorld(e.getTo().getWorld()))
{ {
tick(); J.a(() -> onPlayerLeft(e.getPlayer()));
onPlayerLeft(e.getPlayer());
} }
if(!getTarget().isWorld(e.getFrom().getWorld()) && getTarget().isWorld(e.getTo().getWorld())) if(!getTarget().isWorld(e.getFrom().getWorld()) && getTarget().isWorld(e.getTo().getWorld()))
{ {
tick(); J.a(() -> onPlayerJoin(e.getPlayer()));
onPlayerJoin(e.getPlayer());
} }
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -304,8 +303,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
{ {
if(getTarget().isWorld(e.getPlayer().getWorld())) if(getTarget().isWorld(e.getPlayer().getWorld()))
{ {
tick(); J.a(() -> onPlayerLeft(e.getPlayer()));
onPlayerLeft(e.getPlayer());
} }
} }
@ -314,8 +312,7 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
{ {
if(getTarget().isWorld(e.getPlayer().getWorld())) if(getTarget().isWorld(e.getPlayer().getWorld()))
{ {
tick(); J.a(() -> onPlayerJoin(e.getPlayer()));
onPlayerJoin(e.getPlayer());
} }
} }
@ -324,7 +321,6 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
{ {
if(getTarget().isWorld(e.getWorld())) if(getTarget().isWorld(e.getWorld()))
{ {
tick();
onChunkLoaded(e.getChunk()); onChunkLoaded(e.getChunk());
} }
} }
@ -334,7 +330,6 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
{ {
if(getTarget().isWorld(e.getWorld())) if(getTarget().isWorld(e.getWorld()))
{ {
tick();
onChunkUnloaded(e.getChunk()); onChunkUnloaded(e.getChunk());
} }
} }

View File

@ -505,8 +505,6 @@ public class IrisTerrainProvider extends PostBlockTerrainProvider implements Iri
} }
try try
{
if(isSpawnable())
{ {
if(!IrisSettings.get().isSystemEntitySpawnOverrides()) if(!IrisSettings.get().isSystemEntitySpawnOverrides())
{ {
@ -516,18 +514,26 @@ public class IrisTerrainProvider extends PostBlockTerrainProvider implements Iri
int x = e.getEntity().getLocation().getBlockX(); int x = e.getEntity().getLocation().getBlockX();
int y = e.getEntity().getLocation().getBlockY(); int y = e.getEntity().getLocation().getBlockY();
int z = e.getEntity().getLocation().getBlockZ(); int z = e.getEntity().getLocation().getBlockZ();
J.a(() ->
{
if(isSpawnable())
{
IrisDimension dim = getDimension(); IrisDimension dim = getDimension();
IrisRegion region = sampleRegion(x, z); IrisRegion region = sampleRegion(x, z);
IrisBiome above = sampleTrueBiome(x, z); IrisBiome above = sampleTrueBiome(x, z);
IrisBiome below = sampleTrueBiome(x, y, z); IrisBiome bbelow = sampleTrueBiome(x, y, z);
IrisStructureResult res = getStructure(x, y, z);
if(above.getLoadKey().equals(below.getLoadKey())) if(above.getLoadKey().equals(bbelow.getLoadKey()))
{ {
below = null; bbelow = null;
} }
IrisStructureResult res = getStructure(x, y, z); IrisBiome below = bbelow;
J.s(() ->
{
if(res != null && res.getTile() != null) if(res != null && res.getTile() != null)
{ {
if(trySpawn(res.getTile().getEntitySpawnOverrides(), e)) if(trySpawn(res.getTile().getEntitySpawnOverrides(), e))
@ -566,7 +572,9 @@ public class IrisTerrainProvider extends PostBlockTerrainProvider implements Iri
{ {
return; return;
} }
});
} }
});
} }
catch(Throwable xe) catch(Throwable xe)