This commit is contained in:
Daniel Mills
2020-01-11 03:54:51 -05:00
parent 1c3ad6a925
commit acaf95c017
28 changed files with 624 additions and 70 deletions

View File

@@ -221,7 +221,7 @@ public class IrisGenerator extends ParallelChunkGenerator
@Override
public void onPostChunk(World world, int x, int z, Random random, AtomicChunkData data, ChunkPlan plan)
{
}
@Override

View File

@@ -11,11 +11,12 @@ import java.util.zip.GZIPInputStream;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector;
import ninja.bytecode.iris.Iris;
import ninja.bytecode.iris.util.Direction;
import ninja.bytecode.iris.util.IPlacer;
import ninja.bytecode.iris.util.MB;
import ninja.bytecode.iris.util.VectorMath;
import ninja.bytecode.shuriken.collections.GList;
@@ -202,11 +203,20 @@ public class GenObject
int m = (g / 2);
return g % 2 == 0 ? m : m + 1;
}
@SuppressWarnings("deprecation")
public void place(World source, int wx, int wy, int wz)
public void place(Location l)
{
Location start = new Location(source, wx, wy, wz).clone().add(sh(w), sh(h) + 1, sh(d));
place(l, Iris.settings.performance.placerType.get(l.getWorld()));
}
public void place(Location l, IPlacer placer)
{
place(l.getBlockX(), l.getBlockY(), l.getBlockZ(), placer);
}
public void place(int wx, int wy, int wz, IPlacer placer)
{
Location start = new Location(placer.getWorld(), wx, wy, wz).clone().add(sh(w), sh(h) + 1, sh(d));
if(mount == null)
{
@@ -215,7 +225,7 @@ public class GenObject
start.subtract(mount);
int highestY = source.getHighestBlockYAt(start);
int highestY = placer.getHighestY(start);
if(start.getBlockY() + mountHeight > highestY)
{
@@ -236,11 +246,12 @@ public class GenObject
Location f = start.clone().add(i);
if(i.getBlockY() == mountHeight && f.clone().subtract(0, 1, 0).getBlock().isLiquid())
Material m = placer.get(f.clone().subtract(0, 1, 0)).material;
if(i.getBlockY() == mountHeight && (m.equals(Material.WATER) || m.equals(Material.STATIONARY_WATER) || m.equals(Material.LAVA) || m.equals(Material.STATIONARY_LAVA)))
{
for(Location j : undo.k())
{
source.getBlockAt(j.getBlockX(), j.getBlockY(), j.getBlockZ()).setTypeIdAndData(undo.get(j).material.getId(), undo.get(j).data, false);
placer.set(j, undo.get(j));
}
return;
@@ -253,8 +264,8 @@ public class GenObject
try
{
undo.put(f, MB.of(f.getBlock().getType(), f.getBlock().getData()));
source.getBlockAt(f.getBlockX(), f.getBlockY(), f.getBlockZ()).setTypeIdAndData(b.material.getId(), b.data, false);
undo.put(f, placer.get(f));
placer.set(f, b);
}
catch(Throwable e)

View File

@@ -16,6 +16,7 @@ import ninja.bytecode.iris.controller.PackController;
import ninja.bytecode.iris.controller.TimingsController;
import ninja.bytecode.iris.generator.IrisGenerator;
import ninja.bytecode.iris.pack.IrisBiome;
import ninja.bytecode.iris.util.IPlacer;
import ninja.bytecode.shuriken.collections.GMap;
import ninja.bytecode.shuriken.collections.GSet;
import ninja.bytecode.shuriken.logging.L;
@@ -25,6 +26,7 @@ public class GenObjectDecorator extends BlockPopulator
{
private GMap<Biome, IrisBiome> biomeMap;
private GMap<Biome, GMap<GenObjectGroup, Double>> populationCache;
private IPlacer placer;
public GenObjectDecorator(IrisGenerator generator)
{
@@ -109,7 +111,12 @@ public class GenObjectDecorator extends BlockPopulator
return;
}
i.getSchematics().get(random.nextInt(i.getSchematics().size())).place(world, x, b.getY(), z);
if(placer == null)
{
placer = Iris.settings.performance.placerType.get(world);
}
i.getSchematics().get(random.nextInt(i.getSchematics().size())).place(x, b.getY(), z, placer);
}
}
}