Reworked dimension population
other mods shouldnt attempt to generate in pockets/limbo now. Expect pockets to gen 40x faster on hexxit
This commit is contained in:
@@ -1,12 +1,16 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.ITickHandler;
|
import cpw.mods.fml.common.ITickHandler;
|
||||||
@@ -19,6 +23,11 @@ public class CommonTickHandler implements ITickHandler
|
|||||||
public int tickCount=0;
|
public int tickCount=0;
|
||||||
public int tickCount2=0;
|
public int tickCount2=0;
|
||||||
private static DDProperties properties = null;
|
private static DDProperties properties = null;
|
||||||
|
public static ArrayList<int[]> chunksToPopulate= new ArrayList<int[]>();
|
||||||
|
public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100;
|
||||||
|
private static final int MAX_MONOLITH_SPAWN_Y = 245;
|
||||||
|
private static final int CHUNK_SIZE = 16;
|
||||||
|
|
||||||
|
|
||||||
public CommonTickHandler()
|
public CommonTickHandler()
|
||||||
{
|
{
|
||||||
@@ -40,6 +49,22 @@ public class CommonTickHandler implements ITickHandler
|
|||||||
{
|
{
|
||||||
if (type.equals(EnumSet.of(TickType.SERVER)))
|
if (type.equals(EnumSet.of(TickType.SERVER)))
|
||||||
{
|
{
|
||||||
|
if(!CommonTickHandler.chunksToPopulate.isEmpty())
|
||||||
|
{
|
||||||
|
for(int[] chunkData : CommonTickHandler.chunksToPopulate)
|
||||||
|
{
|
||||||
|
if(chunkData[0]==properties.LimboDimensionID)
|
||||||
|
{
|
||||||
|
this.placeMonolithsInLimbo(chunkData[0], chunkData[1], chunkData[2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.placeMonolithsInPockets(chunkData[0], chunkData[1], chunkData[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CommonTickHandler.chunksToPopulate.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +78,134 @@ public class CommonTickHandler implements ITickHandler
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void placeMonolithsInPockets(int worldID, int chunkX, int chunkZ)
|
||||||
|
{
|
||||||
|
World worldObj = dimHelper.getWorld(worldID);
|
||||||
|
DimData dimData = dimHelper.dimList.get(worldObj.provider.dimensionId);
|
||||||
|
int sanity = 0;
|
||||||
|
int blockID = 0;
|
||||||
|
boolean didSpawn=false;
|
||||||
|
|
||||||
|
if (dimData == null ||
|
||||||
|
dimData.dungeonGenerator == null ||
|
||||||
|
dimData.dungeonGenerator.isOpen)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//The following initialization code is based on code from ChunkProviderGenerate.
|
||||||
|
//It makes our generation depend on the world seed.
|
||||||
|
Random random = new Random(worldObj.getSeed());
|
||||||
|
long factorA = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
long factorB = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
random.setSeed((long)chunkX * factorA + (long)chunkZ * factorB ^ worldObj.getSeed());
|
||||||
|
|
||||||
|
int x, y, z;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
//Select a random column within the chunk
|
||||||
|
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
y = MAX_MONOLITH_SPAWN_Y;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
while (blockID == 0 &&y>0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
}
|
||||||
|
while(blockID == mod_pocketDim.blockDimWall.blockID&&y>0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
}
|
||||||
|
while (blockID == 0 &&y>0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(y > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int jumpSanity=0;
|
||||||
|
int jumpHeight=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
jumpHeight = y+random.nextInt(10);
|
||||||
|
|
||||||
|
jumpSanity++;
|
||||||
|
}
|
||||||
|
while(!worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Entity mob = new MobObelisk(worldObj);
|
||||||
|
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
||||||
|
worldObj.spawnEntityInWorld(mob);
|
||||||
|
didSpawn=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sanity++;
|
||||||
|
|
||||||
|
}
|
||||||
|
while (sanity<5&&!didSpawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void placeMonolithsInLimbo(int worldID, int var2, int var3)
|
||||||
|
{
|
||||||
|
World world = dimHelper.getWorld(worldID);
|
||||||
|
|
||||||
|
if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance)
|
||||||
|
{
|
||||||
|
int y =0;
|
||||||
|
int x = var2*16 + rand.nextInt(16);
|
||||||
|
int z = var3*16 + rand.nextInt(16);
|
||||||
|
int yTest;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
x = var2*16 + rand.nextInt(16);
|
||||||
|
z = var3*16 + rand.nextInt(16);
|
||||||
|
|
||||||
|
while(world.getBlockId(x, y, z)==0&&y<255)
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
y = yCoordHelper.getFirstUncovered(world,x , y+2, z);
|
||||||
|
|
||||||
|
yTest=yCoordHelper.getFirstUncovered(world,x , y+5, z);
|
||||||
|
if(yTest>245)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int jumpSanity=0;
|
||||||
|
int jumpHeight=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
jumpHeight = y+rand.nextInt(25);
|
||||||
|
|
||||||
|
jumpSanity++;
|
||||||
|
}
|
||||||
|
while(!world.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
||||||
|
|
||||||
|
|
||||||
|
Entity mob = new MobObelisk(world);
|
||||||
|
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
|
world.spawnEntityInWorld(mob);
|
||||||
|
|
||||||
|
}
|
||||||
|
while (yTest > y);
|
||||||
|
}
|
||||||
|
}
|
||||||
//replaces rifts in game that have been destroyed/have blocks placed over them.
|
//replaces rifts in game that have been destroyed/have blocks placed over them.
|
||||||
private void onTickInGame()
|
private void onTickInGame()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ public class DDProperties
|
|||||||
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
|
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
|
||||||
|
|
||||||
MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28,
|
MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28,
|
||||||
"Sets the chance (out of " + LimboGenerator.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " +
|
"Sets the chance (out of " + CommonTickHandler.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " +
|
||||||
"spawn in a given Limbo chunk. The default chance is 28.").getInt();
|
"spawn in a given Limbo chunk. The default chance is 28.").getInt();
|
||||||
|
|
||||||
ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3,
|
ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3,
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import java.util.Random;
|
|||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.LimboGenerator;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.PocketGenerator;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@@ -29,11 +33,13 @@ import net.minecraft.util.Vec3;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||||
|
import net.minecraftforge.event.Event.Result;
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
|
||||||
public class EventHookContainer
|
public class EventHookContainer
|
||||||
@@ -102,6 +108,8 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event)
|
public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.world;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
@@ -33,7 +34,6 @@ import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
|||||||
|
|
||||||
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
|
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
|
||||||
{
|
{
|
||||||
public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100;
|
|
||||||
private static Random rand;
|
private static Random rand;
|
||||||
|
|
||||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||||
@@ -158,15 +158,17 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||||||
this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
|
this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
|
||||||
byte[] var3 = new byte[32768];
|
byte[] var3 = new byte[32768];
|
||||||
this.generateTerrain(par1, par2, var3);
|
this.generateTerrain(par1, par2, var3);
|
||||||
this.caveGenerator.generate(this, this.worldObj, par1, par2, var3);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
|
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
|
||||||
|
|
||||||
|
|
||||||
var4.generateSkylightMap();
|
var4.generateSkylightMap();
|
||||||
|
|
||||||
|
if(!var4.isTerrainPopulated)
|
||||||
|
{
|
||||||
|
var4.isTerrainPopulated=true;
|
||||||
|
CommonTickHandler.chunksToPopulate.add(new int[] {properties.LimboDimensionID,par1,par2});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return var4;
|
return var4;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@@ -178,50 +180,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||||||
@Override
|
@Override
|
||||||
public void populate(IChunkProvider var1, int var2, int var3)
|
public void populate(IChunkProvider var1, int var2, int var3)
|
||||||
{
|
{
|
||||||
if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance)
|
|
||||||
{
|
|
||||||
int y =0;
|
|
||||||
int x = var2*16 + rand.nextInt(16);
|
|
||||||
int z = var3*16 + rand.nextInt(16);
|
|
||||||
int yTest;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
|
|
||||||
x = var2*16 + rand.nextInt(16);
|
|
||||||
z = var3*16 + rand.nextInt(16);
|
|
||||||
|
|
||||||
while(this.worldObj.getBlockId(x, y, z)==0&&y<255)
|
|
||||||
{
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
y = yCoordHelper.getFirstUncovered(this.worldObj,x , y+2, z);
|
|
||||||
|
|
||||||
yTest=yCoordHelper.getFirstUncovered(this.worldObj,x , y+5, z);
|
|
||||||
if(yTest>245)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int jumpSanity=0;
|
|
||||||
int jumpHeight=0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
jumpHeight = y+rand.nextInt(25);
|
|
||||||
|
|
||||||
jumpSanity++;
|
|
||||||
}
|
|
||||||
while(!this.worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
|
||||||
|
|
||||||
|
|
||||||
Entity mob = new MobObelisk(this.worldObj);
|
|
||||||
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
this.worldObj.spawnEntityInWorld(mob);
|
|
||||||
|
|
||||||
}
|
|
||||||
while (yTest > y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||||
|
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.DimData;
|
import StevenDimDoors.mod_pocketDim.DimData;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
@@ -23,13 +25,17 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
|||||||
{
|
{
|
||||||
private World worldObj;
|
private World worldObj;
|
||||||
|
|
||||||
private static final int MAX_MONOLITH_SPAWN_Y = 245;
|
private DDProperties properties = null;
|
||||||
private static final int CHUNK_SIZE = 16;
|
|
||||||
|
|
||||||
|
|
||||||
public PocketGenerator(World par1World, long par2, boolean par4)
|
public PocketGenerator(World par1World, long par2, boolean par4)
|
||||||
{
|
{
|
||||||
super(par1World, par2, par4);
|
super(par1World, par2, par4);
|
||||||
this.worldObj = par1World;
|
this.worldObj = par1World;
|
||||||
|
|
||||||
|
if (properties == null)
|
||||||
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,6 +56,12 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
|||||||
|
|
||||||
Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ);
|
Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ);
|
||||||
|
|
||||||
|
if(!chunk.isTerrainPopulated)
|
||||||
|
{
|
||||||
|
chunk.isTerrainPopulated=true;
|
||||||
|
CommonTickHandler.chunksToPopulate.add(new int[] {chunk.worldObj.provider.dimensionId,chunkX,chunkZ});
|
||||||
|
}
|
||||||
|
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,81 +74,7 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
|||||||
@Override
|
@Override
|
||||||
public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ)
|
public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ)
|
||||||
{
|
{
|
||||||
//Check whether we want to populate this chunk with Monoliths.
|
|
||||||
DimData dimData = dimHelper.dimList.get(worldObj.provider.dimensionId);
|
|
||||||
int sanity = 0;
|
|
||||||
int blockID = 0;
|
|
||||||
boolean didSpawn=false;
|
|
||||||
|
|
||||||
if (dimData == null ||
|
|
||||||
dimData.dungeonGenerator == null ||
|
|
||||||
dimData.dungeonGenerator.isOpen)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//The following initialization code is based on code from ChunkProviderGenerate.
|
|
||||||
//It makes our generation depend on the world seed.
|
|
||||||
Random random = new Random(worldObj.getSeed());
|
|
||||||
long factorA = random.nextLong() / 2L * 2L + 1L;
|
|
||||||
long factorB = random.nextLong() / 2L * 2L + 1L;
|
|
||||||
random.setSeed((long)chunkX * factorA + (long)chunkZ * factorB ^ worldObj.getSeed());
|
|
||||||
|
|
||||||
int x, y, z;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
//Select a random column within the chunk
|
|
||||||
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
|
||||||
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
|
||||||
y = MAX_MONOLITH_SPAWN_Y;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
while (blockID == 0 &&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
}
|
|
||||||
while(blockID == mod_pocketDim.blockDimWall.blockID&&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
}
|
|
||||||
while (blockID == 0 &&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(y > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int jumpSanity=0;
|
|
||||||
int jumpHeight=0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
|
|
||||||
jumpHeight = y+random.nextInt(10);
|
|
||||||
|
|
||||||
jumpSanity++;
|
|
||||||
}
|
|
||||||
while(!this.worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Entity mob = new MobObelisk(worldObj);
|
|
||||||
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
|
||||||
worldObj.spawnEntityInWorld(mob);
|
|
||||||
didSpawn=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sanity++;
|
|
||||||
|
|
||||||
}
|
|
||||||
while (sanity<5&&!didSpawn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user