mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
RTP Fixes
This commit is contained in:
parent
59e8ba2297
commit
e0a5ecc156
@ -75,6 +75,7 @@ public class CommandIris implements CommandExecutor
|
||||
{
|
||||
msg(sender, "Looking for " + b.getName() + "...");
|
||||
boolean f = false;
|
||||
int t = 0;
|
||||
for(int i = 0; i < 10000; i++)
|
||||
{
|
||||
int x = (int) ((int) (29999983 / 1.2) * Math.random());
|
||||
@ -83,8 +84,23 @@ public class CommandIris implements CommandExecutor
|
||||
if(g.getBiome(x, z).equals(b))
|
||||
{
|
||||
f = true;
|
||||
p.teleport(w.getHighestBlockAt(x, z).getLocation());
|
||||
break;
|
||||
|
||||
if(w.getHighestBlockYAt(x, z) > 66)
|
||||
{
|
||||
p.teleport(w.getHighestBlockAt(x, z).getLocation());
|
||||
break;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
t++;
|
||||
|
||||
if(t > 30)
|
||||
{
|
||||
msg(sender, "Checked 30 " + b.getName() + " bearing chunks. All of them were underwater. Try Again!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class Settings
|
||||
public double caveDensity = 4;
|
||||
public double caveScale = 1.45;
|
||||
public double biomeScale = 2;
|
||||
public boolean flatBedrock = false;
|
||||
public boolean flatBedrock = true;
|
||||
public boolean genObjects = true;
|
||||
public boolean genCarving = true;
|
||||
public boolean genCaverns = true;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
81
src/main/java/ninja/bytecode/iris/generator/IrisSample.java
Normal file
81
src/main/java/ninja/bytecode/iris/generator/IrisSample.java
Normal 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;
|
||||
}
|
||||
}
|
@ -141,13 +141,24 @@ public class IrisBiome
|
||||
J.attempt(() -> scatterSurface = o.getString("surfaceType").equalsIgnoreCase("scatter"));
|
||||
J.attempt(() ->
|
||||
{
|
||||
schematicGroups = strFromJSON(o.getJSONArray("objects"));
|
||||
if(Iris.settings.gen.genObjects)
|
||||
{
|
||||
schematicGroups = strFromJSON(o.getJSONArray("objects"));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
schematicGroups = new GMap<>();
|
||||
}
|
||||
|
||||
if(chain)
|
||||
{
|
||||
for(String i : schematicGroups.k())
|
||||
if(Iris.settings.gen.genObjects)
|
||||
{
|
||||
Iris.getController(PackController.class).loadSchematicGroup(i);
|
||||
for(String i : schematicGroups.k())
|
||||
{
|
||||
Iris.getController(PackController.class).loadSchematicGroup(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -6,12 +6,14 @@ import ninja.bytecode.shuriken.collections.GMap;
|
||||
public class ChunkPlan
|
||||
{
|
||||
private final GMap<ChunkedVector, Integer> realHeightCache;
|
||||
private final GMap<ChunkedVector, Integer> realWaterHeightCache;
|
||||
private final GMap<ChunkedVector, Double> heightCache;
|
||||
private final GMap<ChunkedVector, IrisBiome> biomeCache;
|
||||
|
||||
public ChunkPlan()
|
||||
{
|
||||
this.realHeightCache = new GMap<>();
|
||||
this.realWaterHeightCache = new GMap<>();
|
||||
this.heightCache = new GMap<>();
|
||||
this.biomeCache = new GMap<>();
|
||||
}
|
||||
@ -48,6 +50,18 @@ public class ChunkPlan
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getRealWaterHeight(int x, int z)
|
||||
{
|
||||
ChunkedVector c = new ChunkedVector(x, z);
|
||||
|
||||
if(realWaterHeightCache.containsKey(c))
|
||||
{
|
||||
return realWaterHeightCache.get(c);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean hasHeight(ChunkedVector c)
|
||||
{
|
||||
return heightCache.containsKey(c);
|
||||
@ -68,13 +82,23 @@ public class ChunkPlan
|
||||
realHeightCache.put(c, h);
|
||||
}
|
||||
|
||||
public void setHeight(int x, int z, double h)
|
||||
{
|
||||
setHeight(new ChunkedVector(x, z), h);
|
||||
}
|
||||
|
||||
public void setRealHeight(int x, int z, int h)
|
||||
{
|
||||
setRealHeight(new ChunkedVector(x, z), h);
|
||||
}
|
||||
|
||||
public void setRealWaterHeight(ChunkedVector c, int h)
|
||||
{
|
||||
realWaterHeightCache.put(c, h);
|
||||
}
|
||||
|
||||
public void setRealWaterHeight(int x, int z, int h)
|
||||
{
|
||||
setRealWaterHeight(new ChunkedVector(x, z), h);
|
||||
}
|
||||
|
||||
public void setHeight(int x, int z, double h)
|
||||
{
|
||||
setHeight(new ChunkedVector(x, z), h);
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return data.toChunkData();
|
||||
}
|
||||
|
||||
@ -113,10 +113,9 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
||||
|
||||
public abstract void decorateColumn(int wx, int wz, int x, int z, ChunkPlan plan);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setBlock(int x, int y, int z, Material b)
|
||||
{
|
||||
setBlock(x, y, z, b.getId(), (byte) 0);
|
||||
setBlock(x, y, z, b, (byte) 0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
Loading…
x
Reference in New Issue
Block a user