From 420faddca46e70e3a70def168fb4e452ef193b0d Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 21 Feb 2015 21:31:16 +0000 Subject: Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :) --- .../jewelrycraft/worldGen/Generation.java | 39 +- .../worldGen/village/ComponentJewelry.java | 512 ++++++++++++--------- .../jewelrycraft/worldGen/village/JCTrades.java | 58 +-- .../worldGen/village/VillageJewelryHandler.java | 27 +- 4 files changed, 366 insertions(+), 270 deletions(-) (limited to 'java/darkknight/jewelrycraft/worldGen') diff --git a/java/darkknight/jewelrycraft/worldGen/Generation.java b/java/darkknight/jewelrycraft/worldGen/Generation.java index bb6d3f2..5992273 100644 --- a/java/darkknight/jewelrycraft/worldGen/Generation.java +++ b/java/darkknight/jewelrycraft/worldGen/Generation.java @@ -1,7 +1,6 @@ package darkknight.jewelrycraft.worldGen; import java.util.Random; - import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -10,10 +9,19 @@ import darkknight.jewelrycraft.block.BlockList; public class Generation implements IWorldGenerator { + + /** + * @param random + * @param chunkX + * @param chunkZ + * @param world + * @param chunkGenerator + * @param chunkProvider + */ @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { - switch (world.provider.dimensionId) + switch(world.provider.dimensionId) { case -1: generateNether(world, random, chunkX << 4, chunkZ << 4); @@ -27,14 +35,24 @@ public class Generation implements IWorldGenerator } } + /** + * @param world + * @param random + * @param i + * @param j + */ private void generateEnd(World world, Random random, int i, int j) - { - } + {} + /** + * @param world + * @param random + * @param i + * @param j + */ private void generateSurface(World world, Random random, int i, int j) { - for (int k = 0; k < 1; k++) - { + for(int k = 0; k < 1; k++){ int x = i + random.nextInt(16); int y = 5 + random.nextInt(4); int z = j + random.nextInt(16); @@ -44,7 +62,12 @@ public class Generation implements IWorldGenerator } } + /** + * @param world + * @param random + * @param i + * @param j + */ private void generateNether(World world, Random random, int i, int j) - { - } + {} } diff --git a/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java index f07a4a6..6083049 100644 --- a/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java +++ b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java @@ -2,7 +2,6 @@ package darkknight.jewelrycraft.worldGen.village; import java.util.List; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -29,18 +28,38 @@ public class ComponentJewelry extends StructureVillagePieces.House1 { private int averageGroundLevel = -1; + /** + * + */ public ComponentJewelry() - { - } + {} + /** + * @param par1ComponentVillageStartPiece + * @param par2 + * @param par3Random + * @param par4StructureBoundingBox + * @param par5 + */ public ComponentJewelry(Start par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) { super(); - this.coordBaseMode = par5; - this.boundingBox = par4StructureBoundingBox; + coordBaseMode = par5; + boundingBox = par4StructureBoundingBox; } - @SuppressWarnings("rawtypes") + /** + * @param villagePiece + * @param pieces + * @param random + * @param p1 + * @param p2 + * @param p3 + * @param p4 + * @param p5 + * @return + */ + @SuppressWarnings ("rawtypes") public static ComponentJewelry buildComponent(Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) { StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 11, 5, 12, p4); @@ -48,191 +67,162 @@ public class ComponentJewelry extends StructureVillagePieces.House1 } /** - * second Part of Structure generating, this for example places Spiderwebs, - * Mob Spawners, it closes Mineshafts at the end, it adds Fences... + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences... + * + * @param world + * @param random + * @param sbb + * @return */ + @Override public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb) { - if (this.averageGroundLevel < 0) - { - this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); - - if (this.averageGroundLevel < 0) { return true; } - - this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 3, 0); + if (averageGroundLevel < 0){ + averageGroundLevel = getAverageGroundLevel(world, sbb); + if (averageGroundLevel < 0) return true; + boundingBox.offset(0, averageGroundLevel - boundingBox.maxY + 3, 0); } - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, - * int minY, int minZ, int maxX, int maxY, int maxZ, int placeBlockId, - * int replaceBlockId, boolean alwaysreplace) + * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace) */ - this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11, Block.getBlockById(0), Block.getBlockById(0), false); - this.fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0), Block.getBlockById(0), false); + fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11, Block.getBlockById(0), Block.getBlockById(0), false); + fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0), Block.getBlockById(0), false); // Pillars - this.fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log, Blocks.log, false); - this.fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log, Blocks.log, false); - this.fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log, Blocks.log, false); - this.fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log, Blocks.log, false); - + fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log, Blocks.log, false); + fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log, Blocks.log, false); + fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log, Blocks.log, false); + fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log, Blocks.log, false); // Walls - this.fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks, Blocks.planks, false); - this.fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks, Blocks.planks, false); - this.fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks, Blocks.planks, false); - this.fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks, Blocks.planks, false); - this.fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks, Blocks.planks, false); - - this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone, Blocks.cobblestone, false); - this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false); - this.fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false); - this.fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false); - + fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks, Blocks.planks, false); + fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks, Blocks.planks, false); + fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks, Blocks.planks, false); + fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks, Blocks.planks, false); + fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks, Blocks.planks, false); + fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone, Blocks.cobblestone, false); + fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false); + fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false); + fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false); // Roof - for (int i = 3; i <= 7; i++) - for (int j = 1; j <= 5; j++) - this.placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2, i, 4, j, sbb); - - for (int i = 3; i <= 7; i++) - for (int j = 6; j <= 6; j++) - this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i, 4, j, sbb); - - for (int i = 1; i <= 9; i++) - for (int j = 7; j <= 10; j++) - this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i, 4, j, sbb); - - for (int i = 2; i <= 8; i++) - this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, i, 4, 0, sbb); - - for (int i = 1; i <= 5; i++) - { - this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 2, 4, i, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 8, 4, i, sbb); + for(int i = 3; i <= 7; i++) + for(int j = 1; j <= 5; j++) + placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2, i, 4, j, sbb); + for(int i = 3; i <= 7; i++) + for(int j = 6; j <= 6; j++) + placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i, 4, j, sbb); + for(int i = 1; i <= 9; i++) + for(int j = 7; j <= 10; j++) + placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i, 4, j, sbb); + for(int i = 2; i <= 8; i++) + placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, i, 4, 0, sbb); + for(int i = 1; i <= 5; i++){ + placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 2, 4, i, sbb); + placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 8, 4, i, sbb); } - - for (int i = 0; i <= 2; i++) - { - this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 6, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i + 8, 4, 6, sbb); + for(int i = 0; i <= 2; i++){ + placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 6, sbb); + placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i + 8, 4, 6, sbb); } - - for (int i = 7; i <= 11; i++) - { - this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 0, 4, i, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 10, 4, i, sbb); + for(int i = 7; i <= 11; i++){ + placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 0, 4, i, sbb); + placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 10, 4, i, sbb); } - - for (int i = 0; i <= 10; i++) - this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 11, sbb); - + for(int i = 0; i <= 10; i++) + placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 11, sbb); // Base - for (int i = 2; i <= 8; i++) - for (int j = 0; j <= 5; j++) - this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0, j, sbb); - this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick, Blocks.stonebrick, false); - - for (int i = 6; i <= 10; i++) - this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 5, 0, i, sbb); - - for (int i = 7; i <= 10; i++) - { - this.placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb); + for(int i = 2; i <= 8; i++) + for(int j = 0; j <= 5; j++) + placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0, j, sbb); + fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick, Blocks.stonebrick, false); + for(int i = 6; i <= 10; i++) + placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 5, 0, i, sbb); + for(int i = 7; i <= 10; i++){ + placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb); + placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb); } - // Decorations - this.placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0, this.getMetadataWithOffset(Blocks.wooden_door, 1)); - this.placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6, this.getMetadataWithOffset(Blocks.wooden_door, 1)); - - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 2, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 4, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 5, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 1, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5, sbb); - - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3, 1, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3, 3, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3, 3, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 5, sbb); - - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 7, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 10, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 8, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 9, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 8, sbb); - this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 9, sbb); - + placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0, getMetadataWithOffset(Blocks.wooden_door, 1)); + placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6, getMetadataWithOffset(Blocks.wooden_door, 1)); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 2, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 4, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 5, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 1, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4, sbb); + placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3, 1, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3, 3, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3, 3, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 5, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 7, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 10, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 8, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 9, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 8, sbb); + placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 9, sbb); int bgCarpetColor = random.nextInt(16); - - for (int i = 4; i <= 7; i++) - for (int j = 1; j <= 5; j++) - this.placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb); - + for(int i = 4; i <= 7; i++) + for(int j = 1; j <= 5; j++) + placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb); generateChest(world, 3, 1, 1, 0, random, sbb, ConfigHandler.jewelsChestMin, ConfigHandler.jewelsChestMax); - generateDisplayer(world, 3, 1, 2, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb); - placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, 3, 1, 3, sbb); - generateDisplayer(world, 3, 1, 4, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb); + generateDisplayer(world, 3, 1, 2, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb); + placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, 3, 1, 3, sbb); + generateDisplayer(world, 3, 1, 4, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb); generateChest(world, 3, 1, 5, 0, random, sbb, ConfigHandler.jewelsChestMin, ConfigHandler.jewelsChestMax); - generateFurnace(world, 1, 1, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots); generateFurnace(world, 1, 2, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots); generateFurnace(world, 1, 3, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots); generateFurnace(world, 1, 1, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots); generateFurnace(world, 1, 2, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots); generateFurnace(world, 1, 3, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots); - - 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()); - - 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()); - - if(random.nextBoolean()) generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack); + 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()); + 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()); + if (random.nextBoolean()) generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack); else generateOresChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack); - if(random.nextBoolean()) generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack); + if (random.nextBoolean()) generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack); else generateOresChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack); - if(random.nextBoolean()) generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack); + if (random.nextBoolean()) generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack); else generateOresChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack); - if(random.nextBoolean()) generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack); + if (random.nextBoolean()) generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack); else generateOresChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack); - - for (int l = 0; l < 6; ++l) - { - for (int i1 = 2; i1 < 9; ++i1) - { - this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb); - this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb); + for(int l = 0; l < 6; ++l) + for(int i1 = 2; i1 < 9; ++i1){ + clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb); + func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb); } - } - - for (int l = 6; l < 12; ++l) - { - for (int i1 = 0; i1 < 11; ++i1) - { - this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb); - this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb); + for(int l = 6; l < 12; ++l) + for(int i1 = 0; i1 < 11; ++i1){ + clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb); + func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb); } - } - - this.spawnVillagers(world, sbb, 3, 1, 3, 1); - + spawnVillagers(world, sbb, 3, 1, 3, 1); return true; } + /** + * @param world + * @param i + * @param j + * @param k + * @param metadata + * @param random + * @param sbb + * @param min + * @param max + */ public void generateChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max) { - int i1 = this.getXWithOffset(i, k); - int j1 = this.getYWithOffset(j); - int k1 = this.getZWithOffset(i, k); + int i1 = getXWithOffset(i, k); + int j1 = getYWithOffset(j); + int k1 = getZWithOffset(i, k); int t = random.nextInt(max - min + 1) + min; - this.placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb); - TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1); - while (chest != null && t > 0) - { + placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb); + TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1); + while (chest != null && t > 0){ ItemStack jewels = JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())); chest.func_145976_a("Jeweler's Chest"); if (jewels.getItem() == Items.nether_star && ConfigHandler.generateVillageNetherstar) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels); @@ -241,16 +231,28 @@ public class ComponentJewelry extends StructureVillagePieces.House1 } } + /** + * @param world + * @param i + * @param j + * @param k + * @param metadata + * @param random + * @param sbb + * @param min + * @param max + * @param chestB + * @param randomAmount + */ 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 i1 = getXWithOffset(i, k); + int j1 = getYWithOffset(j); + int k1 = getZWithOffset(i, k); int t = random.nextInt(max - min + 1) + min; - this.placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb); - TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1); - while (chest != null && t > 0) - { + placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb); + TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1); + while (chest != null && t > 0){ chest.func_145976_a("Ingot Chest"); int metalID = random.nextInt(JewelrycraftUtil.metal.size()); ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy(); @@ -260,16 +262,28 @@ public class ComponentJewelry extends StructureVillagePieces.House1 } } + /** + * @param world + * @param i + * @param j + * @param k + * @param metadata + * @param random + * @param sbb + * @param min + * @param max + * @param chestB + * @param randomAmount + */ public void generateOresChest(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 i1 = getXWithOffset(i, k); + int j1 = getYWithOffset(j); + int k1 = getZWithOffset(i, k); int t = random.nextInt(max - min + 1) + min; - this.placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb); - TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1); - while (chest != null && t > 0) - { + placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb); + TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1); + while (chest != null && t > 0){ chest.func_145976_a("Ores Chest"); int oreID = random.nextInt(JewelrycraftUtil.ores.size()); ItemStack ores = JewelrycraftUtil.ores.get(oreID).copy(); @@ -279,15 +293,23 @@ public class ComponentJewelry extends StructureVillagePieces.House1 } } + /** + * @param world + * @param i + * @param j + * @param k + * @param metadata + * @param random + * @param sbb + */ public void generateDisplayer(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb) { - int i1 = this.getXWithOffset(i, k); - int j1 = this.getYWithOffset(j); - int k1 = this.getZWithOffset(i, k); + int i1 = getXWithOffset(i, k); + int j1 = getYWithOffset(j); + int k1 = getZWithOffset(i, k); placeBlockAtCurrentPosition(world, BlockList.displayer, metadata, i, j, k, sbb); - TileEntityDisplayer displayer = (TileEntityDisplayer) world.getTileEntity(i1, j1, k1); - if (displayer != null) - { + TileEntityDisplayer displayer = (TileEntityDisplayer)world.getTileEntity(i1, j1, k1); + if (displayer != null){ Item[] jewels = {ItemList.ring, ItemList.necklace}; ItemStack jewel = new ItemStack(jewels[random.nextInt(jewels.length)]); JewelryNBT.addMetal(jewel, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()))); @@ -299,76 +321,117 @@ public class ComponentJewelry extends StructureVillagePieces.House1 } } + /** + * @param world + * @param i + * @param j + * @param k + * @param metadata + * @param random + * @param sbb + * @param isEmpty + */ public void generateSmelter(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean isEmpty) { - int i1 = this.getXWithOffset(i, k); - int j1 = this.getYWithOffset(j); - int k1 = this.getZWithOffset(i, k); + int i1 = getXWithOffset(i, k); + int j1 = getYWithOffset(j); + int k1 = getZWithOffset(i, k); placeBlockAtCurrentPosition(world, BlockList.smelter, metadata, i, j, k, sbb); - TileEntitySmelter smelter = (TileEntitySmelter) world.getTileEntity(i1, j1, k1); - if (smelter != null && !isEmpty) - { + TileEntitySmelter smelter = (TileEntitySmelter)world.getTileEntity(i1, j1, k1); + if (smelter != null && !isEmpty){ int metal = random.nextInt(JewelrycraftUtil.metal.size()); smelter.moltenMetal = JewelrycraftUtil.metal.get(metal).copy(); smelter.hasMoltenMetal = true; int quantity = random.nextInt(9); switch(quantity) { - case 0: smelter.quantity = 0.1f; - case 1: smelter.quantity = 0.2f; - case 2: smelter.quantity = 0.3f; - case 3: smelter.quantity = 0.4f; - case 4: smelter.quantity = 0.5f; - case 5: smelter.quantity = 0.6f; - case 6: smelter.quantity = 0.7f; - case 7: smelter.quantity = 0.8f; - case 8: smelter.quantity = 0.9f; - default: smelter.quantity = 0.1f; + case 0: + smelter.quantity = 0.1f; + case 1: + smelter.quantity = 0.2f; + case 2: + smelter.quantity = 0.3f; + case 3: + smelter.quantity = 0.4f; + case 4: + smelter.quantity = 0.5f; + case 5: + smelter.quantity = 0.6f; + case 6: + smelter.quantity = 0.7f; + case 7: + smelter.quantity = 0.8f; + case 8: + smelter.quantity = 0.9f; + default: + smelter.quantity = 0.1f; } } } + /** + * @param world + * @param i + * @param j + * @param k + * @param metadata + * @param random + * @param sbb + * @param hasMold + * @param hasStuff + */ public void generateMolder(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean hasMold, boolean hasStuff) { - int i1 = this.getXWithOffset(i, k); - int j1 = this.getYWithOffset(j); - int k1 = this.getZWithOffset(i, k); + int i1 = getXWithOffset(i, k); + int j1 = getYWithOffset(j); + int k1 = getZWithOffset(i, k); placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i, j, k, sbb); - TileEntityMolder molder = (TileEntityMolder) world.getTileEntity(i1, j1, k1); - if (molder != null) - { - if (hasMold) - { - int meta = random.nextInt(ItemMolds.moldsItemNames.length + 1); - molder.mold = new ItemStack(ItemList.molds, 1, meta); - molder.hasMold = true; - if (hasStuff) - { - ItemStack ring = new ItemStack(ItemList.ring); - JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy()); - ItemStack necklace = new ItemStack(ItemList.necklace); - JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy()); - if (meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())); - else if (meta == 1) molder.jewelBase = ring; - else molder.jewelBase = necklace; - molder.hasJewelBase = true; - } + TileEntityMolder molder = (TileEntityMolder)world.getTileEntity(i1, j1, k1); + if (molder != null) if (hasMold){ + int meta = random.nextInt(ItemMolds.moldsItemNames.length + 1); + molder.mold = new ItemStack(ItemList.molds, 1, meta); + molder.hasMold = true; + if (hasStuff){ + ItemStack ring = new ItemStack(ItemList.ring); + JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy()); + ItemStack necklace = new ItemStack(ItemList.necklace); + JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy()); + ItemStack bracelet = new ItemStack(ItemList.bracelet); + JewelryNBT.addMetal(bracelet, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy()); + ItemStack earrings = new ItemStack(ItemList.earrings); + JewelryNBT.addMetal(earrings, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy()); + if (meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())); + else if (meta == 1) molder.jewelBase = ring; + else if (meta == 2) molder.jewelBase = necklace; + else if (meta == 3) molder.jewelBase = bracelet; + else if (meta == 4) molder.jewelBase = earrings; + molder.hasJewelBase = true; } } } + /** + * @param world + * @param i + * @param j + * @param k + * @param metadata + * @param random + * @param sbb + * @param min + * @param max + * @param hasMetal + */ public void generateFurnace(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, boolean hasMetal) { - int i1 = this.getXWithOffset(i, k); - int j1 = this.getYWithOffset(j); - int k1 = this.getZWithOffset(i, k); + int i1 = getXWithOffset(i, k); + int j1 = getYWithOffset(j); + int k1 = getZWithOffset(i, k); placeBlockAtCurrentPosition(world, Blocks.furnace, metadata, i, j, k, sbb); - TileEntityFurnace furnace = (TileEntityFurnace) world.getTileEntity(i1, j1, k1); - if (furnace != null) - { + TileEntityFurnace furnace = (TileEntityFurnace)world.getTileEntity(i1, j1, k1); + if (furnace != null){ if (random.nextBoolean()) furnace.setInventorySlotContents(1, new ItemStack(Items.coal, 1 + random.nextInt(16))); - if (hasMetal) - { + if (hasMetal){ int metalID = random.nextInt(JewelrycraftUtil.metal.size()); ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy(); metal.stackSize = random.nextInt(max - min + 1) + min; @@ -378,9 +441,12 @@ public class ComponentJewelry extends StructureVillagePieces.House1 } /** - * Returns the villager type to spawn in this component, based on the number - * of villagers already spawned. + * Returns the villager type to spawn in this component, based on the number of villagers already spawned. + * + * @param par1 + * @return */ + @Override protected int getVillagerType(int par1) { return 3000; diff --git a/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java b/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java index 1d474b0..a3f7158 100644 --- a/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java +++ b/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java @@ -1,7 +1,6 @@ package darkknight.jewelrycraft.worldGen.village; import java.util.Random; - import net.minecraft.entity.passive.EntityVillager; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -18,109 +17,101 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil; public class JCTrades implements IVillageTradeHandler { + /** + * + */ public JCTrades() { super(); } + /** + * @param villager + * @param recipeList + * @param random + */ @Override public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - if (villager.getProfession() == 3000) - { + if (villager.getProfession() == 3000){ ItemStack ingredient = null; ItemStack ingredient2 = null; ItemStack result; - int type = random.nextInt(12); - switch (type) + switch(type) { - case 0: - { + case 0:{ result = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())); result.stackSize = 5 + random.nextInt(5); ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(7)); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2)); break; } - case 1: - { + case 1:{ result = new ItemStack(ItemList.molds, 5 + random.nextInt(7), random.nextInt(ItemMolds.moldsItemNames.length)); ingredient = new ItemStack(Items.emerald, 1); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2)); break; } - case 2: - { + case 2:{ int number = random.nextInt(3); result = new ItemStack(BlockList.displayer, 1 + number); - ingredient = new ItemStack(Blocks.emerald_block, 2 + number*3 + random.nextInt(2)); + ingredient = new ItemStack(Blocks.emerald_block, 2 + number * 3 + random.nextInt(2)); ingredient2 = new ItemStack(Items.emerald, 3 + number + random.nextInt(8)); break; } - case 3: - { + case 3:{ result = new ItemStack(BlockList.jewelCraftingTable); ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2)); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2)); break; } - case 4: - { + case 4:{ result = new ItemStack(BlockList.shadowOre, 1 + random.nextInt(6)); ingredient = new ItemStack(Items.emerald, 3 + random.nextInt(4)); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(4)); break; } - case 5: - { + case 5:{ result = new ItemStack(BlockList.molder, 5 + random.nextInt(5)); ingredient = new ItemStack(Items.emerald, 1); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1); break; } - case 6: - { + case 6:{ result = new ItemStack(BlockList.smelter); ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2)); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2)); break; } - case 7: - { + case 7:{ int end = random.nextInt(JewelrycraftUtil.gem.size()); result = JewelrycraftUtil.gem.get(end); result.stackSize = 1 + random.nextInt(JewelrycraftUtil.gem.size() - end); - if (JewelrycraftUtil.gem.size() - 1 - end >= 1) - { + if (JewelrycraftUtil.gem.size() - 1 - end >= 1){ int value = end; if (value > 64) value = 64; ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(value)); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(value)); - } - else - { + }else{ ingredient = new ItemStack(Blocks.emerald_block, 16 + random.nextInt(32)); ingredient2 = new ItemStack(Blocks.emerald_block, 8 + random.nextInt(48)); } break; } - case 8: - { + case 8:{ result = JewelrycraftUtil.ores.get(random.nextInt(JewelrycraftUtil.ores.size())); result.stackSize = 3 + random.nextInt(3); ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(5)); if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(6)); break; } - case 9: - { + case 9:{ result = new ItemStack(ItemList.guide, 1); ingredient = new ItemStack(Items.emerald, 1); break; } - default: - { + default:{ result = new ItemStack(ItemList.ring, 1, 0); int randValue = random.nextInt(4); JewelryNBT.addMetal(result, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()))); @@ -130,7 +121,6 @@ public class JCTrades implements IVillageTradeHandler ingredient2 = new ItemStack(Blocks.emerald_block, 2 + randValue); } } - recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result)); } } diff --git a/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java b/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java index e12fde1..a2c3d62 100644 --- a/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java +++ b/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java @@ -2,10 +2,6 @@ package darkknight.jewelrycraft.worldGen.village; import java.util.List; import java.util.Random; - -import net.minecraft.world.gen.structure.StructureVillagePieces.House1; -import net.minecraft.world.gen.structure.StructureStart; -import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight; import net.minecraft.world.gen.structure.StructureVillagePieces.Start; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; @@ -13,20 +9,41 @@ import darkknight.jewelrycraft.config.ConfigHandler; public class VillageJewelryHandler implements IVillageCreationHandler { + + /** + * @param random + * @param i + * @return + */ @Override public PieceWeight getVillagePieceWeight(Random random, int i) { return new PieceWeight(ComponentJewelry.class, ConfigHandler.jewelerWeight, ConfigHandler.maxVillageJewelers); } + /** + * @return + */ @Override public Class getComponentClass() { return ComponentJewelry.class; } + /** + * @param villagePiece + * @param startPiece + * @param pieces + * @param random + * @param p1 + * @param p2 + * @param p3 + * @param p4 + * @param p5 + * @return + */ @Override - public Object buildComponent(PieceWeight villagePiece, Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1, int p2, int p3, int p4, int p5) + public Object buildComponent(PieceWeight villagePiece, Start startPiece, @SuppressWarnings ("rawtypes") List pieces, Random random, int p1, int p2, int p3, int p4, int p5) { return ComponentJewelry.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5); } -- cgit v1.2.3