Merge pull request #58 from SenseiKiwi/master
Added Support for GenerateStructures
This commit is contained in:
commit
c92e5b2096
1 changed files with 11 additions and 6 deletions
|
@ -6,8 +6,8 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
|
||||||
import StevenDimDoors.mod_pocketDim.items.itemDimDoor;
|
import StevenDimDoors.mod_pocketDim.items.itemDimDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
|
@ -42,7 +42,7 @@ public class RiftGenerator implements IWorldGenerator
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//FIXME: Why is this here? Comment your code! =/ ~SenseiKiwi
|
||||||
if (dimHelper.getWorld(0) == null)
|
if (dimHelper.getWorld(0) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -89,9 +89,9 @@ public class RiftGenerator implements IWorldGenerator
|
||||||
while (random.nextInt(MAX_CLUSTER_GROWTH_CHANCE) < CLUSTER_GROWTH_CHANCE);
|
while (random.nextInt(MAX_CLUSTER_GROWTH_CHANCE) < CLUSTER_GROWTH_CHANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Randomly decide whether to place a Rift Gateway here.
|
//Check if generating structures is enabled and randomly decide whether to place a Rift Gateway here.
|
||||||
//This only happens if a rift cluster was NOT generated.
|
//This only happens if a rift cluster was NOT generated.
|
||||||
else if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.GatewayGenerationChance)
|
else if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.GatewayGenerationChance && isStructureGenerationAllowed())
|
||||||
{
|
{
|
||||||
valid = false;
|
valid = false;
|
||||||
x = y = z = 0; //Stop the compiler from freaking out
|
x = y = z = 0; //Stop the compiler from freaking out
|
||||||
|
@ -192,4 +192,9 @@ public class RiftGenerator implements IWorldGenerator
|
||||||
return (material != Material.leaves && material != Material.wood && material != Material.pumpkin
|
return (material != Material.leaves && material != Material.wood && material != Material.pumpkin
|
||||||
&& world.isBlockOpaqueCube(x, y, z) && world.getBlockId(x, y, z) != Block.bedrock.blockID);
|
&& world.isBlockOpaqueCube(x, y, z) && world.getBlockId(x, y, z) != Block.bedrock.blockID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isStructureGenerationAllowed()
|
||||||
|
{
|
||||||
|
return DimensionManager.getWorld(0).getWorldInfo().isMapFeaturesEnabled();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue