Support double plants and fix scatter chances

This commit is contained in:
Daniel Mills 2020-01-26 23:17:55 -05:00
parent b61a71b3b4
commit 30ffc8cd11
2 changed files with 21 additions and 4 deletions

View File

@ -556,11 +556,16 @@ public class IrisGenerator extends ParallaxWorldGenerator
else else
{ {
MB mbx = biome.getScatterChanceSingle(scatter(wx, h, wz)); MB mbx = biome.getScatterChanceSingle(scatter(wx, h, wz), scatter(wz, h, wx));
if(!mbx.material.equals(Material.AIR)) if(!mbx.material.equals(Material.AIR))
{ {
data.setBlock(x, h + 1, z, mbx.material, mbx.data); data.setBlock(x, h + 1, z, mbx.material, mbx.data);
if(mbx.material.equals(Material.DOUBLE_PLANT))
{
data.setBlock(x, h + 2, z, mbx.material, (byte) 10);
}
} }
} }

View File

@ -599,17 +599,29 @@ public class IrisBiome
return scatterChance; return scatterChance;
} }
public MB getScatterChanceSingle(double d) public MB getScatterChanceSingle(double d, double aux)
{ {
KList<MB> a = new KList<>();
for(MB i : getScatterChance().keySet()) for(MB i : getScatterChance().keySet())
{ {
if(d < getScatterChance().get(i)) if(d < getScatterChance().get(i))
{ {
return i; a.add(i);
} }
} }
return MB.of(Material.AIR); if(a.isEmpty())
{
return MB.of(Material.AIR);
}
if(a.size() == 1)
{
return a.get(0);
}
return a.get((int) (aux * (a.size() - 1)));
} }
public static KList<IrisBiome> getBiomes() public static KList<IrisBiome> getBiomes()