Vastly improved structure generation

This commit is contained in:
GotoLink 2013-10-22 00:41:12 +02:00
commit 55d14fc782
8 changed files with 4509 additions and 5159 deletions

3
.gitignore vendored
View file

@ -5,9 +5,8 @@
*.pydevproject *.pydevproject
.project .project
.metadata .metadata
bin/ common/bin/
tmp/ tmp/
*.class
*.tmp *.tmp
*.bak *.bak
*.swp *.swp

File diff suppressed because it is too large Load diff

View file

@ -3,41 +3,32 @@ package mysticruins;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
public class StructureRuin$1 extends WorldGenerator public class StructureRuin$1 extends WorldGenerator {
{ public StructureRuin$1() {
public StructureRuin$1()
{
} }
public boolean generate(World world, Random random, int i, int j, int k) @Override
{ public boolean generate(World world, Random random, int i, int j, int k) {
int l = random.nextInt(100); int l = random.nextInt(100);
if(l >= 10) if (l >= 10) {
{
return false; return false;
} }
for(int i1 = 0; i1 < 1; i1++) for (int i1 = 0; i1 < 1; i1++) {
{
int j1 = (i + random.nextInt(8)) - random.nextInt(8); int j1 = (i + random.nextInt(8)) - random.nextInt(8);
int k1 = (j + random.nextInt(4)) - random.nextInt(4); int k1 = (j + random.nextInt(4)) - random.nextInt(4);
int l1 = (k + random.nextInt(8)) - random.nextInt(8); int l1 = (k + random.nextInt(8)) - random.nextInt(8);
if(!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) if (!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) {
{
continue; continue;
} }
int i2 = random.nextInt(3) + 1; int i2 = random.nextInt(3) + 1;
if(i2 == 1) if (i2 == 1) {
{
int j2 = random.nextInt(8) + 5; int j2 = random.nextInt(8) + 5;
int i3 = random.nextInt(8) + 5; int i3 = random.nextInt(8) + 5;
int l3 = random.nextInt(8) + 5; int l3 = random.nextInt(8) + 5;
@ -48,11 +39,9 @@ public class StructureRuin$1 extends WorldGenerator
boolean flag = false; boolean flag = false;
int k7 = random.nextInt(100); int k7 = random.nextInt(100);
int j8 = random.nextInt(100); int j8 = random.nextInt(100);
if(j8 <= 20) if (j8 <= 20) {
{
j5 = 0; j5 = 0;
} else } else {
{
j5 = random.nextInt(4) + 5; j5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - j5, l1, Block.stoneBrick.blockID); world.setBlock(j1, k1 - j5, l1, Block.stoneBrick.blockID);
@ -68,57 +57,42 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1, k1 - j5, l1 + 3, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1, k1 - j5, l1 + 3, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.stoneBrick.blockID); world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.stoneBrick.blockID);
world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.stoneBrick.blockID); world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.stoneBrick.blockID);
world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID);
world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID); world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID);
TileEntityChest tileentitychest = (TileEntityChest) world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2); if (world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2) instanceof IInventory) {
IInventory tileentitychest = (IInventory) world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2);
Random rand = new Random(); Random rand = new Random();
for(int slot = 0; slot < tileentitychest.getSizeInventory(); slot++) for (int slot = 0; slot < tileentitychest.getSizeInventory(); slot++) {
{
int num = rand.nextInt(32); int num = rand.nextInt(32);
if (num == 1) {
if(num == 1)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.pickaxeIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.pickaxeIron, 1, 0));
} }
if (num == 2) {
if(num == 2)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.axeIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.axeIron, 1, 0));
} }
if (num == 3) {
if(num == 3)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.swordIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.swordIron, 1, 0));
} }
if (num == 4) {
if(num == 4)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.shovelIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.shovelIron, 1, 0));
} }
if (num == 5) {
if(num == 5)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
} }
if (num == 6) {
if(num == 6)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
} }
} }
}
world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID);
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6)
if(world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while (!flag && l6++ < 12); } while (!flag && l6++ < 12);
@ -138,30 +112,23 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.stoneBrick.blockID); world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.stoneBrick.blockID);
world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.stoneBrick.blockID, 1, 2);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 30) if (k7 <= 30) {
{
world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID);
TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5); TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5);
if(spawner != null) if (spawner != null) {
{
spawner.getSpawnerLogic().setMobID("Zombie"); spawner.getSpawnerLogic().setMobID("Zombie");
} }
world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID);
} }
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5)
if(world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while (!flag && l6++ < 12); } while (!flag && l6++ < 12);
@ -173,14 +140,12 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.stoneBrick.blockID); world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.stoneBrick.blockID);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 60) if (k7 <= 60) {
{
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID);
} }
} }
if(i2 == 2) if (i2 == 2) {
{
int k2 = random.nextInt(8) + 5; int k2 = random.nextInt(8) + 5;
int j3 = random.nextInt(8) + 5; int j3 = random.nextInt(8) + 5;
int i4 = random.nextInt(8) + 5; int i4 = random.nextInt(8) + 5;
@ -191,11 +156,9 @@ public class StructureRuin$1 extends WorldGenerator
boolean flag1 = false; boolean flag1 = false;
int l7 = random.nextInt(100); int l7 = random.nextInt(100);
int k8 = random.nextInt(100); int k8 = random.nextInt(100);
if(k8 <= 20) if (k8 <= 20) {
{
k5 = 0; k5 = 0;
} else } else {
{
k5 = random.nextInt(4) + 5; k5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - k5, l1, Block.stoneBrick.blockID); world.setBlock(j1, k1 - k5, l1, Block.stoneBrick.blockID);
@ -214,13 +177,12 @@ public class StructureRuin$1 extends WorldGenerator
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5)
if(world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -238,21 +200,19 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.stoneBrick.blockID); world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.stoneBrick.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8)
if(world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID
{ || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -275,21 +235,19 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.stoneBrick.blockID, 1, 2);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 60) if (l7 <= 60) {
{
world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID);
world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4)
if(world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID
{ || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -311,21 +269,19 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID); world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID);
world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.stoneBrick.blockID, 1, 2);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID);
world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7)
if(world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID
{ || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -339,14 +295,12 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.stoneBrick.blockID); world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.stoneBrick.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID);
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID);
} }
} }
if(i2 != 3) if (i2 != 3) {
{
continue; continue;
} }
int l2 = random.nextInt(8) + 5; int l2 = random.nextInt(8) + 5;
@ -359,11 +313,9 @@ public class StructureRuin$1 extends WorldGenerator
boolean flag2 = false; boolean flag2 = false;
int i8 = random.nextInt(100); int i8 = random.nextInt(100);
int l8 = random.nextInt(100); int l8 = random.nextInt(100);
if(l8 <= 20) if (l8 <= 20) {
{
l5 = 0; l5 = 0;
} else } else {
{
l5 = random.nextInt(4) + 5; l5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - l5, l1, Block.stoneBrick.blockID); world.setBlock(j1, k1 - l5, l1, Block.stoneBrick.blockID);
@ -380,19 +332,18 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1, k1 - l5, l1 + 2, Block.stoneBrick.blockID); world.setBlock(j1, k1 - l5, l1 + 2, Block.stoneBrick.blockID);
world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID);
world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID);
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4)
if(world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID
{ || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID
|| world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -413,21 +364,19 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.stoneBrick.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.stoneBrick.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.stoneBrick.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.stoneBrick.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6)
if(world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -444,21 +393,19 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.stoneBrick.blockID); world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.stoneBrick.blockID);
world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.stoneBrick.blockID); world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.stoneBrick.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 60) if (i8 <= 60) {
{
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID);
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4)
if(world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -475,21 +422,19 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.stoneBrick.blockID, 1, 2);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID);
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4)
if(world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID
{ || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -505,49 +450,36 @@ public class StructureRuin$1 extends WorldGenerator
world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.stoneBrick.blockID, 1, 2);
world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.stoneBrick.blockID, 1, 2); world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.stoneBrick.blockID, 1, 2);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{ world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID);
world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID); world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID);
TileEntityChest chest = (TileEntityChest) world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3); if (world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3) instanceof IInventory) {
IInventory chest = (IInventory) world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3);
Random rand = new Random(); Random rand = new Random();
for(int slot = 0; slot < chest.getSizeInventory(); slot++) for (int slot = 0; slot < chest.getSizeInventory(); slot++) {
{
int num = rand.nextInt(16); int num = rand.nextInt(16);
if (num == 1) {
if(num == 1)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.enderPearl, 4, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.enderPearl, 4, 0));
} }
if (num == 2) {
if(num == 2)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.diamond, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.diamond, 1, 0));
} }
if (num == 3) {
if(num == 3)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.emerald, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.emerald, 1, 0));
} }
if (num == 4) {
if(num == 4)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.appleGold, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.appleGold, 1, 0));
} }
if (num == 5) {
if(num == 5)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
} }
if (num == 6) {
if(num == 6)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
} }
} }
world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID);
} }
} }
}
return true; return true;
} }
} }

View file

@ -3,41 +3,32 @@ package mysticruins;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
public class StructureRuin extends WorldGenerator public class StructureRuin extends WorldGenerator {
{ public StructureRuin() {
public StructureRuin()
{
} }
public boolean generate(World world, Random random, int i, int j, int k) @Override
{ public boolean generate(World world, Random random, int i, int j, int k) {
int l = random.nextInt(100); int l = random.nextInt(100);
if(l >= 10) if (l >= 10) {
{
return false; return false;
} }
for(int i1 = 0; i1 < 1; i1++) for (int i1 = 0; i1 < 1; i1++) {
{
int j1 = (i + random.nextInt(8)) - random.nextInt(8); int j1 = (i + random.nextInt(8)) - random.nextInt(8);
int k1 = (j + random.nextInt(4)) - random.nextInt(4); int k1 = (j + random.nextInt(4)) - random.nextInt(4);
int l1 = (k + random.nextInt(8)) - random.nextInt(8); int l1 = (k + random.nextInt(8)) - random.nextInt(8);
if(!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) if (!world.isAirBlock(j1, k1, l1) || world.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || !Block.pumpkin.canPlaceBlockAt(world, j1, k1, l1)) {
{
continue; continue;
} }
int i2 = random.nextInt(3) + 1; int i2 = random.nextInt(3) + 1;
if(i2 == 1) if (i2 == 1) {
{
int j2 = random.nextInt(8) + 5; int j2 = random.nextInt(8) + 5;
int i3 = random.nextInt(8) + 5; int i3 = random.nextInt(8) + 5;
int l3 = random.nextInt(8) + 5; int l3 = random.nextInt(8) + 5;
@ -48,11 +39,9 @@ public class StructureRuin extends WorldGenerator
boolean flag = false; boolean flag = false;
int k7 = random.nextInt(100); int k7 = random.nextInt(100);
int j8 = random.nextInt(100); int j8 = random.nextInt(100);
if(j8 <= 20) if (j8 <= 20) {
{
j5 = 0; j5 = 0;
} else } else {
{
j5 = random.nextInt(4) + 5; j5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - j5, l1, Block.cobblestone.blockID); world.setBlock(j1, k1 - j5, l1, Block.cobblestone.blockID);
@ -68,57 +57,42 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1, k1 - j5, l1 + 3, Block.cobblestoneMossy.blockID); world.setBlock(j1, k1 - j5, l1 + 3, Block.cobblestoneMossy.blockID);
world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.cobblestone.blockID); world.setBlock(j1, (k1 - j5) + 1, l1 + 3, Block.cobblestone.blockID);
world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.cobblestone.blockID); world.setBlock(j1, (k1 - j5) + 2, l1 + 3, Block.cobblestone.blockID);
world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID);
world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID); world.setBlock(j1, k1 - j5 - k4, l1 + 2, Block.chest.blockID);
TileEntityChest tileentitychest = (TileEntityChest) world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2); if (world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2) instanceof IInventory) {
IInventory tileentitychest = (IInventory) world.getBlockTileEntity(j1, k1 - j5 - k4, l1 + 2);
Random rand = new Random(); Random rand = new Random();
for(int slot = 0; slot < tileentitychest.getSizeInventory(); slot++) for (int slot = 0; slot < tileentitychest.getSizeInventory(); slot++) {
{
int num = rand.nextInt(32); int num = rand.nextInt(32);
if (num == 1) {
if(num == 1)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.pickaxeIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.pickaxeIron, 1, 0));
} }
if (num == 2) {
if(num == 2)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.axeIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.axeIron, 1, 0));
} }
if (num == 3) {
if(num == 3)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.swordIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.swordIron, 1, 0));
} }
if (num == 4) {
if(num == 4)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.shovelIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.shovelIron, 1, 0));
} }
if (num == 5) {
if(num == 5)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
} }
if (num == 6) {
if(num == 6)
{
tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0)); tileentitychest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
} }
} }
}
world.setBlock(j1, k1 - j5 - k4 - 1, l1 + 2, Block.dirt.blockID);
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6)
if(world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l3, k1 - j5 - l6, l1 + l3 + 6) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while (!flag && l6++ < 12); } while (!flag && l6++ < 12);
@ -138,30 +112,23 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.cobblestone.blockID); world.setBlock(j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Block.cobblestone.blockID);
world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Block.cobblestoneMossy.blockID);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 30) if (k7 <= 30) {
{
world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Block.mobSpawner.blockID);
TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5); TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getBlockTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5);
if(spawner != null) if (spawner != null) {
{
spawner.getSpawnerLogic().setMobID("Zombie"); spawner.getSpawnerLogic().setMobID("Zombie");
} }
world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID); world.setBlock(j1 + l3, k1 - j5 - i6 - k4 - 1, l1 + l3 + 5, Block.dirt.blockID);
} }
l6 = 1; l6 = 1;
i6 = 0; i6 = 0;
flag = false; flag = false;
do do {
{ if (world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5)
if(world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 4) || world.isAirBlock(j1 - i3, k1 - j5 - l6, l1 - 5) || world.isAirBlock(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - i3, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - i3 - 1, k1 - j5 - l6, l1 - 5) == Block.waterStill.blockID) {
i6++; i6++;
} else } else {
{
flag = true; flag = true;
} }
} while (!flag && l6++ < 12); } while (!flag && l6++ < 12);
@ -173,14 +140,12 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.cobblestoneMossy.blockID); world.setBlock(j1 - i3 - 1, ((k1 - j5) + 2) - i6, l1 - 5, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.cobblestone.blockID); world.setBlock(j1 - i3 - 2, k1 - j5 - i6, l1 - 5, Block.cobblestone.blockID);
k7 = random.nextInt(100); k7 = random.nextInt(100);
if(k7 <= 60) if (k7 <= 60) {
{
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - i3 - 1, k1 - j5 - i6 - k4 - 1, l1 - 5, Block.dirt.blockID);
} }
} }
if(i2 == 2) if (i2 == 2) {
{
int k2 = random.nextInt(8) + 5; int k2 = random.nextInt(8) + 5;
int j3 = random.nextInt(8) + 5; int j3 = random.nextInt(8) + 5;
int i4 = random.nextInt(8) + 5; int i4 = random.nextInt(8) + 5;
@ -191,11 +156,9 @@ public class StructureRuin extends WorldGenerator
boolean flag1 = false; boolean flag1 = false;
int l7 = random.nextInt(100); int l7 = random.nextInt(100);
int k8 = random.nextInt(100); int k8 = random.nextInt(100);
if(k8 <= 20) if (k8 <= 20) {
{
k5 = 0; k5 = 0;
} else } else {
{
k5 = random.nextInt(4) + 5; k5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - k5, l1, Block.cobblestone.blockID); world.setBlock(j1, k1 - k5, l1, Block.cobblestone.blockID);
@ -214,13 +177,12 @@ public class StructureRuin extends WorldGenerator
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5)
if(world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k2, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k2 - 1, k1 - k5 - i7, l1 - 5) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -238,21 +200,19 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.cobblestoneMossy.blockID); world.setBlock(j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.cobblestone.blockID); world.setBlock(j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Block.cobblestone.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Block.dirt.blockID);
world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID); world.setBlock(j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8)
if(world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 4) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 6) || world.isAirBlock(j1 + i4, k1 - k5 - i7, l1 + 8) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 4) == Block.waterStill.blockID || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 6) == Block.waterStill.blockID
{ || world.getBlockId(j1 + i4, k1 - k5 - i7, l1 + 8) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -275,21 +235,19 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.cobblestoneMossy.blockID); world.setBlock(j1 + i4, ((k1 - k5) + 1) - j6, l1 + 8, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.cobblestoneMossy.blockID); world.setBlock(j1 + i4, k1 - k5 - j6, l1 + 9, Block.cobblestoneMossy.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 60) if (l7 <= 60) {
{
world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4, l1 + 7, Block.dirt.blockID);
world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID); world.setBlock(j1 + i4, k1 - k5 - j6 - l4 - 1, l1 + 7, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4)
if(world.isAirBlock(j1 - j3, k1 - k5 - i7, l1 + i4) || world.isAirBlock(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) || world.isAirBlock((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) || world.getBlockId(j1 - j3, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID || world.getBlockId(j1 - j3, k1 - k5 - i7, (l1 + i4) - 2) == Block.waterStill.blockID
{ || world.getBlockId((j1 - j3) + 1, k1 - k5 - i7, l1 + i4) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -311,21 +269,19 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.cobblestone.blockID); world.setBlock(j1 - j3, ((k1 - k5) + 2) - j6, (l1 + i4) - 3, Block.cobblestone.blockID);
world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.cobblestoneMossy.blockID); world.setBlock(j1 - j3, ((k1 - k5) + 3) - j6, (l1 + i4) - 3, Block.cobblestoneMossy.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4, (l1 + i4) - 2, Block.dirt.blockID);
world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID); world.setBlock(j1 - j3, k1 - k5 - j6 - l4 - 1, (l1 + i4) - 2, Block.dirt.blockID);
} }
i7 = 1; i7 = 1;
j6 = 0; j6 = 0;
flag1 = false; flag1 = false;
do do {
{ if (world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7)
if(world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) || world.isAirBlock(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) || world.isAirBlock(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 6) == Block.waterStill.blockID || world.getBlockId(j1 + j3 + 4, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID
{ || world.getBlockId(j1 + j3 + 5, k1 - k5 - i7, l1 - 7) == Block.waterStill.blockID) {
j6++; j6++;
} else } else {
{
flag1 = true; flag1 = true;
} }
} while (!flag1 && i7++ < 12); } while (!flag1 && i7++ < 12);
@ -339,14 +295,12 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.cobblestoneMossy.blockID); world.setBlock(j1 + j3 + 5, ((k1 - k5) + 2) - j6, l1 - 7, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.cobblestone.blockID); world.setBlock(j1 + j3 + 6, k1 - k5 - j6, l1 - 7, Block.cobblestone.blockID);
l7 = random.nextInt(100); l7 = random.nextInt(100);
if(l7 <= 30) if (l7 <= 30) {
{
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4, l1 - 7, Block.dirt.blockID);
world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID); world.setBlock(j1 + j3 + 4, k1 - k5 - j6 - l4 - 1, l1 - 7, Block.dirt.blockID);
} }
} }
if(i2 != 3) if (i2 != 3) {
{
continue; continue;
} }
int l2 = random.nextInt(8) + 5; int l2 = random.nextInt(8) + 5;
@ -359,11 +313,9 @@ public class StructureRuin extends WorldGenerator
boolean flag2 = false; boolean flag2 = false;
int i8 = random.nextInt(100); int i8 = random.nextInt(100);
int l8 = random.nextInt(100); int l8 = random.nextInt(100);
if(l8 <= 20) if (l8 <= 20) {
{
l5 = 0; l5 = 0;
} else } else {
{
l5 = random.nextInt(4) + 5; l5 = random.nextInt(4) + 5;
} }
world.setBlock(j1, k1 - l5, l1, Block.cobblestone.blockID); world.setBlock(j1, k1 - l5, l1, Block.cobblestone.blockID);
@ -380,19 +332,18 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.cobblestoneMossy.blockID); world.setBlock(j1, (k1 - l5) + 2, l1 + 1, Block.cobblestoneMossy.blockID);
world.setBlock(j1, k1 - l5, l1 + 2, Block.cobblestone.blockID); world.setBlock(j1, k1 - l5, l1 + 2, Block.cobblestone.blockID);
world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.cobblestoneMossy.blockID); world.setBlock(j1, (k1 - l5) + 1, l1 + 2, Block.cobblestoneMossy.blockID);
world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5, l1 + 1, Block.dirt.blockID);
world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID); world.setBlock(j1, k1 - l5 - i5 - 1, l1 + 1, Block.dirt.blockID);
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4)
if(world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Block.waterStill.blockID
{ || world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Block.waterStill.blockID
|| world.getBlockId(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -413,21 +364,19 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.cobblestone.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Block.cobblestone.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.cobblestone.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Block.cobblestone.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Block.dirt.blockID);
world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID); world.setBlock(j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6)
if(world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) || world.isAirBlock(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) || world.isAirBlock(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 2) == Block.waterStill.blockID || world.getBlockId(j1 - k3, k1 - l5 - j7, l1 - l2 - 4) == Block.waterStill.blockID
{ || world.getBlockId(j1 - k3 - 2, k1 - l5 - j7, l1 - l2 - 6) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -444,21 +393,19 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.cobblestone.blockID); world.setBlock(j1 - k3 - 2, ((k1 - l5) + 1) - k6, l1 - l2 - 6, Block.cobblestone.blockID);
world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.cobblestone.blockID); world.setBlock(j1 - k3 - 3, k1 - l5 - k6, l1 - l2 - 6, Block.cobblestone.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 60) if (i8 <= 60) {
{
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5, l1 - l2 - 6, Block.dirt.blockID);
world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID); world.setBlock(j1 - k3 - 1, k1 - l5 - k6 - i5 - 1, l1 - l2 - 6, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4)
if(world.isAirBlock(j1 + l2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) || world.isAirBlock(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) || world.getBlockId(j1 + l2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID || world.getBlockId(j1 + l2 + 2, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID
{ || world.getBlockId(j1 + l2 + 4, k1 - l5 - j7, l1 + j4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -475,21 +422,19 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l2 + 4, ((k1 - l5) + 1) - k6, l1 + j4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID); world.setBlock(j1 + l2 + 5, k1 - l5 - k6, l1 + j4, Block.cobblestoneMossy.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5, l1 + j4, Block.dirt.blockID);
world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID); world.setBlock(j1 + l2 + 2, k1 - l5 - k6 - i5 - 1, l1 + j4, Block.dirt.blockID);
} }
j7 = 1; j7 = 1;
k6 = 0; k6 = 0;
flag2 = false; flag2 = false;
do do {
{ if (world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4)
if(world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) || world.isAirBlock(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 1) == Block.waterStill.blockID || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 3) == Block.waterStill.blockID
{ || world.getBlockId(j1 - 3, k1 - l5 - j7, l1 + k3 + 4) == Block.waterStill.blockID) {
k6++; k6++;
} else } else {
{
flag2 = true; flag2 = true;
} }
} while (!flag2 && j7++ < 12); } while (!flag2 && j7++ < 12);
@ -505,49 +450,36 @@ public class StructureRuin extends WorldGenerator
world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.cobblestoneMossy.blockID); world.setBlock(j1 - 3, ((k1 - l5) + 1) - k6, l1 + k3 + 4, Block.cobblestoneMossy.blockID);
world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.cobblestoneMossy.blockID); world.setBlock(j1 - 3, k1 - l5 - k6, l1 + k3 + 5, Block.cobblestoneMossy.blockID);
i8 = random.nextInt(100); i8 = random.nextInt(100);
if(i8 <= 30) if (i8 <= 30) {
{ world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID);
world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID); world.setBlock(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3, Block.chest.blockID);
TileEntityChest chest = (TileEntityChest) world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3); if (world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3) instanceof IInventory) {
IInventory chest = (IInventory) world.getBlockTileEntity(j1 - 3, k1 - l5 - k6 - i5, l1 + k3 + 3);
Random rand = new Random(); Random rand = new Random();
for(int slot = 0; slot < chest.getSizeInventory(); slot++) for (int slot = 0; slot < chest.getSizeInventory(); slot++) {
{
int num = rand.nextInt(16); int num = rand.nextInt(16);
if (num == 1) {
if(num == 1)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.enderPearl, 4, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.enderPearl, 4, 0));
} }
if (num == 2) {
if(num == 2)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.diamond, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.diamond, 1, 0));
} }
if (num == 3) {
if(num == 3)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.emerald, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.emerald, 1, 0));
} }
if (num == 4) {
if(num == 4)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.appleGold, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.appleGold, 1, 0));
} }
if (num == 5) {
if(num == 5)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.ingotGold, 1, 0));
} }
if (num == 6) {
if(num == 6)
{
chest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0)); chest.setInventorySlotContents(slot, new ItemStack(Item.ingotIron, 1, 0));
} }
} }
world.setBlock(j1 - 3, k1 - l5 - k6 - i5 - 1, l1 + k3 + 3, Block.dirt.blockID);
} }
} }
}
return true; return true;
} }
} }

View file

@ -1,31 +0,0 @@
package mysticruins;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenMysticDungeon implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Config.DunRarity; i++)
{
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(9) + 28;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
(new StructureMysticDungeon()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}

View file

@ -1,31 +0,0 @@
package mysticruins;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenRuin$1 implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Config.RuinRarity; i++)
{
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(11) + 60;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
(new StructureRuin$1()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}

View file

@ -1,31 +0,0 @@
package mysticruins;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenRuin implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}
}
private void generateSurface(World world, Random random, int blockX, int blockZ)
{
for (int i = 0; i < Config.RuinRarity; i++)
{
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(11) + 60;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
(new StructureRuin()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}

View file

@ -0,0 +1,43 @@
package mysticruins;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenerator;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGenMystic implements IWorldGenerator {
public static final WorldGenerator ruin = new StructureRuin();
public static final WorldGenerator ruin1 = new StructureRuin$1();
public static final WorldGenerator dungeon = new StructureMysticDungeon();
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
if (Config.ruinAllowId.contains(world.provider.dimensionId)) {
generateRuins(world, random, chunkX * 16, chunkZ * 16);
}
if (Config.dungeonAllowId.contains(world.provider.dimensionId)) {
generateDungeon(world, random, chunkX * 16, chunkZ * 16);
}
}
private void generateDungeon(World world, Random random, int blockX, int blockZ) {
for (int i = 0; i < Config.DunRarity; i++) {
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(9) + 28;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
dungeon.generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
private void generateRuins(World world, Random random, int blockX, int blockZ) {
for (int i = 0; i < Config.RuinRarity; i++) {
int Xcoord1 = blockX + random.nextInt(16) + 8;
int Ycoord1 = random.nextInt(11) + 60;
int Zcoord1 = blockZ + random.nextInt(16) + 8;
ruin.generate(world, random, Xcoord1, Ycoord1, Zcoord1);
ruin1.generate(world, random, Xcoord1, Ycoord1, Zcoord1);
}
}
}