Fixed monolith spawning

This commit is contained in:
StevenRS11
2013-06-15 02:09:17 -04:00
parent 4a5ea9efb3
commit fa4055f198
7 changed files with 105 additions and 15 deletions

View File

@@ -37,7 +37,7 @@ public class yCoordHelper
do do
{ {
flag=false; flag=false;
if(chunk.getBlockID(xC, yC-1, zC)!=0) if(yC>0&&chunk.getBlockID(xC, yC-1, zC)!=0)
{ {
if(!Block.blocksList[chunk.getBlockID(xC, yC-1, zC)].blockMaterial.isReplaceable()||Block.blocksList[chunk.getBlockID(xC, yC-1, zC)].blockMaterial.isLiquid()) if(!Block.blocksList[chunk.getBlockID(xC, yC-1, zC)].blockMaterial.isReplaceable()||Block.blocksList[chunk.getBlockID(xC, yC-1, zC)].blockMaterial.isLiquid())
{ {
@@ -47,7 +47,7 @@ public class yCoordHelper
} }
} }
if(chunk.getBlockID(xC, yC, zC)!=0) if(yC>0&&chunk.getBlockID(xC, yC, zC)!=0)
{ {
if(!Block.blocksList[chunk.getBlockID(xC, yC, zC)].blockMaterial.isReplaceable()||Block.blocksList[chunk.getBlockID(xC, yC, zC)].blockMaterial.isLiquid()) if(!Block.blocksList[chunk.getBlockID(xC, yC, zC)].blockMaterial.isReplaceable()||Block.blocksList[chunk.getBlockID(xC, yC, zC)].blockMaterial.isLiquid())
{ {

View File

@@ -49,6 +49,8 @@ public class ItemStableFabric extends Item
{ {
System.out.println("Block metadata is "+par3World.getBlockMetadata(par4, par5, par6)); System.out.println("Block metadata is "+par3World.getBlockMetadata(par4, par5, par6));
System.out.println(par3World.getBiomeGenForCoords(par4, par6).biomeName); System.out.println(par3World.getBiomeGenForCoords(par4, par6).biomeName);
this.onItemRightClick(par1ItemStack, par3World, par2EntityPlayer); this.onItemRightClick(par1ItemStack, par3World, par2EntityPlayer);
Block block = Block.blocksList[par3World.getBlockId(par4, par5, par6)]; Block block = Block.blocksList[par3World.getBlockId(par4, par5, par6)];

View File

@@ -137,7 +137,7 @@ public class MobObelisk extends EntityFlying implements IMob
{ {
if(this.soundTime<=0) if(this.soundTime<=0)
{ {
this.playSound("mods.DimDoors.sfx.monk", 1.5F, 1F); this.playSound("mods.DimDoors.sfx.monk", 1.7F, 1F);
this.soundTime=100; this.soundTime=100;
} }

View File

@@ -20,14 +20,14 @@ public class BiomeGenLimbo extends BiomeGenBase
this.spawnableCreatureList.clear(); this.spawnableCreatureList.clear();
this.spawnableWaterCreatureList.clear(); this.spawnableWaterCreatureList.clear();
this.spawnableCaveCreatureList.clear(); this.spawnableCaveCreatureList.clear();
this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); // this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0)); // this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0));
this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); // this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0)); // this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0));
this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); // this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0)); // this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0));

View File

@@ -19,10 +19,10 @@ public class BiomeGenPocket extends BiomeGenBase
this.spawnableCreatureList.clear(); this.spawnableCreatureList.clear();
this.spawnableWaterCreatureList.clear(); this.spawnableWaterCreatureList.clear();
this.spawnableCaveCreatureList.clear(); this.spawnableCaveCreatureList.clear();
this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); // this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); // this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
//
this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); // this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1));
} }

View File

@@ -5,8 +5,12 @@ import java.util.Random;
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.yCoordHelper;
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.IProgressUpdate; import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@@ -173,8 +177,49 @@ 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(true)
{
return;
}
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);
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;
}
this.worldObj.spawnEntityInWorld(mob);
}
while(yTest >y);
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override @Override

View File

@@ -2,11 +2,15 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.DimData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
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 StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.ChunkPosition; import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -17,6 +21,7 @@ import net.minecraft.world.gen.ChunkProviderGenerate;
public class pocketGenerator extends ChunkProviderGenerate implements IChunkProvider public class pocketGenerator extends ChunkProviderGenerate implements IChunkProvider
{ {
private World worldObj; private World worldObj;
private Random rand = new Random();
public pocketGenerator(World par1World, long par2, boolean par4) public pocketGenerator(World par1World, long par2, boolean par4)
{ {
@@ -58,7 +63,45 @@ public class pocketGenerator extends ChunkProviderGenerate implements IChunkProv
} }
@Override @Override
public void populate(IChunkProvider var1, int var2, int var3) { public void populate(IChunkProvider var1, int var2, int var3)
{
if(dimHelper.dimList.containsKey(worldObj.provider.dimensionId))
{
if(!dimHelper.dimList.get(worldObj.provider.dimensionId).isDimRandomRift)
{
// return;
}
}
int y =0;
int x = var2*16 + rand.nextInt(32)-8;
int z = var3*16 + rand.nextInt(32)-8;
do
{
x = var2*16 + rand.nextInt(32-8);
z = var3*16 + rand.nextInt(32)-8;
while(this.worldObj.getBlockId(x, y, z)==0&&y<255)
{
y++;
}
y = yCoordHelper.getFirstUncovered(this.worldObj,x , y+2, z);
Entity mob = new MobObelisk(this.worldObj);
mob.setLocationAndAngles(x, y+rand.nextInt(4), z, 1, 1);
this.worldObj.spawnEntityInWorld(mob);
}
while( yCoordHelper.getFirstUncovered(this.worldObj,x , y, z)>y);
if(rand.nextBoolean())
{
this.populate(var1, var2, var3);
}
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }