Merge pull request #192 from fabricator77/master
Fixes biome decoration for Promised Land
This commit is contained in:
commit
252e5ee5a4
8 changed files with 40 additions and 12 deletions
|
@ -115,7 +115,7 @@ public class BiomeGenPromisedLandForest extends BOPBiome //implements IWCFog
|
||||||
@Override
|
@Override
|
||||||
public void decorate(World par1World, Random par2Random, int par3, int par4)
|
public void decorate(World par1World, Random par2Random, int par3, int par4)
|
||||||
{
|
{
|
||||||
//super.decorate(par1World, par2Random, par3, par4);
|
super.decorate(par1World, par2Random, par3, par4);
|
||||||
int var5 = 100;
|
int var5 = 100;
|
||||||
int var6;
|
int var6;
|
||||||
int var7;
|
int var7;
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class BiomeGenPromisedLandPlains extends BOPBiome //implements IWCFog
|
||||||
@Override
|
@Override
|
||||||
public void decorate(World par1World, Random par2Random, int par3, int par4)
|
public void decorate(World par1World, Random par2Random, int par3, int par4)
|
||||||
{
|
{
|
||||||
//super.decorate(par1World, par2Random, par3, par4);
|
super.decorate(par1World, par2Random, par3, par4);
|
||||||
int var5 = 100;
|
int var5 = 100;
|
||||||
int var6;
|
int var6;
|
||||||
int var7;
|
int var7;
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class BiomeGenPromisedLandSwamp extends BOPBiome //implements IWCFog
|
||||||
@Override
|
@Override
|
||||||
public void decorate(World par1World, Random par2Random, int par3, int par4)
|
public void decorate(World par1World, Random par2Random, int par3, int par4)
|
||||||
{
|
{
|
||||||
//super.decorate(par1World, par2Random, par3, par4);
|
super.decorate(par1World, par2Random, par3, par4);
|
||||||
int var5 = 100;
|
int var5 = 100;
|
||||||
int var6;
|
int var6;
|
||||||
int var7;
|
int var7;
|
||||||
|
|
24
src/main/java/biomesoplenty/common/utils/RandomFiltered.java
Normal file
24
src/main/java/biomesoplenty/common/utils/RandomFiltered.java
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package biomesoplenty.common.utils;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
/**
|
||||||
|
* @prevent crashes in non overworld biome generation
|
||||||
|
* due to calls to decorator getting -1 height values
|
||||||
|
* Random.nextInt(-1) = crash
|
||||||
|
*/
|
||||||
|
public class RandomFiltered extends Random{
|
||||||
|
public RandomFiltered(long par2) {
|
||||||
|
super(par2);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int nextInt() {
|
||||||
|
return this.nextInt(1);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int nextInt (int n) {
|
||||||
|
if (n > 0) {
|
||||||
|
return super.nextInt(n);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,11 +18,13 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
||||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||||
import biomesoplenty.api.BOPBlockHelper;
|
import biomesoplenty.api.BOPBlockHelper;
|
||||||
|
import biomesoplenty.common.utils.RandomFiltered;
|
||||||
import biomesoplenty.common.world.noise.NoiseOctaves;
|
import biomesoplenty.common.world.noise.NoiseOctaves;
|
||||||
|
|
||||||
public class ChunkProviderPromised implements IChunkProvider
|
public class ChunkProviderPromised implements IChunkProvider
|
||||||
{
|
{
|
||||||
private Random endRNG;
|
private Random endRNG;
|
||||||
|
private RandomFiltered endRNG2;
|
||||||
private NoiseOctaves field_912_k;
|
private NoiseOctaves field_912_k;
|
||||||
private NoiseOctaves field_911_l;
|
private NoiseOctaves field_911_l;
|
||||||
private NoiseOctaves field_910_m;
|
private NoiseOctaves field_910_m;
|
||||||
|
@ -46,6 +48,8 @@ public class ChunkProviderPromised implements IChunkProvider
|
||||||
{
|
{
|
||||||
endWorld = par1World;
|
endWorld = par1World;
|
||||||
endRNG = new Random(par2);
|
endRNG = new Random(par2);
|
||||||
|
// prevent Random.nextInt(-1) crashes
|
||||||
|
this.endRNG2 = new RandomFiltered(par2);
|
||||||
field_912_k = new NoiseOctaves(endRNG, 16);
|
field_912_k = new NoiseOctaves(endRNG, 16);
|
||||||
field_911_l = new NoiseOctaves(endRNG, 16);
|
field_911_l = new NoiseOctaves(endRNG, 16);
|
||||||
field_910_m = new NoiseOctaves(endRNG, 8);
|
field_910_m = new NoiseOctaves(endRNG, 8);
|
||||||
|
@ -497,7 +501,7 @@ public class ChunkProviderPromised implements IChunkProvider
|
||||||
{
|
{
|
||||||
BlockSand.fallInstantly = true;
|
BlockSand.fallInstantly = true;
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false));
|
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, endWorld, endRNG2, par2, par3, false));
|
||||||
|
|
||||||
int var4 = par2 * 16;
|
int var4 = par2 * 16;
|
||||||
int var5 = par3 * 16;
|
int var5 = par3 * 16;
|
||||||
|
@ -516,9 +520,9 @@ public class ChunkProviderPromised implements IChunkProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var6.decorate(endWorld, endWorld.rand, var4, var5);
|
var6.decorate(endWorld, endRNG2, var4, var5);
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false));
|
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, endWorld, endRNG2, par2, par3, false));
|
||||||
|
|
||||||
BlockSand.fallInstantly = false;
|
BlockSand.fallInstantly = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class WorldGenPromisedTree extends WorldGenAbstractTree
|
||||||
//var11 = world.getBlockId(par3, par4 - 1, par5);
|
//var11 = world.getBlockId(par3, par4 - 1, par5);
|
||||||
block = world.getBlock(par3, par4 - 1, par5);
|
block = world.getBlock(par3, par4 - 1, par5);
|
||||||
|
|
||||||
if ((block == BOPBlockHelper.get("holyGrass") || block == BOPBlockHelper.get("holyDirt")) && par4 < 256 - var6 - 1)
|
if ((block == BOPBlockHelper.get("grass") || block == BOPBlockHelper.get("holyDirt")) && par4 < 256 - var6 - 1)
|
||||||
{
|
{
|
||||||
//this.setBlockAndMetadata(world, par3, par4 - 1, par5, Blocks.holyDirt.get().blockID, 0);
|
//this.setBlockAndMetadata(world, par3, par4 - 1, par5, Blocks.holyDirt.get().blockID, 0);
|
||||||
this.setBlockAndNotifyAdequately(world, par3, par4 - 1, par5, BOPBlockHelper.get("holyDirt"), 0);
|
this.setBlockAndNotifyAdequately(world, par3, par4 - 1, par5, BOPBlockHelper.get("holyDirt"), 0);
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class WorldGenPromisedTree2 extends WorldGenAbstractTree
|
||||||
{
|
{
|
||||||
block = world.getBlock(par3, par4 - 1, par5);
|
block = world.getBlock(par3, par4 - 1, par5);
|
||||||
|
|
||||||
if ((block == BOPBlockHelper.get("holyGrass") || block == BOPBlockHelper.get("holyDirt")) && par4 < 256 - var6 - 1)
|
if ((block == BOPBlockHelper.get("grass") || block == BOPBlockHelper.get("holyDirt")) && par4 < 256 - var6 - 1)
|
||||||
{
|
{
|
||||||
//this.setBlockAndMetadata(world, par3, par4 - 1, par5, Blocks.holyDirt.get().blockID, 0);
|
//this.setBlockAndMetadata(world, par3, par4 - 1, par5, Blocks.holyDirt.get().blockID, 0);
|
||||||
this.setBlockAndNotifyAdequately(world, par3, par4 - 1, par5, BOPBlockHelper.get("holyDirt"), 0);
|
this.setBlockAndNotifyAdequately(world, par3, par4 - 1, par5, BOPBlockHelper.get("holyDirt"), 0);
|
||||||
|
|
|
@ -76,13 +76,13 @@ public class WorldGenPromisedTree3 extends WorldGenAbstractTree
|
||||||
Block block13 = world.getBlock(var3, var4 - 1, var5 - 1);
|
Block block13 = world.getBlock(var3, var4 - 1, var5 - 1);
|
||||||
Block block14 = world.getBlock(var3 - 1, var4 - 1, var5 - 1);
|
Block block14 = world.getBlock(var3 - 1, var4 - 1, var5 - 1);
|
||||||
|
|
||||||
if ((block11 == BOPBlockHelper.get("holyGrass") || block11 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
if ((block11 == BOPBlockHelper.get("grass") || block11 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
||||||
{
|
{
|
||||||
if ((block24 == BOPBlockHelper.get("holyGrass") || block24 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
if ((block24 == BOPBlockHelper.get("grass") || block24 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
||||||
{
|
{
|
||||||
if ((block13 == BOPBlockHelper.get("holyGrass") || block13 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
if ((block13 == BOPBlockHelper.get("grass") || block13 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
||||||
{
|
{
|
||||||
if ((block14 == BOPBlockHelper.get("holyGrass") | block14 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
if ((block14 == BOPBlockHelper.get("grass") | block14 == BOPBlockHelper.get("holyDirt")) && var4 < 256 - var6 - 1)
|
||||||
{
|
{
|
||||||
world.setBlock(var3, var4 - 1, var5, BOPBlockHelper.get("holyDirt"), 0, 2);
|
world.setBlock(var3, var4 - 1, var5, BOPBlockHelper.get("holyDirt"), 0, 2);
|
||||||
world.setBlock(var3 - 1, var4 - 1, var5, BOPBlockHelper.get("holyDirt"), 0, 2);
|
world.setBlock(var3 - 1, var4 - 1, var5, BOPBlockHelper.get("holyDirt"), 0, 2);
|
||||||
|
|
Loading…
Reference in a new issue