Fix fx and spawning before terrain is setup

This commit is contained in:
Daniel Mills 2020-10-19 03:43:33 -04:00
parent 4b11bcb77b
commit d42bcb0ab9
2 changed files with 70 additions and 76 deletions

View File

@ -141,7 +141,15 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
{
spawnable = true;
super.onTick(ticks);
tickEffects();
try
{
tickEffects();
}
catch(Throwable e)
{
}
}
protected void tickEffects()
@ -494,66 +502,74 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
return;
}
if(isSpawnable())
try
{
if(!IrisSettings.get().isSystemEntitySpawnOverrides())
if(isSpawnable())
{
return;
}
if(!IrisSettings.get().isSystemEntitySpawnOverrides())
{
return;
}
int x = e.getEntity().getLocation().getBlockX();
int y = e.getEntity().getLocation().getBlockY();
int z = e.getEntity().getLocation().getBlockZ();
IrisDimension dim = getDimension();
IrisRegion region = sampleRegion(x, z);
IrisBiome above = sampleTrueBiome(x, z);
IrisBiome below = sampleTrueBiome(x, y, z);
int x = e.getEntity().getLocation().getBlockX();
int y = e.getEntity().getLocation().getBlockY();
int z = e.getEntity().getLocation().getBlockZ();
IrisDimension dim = getDimension();
IrisRegion region = sampleRegion(x, z);
IrisBiome above = sampleTrueBiome(x, z);
IrisBiome below = sampleTrueBiome(x, y, z);
if(above.getLoadKey().equals(below.getLoadKey()))
{
below = null;
}
if(above.getLoadKey().equals(below.getLoadKey()))
{
below = null;
}
IrisStructureResult res = getStructure(x, y, z);
IrisStructureResult res = getStructure(x, y, z);
if(res != null && res.getTile() != null)
{
if(trySpawn(res.getTile().getEntitySpawnOverrides(), e))
if(res != null && res.getTile() != null)
{
if(trySpawn(res.getTile().getEntitySpawnOverrides(), e))
{
return;
}
}
if(res != null && res.getStructure() != null)
{
if(trySpawn(res.getStructure().getEntitySpawnOverrides(), e))
{
return;
}
}
if(below != null)
{
if(trySpawn(below.getEntitySpawnOverrides(), e))
{
return;
}
}
if(trySpawn(above.getEntitySpawnOverrides(), e))
{
return;
}
if(trySpawn(region.getEntitySpawnOverrides(), e))
{
return;
}
if(trySpawn(dim.getEntitySpawnOverrides(), e))
{
return;
}
}
}
if(res != null && res.getStructure() != null)
{
if(trySpawn(res.getStructure().getEntitySpawnOverrides(), e))
{
return;
}
}
catch(Throwable xe)
{
if(below != null)
{
if(trySpawn(below.getEntitySpawnOverrides(), e))
{
return;
}
}
if(trySpawn(above.getEntitySpawnOverrides(), e))
{
return;
}
if(trySpawn(region.getEntitySpawnOverrides(), e))
{
return;
}
if(trySpawn(dim.getEntitySpawnOverrides(), e))
{
return;
}
}
}

View File

@ -1,32 +1,22 @@
package com.volmit.iris.gen.nms;
import java.util.Optional;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.Jigsaw;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import net.minecraft.server.v1_16_R2.BlockJigsaw;
import net.minecraft.server.v1_16_R2.ChunkGenerator;
import net.minecraft.server.v1_16_R2.DimensionManager;
import net.minecraft.server.v1_16_R2.IChunkAccess;
import net.minecraft.server.v1_16_R2.IRegistry;
import net.minecraft.server.v1_16_R2.IRegistryCustom;
import net.minecraft.server.v1_16_R2.IRegistryWritable;
import net.minecraft.server.v1_16_R2.MinecraftServer;
import net.minecraft.server.v1_16_R2.RegistryMaterials;
import net.minecraft.server.v1_16_R2.ResourceKey;
import net.minecraft.server.v1_16_R2.StructureGenerator;
import net.minecraft.server.v1_16_R2.StructureManager;
import net.minecraft.server.v1_16_R2.StructureSettings;
import net.minecraft.server.v1_16_R2.WorldDataServer;
import net.minecraft.server.v1_16_R2.WorldDimension;
import net.minecraft.server.v1_16_R2.WorldServer;
public class WorldCracker162
{
public static void makeStuffAt(World world, int x, int z)
@SuppressWarnings("unused")
public static void go(World world, int x, int z)
{
WorldServer ws = ((CraftWorld) world).getHandle();
MinecraftServer server = ws.getMinecraftServer();
@ -38,16 +28,4 @@ public class WorldCracker162
ChunkGenerator cg = wdm.c();
IChunkAccess ica = ws.getChunkAt(x, z);
}
public static void attemptGenVillage(World world, int x, int z)
{
WorldServer ws = ((CraftWorld) world).getHandle();
WorldDataServer wds = ws.worldDataServer;
StructureManager sm = ws.getStructureManager();
RegistryMaterials<WorldDimension> registrymaterials = wds.getGeneratorSettings().d();
WorldDimension wdm = (WorldDimension) registrymaterials.a(WorldDimension.OVERWORLD);
DimensionManager dm = wdm.b();
ChunkGenerator cg = wdm.c();
StructureSettings structureSettings = cg.getSettings();
}
}