diff options
Diffstat (limited to 'common/darkknight/jewelrycraft/worldGen')
3 files changed, 65 insertions, 43 deletions
diff --git a/common/darkknight/jewelrycraft/worldGen/Generation.java b/common/darkknight/jewelrycraft/worldGen/Generation.java index 9444e6a..32da73d 100644 --- a/common/darkknight/jewelrycraft/worldGen/Generation.java +++ b/common/darkknight/jewelrycraft/worldGen/Generation.java @@ -36,7 +36,8 @@ public class Generation implements IWorldGenerator int x = i + random.nextInt(16); int y = 5 + random.nextInt(4); int z = j + random.nextInt(16); - if(world.rand.nextInt(10) == 0) world.setBlock(x, y, z, BlockList.shadowOre.blockID); + world.setBlock(x, y, z, BlockList.shadowOre.blockID); + if(random.nextInt(3) == 0) world.setBlock(x + random.nextInt(2), y + random.nextInt(1), z + random.nextInt(2), BlockList.shadowOre.blockID); } } diff --git a/common/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/common/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java index 3983274..2c740f5 100644 --- a/common/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java +++ b/common/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java @@ -175,12 +175,12 @@ public class ComponentJewelry extends ComponentVillage generateDisplayer(world, 3, 1, 4, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb); generateChest(world, 3, 1, 5, 0, random, sbb, 2, 6); - this.placeBlockAtCurrentPosition(world, Block.furnaceIdle.blockID, 0, 1, 1, 7, sbb); - this.placeBlockAtCurrentPosition(world, Block.furnaceIdle.blockID, 0, 1, 2, 7, sbb); - this.placeBlockAtCurrentPosition(world, Block.furnaceIdle.blockID, 0, 1, 3, 7, sbb); - this.placeBlockAtCurrentPosition(world, Block.furnaceIdle.blockID, 0, 1, 1, 10, sbb); - this.placeBlockAtCurrentPosition(world, Block.furnaceIdle.blockID, 0, 1, 2, 10, sbb); - this.placeBlockAtCurrentPosition(world, Block.furnaceIdle.blockID, 0, 1, 3, 10, sbb); + generateFurnace(world, 1, 1, 7, 0, random, sbb, 1, 2, true); + generateFurnace(world, 1, 2, 7, 0, random, sbb, 2, 3, true); + generateFurnace(world, 1, 3, 7, 0, random, sbb, 1, 3, true); + generateFurnace(world, 1, 1, 10, 0, random, sbb, 1, 2, true); + generateFurnace(world, 1, 2, 10, 0, random, sbb, 2, 3, true); + generateFurnace(world, 1, 3, 10, 0, random, sbb, 1, 3, true); generateSmelter(world, 1, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean()); generateSmelter(world, 1, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean()); @@ -188,10 +188,10 @@ public class ComponentJewelry extends ComponentVillage generateMolder(world, 2, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean(), random.nextBoolean()); generateMolder(world, 2, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean(), random.nextBoolean()); - this.placeBlockAtCurrentPosition(world, Block.chest.blockID, 0, 9, 1, 7, sbb); - this.placeBlockAtCurrentPosition(world, Block.chest.blockID, 0, 9, 1, 8, sbb); - this.placeBlockAtCurrentPosition(world, Block.chestTrapped.blockID, 0, 9, 1, 9, sbb); - this.placeBlockAtCurrentPosition(world, Block.chestTrapped.blockID, 0, 9, 1, 10, sbb); + generateIngotChest(world, 9, 1, 7, 0, random, sbb, 3, 12, Block.chest, 5); + generateIngotChest(world, 9, 1, 8, 0, random, sbb, 5, 16, Block.chest, 3); + generateIngotChest(world, 9, 1, 9, 0, random, sbb, 3, 10, Block.chestTrapped, 2); + generateIngotChest(world, 9, 1, 10, 0, random, sbb, 3, 9, Block.chestTrapped, 6); for (int l = 0; l < 6; ++l) @@ -234,6 +234,22 @@ public class ComponentJewelry extends ComponentVillage } } + public void generateIngotChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount) + { + int i1 = this.getXWithOffset(i, k); + int j1 = this.getYWithOffset(j); + int k1 = this.getZWithOffset(i, k); + int t = random.nextInt(max - min + 1) + min; + this.placeBlockAtCurrentPosition(world, chestB.blockID, metadata, i, j, k, sbb); + TileEntityChest chest = (TileEntityChest)world.getBlockTileEntity(i1, j1, k1); + while(chest != null && t > 0) + { + chest.setChestGuiName("Ingot Chest"); + if(random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), new ItemStack(JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).getItem(), 2 + random.nextInt(randomAmount))); + t--; + } + } + public void generateTrappedChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max) { int i1 = this.getXWithOffset(i, k); @@ -320,12 +336,11 @@ public class ComponentJewelry extends ComponentVillage TileEntityFurnace furnace = (TileEntityFurnace)world.getBlockTileEntity(i1, j1, k1); if(furnace != null) { -// if(random.nextBoolean()) furnace.setInventorySlotContents(1, new ItemStack(Item.coal, random.nextInt(16))); -// if(hasMetal){ -// ItemStack metal = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())); -// metal.stackSize = random.nextInt(max - min + 1) + min; -// furnace.setInventorySlotContents(2, metal); -// } + if(random.nextBoolean()) furnace.setInventorySlotContents(1, new ItemStack(Item.coal, 1 + random.nextInt(16))); + if(hasMetal){ + ItemStack metal = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())); + furnace.setInventorySlotContents(2, new ItemStack(metal.getItem(), random.nextInt(max - min + 1) + min)); + } } } diff --git a/common/darkknight/jewelrycraft/worldGen/village/JCTrades.java b/common/darkknight/jewelrycraft/worldGen/village/JCTrades.java index a60696b..2a5ba6f 100644 --- a/common/darkknight/jewelrycraft/worldGen/village/JCTrades.java +++ b/common/darkknight/jewelrycraft/worldGen/village/JCTrades.java @@ -37,15 +37,15 @@ public class JCTrades implements IVillageTradeHandler case 0: { result = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())); - result.stackSize = 1 + random.nextInt(16); - ingredient = new ItemStack(Item.emerald, 8 + random.nextInt(8)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 8 + random.nextInt(8)); + result.stackSize = 5 + random.nextInt(8); + ingredient = new ItemStack(Item.emerald, 2 + random.nextInt(2)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 2 + random.nextInt(2)); break; } case 1: { - result = new ItemStack(ItemList.molds, 1, random.nextInt(2)); - ingredient = new ItemStack(Item.emerald, 1 + random.nextInt(2)); + result = new ItemStack(ItemList.molds, 5 + random.nextInt(7), random.nextInt(2)); + ingredient = new ItemStack(Item.emerald, 1 + random.nextInt(1)); if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 1 + random.nextInt(2)); break; } @@ -53,70 +53,76 @@ public class JCTrades implements IVillageTradeHandler { result = new ItemStack(ItemList.thiefGloves); ingredient = new ItemStack(Item.emerald, 16 + random.nextInt(8)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 16 + random.nextInt(8)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 8 + random.nextInt(4)); break; } case 3: { result = new ItemStack(BlockList.displayer, 1 + random.nextInt(6)); - ingredient = new ItemStack(Item.emerald, 8 + random.nextInt(32)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Block.blockEmerald, 2 + random.nextInt(6)); + ingredient = new ItemStack(Item.emerald, 3 + random.nextInt(8)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 3 + random.nextInt(8)); break; } case 4: { result = new ItemStack(BlockList.jewelCraftingTable); - ingredient = new ItemStack(Item.emerald, 8 + random.nextInt(17)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 8 + random.nextInt(17)); + ingredient = new ItemStack(Item.emerald, 1 + random.nextInt(2)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 1 + random.nextInt(2)); break; } case 5: { result = new ItemStack(BlockList.shadowOre, 1 + random.nextInt(16)); - ingredient = new ItemStack(Item.emerald, 8 + random.nextInt(17)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 8 + random.nextInt(17)); + ingredient = new ItemStack(Item.emerald, 3 + random.nextInt(4)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 3 + random.nextInt(4)); break; } case 6: { - result = new ItemStack(BlockList.molder); - ingredient = new ItemStack(Item.emerald, 1 + random.nextInt(2)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 1 + random.nextInt(3)); + result = new ItemStack(BlockList.molder, 5 + random.nextInt(5)); + ingredient = new ItemStack(Item.emerald, 1 + random.nextInt(1)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 1 + random.nextInt(1)); break; } case 7: { result = new ItemStack(BlockList.smelter); - ingredient = new ItemStack(Item.emerald, 3 + random.nextInt(9)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 4 + random.nextInt(2)); + ingredient = new ItemStack(Item.emerald, 1 + random.nextInt(2)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 1 + random.nextInt(2)); break; } case 8: { int end = random.nextInt(JewelrycraftUtil.modifiers.size()); result = JewelrycraftUtil.modifiers.get(end); - if(result.getMaxStackSize() > 1) result.stackSize = 1 + random.nextInt(16); if(JewelrycraftUtil.modifiers.size() - 1 - end >= 3) { - ingredient = new ItemStack(Item.emerald, 3 + random.nextInt(9)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 4 + random.nextInt(2)); + result.stackSize = 1 + random.nextInt(JewelrycraftUtil.modifiers.size() - end); + int value = end; + if(value > 64) value = 64; + ingredient = new ItemStack(Item.emerald, 3 + random.nextInt(value)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 4 + random.nextInt(value)); } else { - ingredient = new ItemStack(Item.emerald, 32 + random.nextInt(33)); - ingredient2 = new ItemStack(Block.blockEmerald, 8 + random.nextInt(16)); + result.stackSize = 1 + random.nextInt(7); + ingredient = new ItemStack(Item.emerald, result.stackSize/2 + 1 + random.nextInt(7)); + ingredient2 = new ItemStack(Item.emerald, result.stackSize/2 + 1 + random.nextInt(4)); } + if(result.getMaxStackSize()<=1) result.stackSize = 1; break; } case 9: { int end = random.nextInt(JewelrycraftUtil.jewel.size()); result = JewelrycraftUtil.jewel.get(end); - result.stackSize = 1 + random.nextInt(3); - if(JewelrycraftUtil.modifiers.size() - 1 - end >= 1) + result.stackSize = 1 + random.nextInt(JewelrycraftUtil.jewel.size() - end); + if(JewelrycraftUtil.jewel.size() - 1 - end >= 1) { - ingredient = new ItemStack(Item.emerald, 6 + random.nextInt(32)); - if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 2 + random.nextInt(16)); + int value = end; + if(value > 64) value = 64; + ingredient = new ItemStack(Item.emerald, 2 + random.nextInt(value)); + if(random.nextBoolean()) ingredient2 = new ItemStack(Item.emerald, 2 + random.nextInt(value)); } else { |
