RTP Fixes

This commit is contained in:
Daniel Mills
2020-01-15 22:34:02 -05:00
parent 59e8ba2297
commit e0a5ecc156
7 changed files with 181 additions and 17 deletions

View File

@@ -174,14 +174,24 @@ public class IrisGenerator extends ParallelChunkGenerator
return biomeCache.get(name);
}
public double getOffsetX(double x)
{
return Math.round((double) x * (Iris.settings.gen.horizontalZoom / 1.90476190476));
}
public double getOffsetZ(double z)
{
return Math.round((double) z * (Iris.settings.gen.horizontalZoom / 1.90476190476));
}
@Override
public Biome genColumn(int wxx, int wzx, int x, int z, ChunkPlan plan)
{
//@builder
int highest = 0;
int seaLevel = Iris.settings.gen.seaLevel;
double wx = Math.round((double) wxx * (Iris.settings.gen.horizontalZoom / 1.90476190476));
double wz = Math.round((double) wzx * (Iris.settings.gen.horizontalZoom / 1.90476190476));
double wx = getOffsetX(wxx);
double wz = getOffsetZ(wzx);
IrisBiome biome = getBiome(wxx, wzx);
double hv = IrisInterpolation.getNoise(wxx, wzx,
Iris.settings.gen.hermiteSampleRadius,
@@ -260,11 +270,13 @@ public class IrisGenerator extends ParallelChunkGenerator
{
if(j == snowHeight - 1)
{
highest = highest < j ? j : highest;
setBlock(x, i + j + 1, z, Material.SNOW, (byte) layers);
}
else
{
highest = highest < j + 1 ? j + 1 : highest;
setBlock(x, i + j + 1, z, Material.SNOW_BLOCK);
}
}
@@ -299,7 +311,28 @@ public class IrisGenerator extends ParallelChunkGenerator
glCaves.genCaves(wxx, wzx, x, z, height, this);
glCarving.genCarves(wxx, wzx, x, z, height, this, biome);
glCaverns.genCaverns(wxx, wzx, x, z, height, this, biome);
plan.setRealHeight(x, z, highest);
int hw = 0;
int hl = 0;
for(int i = highest; i > 0; i--)
{
Material t = getType(x, i, z);
if(i > seaLevel && hw == 0 && (t.equals(Material.WATER) || t.equals(Material.STATIONARY_WATER)))
{
hw = i;
}
else if(hl == 0 && !t.equals(Material.AIR))
{
hl = i;
}
}
plan.setRealHeight(x, z, hl);
plan.setRealWaterHeight(x, z, hw == 0 ? seaLevel : hw);
plan.setBiome(x, z, biome);
return biome.getRealBiome();
}

View File

@@ -0,0 +1,81 @@
package ninja.bytecode.iris.generator;
import ninja.bytecode.iris.pack.IrisBiome;
import ninja.bytecode.iris.util.MB;
public class IrisSample
{
public MB surface;
public int height;
public IrisBiome biome;
public MB getSurface()
{
return surface;
}
public void setSurface(MB surface)
{
this.surface = surface;
}
public int getHeight()
{
return height;
}
public void setHeight(int height)
{
this.height = height;
}
public IrisBiome getBiome()
{
return biome;
}
public void setBiome(IrisBiome biome)
{
this.biome = biome;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((biome == null) ? 0 : biome.hashCode());
result = prime * result + height;
result = prime * result + ((surface == null) ? 0 : surface.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
IrisSample other = (IrisSample) obj;
if(biome == null)
{
if(other.biome != null)
return false;
}
else if(!biome.equals(other.biome))
return false;
if(height != other.height)
return false;
if(surface == null)
{
if(other.surface != null)
return false;
}
else if(!surface.equals(other.surface))
return false;
return true;
}
}