mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 20:19:06 +00:00
WORKING
This commit is contained in:
@@ -11,6 +11,7 @@ import com.volmit.iris.gen.atomics.AtomicSliver;
|
||||
import com.volmit.iris.gen.atomics.AtomicSliverMap;
|
||||
import com.volmit.iris.gen.atomics.AtomicWorldData;
|
||||
import com.volmit.iris.gen.atomics.MasterLock;
|
||||
import com.volmit.iris.gen.layer.GenLayerText;
|
||||
import com.volmit.iris.gen.layer.GenLayerUpdate;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeMutation;
|
||||
@@ -44,6 +45,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
private IrisLock lock = new IrisLock("ParallaxLock");
|
||||
private IrisLock lockq = new IrisLock("ParallaxQueueLock");
|
||||
private GenLayerUpdate glUpdate;
|
||||
private GenLayerText glText;
|
||||
private int sliverBuffer;
|
||||
|
||||
public ParallaxChunkGenerator(String dimensionName, int threads)
|
||||
@@ -58,6 +60,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
{
|
||||
super.onInit(world, rng);
|
||||
parallaxMap = new AtomicWorldData(world, "floor");
|
||||
glText = new GenLayerText(this, rng.nextParallelRNG(32485));
|
||||
}
|
||||
|
||||
protected KMap<ChunkPosition, AtomicSliver> getSliverCache()
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BiomeDataProvider
|
||||
|
||||
public BiomeResult generatePureData(ContextualChunkGenerator g, double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
return layer.generateBiomeData(bx, bz, regionData, getGenerator(), regionData.getBiomes(g, getType()), getType());
|
||||
return layer.generateBiomeData(bx, bz, regionData, getGenerator(), regionData.getBiomes(g, getType()), getType(), rawX, rawZ);
|
||||
}
|
||||
|
||||
public BiomeResult generateData(ContextualChunkGenerator g, double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
|
||||
@@ -121,8 +121,24 @@ public class GenLayerBiome extends GenLayer
|
||||
return bridge;
|
||||
}
|
||||
|
||||
public BiomeResult generateBiomeData(double bx, double bz, IrisRegion regionData, CNG cell, KList<IrisBiome> biomes, InferredType inferredType)
|
||||
public BiomeResult generateBiomeData(double bx, double bz, IrisRegion regionData, CNG cell, KList<IrisBiome> biomes, InferredType inferredType, int rx, int rz)
|
||||
{
|
||||
for(IrisRegionRidge i : regionData.getRidgeBiomes())
|
||||
{
|
||||
if(i.getType().equals(inferredType) && i.isRidge(rng, rx, rz))
|
||||
{
|
||||
return new BiomeResult(iris.loadBiome(i.getBiome()).infer(i.getAs(), inferredType), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
for(IrisRegionSpot i : regionData.getSpotBiomes())
|
||||
{
|
||||
if(i.getType().equals(inferredType) && i.isSpot(rng, rx, rz))
|
||||
{
|
||||
return new BiomeResult(iris.loadBiome(i.getBiome()).infer(i.getAs(), inferredType), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
if(biomes.isEmpty())
|
||||
{
|
||||
return new BiomeResult(null, 0);
|
||||
@@ -138,22 +154,6 @@ public class GenLayerBiome extends GenLayer
|
||||
|
||||
public BiomeResult generateImpureData(int rawX, int rawZ, InferredType type, IrisRegion regionData, BiomeResult pureResult)
|
||||
{
|
||||
for(IrisRegionRidge i : regionData.getRidgeBiomes())
|
||||
{
|
||||
if(i.getType().equals(type) && i.isRidge(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(iris.loadBiome(i.getBiome()).infer(i.getAs(), type), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
for(IrisRegionSpot i : regionData.getSpotBiomes())
|
||||
{
|
||||
if(i.getType().equals(type) && i.isSpot(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(iris.loadBiome(i.getBiome()).infer(i.getAs(), type), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
return pureResult;
|
||||
}
|
||||
|
||||
|
||||
68
src/main/java/com/volmit/iris/gen/layer/GenLayerText.java
Normal file
68
src/main/java/com/volmit/iris/gen/layer/GenLayerText.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.volmit.iris.gen.layer;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.DimensionChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.GenLayer;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
public class GenLayerText extends GenLayer
|
||||
{
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
|
||||
private AtomicCache<IrisObject> debug = new AtomicCache<>();
|
||||
|
||||
public GenLayerText(DimensionChunkGenerator iris, RNG rng)
|
||||
{
|
||||
super(iris, rng);
|
||||
}
|
||||
|
||||
public IrisObject getDebug()
|
||||
{
|
||||
return debug.aquire(() ->
|
||||
{
|
||||
return createTextObject("Test", "Impact", 24, B.get("STONE"));
|
||||
});
|
||||
}
|
||||
|
||||
public IrisObject createTextObject(String text, String font, int size, BlockData b)
|
||||
{
|
||||
Font f = new Font(font, Font.PLAIN, size);
|
||||
int w = ((Graphics2D) new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB).getGraphics()).getFontMetrics(f).stringWidth(text);
|
||||
int h = size;
|
||||
Iris.info("WH is " + w + " " + h);
|
||||
BufferedImage bufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics gs = bufferedImage.getGraphics();
|
||||
Graphics2D g = (Graphics2D) gs;
|
||||
g.setFont(f);
|
||||
g.drawString(text, 0, h);
|
||||
IrisObject o = new IrisObject(w, 1, h);
|
||||
for(int y = 0; y < h; y++)
|
||||
{
|
||||
for(int x = 0; x < w; x++)
|
||||
{
|
||||
if(bufferedImage.getRGB(x, y) != -16777216)
|
||||
{
|
||||
o.setUnsigned(x, 0, y, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generate(double x, double z)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user