summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/worldGen
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2019-08-22 20:01:40 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2019-08-22 20:01:40 -0400
commit20bef6e26d948698398bd16aeab8c9e6b89110e4 (patch)
tree8a21e17f78b330435f4ce2d4355d72b773230aa7 /src/main/java/darkknight/jewelrycraft/worldGen
parent26fb28edd1ebb6390f8803fed3876d222cb8fdba (diff)
Format/import cleanup
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/worldGen')
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java105
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/Generation.java216
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java6
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java65
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java38
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java53
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java23
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java56
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java123
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java672
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java302
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java10
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java11
13 files changed, 487 insertions, 1193 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java b/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java
index c84696d..fca251c 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java
@@ -17,69 +17,45 @@ import net.minecraftforge.common.ChestGenHooks;
*
*/
public class ChestGeneration {
- static Item[] jewelry = new Item[] {
- ItemList.ring, ItemList.necklace,
- ItemList.bracelet, ItemList.earrings
- };
+ static Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings };
static Random random = new Random();
public static void preInit(FMLPreInitializationEvent e) {
- addItemToDifferentPlaces(new WeightedRandomChestContent(
- new ItemStack(ItemList.thiefGloves), 1, 1,
- 2), true, true, false, false, true);
+ addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(ItemList.thiefGloves), 1, 1, 2), true,
+ true, false, false, true);
- addItemToDifferentPlaces(new WeightedRandomChestContent(
- new ItemStack(ItemList.guide), 1, 1, 7),
- true, true, true, true, true, false, true,
- true);
+ addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(ItemList.guide), 1, 1, 7), true, true,
+ true, true, true, false, true, true);
- addVillageBlacksmithLoot(new WeightedRandomChestContent(
- new ItemStack(ItemList.shadowIngot), 1, 4,
- 5));
+ addVillageBlacksmithLoot(new WeightedRandomChestContent(new ItemStack(ItemList.shadowIngot), 1, 4, 5));
for (int i = 0; i < 16 && i % 3 == 0; i++)
- addItemToDifferentPlaces(
- new WeightedRandomChestContent(
- new ItemStack(BlockList.crystal,
- 1,
- i),
- 1, 3, 3),
+ addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(BlockList.crystal, 1, i), 1, 3, 3),
true, true, true, true);
- ItemStack special = new ItemStack(
- jewelry[random.nextInt(4)]);
+ ItemStack special = new ItemStack(jewelry[random.nextInt(4)]);
int randValue = random.nextInt(4);
if (JewelrycraftUtil.metal.size() > 0) {
- JewelryNBT.addMetal(special, JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size())));
+ JewelryNBT.addMetal(special, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
}
if (JewelrycraftUtil.objects.size() > 0) {
- JewelryNBT.addModifiers(special, JewelrycraftUtil
- .addRandomModifiers(randValue));
+ JewelryNBT.addModifiers(special, JewelrycraftUtil.addRandomModifiers(randValue));
}
if (JewelrycraftUtil.gem.size() > 0) {
- JewelryNBT.addGem(special, JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size())));
+ JewelryNBT.addGem(special, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
}
- addItemToDifferentPlaces(
- new WeightedRandomChestContent(special, 1,
- 1, 1),
- true, true, true, true);
+ addItemToDifferentPlaces(new WeightedRandomChestContent(special, 1, 1, 1), true, true, true, true);
}
/**
- * The booleans determine in which places should the items be
- * added. The order is like so:
+ * The booleans determine in which places should the items be added. The order
+ * is like so:
* <p>
* <ul>
* <li>Dungeon
@@ -93,9 +69,7 @@ public class ChestGeneration {
* </ul>
* <p>
*/
- public static void addItemToDifferentPlaces(
- WeightedRandomChestContent item,
- Boolean... options) {
+ public static void addItemToDifferentPlaces(WeightedRandomChestContent item, Boolean... options) {
if (options.length > 0 && options[0])
addDungeonLoot(item);
if (options.length > 1 && options[1])
@@ -114,54 +88,37 @@ public class ChestGeneration {
addStrongholdLibraryLoot(item);
}
- public static void addDungeonLoot(
- WeightedRandomChestContent item) {
+ public static void addDungeonLoot(WeightedRandomChestContent item) {
ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, item);
}
- public static void addStrongholdLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR,
- item);
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING,
- item);
+ public static void addStrongholdLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, item);
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, item);
}
- public static void addPyramidLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST,
- item);
- ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST,
- item);
+ public static void addPyramidLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, item);
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, item);
}
- public static void addMineshaftLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR,
- item);
+ public static void addMineshaftLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, item);
}
- public static void addVillageBlacksmithLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH,
- item);
+ public static void addVillageBlacksmithLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, item);
}
- public static void addDispenserLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(
- ChestGenHooks.PYRAMID_JUNGLE_DISPENSER,
- item);
+ public static void addDispenserLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, item);
}
- public static void addBonusChestLoot(
- WeightedRandomChestContent item) {
+ public static void addBonusChestLoot(WeightedRandomChestContent item) {
ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, item);
}
- public static void addStrongholdLibraryLoot(
- WeightedRandomChestContent item) {
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY,
- item);
+ public static void addStrongholdLibraryLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, item);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java
index cc7790b..4d39023 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java
@@ -13,85 +13,57 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
public class Generation implements IWorldGenerator {
- public static WorldGenStructure STRUCTURE_1 = new WorldGenStructure1();
- public static WorldGenStructure STRUCTURE_2 = new WorldGenStructure2();
- public static WorldGenStructure STRUCTURE_3 = new WorldGenStructure3();
- public static WorldGenStructure STRUCTURE_4 = new WorldGenStructure4();
- public static WorldGenStructure STRUCTURE_5 = new WorldGenStructure5();
- public static WorldGenStructure STRUCTURE_6 = new WorldGenStructure6();
+ public static WorldGenStructure STRUCTURE_1 = new WorldGenStructure1();
+ public static WorldGenStructure STRUCTURE_2 = new WorldGenStructure2();
+ public static WorldGenStructure STRUCTURE_3 = new WorldGenStructure3();
+ public static WorldGenStructure STRUCTURE_4 = new WorldGenStructure4();
+ public static WorldGenStructure STRUCTURE_5 = new WorldGenStructure5();
+ public static WorldGenStructure STRUCTURE_6 = new WorldGenStructure6();
@Override
- public void generate(Random random, int chunkX, int chunkZ,
- World world, IChunkProvider chunkGenerator,
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
switch (world.provider.dimensionId) {
- case -1:
- generateNether(world, random, chunkX << 4,
- chunkZ << 4);
- break;
- case 0:
- generateSurface(world, random, chunkX << 4,
- chunkZ << 4);
- break;
- case 1:
- generateEnd(world, random, chunkX << 4,
- chunkZ << 4);
- break;
- default:
- generateSurface(world, random, chunkX << 4,
- chunkZ << 4);
- break;
+ case -1:
+ generateNether(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ case 0:
+ generateSurface(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ case 1:
+ generateEnd(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ default:
+ generateSurface(world, random, chunkX << 4, chunkZ << 4);
+ break;
}
}
- private void generateEnd(World world, Random random, int i,
- int j) {
+ private void generateEnd(World world, Random random, int i, int j) {
}
- private void generateSurface(World world, Random random, int i,
- int j) {
+ private void generateSurface(World world, Random random, int i, int j) {
if (ConfigHandler.ENABLE_WORLD_GEN) {
- if (!world.getWorldInfo().getTerrainType()
- .equals(WorldType.FLAT)) {
+ if (!world.getWorldInfo().getTerrainType().equals(WorldType.FLAT)) {
if (ConfigHandler.ORE_GEN)
- generateShadowOre(world, random, i,
- j);
+ generateShadowOre(world, random, i, j);
if (ConfigHandler.CRYSTAL_GEN)
- generateCrystals(world, random, i,
- j);
+ generateCrystals(world, random, i, j);
try {
- for (Field f : this.getClass()
- .getDeclaredFields()) {
+ for (Field f : this.getClass().getDeclaredFields()) {
Object obj = f.get(null);
if (obj instanceof WorldGenStructure
- && ConfigHandler.STRUCTURES[((WorldGenStructure) obj)
- .structureNo()
- - 1])
- if (((WorldGenStructure) obj)
- .isUnderground())
- generateStructureUnderground(
- (WorldGenStructure) obj,
- world,
- random,
- i,
- j,
- ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj)
- .structureNo()
+ && ConfigHandler.STRUCTURES[((WorldGenStructure) obj).structureNo() - 1])
+ if (((WorldGenStructure) obj).isUnderground())
+ generateStructureUnderground((WorldGenStructure) obj, world, random, i, j,
+ ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj).structureNo()
- 1],
- false,
- true);
+ false, true);
else
- generateStructureOverground(
- (WorldGenStructure) obj,
- world,
- random,
- i,
- j,
- ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj)
- .structureNo()
+ generateStructureOverground((WorldGenStructure) obj, world, random, i, j,
+ ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj).structureNo()
- 1],
- false,
- true);
+ false, true);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
@@ -100,33 +72,23 @@ public class Generation implements IWorldGenerator {
}
}
- private void generateNether(World world, Random random, int i,
- int j) {
+ private void generateNether(World world, Random random, int i, int j) {
}
- private void generateShadowOre(World world, Random random, int i,
- int j) {
+ private void generateShadowOre(World world, Random random, int i, int j) {
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);
if (world.getBlock(x, y, z) == Blocks.stone)
- world.setBlock(x, y, z,
- BlockList.shadowOre);
- int randX = random.nextInt(2),
- randY = random.nextInt(1),
- randZ = random.nextInt(2);
- if (random.nextInt(3) == 0 && world.getBlock(
- x + randX, y + randY,
- z + randZ) == Blocks.stone)
- world.setBlock(x + randX, y + randY,
- z + randZ,
- BlockList.shadowOre);
+ world.setBlock(x, y, z, BlockList.shadowOre);
+ int randX = random.nextInt(2), randY = random.nextInt(1), randZ = random.nextInt(2);
+ if (random.nextInt(3) == 0 && world.getBlock(x + randX, y + randY, z + randZ) == Blocks.stone)
+ world.setBlock(x + randX, y + randY, z + randZ, BlockList.shadowOre);
}
}
- private void generateCrystals(World world, Random random, int i,
- int j) {
+ private void generateCrystals(World world, Random random, int i, int j) {
for (int k = 0; k < 16; k++) {
int x = i + random.nextInt(12);
int y = 5 + random.nextInt(64);
@@ -135,113 +97,57 @@ public class Generation implements IWorldGenerator {
int randX = random.nextInt(4);
int randY = random.nextInt(2);
int randZ = random.nextInt(4);
- if (world.getBlock(x + randX,
- y + randY - 1,
- z + randZ) == Blocks.stone
- && world.getBlock(
- x + randX,
- y + randY,
- z + randZ) == Blocks.air)
- world.setBlock(x + randX,
- y + randY,
- z + randZ,
- BlockList.crystal,
- random.nextInt(16),
- 2);
+ if (world.getBlock(x + randX, y + randY - 1, z + randZ) == Blocks.stone
+ && world.getBlock(x + randX, y + randY, z + randZ) == Blocks.air)
+ world.setBlock(x + randX, y + randY, z + randZ, BlockList.crystal, random.nextInt(16), 2);
}
}
}
- private void generateStructureUnderground(
- WorldGenStructure structure, World world,
- Random random, int i, int j, int maxAttempts,
- boolean noOfAttempts, boolean chanceOfSpawning) {
+ private void generateStructureUnderground(WorldGenStructure structure, World world, Random random, int i, int j,
+ int maxAttempts, boolean noOfAttempts, boolean chanceOfSpawning) {
BiomeGenBase biomeBase = world.getBiomeGenForCoords(i, j);
if (noOfAttempts) {
for (int k = 0; k < maxAttempts; k++) {
int x = i + random.nextInt(16);
int y = random.nextInt(64);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y,
- z) == Blocks.stone)
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.stone)
+ structure.generate(world, biomeBase, random, x, y, z);
}
} else if (chanceOfSpawning) {
if (random.nextInt(maxAttempts) == 0) {
int x = i + random.nextInt(16);
int y = random.nextInt(64);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y,
- z) == Blocks.stone)
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.stone)
+ structure.generate(world, biomeBase, random, x, y, z);
}
}
}
- private void generateStructureOverground(
- WorldGenStructure structure, World world,
- Random random, int i, int j, int maxAttempts,
- boolean noOfAttempts, boolean chanceOfSpawning) {
+ private void generateStructureOverground(WorldGenStructure structure, World world, Random random, int i, int j,
+ int maxAttempts, boolean noOfAttempts, boolean chanceOfSpawning) {
BiomeGenBase biomeBase = world.getBiomeGenForCoords(i, j);
if (noOfAttempts) {
for (int k = 0; k < maxAttempts; k++) {
int x = i + random.nextInt(16);
- int y = (world.getChunkHeightMapMinimum(i,
- j) > 0 ? world.getChunkHeightMapMinimum(
- i, j)
- : world.getChunkFromChunkCoords(
- i,
- j).heightMapMinimum
- - 16)
- + random.nextInt(4);
+ int y = (world.getChunkHeightMapMinimum(i, j) > 0 ? world.getChunkHeightMapMinimum(i, j)
+ : world.getChunkFromChunkCoords(i, j).heightMapMinimum - 16) + random.nextInt(4);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.air
- && (world.getBlock(x,
- y - 1,
- z) == Blocks.stone
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.grass))
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.air && (world.getBlock(x, y - 1, z) == Blocks.stone
+ || world.getBlock(x, y - 1, z) == Blocks.sand || world.getBlock(x, y - 1, z) == Blocks.grass))
+ structure.generate(world, biomeBase, random, x, y, z);
}
} else if (chanceOfSpawning) {
if (random.nextInt(maxAttempts) == 0) {
int x = i + random.nextInt(16);
- int y = (world.getChunkHeightMapMinimum(i,
- j) > 0 ? world.getChunkHeightMapMinimum(
- i, j)
- : world.getChunkFromChunkCoords(
- i,
- j).heightMapMinimum
- - 16)
- + random.nextInt(4);
+ int y = (world.getChunkHeightMapMinimum(i, j) > 0 ? world.getChunkHeightMapMinimum(i, j)
+ : world.getChunkFromChunkCoords(i, j).heightMapMinimum - 16) + random.nextInt(4);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.air
- && (world.getBlock(x,
- y - 1,
- z) == Blocks.stone
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.grass)) {
- structure.generate(world,
- biomeBase, random,
- x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.air && (world.getBlock(x, y - 1, z) == Blocks.stone
+ || world.getBlock(x, y - 1, z) == Blocks.sand || world.getBlock(x, y - 1, z) == Blocks.grass)) {
+ structure.generate(world, biomeBase, random, x, y, z);
System.out.println(x + " " + z);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java
index bc4f508..1165de8 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java
@@ -13,14 +13,12 @@ import net.minecraft.world.gen.feature.WorldGenerator;
* @author Sorin
*/
public class WorldGenStructure extends WorldGenerator {
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
return false;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java
index 9e86822..11fcf18 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java
@@ -22,37 +22,21 @@ import net.minecraft.world.biome.BiomeGenBase;
*/
public class WorldGenStructure1 extends WorldGenStructure {
public static final WeightedRandomItem[] items = new WeightedRandomItem[] {
- new WeightedRandomItem(new ItemStack(
- ItemList.thiefGloves), 10),
- new WeightedRandomItem(
- new ItemStack(Items.golden_apple),
- 8),
- new WeightedRandomItem(new ItemStack(
- Items.golden_apple, 1, 1), 1),
- new WeightedRandomItem(
- new ItemStack(ItemList.guide), 20),
- new WeightedRandomItem(new ItemStack(
- ItemList.shadowIngot), 25),
- new WeightedRandomItem(
- new ItemStack(BlockList.shadowEye),
- 2),
- new WeightedRandomItem(
- new ItemStack(Items.nether_star),
- 1),
- new WeightedRandomItem(new ItemStack(
- BlockList.shadowBlock), 2),
- new WeightedRandomItem(
- new ItemStack(BlockList.crystal),
- 16, 20)
- };
+ new WeightedRandomItem(new ItemStack(ItemList.thiefGloves), 10),
+ new WeightedRandomItem(new ItemStack(Items.golden_apple), 8),
+ new WeightedRandomItem(new ItemStack(Items.golden_apple, 1, 1), 1),
+ new WeightedRandomItem(new ItemStack(ItemList.guide), 20),
+ new WeightedRandomItem(new ItemStack(ItemList.shadowIngot), 25),
+ new WeightedRandomItem(new ItemStack(BlockList.shadowEye), 2),
+ new WeightedRandomItem(new ItemStack(Items.nether_star), 1),
+ new WeightedRandomItem(new ItemStack(BlockList.shadowBlock), 2),
+ new WeightedRandomItem(new ItemStack(BlockList.crystal), 16, 20) };
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
block = Blocks.sandstone;
metadata = 2;
slabMeta = 1;
@@ -60,36 +44,25 @@ public class WorldGenStructure1 extends WorldGenStructure {
for (int i = -2; i <= 2; i++)
for (int j = -1; j <= 4; j++)
for (int k = -2; k <= 2; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -2; i <= 2; i++)
for (int k = -2; k <= 2; k++) {
- world.setBlock(x + i, y - 1, z + k, block,
- metadata, 2);
- if (i % 2 == 0 && k % 2 == 0 && i != 0
- && k != 0)
- world.setBlock(x + i, y, z + k,
- BlockList.crystal);
+ world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
+ if (i % 2 == 0 && k % 2 == 0 && i != 0 && k != 0)
+ world.setBlock(x + i, y, z + k, BlockList.crystal);
}
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.stone_slab,
- slabMeta, 2);
+ world.setBlock(x + i, y, z + k, Blocks.stone_slab, slabMeta, 2);
world.setBlock(x, y, z, block, metadata, 2);
world.setBlock(x, y + 1, z, BlockList.handPedestal, 6, 2);
- TileEntityHandPedestal pedestal = (TileEntityHandPedestal) world
- .getTileEntity(x, y + 1, z);
- pedestal.setHeldItemStack(
- ((WeightedRandomItem) WeightedRandom
- .getRandomItem(rand,
- items)).getItem(rand));
+ TileEntityHandPedestal pedestal = (TileEntityHandPedestal) world.getTileEntity(x, y + 1, z);
+ pedestal.setHeldItemStack(((WeightedRandomItem) WeightedRandom.getRandomItem(rand, items)).getItem(rand));
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java
index b61b9cd..3c304b0 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java
@@ -18,60 +18,42 @@ import net.minecraft.world.biome.BiomeGenBase;
*/
public class WorldGenStructure2 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block block = Blocks.stonebrick;
Block stair = Blocks.stone_brick_stairs;
int metadata = 0;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
block = Blocks.sandstone;
stair = Blocks.sandstone_stairs;
metadata = 2;
}
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.air);
+ world.setBlock(x + i, y, z + k, Blocks.air);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y - 1, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y, z + k, stair);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i, y,
- z + k,
- (k == -1) ? 3
- : (k == 0) ? (i == 1)
- ? 0
- : 1
- : 2,
- 2);
+ world.setBlockMetadataWithNotify(x + i, y, z + k, (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2, 2);
world.setBlock(x, y, z, Blocks.air);
ItemStack stack = new ItemStack(ItemList.bucket);
- JewelryNBT.addMetal(stack, JewelrycraftUtil.metal.get(rand
- .nextInt(JewelrycraftUtil.metal.size())));
+ JewelryNBT.addMetal(stack, JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
if (stack != null && JewelryNBT.ingot(stack) != null) {
if (!world.isRemote)
world.func_147480_a(x, y, z, true);
- world.setBlock(x, y, z, BlockList.moltenMetal, 0,
- 3);
- if (BlockMoltenMetal.getTileEntity(world, x, y,
- z) != null)
- BlockMoltenMetal.getTileEntity(world, x, y,
- z)
- .setMetal(JewelryNBT.ingot(
- stack));
+ world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
+ if (BlockMoltenMetal.getTileEntity(world, x, y, z) != null)
+ BlockMoltenMetal.getTileEntity(world, x, y, z).setMetal(JewelryNBT.ingot(stack));
}
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java
index 5eafd03..0af7443 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java
@@ -17,83 +17,54 @@ import net.minecraftforge.common.DungeonHooks;
*/
public class WorldGenStructure3 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block slab = Blocks.stone_slab;
Block stair = Blocks.stone_brick_stairs;
int slabMeta = 13;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
stair = Blocks.sandstone_stairs;
slabMeta = 9;
}
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 2; j++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y - 1, z + k, slab,
- slabMeta, 1);
+ world.setBlock(x + i, y - 1, z + k, slab, slabMeta, 1);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y, z + k, stair);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i, y,
- z + k,
- (k == -1) ? 3
- : (k == 0) ? (i == 1)
- ? 0
- : 1
- : 2,
- 2);
+ world.setBlockMetadataWithNotify(x + i, y, z + k, (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2, 2);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y + 1, z + k, stair);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i,
- y + 1, z + k,
- (k == -1) ? 7
- : (k == 0) ? (i == 1)
- ? 4
- : 5
- : 6,
+ world.setBlockMetadataWithNotify(x + i, y + 1, z + k, (k == -1) ? 7 : (k == 0) ? (i == 1) ? 4 : 5 : 6,
2);
slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills)
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills)
slabMeta = 1;
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + 2, z + k, slab,
- slabMeta, 2);
+ world.setBlock(x + i, y + 2, z + k, slab, slabMeta, 2);
world.setBlock(x, y, z, Blocks.mob_spawner);
world.setBlock(x, y + 1, z, Blocks.mob_spawner);
for (int l = 0; l < 2; l++) {
- TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world
- .getTileEntity(x, y + l, z);
+ TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world.getTileEntity(x, y + l, z);
if (tileentitymobspawner != null)
- tileentitymobspawner.func_145881_a()
- .setEntityName(DungeonHooks
- .getRandomDungeonMob(
- rand));
+ tileentitymobspawner.func_145881_a().setEntityName(DungeonHooks.getRandomDungeonMob(rand));
else
- System.err.println(
- "Failed to fetch mob spawner entity at ("
- + x + ", "
- + (y + l)
- + ", " + z
- + ")");
+ System.err.println("Failed to fetch mob spawner entity at (" + x + ", " + (y + l) + ", " + z + ")");
}
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java
index 2dc2544..78eb883 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java
@@ -16,13 +16,11 @@ import net.minecraft.world.biome.BiomeGenBase;
*/
public class WorldGenStructure4 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block stair = Blocks.stone_brick_stairs;
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
stair = Blocks.sandstone_stairs;
block = Blocks.sandstone;
metadata = 2;
@@ -31,13 +29,10 @@ public class WorldGenStructure4 extends WorldGenStructure {
for (int i = -1; i <= 1; i++)
for (int j = 0; j <= 3; j++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.stone_slab,
- slabMeta, 2);
+ world.setBlock(x + i, y, z + k, Blocks.stone_slab, slabMeta, 2);
world.setBlock(x, y, z, block, metadata, 2);
world.setBlock(x, y, z - 1, stair, 3, 1);
world.setBlock(x, y, z + 1, stair, 2, 1);
@@ -49,23 +44,19 @@ public class WorldGenStructure4 extends WorldGenStructure {
world.setBlock(x + 1, y + 1, z, stair, 4, 1);
world.setBlock(x, y + 1, z, BlockList.shadowBlock);
slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills)
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills)
slabMeta = 1;
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
if (i == 0 || k == 0)
- world.setBlock(x + i, y + 2, z + k,
- Blocks.stone_slab,
- slabMeta, 2);
+ world.setBlock(x + i, y + 2, z + k, Blocks.stone_slab, slabMeta, 2);
world.setBlock(x, y + 2, z, block, metadata, 2);
world.setBlock(x, y + 3, z, BlockList.crystal);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java
index 16782af..5208aa0 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java
@@ -21,14 +21,12 @@ import net.minecraft.world.biome.BiomeGenBase;
*/
public class WorldGenStructure5 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block slab = Blocks.stone_slab;
Block stair = Blocks.stone_brick_stairs;
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert
- || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
stair = Blocks.sandstone_stairs;
block = Blocks.sandstone;
metadata = 2;
@@ -37,30 +35,23 @@ public class WorldGenStructure5 extends WorldGenStructure {
for (int i = -2; i <= 2; i++)
for (int j = 0; j <= 3; j++)
for (int k = -3; k <= -1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -5; i <= -3; i++)
for (int k = -3; k <= 2; k++)
- world.setBlock(x + i, y, z + k,
- Blocks.air);
+ world.setBlock(x + i, y, z + k, Blocks.air);
for (int i = -2; i <= 2; i++)
for (int k = -3; k <= -1; k++)
- world.setBlock(x + i, y, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y, z + k, block, metadata, 2);
for (int i = 1; i <= 2; i++)
for (int k = -3; k <= -1; k++)
- world.setBlock(x + i, y + 1, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y + 1, z + k, block, metadata, 2);
for (int i = -5; i <= -3; i++)
for (int k = -3; k <= 2; k++)
- world.setBlock(x + i, y - 1, z + k, block,
- metadata, 2);
+ world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
for (int i = -5; i <= -3; i++)
for (int k = -3; k <= 2; k++)
- if ((i != -4 || k <= -3 || k >= 2)
- && !(i == -3 && k == -2))
- world.setBlock(x + i, y, z + k,
- slab, slabMeta, 2);
+ if ((i != -4 || k <= -3 || k >= 2) && !(i == -3 && k == -2))
+ world.setBlock(x + i, y, z + k, slab, slabMeta, 2);
world.setBlock(x - 3, y, z - 1, stair, 0, 2);
world.setBlock(x - 3, y, z - 3, stair, 0, 2);
world.setBlock(x - 2, y + 1, z - 3, slab, slabMeta, 2);
@@ -72,37 +63,24 @@ public class WorldGenStructure5 extends WorldGenStructure {
world.setBlock(x + 1, y + 2, z - 3, slab, slabMeta, 2);
world.setBlock(x + 1, y + 2, z - 1, slab, slabMeta, 2);
for (int k = -3; k <= -1; k++)
- world.setBlock(x + 2, y + 2, z + k, block,
- metadata, 2);
+ world.setBlock(x + 2, y + 2, z + k, block, metadata, 2);
if (rand.nextInt(5) == 0) {
ItemStack stack = new ItemStack(ItemList.bucket);
- JewelryNBT.addMetal(stack,
- new ItemStack(Items.gold_ingot));
- if (stack != null && JewelryNBT
- .ingot(stack) != null) {
+ JewelryNBT.addMetal(stack, new ItemStack(Items.gold_ingot));
+ if (stack != null && JewelryNBT.ingot(stack) != null) {
if (!world.isRemote)
world.func_147480_a(x, y, z, true);
- world.setBlock(x + 1, y + 2, z - 2,
- BlockList.moltenMetal, 0,
- 3);
- if (BlockMoltenMetal.getTileEntity(world,
- x + 1, y + 2,
- z - 2) != null)
- BlockMoltenMetal.getTileEntity(
- world, x + 1,
- y + 2, z - 2)
- .setMetal(JewelryNBT
- .ingot(stack));
+ world.setBlock(x + 1, y + 2, z - 2, BlockList.moltenMetal, 0, 3);
+ if (BlockMoltenMetal.getTileEntity(world, x + 1, y + 2, z - 2) != null)
+ BlockMoltenMetal.getTileEntity(world, x + 1, y + 2, z - 2).setMetal(JewelryNBT.ingot(stack));
}
} else
- world.setBlock(x + 1, y + 2, z - 2, Blocks.water,
- 0, 3);
+ world.setBlock(x + 1, y + 2, z - 2, Blocks.water, 0, 3);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java
index ec85f35..8196bd4 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java
@@ -29,116 +29,75 @@ import net.minecraft.world.biome.BiomeGenBase;
*/
public class WorldGenStructure6 extends WorldGenStructure {
@Override
- public boolean generate(World world, BiomeGenBase biome,
- Random rand, int x, int y, int z) {
+ public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
int randBlock, randBlockMeta;
Block block;
for (int i = -2; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int k = -2; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k,
- Blocks.air);
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
for (int i = -2; i <= 1; i++)
for (int k = -2; k <= 1; k++) {
randBlock = rand.nextInt(4);
switch (randBlock) {
- case 0:
- block = Blocks.cobblestone;
- randBlockMeta = 0;
- break;
- case 1:
- block = Blocks.stonebrick;
- randBlockMeta = 2;
- break;
- case 2:
- block = Blocks.stonebrick;
- randBlockMeta = 0;
- break;
- default:
- block = Blocks.cobblestone;
- randBlockMeta = 0;
- break;
+ case 0:
+ block = Blocks.cobblestone;
+ randBlockMeta = 0;
+ break;
+ case 1:
+ block = Blocks.stonebrick;
+ randBlockMeta = 2;
+ break;
+ case 2:
+ block = Blocks.stonebrick;
+ randBlockMeta = 0;
+ break;
+ default:
+ block = Blocks.cobblestone;
+ randBlockMeta = 0;
+ break;
}
- world.setBlock(x + i, y - 1, z + k, block,
- randBlockMeta, 2);
+ world.setBlock(x + i, y - 1, z + k, block, randBlockMeta, 2);
}
int crystalCol = rand.nextInt(15);
world.setBlock(x - 2, y, z - 2, BlockList.crystal, 0, 2);
- world.setBlock(x - 2, y, z + 1, BlockList.crystal,
- 1 + crystalCol, 2);
- world.setBlock(x + 1, y, z - 2, BlockList.crystal,
- 1 + crystalCol, 2);
+ world.setBlock(x - 2, y, z + 1, BlockList.crystal, 1 + crystalCol, 2);
+ world.setBlock(x + 1, y, z - 2, BlockList.crystal, 1 + crystalCol, 2);
world.setBlock(x + 1, y, z + 1, BlockList.crystal, 0, 2);
world.setBlock(x - 1, y, z - 1, Blocks.skull, 1, 2);
- TileEntity tileentity = world.getTileEntity(x - 1, y,
- z - 1);
- if (tileentity != null
- && tileentity instanceof TileEntitySkull) {
- ((TileEntitySkull) tileentity).func_152107_a(
- rand.nextInt(50) == 0 ? 1 : 0);
- ((TileEntitySkull) tileentity).func_145903_a(
- MathHelper.floor_double(
- (double) (rand.nextInt(
- 361)
- * 16.0F
- / 360.0F)
- + 0.5D)
- & 15);
- ((BlockSkull) Blocks.skull).func_149965_a(world,
- x - 1, y, z - 1,
- (TileEntitySkull) tileentity);
+ TileEntity tileentity = world.getTileEntity(x - 1, y, z - 1);
+ if (tileentity != null && tileentity instanceof TileEntitySkull) {
+ ((TileEntitySkull) tileentity).func_152107_a(rand.nextInt(50) == 0 ? 1 : 0);
+ ((TileEntitySkull) tileentity)
+ .func_145903_a(MathHelper.floor_double((double) (rand.nextInt(361) * 16.0F / 360.0F) + 0.5D) & 15);
+ ((BlockSkull) Blocks.skull).func_149965_a(world, x - 1, y, z - 1, (TileEntitySkull) tileentity);
}
- world.setBlock(x + 1, y, z - 1,
- BlockList.jewelCraftingTable, 3, 2);
- TileEntity jewelersTable = world.getTileEntity(x + 1, y,
- z - 1);
- Item[] jewelry = new Item[] {
- ItemList.ring, ItemList.necklace,
- ItemList.bracelet, ItemList.earrings
- };
- if (jewelersTable != null
- && jewelersTable instanceof TileEntityJewelrsCraftingTable) {
+ world.setBlock(x + 1, y, z - 1, BlockList.jewelCraftingTable, 3, 2);
+ TileEntity jewelersTable = world.getTileEntity(x + 1, y, z - 1);
+ Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings };
+ if (jewelersTable != null && jewelersTable instanceof TileEntityJewelrsCraftingTable) {
if (rand.nextBoolean())
((TileEntityJewelrsCraftingTable) jewelersTable)
- .setGemItemStack(
- JewelrycraftUtil.gem
- .get(rand.nextInt(
- JewelrycraftUtil.gem
- .size())));
+ .setGemItemStack(JewelrycraftUtil.gem.get(rand.nextInt(JewelrycraftUtil.gem.size())));
else if (rand.nextBoolean()) {
- ItemStack result = new ItemStack(
- jewelry[rand.nextInt(4)],
- 1, 0);
+ ItemStack result = new ItemStack(jewelry[rand.nextInt(4)], 1, 0);
if (JewelrycraftUtil.metal.size() > 0)
JewelryNBT.addMetal(result,
- JewelrycraftUtil.metal
- .get(rand.nextInt(
- JewelrycraftUtil.metal
- .size())));
- ((TileEntityJewelrsCraftingTable) jewelersTable)
- .setJewelryItemStack(
- result);
+ JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
+ ((TileEntityJewelrsCraftingTable) jewelersTable).setJewelryItemStack(result);
}
}
- world.setBlock(x - 1, y, z + 1, BlockList.handPedestal, 0,
- 2);
+ world.setBlock(x - 1, y, z + 1, BlockList.handPedestal, 0, 2);
TileEntity pedestal = world.getTileEntity(x - 1, y, z + 1);
- if (pedestal != null
- && pedestal instanceof TileEntityHandPedestal)
- ((TileEntityHandPedestal) pedestal)
- .setHeldItemStack(
- ((WeightedRandomItem) WeightedRandom
- .getRandomItem(rand,
- WorldGenStructure1.items))
- .getItem(rand));
- world.setBlock(x - 1, y + 1, z + 1, BlockList.shadowEye, 0,
- 2);
+ if (pedestal != null && pedestal instanceof TileEntityHandPedestal)
+ ((TileEntityHandPedestal) pedestal).setHeldItemStack(
+ ((WeightedRandomItem) WeightedRandom.getRandomItem(rand, WorldGenStructure1.items)).getItem(rand));
+ world.setBlock(x - 1, y + 1, z + 1, BlockList.shadowEye, 0, 2);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y,
- int z) {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
index c5d0cc2..0580f57 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
@@ -33,497 +33,264 @@ public class ComponentJewelry extends StructureVillagePieces.House1 {
public ComponentJewelry() {
}
- public ComponentJewelry(Start par1ComponentVillageStartPiece,
- int par2, Random par3Random,
- StructureBoundingBox par4StructureBoundingBox,
- int par5) {
+ public ComponentJewelry(Start par1ComponentVillageStartPiece, int par2, Random par3Random,
+ StructureBoundingBox par4StructureBoundingBox, int par5) {
super();
coordBaseMode = par5;
boundingBox = par4StructureBoundingBox;
}
@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);
+ 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);
return canVillageGoDeeper(structureboundingbox)
- && StructureComponent.findIntersecting(
- pieces,
- structureboundingbox) == null
- ? new ComponentJewelry(
- villagePiece,
- p5,
- random,
- structureboundingbox,
- p4)
- : null;
+ && StructureComponent.findIntersecting(pieces, structureboundingbox) == null
+ ? new ComponentJewelry(villagePiece, p5, random, structureboundingbox, p4)
+ : null;
}
@Override
- public boolean addComponentParts(World world, Random random,
- StructureBoundingBox sbb) {
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb) {
if (averageGroundLevel < 0) {
- averageGroundLevel = getAverageGroundLevel(world,
- sbb);
+ averageGroundLevel = getAverageGroundLevel(world, sbb);
if (averageGroundLevel < 0)
return true;
- boundingBox.offset(0, averageGroundLevel
- - boundingBox.maxY + 3, 0);
+ boundingBox.offset(0, averageGroundLevel - boundingBox.maxY + 3, 0);
}
- 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);
+ 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
- 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);
+ 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
- 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);
+ 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++)
- placeBlockAtCurrentPosition(world,
- Blocks.wooden_slab, 2, i,
- 4, j, sbb);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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++) {
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, i, 4,
- 6, sbb);
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, i + 8,
- 4, 6, sbb);
+ 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++) {
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, 0, 4,
- i, sbb);
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, 10, 4,
- i, sbb);
+ 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++)
- placeBlockAtCurrentPosition(world,
- Blocks.double_stone_slab, 0, i, 4,
- 11, sbb);
+ 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++)
- placeBlockAtCurrentPosition(world,
- Blocks.planks, 1, i, 0, j,
- sbb);
- fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11,
- Blocks.stonebrick, Blocks.stonebrick,
- false);
+ 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);
+ 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);
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb);
}
// Decorations
- 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);
+ 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++)
- placeBlockAtCurrentPosition(world,
- Blocks.carpet,
- bgCarpetColor, i, 1, j,
- sbb);
- generateChest(world, 3, 1, 1, 0, random, sbb,
- ConfigHandler.GEM_CHEST_MIN,
- ConfigHandler.GEM_CHEST_MAX);
- 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.GEM_CHEST_MIN,
- ConfigHandler.GEM_CHEST_MAX);
- generateFurnace(world, 1, 1, 7, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 2, 7, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 3, 7, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 1, 10, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 2, 10, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 3, 10, 0, random, sbb,
- ConfigHandler.FURNACE_MIN_INGOT_STACK,
- ConfigHandler.FURNACE_MAX_INGOT_STACK,
- ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- 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(),
+ placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb);
+ generateChest(world, 3, 1, 1, 0, random, sbb, ConfigHandler.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
+ 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.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
+ generateFurnace(world, 1, 1, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 2, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 3, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 1, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 2, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 3, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateSmelter(world, 1, 1, 8, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb,
random.nextBoolean());
- generateMolder(world, 2, 1, 9,
- 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.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 7, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
if (random.nextBoolean())
- generateIngotChest(world, 9, 1, 8, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 8, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
if (random.nextBoolean())
- generateIngotChest(world, 9, 1, 9, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 9, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
if (random.nextBoolean())
- generateIngotChest(world, 9, 1, 10, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
else
- generateOresChest(world, 9, 1, 10, 0, random, sbb,
- ConfigHandler.INGOT_CHEST_MIN,
- ConfigHandler.INGOT_CHEST_MAX,
- Blocks.trapped_chest,
- ConfigHandler.INGOT_CHEST_MAX_STACK);
+ generateOresChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
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);
+ 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) {
- clearCurrentPositionBlocksUpwards(world,
- i1, 9, l, sbb);
- func_151554_b(world, Blocks.cobblestone, 0,
- i1, -1, l, sbb);
+ clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
+ func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
spawnVillagers(world, sbb, 3, 1, 3, 1);
return true;
}
- public void generateChest(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, int min, int max) {
+ public void generateChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb,
+ int min, int max) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, Blocks.chest,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world
- .getTileEntity(i1, j1, k1);
- while (chest != null && t > 0
- && JewelrycraftUtil.gem
- .size() > 0) {
- ItemStack jewels = JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size()));
- chest.func_145976_a(StatCollector
- .translateToLocal(
- "jeweler." + Variables.MODID
- + ".jewelerchest"));
- if (jewels.getItem() == Items.nether_star
- && ConfigHandler.GENERATE_VILLAGE_NETHERSTAR)
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- jewels);
- else if (random.nextBoolean()
- && jewels.getItem() != Items.nether_star)
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- jewels);
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0 && JewelrycraftUtil.gem.size() > 0) {
+ ItemStack jewels = JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size()));
+ chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".jewelerchest"));
+ if (jewels.getItem() == Items.nether_star && ConfigHandler.GENERATE_VILLAGE_NETHERSTAR)
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
+ else if (random.nextBoolean() && jewels.getItem() != Items.nether_star)
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
t--;
}
}
}
}
- 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) {
+ 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 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, chestB,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world
- .getTileEntity(i1, j1, k1);
- while (chest != null && t > 0
- && JewelrycraftUtil.metal
- .size() > 0) {
- chest.func_145976_a(StatCollector
- .translateToLocal(
- "jeweler." + Variables.MODID
- + ".ingotchest"));
- int metalID = random.nextInt(
- JewelrycraftUtil.metal
- .size());
- ItemStack metal = JewelrycraftUtil.metal
- .get(metalID)
- .copy();
- metal.stackSize = 2 + random
- .nextInt(randomAmount);
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0 && JewelrycraftUtil.metal.size() > 0) {
+ chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".ingotchest"));
+ int metalID = random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ metal.stackSize = 2 + random.nextInt(randomAmount);
if (random.nextBoolean())
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- metal);
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), metal);
t--;
}
}
}
}
- 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) {
+ 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 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, chestB,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world
- .getTileEntity(i1, j1, k1);
- while (chest != null && t > 0
- && JewelrycraftUtil.ores
- .size() > 0) {
- chest.func_145976_a(StatCollector
- .translateToLocal(
- "jeweler." + Variables.MODID
- + ".orechest"));
- int oreID = random.nextInt(
- JewelrycraftUtil.ores
- .size());
- ItemStack ores = JewelrycraftUtil.ores
- .get(oreID).copy();
- ores.stackSize = 2 + random
- .nextInt(randomAmount);
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0 && JewelrycraftUtil.ores.size() > 0) {
+ chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".orechest"));
+ int oreID = random.nextInt(JewelrycraftUtil.ores.size());
+ ItemStack ores = JewelrycraftUtil.ores.get(oreID).copy();
+ ores.stackSize = 2 + random.nextInt(randomAmount);
if (random.nextBoolean())
- chest.setInventorySlotContents(
- random.nextInt(chest
- .getSizeInventory()),
- ores);
+ chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), ores);
t--;
}
}
}
}
- public void generateDisplayer(World world, int i, int j, int k,
- int metadata, Random random,
+ public void generateDisplayer(World world, int i, int j, int k, int metadata, Random random,
StructureBoundingBox sbb) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.displayer,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.displayer, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityDisplayer displayer = (TileEntityDisplayer) world
- .getTileEntity(i1, j1, k1);
+ 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)]);
+ Item[] jewels = { ItemList.ring, ItemList.necklace };
+ ItemStack jewel = new ItemStack(jewels[random.nextInt(jewels.length)]);
if (JewelrycraftUtil.metal.size() > 0)
JewelryNBT.addMetal(jewel,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size())));
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
if (JewelrycraftUtil.objects.size() > 0)
- JewelryNBT.addModifiers(jewel,
- JewelrycraftUtil.addRandomModifiers(
- random.nextInt(4)));
+ JewelryNBT.addModifiers(jewel, JewelrycraftUtil.addRandomModifiers(random.nextInt(4)));
if (JewelrycraftUtil.gem.size() > 0)
- JewelryNBT.addGem(jewel,
- JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size())));
+ JewelryNBT.addGem(jewel, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
displayer.object = jewel;
displayer.quantity = 1;
displayer.hasObject = true;
@@ -531,103 +298,55 @@ public class ComponentJewelry extends StructureVillagePieces.House1 {
}
}
- public void generateSmelter(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, boolean isEmpty) {
+ public void generateSmelter(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb,
+ boolean isEmpty) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.smelter,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.smelter, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntitySmelter smelter = (TileEntitySmelter) world
- .getTileEntity(i1, j1, k1);
- if (smelter != null && !isEmpty
- && JewelrycraftUtil.metal
- .size() > 0) {
- int metal = random.nextInt(
- JewelrycraftUtil.metal
- .size());
- smelter.moltenMetal = JewelrycraftUtil.metal
- .get(metal).copy();
- smelter.hasMoltenMetal = random
- .nextBoolean();
+ TileEntitySmelter smelter = (TileEntitySmelter) world.getTileEntity(i1, j1, k1);
+ if (smelter != null && !isEmpty && JewelrycraftUtil.metal.size() > 0) {
+ int metal = random.nextInt(JewelrycraftUtil.metal.size());
+ smelter.moltenMetal = JewelrycraftUtil.metal.get(metal).copy();
+ smelter.hasMoltenMetal = random.nextBoolean();
float quantity = random.nextFloat();
if (smelter.hasMoltenMetal)
- smelter.quantity = quantity < 0.9F
- ? 0.1F + Math.round(
- quantity * 10)
- / 10
- : Math.round(quantity
- * 10)
- / 10;
+ smelter.quantity = quantity < 0.9F ? 0.1F + Math.round(quantity * 10) / 10
+ : Math.round(quantity * 10) / 10;
}
}
}
- public void generateMolder(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, boolean hasMold,
- boolean hasStuff) {
+ public void generateMolder(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb,
+ boolean hasMold, boolean hasStuff) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.molder,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityMolder molder = (TileEntityMolder) world
- .getTileEntity(i1, j1, k1);
+ TileEntityMolder molder = (TileEntityMolder) world.getTileEntity(i1, j1, k1);
if (molder != null && !molder.hasMold)
if (hasMold) {
- int meta = random.nextInt(
- ItemMolds.moldsItemNames.length
- - 1);
- molder.mold = new ItemStack(
- ItemList.molds, 1,
- meta + 1);
+ int meta = random.nextInt(ItemMolds.moldsItemNames.length - 1);
+ molder.mold = new ItemStack(ItemList.molds, 1, meta + 1);
molder.hasMold = true;
- if (hasStuff && JewelrycraftUtil.metal
- .size() > 0) {
- ItemStack ring = new ItemStack(
- ItemList.ring);
+ if (hasStuff && JewelrycraftUtil.metal.size() > 0) {
+ 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());
+ 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()));
+ .get(random.nextInt(JewelrycraftUtil.metal.size()));
else if (meta == 1)
molder.jewelBase = ring;
else if (meta == 2)
@@ -642,37 +361,22 @@ public class ComponentJewelry extends StructureVillagePieces.House1 {
}
}
- public void generateFurnace(World world, int i, int j, int k,
- int metadata, Random random,
- StructureBoundingBox sbb, int min, int max,
- boolean 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 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, Blocks.furnace,
- metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.furnace, metadata, i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityFurnace furnace = (TileEntityFurnace) world
- .getTileEntity(i1, j1, k1);
+ 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 && JewelrycraftUtil.metal
- .size() > 0) {
- int metalID = random.nextInt(
- JewelrycraftUtil.metal
- .size());
- ItemStack metal = JewelrycraftUtil.metal
- .get(metalID)
- .copy();
- metal.stackSize = random.nextInt(
- max - min + 1)
- + min;
- furnace.setInventorySlotContents(2,
- metal);
+ furnace.setInventorySlotContents(1, new ItemStack(Items.coal, 1 + random.nextInt(16)));
+ if (hasMetal && JewelrycraftUtil.metal.size() > 0) {
+ int metalID = random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ metal.stackSize = random.nextInt(max - min + 1) + min;
+ furnace.setInventorySlotContents(2, metal);
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
index d905948..f23dee6 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
@@ -17,10 +17,7 @@ import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
public class JCTrades implements IVillageTradeHandler {
- Item[] jewelry = new Item[] {
- ItemList.ring, ItemList.necklace,
- ItemList.bracelet, ItemList.earrings
- };
+ Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings };
public JCTrades() {
super();
@@ -32,227 +29,112 @@ public class JCTrades implements IVillageTradeHandler {
* @param random
*/
@Override
- public void manipulateTradesForVillager(EntityVillager villager,
- MerchantRecipeList recipeList, Random random) {
+ public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
if (villager.getProfession() == 3000) {
ItemStack ingredient = null;
ItemStack ingredient2 = null;
ItemStack result;
int type = random.nextInt(12);
switch (type) {
- case 0:
- if (JewelrycraftUtil.metal
- .size() > 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: {
- 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: {
- int number = random.nextInt(3);
- result = new ItemStack(
- BlockList.displayer,
- 1 + number);
- 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: {
- result = new ItemStack(
- BlockList.jewelCraftingTable);
- ingredient = new ItemStack(
- Items.emerald,
- 1 + random.nextInt(
- 2));
+ case 0:
+ if (JewelrycraftUtil.metal.size() > 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,
- 1 + random.nextInt(
- 2));
+ ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2));
break;
}
- 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: {
- 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: {
- 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:
- if (JewelrycraftUtil.gem
- .size() > 0) {
- 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) {
- int value = 1 + 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 {
- ingredient = new ItemStack(
- Blocks.emerald_block,
- 16 + random.nextInt(
- 32));
- ingredient2 = new ItemStack(
- Blocks.emerald_block,
- 8 + random.nextInt(
- 48));
- }
- break;
- }
- case 8:
- if (JewelrycraftUtil.ores
- .size() > 0) {
- result = JewelrycraftUtil.ores
- .get(random.nextInt(
- JewelrycraftUtil.ores
- .size()));
- result.stackSize = 3
- + random.nextInt(
- 3);
- ingredient = new ItemStack(
- Items.emerald,
- 2 + random.nextInt(
- 5));
+ 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: {
+ int number = random.nextInt(3);
+ result = new ItemStack(BlockList.displayer, 1 + number);
+ 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: {
+ 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: {
+ 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: {
+ 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: {
+ 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:
+ if (JewelrycraftUtil.gem.size() > 0) {
+ 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) {
+ int value = 1 + 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(
- 6));
- break;
+ ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(value));
+ } else {
+ ingredient = new ItemStack(Blocks.emerald_block, 16 + random.nextInt(32));
+ ingredient2 = new ItemStack(Blocks.emerald_block, 8 + random.nextInt(48));
}
- case 9: {
- result = new ItemStack(
- ItemList.guide, 1);
- ingredient = new ItemStack(
- Items.emerald, 1);
break;
}
- default: {
- result = new ItemStack(
- jewelry[random.nextInt(
- 4)],
- 1, 0);
- int randValue = random.nextInt(4);
- if (JewelrycraftUtil.metal
- .size() > 0)
- JewelryNBT.addMetal(result,
- JewelrycraftUtil.metal
- .get(random.nextInt(
- JewelrycraftUtil.metal
- .size())));
- if (JewelrycraftUtil.objects
- .size() > 0)
- JewelryNBT.addModifiers(
- result,
- JewelrycraftUtil.addRandomModifiers(
- randValue));
- if (JewelrycraftUtil.gem
- .size() > 0)
- JewelryNBT.addGem(result,
- JewelrycraftUtil.gem
- .get(random.nextInt(
- JewelrycraftUtil.gem
- .size())));
- ingredient = new ItemStack(
- Items.emerald,
- 16 + random.nextInt(
- 20));
- ingredient2 = new ItemStack(
- Blocks.emerald_block,
- 2 + randValue);
+ case 8:
+ if (JewelrycraftUtil.ores.size() > 0) {
+ 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: {
+ result = new ItemStack(ItemList.guide, 1);
+ ingredient = new ItemStack(Items.emerald, 1);
+ break;
+ }
+ default: {
+ result = new ItemStack(jewelry[random.nextInt(4)], 1, 0);
+ int randValue = random.nextInt(4);
+ if (JewelrycraftUtil.metal.size() > 0)
+ JewelryNBT.addMetal(result,
+ JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
+ if (JewelrycraftUtil.objects.size() > 0)
+ JewelryNBT.addModifiers(result, JewelrycraftUtil.addRandomModifiers(randValue));
+ if (JewelrycraftUtil.gem.size() > 0)
+ JewelryNBT.addGem(result, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
+ ingredient = new ItemStack(Items.emerald, 16 + random.nextInt(20));
+ ingredient2 = new ItemStack(Blocks.emerald_block, 2 + randValue);
+ }
}
- recipeList.addToListWithCheck(new MerchantRecipe(
- ingredient, ingredient2, result));
+ recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
}
}
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java
index 0a4b832..49c2d37 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java
@@ -12,14 +12,10 @@ import net.minecraft.world.gen.structure.MapGenStructureIO;
public class VillageHandler {
public static void preInit(FMLPreInitializationEvent e) {
VillagerRegistry.instance().registerVillagerId(3000);
- VillagerRegistry.instance().registerVillageTradeHandler(
- 3000, new JCTrades());
- VillagerRegistry.instance().registerVillageCreationHandler(
- new VillageJewelryHandler());
+ VillagerRegistry.instance().registerVillageTradeHandler(3000, new JCTrades());
+ VillagerRegistry.instance().registerVillageCreationHandler(new VillageJewelryHandler());
try {
- MapGenStructureIO.func_143031_a(
- ComponentJewelry.class,
- Variables.MODID + ":Jewelry");
+ MapGenStructureIO.func_143031_a(ComponentJewelry.class, Variables.MODID + ":Jewelry");
} catch (Throwable thrw) {
JewelrycraftMod.logger.error(
"Error registering Jewelrycraft Structures with Vanilla Minecraft: this is expected in versions earlier than 1.7.10");
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
index 3b9c274..4953461 100755
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
@@ -17,8 +17,7 @@ public class VillageJewelryHandler implements IVillageCreationHandler {
*/
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
- return new PieceWeight(ComponentJewelry.class,
- ConfigHandler.JEWELER_WEIGHT,
+ return new PieceWeight(ComponentJewelry.class, ConfigHandler.JEWELER_WEIGHT,
ConfigHandler.MAX_VILLAGE_JEWELERS);
}
@@ -43,10 +42,8 @@ public class VillageJewelryHandler implements IVillageCreationHandler {
* @return
*/
@Override
- public Object buildComponent(PieceWeight villagePiece,
- Start startPiece, 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);
+ public Object buildComponent(PieceWeight villagePiece, Start startPiece, 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);
}
} \ No newline at end of file