finished changes to monolith spawning

This commit is contained in:
StevenRS11
2013-06-24 00:34:21 -04:00
parent e847794e8d
commit 8bbd1384c5
3 changed files with 50 additions and 27 deletions

View File

@@ -196,14 +196,27 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
}
y = yCoordHelper.getFirstUncovered(this.worldObj,x , y+2, z);
Entity mob = new MobObelisk(this.worldObj);
mob.setLocationAndAngles(x, y, z, 1, 1);
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);
}

View File

@@ -3,8 +3,11 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.network.packet.Packet34EntityTeleport;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@@ -108,9 +111,25 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
}
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, y+2+random.nextInt(5), z, 1, 1);
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
worldObj.spawnEntityInWorld(mob);
didSpawn=true;
}