aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-07-09 18:28:20 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-07-09 18:28:20 +1000
commit641c635cdad2b93cebfaad94c70235a2bcd179f1 (patch)
treeb7dee4bbf7a46027a70cacf6aef5ed033f6b076a
parent0b14ec3f1d19c936819316ba924074dc8de4cb2e (diff)
downloadGT5-Unofficial-641c635cdad2b93cebfaad94c70235a2bcd179f1.tar.gz
GT5-Unofficial-641c635cdad2b93cebfaad94c70235a2bcd179f1.tar.bz2
GT5-Unofficial-641c635cdad2b93cebfaad94c70235a2bcd179f1.zip
% Changed the Villagers the spawn in Outback/Desert biomes to be exclusively Natives.
% Tweaked debug tool to not remove GT ores and tiles. % Changed the hut the natives get, it's now more of an igloo shape. $ Fixed BoP Issue with Australia Generation.
-rw-r--r--src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java637
-rw-r--r--src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java162
-rw-r--r--src/Java/gtPlusPlus/australia/gen/map/MapGenVillageLogging.java73
-rw-r--r--src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java257
-rw-r--r--src/Java/gtPlusPlus/australia/gen/map/component/ComponentShack.java80
-rw-r--r--src/Java/gtPlusPlus/australia/world/AustraliaWorldGenerator.java6
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java10
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java4
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java549
9 files changed, 1246 insertions, 532 deletions
diff --git a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java
index a7622028e2..071b5ab589 100644
--- a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java
+++ b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java
@@ -8,9 +8,9 @@ import java.util.Map;
import java.util.Random;
import cpw.mods.fml.common.eventhandler.Event.Result;
+import cpw.mods.fml.common.registry.VillagerRegistry;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.australia.gen.map.MapGenLargeRavine;
-import gtPlusPlus.australia.gen.map.MapGenVillageLogging;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling;
import net.minecraft.entity.EnumCreatureType;
@@ -63,10 +63,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
*/
// private MapGenStronghold strongholdGenerator = new
// MapGenStronghold();
- /**
- * Holds Village Generator
- */
- private MapGenVillageLogging villageGenerator = new MapGenVillageLogging();
+
/**
* Holds Mineshaft Generator
*/
@@ -83,54 +80,45 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
double[] doubleArray1;
double[] doubleArray2;
double[] doubleArray3;
- double[] doubleArray4;
+ double[] doubleArray4;
int[][] field_73219_j = new int[32][32];
Map map;
- //Some Init Field?
+ // Some Init Field?
{
-
List<BiomeGenBase> y = new ArrayList<BiomeGenBase>();
- for (Object r : MapGenVillage.villageSpawnBiomes.toArray()) {
- if (r instanceof BiomeGenBase) {
- y.add((BiomeGenBase) r);
- }
- }
- for (BiomeGenBase h : y) {
+ for (BiomeGenBase h : gtPlusPlus.australia.gen.map.MapGenExtendedVillage.villageSpawnBiomes) {
if (!MapGenVillage.villageSpawnBiomes.contains(h)) {
if (h instanceof BiomeGenBase) {
- y.add(h);
+ MapGenVillage.villageSpawnBiomes.add(h);
}
}
}
- if (!MapGenVillage.villageSpawnBiomes.toArray().equals(y.toArray())) {
- MapGenVillage.villageSpawnBiomes = y;
- }
-
- /*if (map == null) {
- map = FlatGeneratorInfo.createFlatGeneratorFromString("abcdefg12345678").getWorldFeatures();
- }*/
-
- /*if (map != null && map.containsKey("village")){
- Map map1 = (Map)map.get("village");
- if (!map1.containsKey("size"))
- {
- map1.put("size", "10");
- }
- villageGenerator = new MapGenExtendedVillage(map1);
- villageGenerator = (MapGenExtendedVillage) TerrainGen.getModdedMapGen(villageGenerator,
- net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE);
- Logger.INFO("Registered Valid Chunk Provider for Custom Villages.");
- }
- else {
- Logger.INFO("Failed to register Valid Chunk Provider for Custom Villages.");
- }*/
-
- villageGenerator = (MapGenVillageLogging) TerrainGen.getModdedMapGen(villageGenerator,
- net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE);
+ /*
+ * if (map == null) { map =
+ * FlatGeneratorInfo.createFlatGeneratorFromString("abcdefg12345678").
+ * getWorldFeatures(); }
+ */
+
+ /*
+ * if (map != null && map.containsKey("village")){ Map map1 =
+ * (Map)map.get("village"); if (!map1.containsKey("size")) { map1.put("size",
+ * "10"); } villageGenerator = new MapGenExtendedVillage(map1); villageGenerator
+ * = (MapGenExtendedVillage) TerrainGen.getModdedMapGen(villageGenerator,
+ * net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE);
+ * Logger.INFO("Registered Valid Chunk Provider for Custom Villages."); } else {
+ * Logger.INFO("Failed to register Valid Chunk Provider for Custom Villages.");
+ * }
+ */
+
+ /*
+ * villageGenerator = (MapGenVillageLogging)
+ * TerrainGen.getModdedMapGen(villageGenerator,
+ * net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE);
+ */
caveGenerator = TerrainGen.getModdedMapGen(caveGenerator,
net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE);
mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator,
@@ -141,7 +129,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE);
}
- public ChunkProviderAustralia(World par1World, long par2) {
+ public ChunkProviderAustralia(World par1World, long par2) {
super(par1World, par2, true);
this.worldObj = par1World;
this.worldType = par1World.getWorldInfo().getTerrainType();
@@ -156,40 +144,38 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
this.field_147434_q = new double[2500];
this.parabolicField = new float[25];
for (int j = -2; j <= 2; j++) {
- for (int k = -2; k <= 2; k++)
- {
+ for (int k = -2; k <= 2; k++) {
float f = 10.0F / MathHelper.sqrt_float(j * j + k * k + 0.2F);
this.parabolicField[(j + 2 + (k + 2) * 5)] = f;
}
}
- NoiseGenerator[] noiseGens = { this.noiseGen1, this.noiseGen2, this.noiseGen3, this.noiseGen4, this.noiseGen5, this.noiseGen6, this.mobSpawnerNoise };
+ NoiseGenerator[] noiseGens = { this.noiseGen1, this.noiseGen2, this.noiseGen3, this.noiseGen4, this.noiseGen5,
+ this.noiseGen6, this.mobSpawnerNoise };
noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
- this.noiseGen1 = ((NoiseGeneratorOctaves)noiseGens[0]);
- this.noiseGen2 = ((NoiseGeneratorOctaves)noiseGens[1]);
- this.noiseGen3 = ((NoiseGeneratorOctaves)noiseGens[2]);
- this.noiseGen4 = ((NoiseGeneratorPerlin)noiseGens[3]);
- this.noiseGen5 = ((NoiseGeneratorOctaves)noiseGens[4]);
- this.noiseGen6 = ((NoiseGeneratorOctaves)noiseGens[5]);
- this.mobSpawnerNoise = ((NoiseGeneratorOctaves)noiseGens[6]);
+ this.noiseGen1 = ((NoiseGeneratorOctaves) noiseGens[0]);
+ this.noiseGen2 = ((NoiseGeneratorOctaves) noiseGens[1]);
+ this.noiseGen3 = ((NoiseGeneratorOctaves) noiseGens[2]);
+ this.noiseGen4 = ((NoiseGeneratorPerlin) noiseGens[3]);
+ this.noiseGen5 = ((NoiseGeneratorOctaves) noiseGens[4]);
+ this.noiseGen6 = ((NoiseGeneratorOctaves) noiseGens[5]);
+ this.mobSpawnerNoise = ((NoiseGeneratorOctaves) noiseGens[6]);
}
public void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_) {
byte b0 = 63;
- this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_147424_1_ * 4 - 2, p_147424_2_ * 4 - 2, 10, 10);
+ this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration,
+ p_147424_1_ * 4 - 2, p_147424_2_ * 4 - 2, 10, 10);
func_147423_a(p_147424_1_ * 4, 0, p_147424_2_ * 4);
- for (int k = 0; k < 4; k++)
- {
+ for (int k = 0; k < 4; k++) {
int l = k * 5;
int i1 = (k + 1) * 5;
- for (int j1 = 0; j1 < 4; j1++)
- {
+ for (int j1 = 0; j1 < 4; j1++) {
int k1 = (l + j1) * 33;
int l1 = (l + j1 + 1) * 33;
int i2 = (i1 + j1) * 33;
int j2 = (i1 + j1 + 1) * 33;
- for (int k2 = 0; k2 < 32; k2++)
- {
+ for (int k2 = 0; k2 < 32; k2++) {
double d0 = 0.125D;
double d1 = this.field_147434_q[(k1 + k2)];
double d2 = this.field_147434_q[(l1 + k2)];
@@ -199,15 +185,13 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
double d6 = (this.field_147434_q[(l1 + k2 + 1)] - d2) * d0;
double d7 = (this.field_147434_q[(i2 + k2 + 1)] - d3) * d0;
double d8 = (this.field_147434_q[(j2 + k2 + 1)] - d4) * d0;
- for (int l2 = 0; l2 < 8; l2++)
- {
+ for (int l2 = 0; l2 < 8; l2++) {
double d9 = 0.25D;
double d10 = d1;
double d11 = d2;
double d12 = (d3 - d1) * d9;
double d13 = (d4 - d2) * d9;
- for (int i3 = 0; i3 < 4; i3++)
- {
+ for (int i3 = 0; i3 < 4; i3++) {
int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2;
short short1 = 256;
j3 -= short1;
@@ -236,19 +220,22 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
}
}
- public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_) {
- ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_5_);
+ public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_,
+ BiomeGenBase[] p_147422_5_) {
+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_,
+ p_147422_2_, p_147422_3_, p_147422_5_);
MinecraftForge.EVENT_BUS.post(event);
if (event.getResult() == Result.DENY) {
return;
}
double d0 = 0.03125D;
- this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, p_147422_1_ * 16, p_147422_2_ * 16, 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
+ this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, p_147422_1_ * 16, p_147422_2_ * 16, 16, 16,
+ d0 * 2.0D, d0 * 2.0D, 1.0D);
for (int k = 0; k < 16; k++) {
- for (int l = 0; l < 16; l++)
- {
+ for (int l = 0; l < 16; l++) {
BiomeGenBase biomegenbase = p_147422_5_[(l + k * 16)];
- biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[(l + k * 16)]);
+ biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k,
+ p_147422_2_ * 16 + l, this.stoneNoise[(l + k * 16)]);
}
}
}
@@ -262,63 +249,70 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
}
/**
- * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
- * specified chunk from the map seed and chunk seed
+ * Will return back a chunk, if it doesn't exist and its not a MP client it will
+ * generates all the blocks for the specified chunk from the map seed and chunk
+ * seed
*/
@Override
- public Chunk provideChunk(int x, int z)
- {
- rand.setSeed(x * 341873128712L + z * 132897987541L);
- Block[] ablock = new Block[65536];
- byte[] abyte = new byte[65536];
- generateTerrain(x, z, ablock);
- biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, x * 16, z * 16, 16, 16);
- replaceBlocksForBiome(x, z, ablock, abyte, biomesForGeneration);
-
- caveGenerator.func_151539_a(this, worldObj, x, z, ablock);
- caveGenerator.func_151539_a(this, worldObj, x, z, ablock);
- ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
- ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
- ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
- ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
- villageGenerator.func_151539_a(this, worldObj, x, z, ablock);
- scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
- scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
- scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
- scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
- scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
- mineshaftGenerator.func_151539_a(this, worldObj, x, z, ablock);
-
- Chunk chunk = new Chunk(worldObj, ablock, abyte, x, z);
- byte[] abyte1 = chunk.getBiomeArray();
-
- for (int k = 0; k < abyte1.length; ++k)
- abyte1[k] = (byte)biomesForGeneration[k].biomeID;
-
- chunk.generateSkylightMap();
- return chunk;
+ public Chunk provideChunk(int x, int z) {
+ try {
+ Block[] ablock = new Block[65536];
+ //generateTerrain(x, z, ablock);
+ caveGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return super.provideChunk(x, z);
+ /*
+ * rand.setSeed(x * 341873128712L + z * 132897987541L); Block[] ablock = new
+ * Block[65536]; byte[] abyte = new byte[65536]; generateTerrain(x, z, ablock);
+ * biomesForGeneration =
+ * worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, x
+ * * 16, z * 16, 16, 16); replaceBlocksForBiome(x, z, ablock, abyte,
+ * biomesForGeneration);
+ *
+ * caveGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * caveGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * ravineGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * //villageGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ * mineshaftGenerator.func_151539_a(this, worldObj, x, z, ablock);
+ *
+ * Chunk chunk = new Chunk(worldObj, ablock, abyte, x, z); byte[] abyte1 =
+ * chunk.getBiomeArray();
+ *
+ * for (int k = 0; k < abyte1.length; ++k) abyte1[k] =
+ * (byte)biomesForGeneration[k].biomeID;
+ *
+ * chunk.generateSkylightMap(); return chunk;
+ */
}
- public void generateTerrain(int x, int z, Block[] par3BlockArray)
- {
+ public void generateTerrain(int x, int z, Block[] par3BlockArray) {
byte b0 = 63;
- biomesForGeneration = worldObj.getWorldChunkManager().getBiomesForGeneration(biomesForGeneration, x * 4 - 2, z * 4 - 2, 10, 10);
+ biomesForGeneration = worldObj.getWorldChunkManager().getBiomesForGeneration(biomesForGeneration, x * 4 - 2,
+ z * 4 - 2, 10, 10);
generateNoise(x * 4, 0, z * 4);
- for (int k = 0; k < 4; ++k)
- {
+ for (int k = 0; k < 4; ++k) {
int l = k * 5;
int i1 = (k + 1) * 5;
- for (int j1 = 0; j1 < 4; ++j1)
- {
+ for (int j1 = 0; j1 < 4; ++j1) {
int k1 = (l + j1) * 33;
int l1 = (l + j1 + 1) * 33;
int i2 = (i1 + j1) * 33;
int j2 = (i1 + j1 + 1) * 33;
- for (int k2 = 0; k2 < 32; ++k2)
- {
+ for (int k2 = 0; k2 < 32; ++k2) {
double d0 = 0.125D;
double d1 = field_147434_q[k1 + k2];
double d2 = field_147434_q[l1 + k2];
@@ -329,16 +323,14 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
double d7 = (field_147434_q[i2 + k2 + 1] - d3) * d0;
double d8 = (field_147434_q[j2 + k2 + 1] - d4) * d0;
- for (int l2 = 0; l2 < 8; ++l2)
- {
+ for (int l2 = 0; l2 < 8; ++l2) {
double d9 = 0.25D;
double d10 = d1;
double d11 = d2;
double d12 = (d3 - d1) * d9;
double d13 = (d4 - d2) * d9;
- for (int i3 = 0; i3 < 4; ++i3)
- {
+ for (int i3 = 0; i3 < 4; ++i3) {
int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2;
short short1 = 256;
j3 -= short1;
@@ -368,17 +360,16 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
}
}
- private void generateNoise(int x, int y, int z)
- {
+ private void generateNoise(int x, int y, int z) {
doubleArray4 = noiseGen6.generateNoiseOctaves(doubleArray4, x, z, 5, 5, 200.0D, 200.0D, 0.5D);
- doubleArray1 = noiseGen3.generateNoiseOctaves(doubleArray1, x, y, z, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);
+ doubleArray1 = noiseGen3.generateNoiseOctaves(doubleArray1, x, y, z, 5, 33, 5, 8.555150000000001D,
+ 4.277575000000001D, 8.555150000000001D);
doubleArray2 = noiseGen1.generateNoiseOctaves(doubleArray2, x, y, z, 5, 33, 5, 684.412D, 684.412D, 684.412D);
doubleArray3 = noiseGen2.generateNoiseOctaves(doubleArray3, x, y, z, 5, 33, 5, 684.412D, 684.412D, 684.412D);
int l = 0;
int i1 = 0;
for (int j1 = 0; j1 < 5; ++j1)
- for (int k1 = 0; k1 < 5; ++k1)
- {
+ for (int k1 = 0; k1 < 5; ++k1) {
float f = 0.0F;
float f1 = 0.0F;
float f2 = 0.0F;
@@ -386,14 +377,12 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
BiomeGenBase biomegenbase = biomesForGeneration[j1 + 2 + (k1 + 2) * 10];
for (int l1 = -b0; l1 <= b0; ++l1)
- for (int i2 = -b0; i2 <= b0; ++i2)
- {
+ for (int i2 = -b0; i2 <= b0; ++i2) {
BiomeGenBase biomegenbase1 = biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
float f3 = biomegenbase1.rootHeight;
float f4 = biomegenbase1.heightVariation;
- if (worldType == WorldType.AMPLIFIED && f3 > 0.0F)
- {
+ if (worldType == WorldType.AMPLIFIED && f3 > 0.0F) {
f3 = 1.0F + f3 * 2.0F;
f4 = 1.0F + f4 * 4.0F;
}
@@ -419,8 +408,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
d13 = d13 * 3.0D - 2.0D;
- if (d13 < 0.0D)
- {
+ if (d13 < 0.0D) {
d13 /= 2.0D;
if (d13 < -1.0D)
@@ -428,9 +416,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
d13 /= 1.4D;
d13 /= 2.0D;
- }
- else
- {
+ } else {
if (d13 > 1.0D)
d13 = 1.0D;
@@ -444,8 +430,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
d12 = d12 * 8.5D / 8.0D;
double d5 = 8.5D + d12 * 4.0D;
- for (int j2 = 0; j2 < 33; ++j2)
- {
+ for (int j2 = 0; j2 < 33; ++j2) {
double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
if (d6 < 0.0D)
@@ -456,8 +441,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
double d9 = (doubleArray1[l] / 10.0D + 1.0D) / 2.0D;
double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;
- if (j2 > 29)
- {
+ if (j2 > 29) {
double d11 = (j2 - 29) / 3.0F;
d10 = d10 * (1.0D - d11) + -10.0D * d11;
}
@@ -473,12 +457,16 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
double d1 = 684.412D;
double d2 = 512.0D;
double d3 = 512.0D;
- this.doubleArray4 = this.noiseGen6.generateNoiseOctaves(this.doubleArray4, p_147423_1_, p_147423_3_, 5, 5, 200.0D, 200.0D, 0.5D);
- this.doubleArray1 = this.noiseGen3.generateNoiseOctaves(this.doubleArray1, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);
+ this.doubleArray4 = this.noiseGen6.generateNoiseOctaves(this.doubleArray4, p_147423_1_, p_147423_3_, 5, 5,
+ 200.0D, 200.0D, 0.5D);
+ this.doubleArray1 = this.noiseGen3.generateNoiseOctaves(this.doubleArray1, p_147423_1_, p_147423_2_,
+ p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);
- this.doubleArray2 = this.noiseGen1.generateNoiseOctaves(this.doubleArray2, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
+ this.doubleArray2 = this.noiseGen1.generateNoiseOctaves(this.doubleArray2, p_147423_1_, p_147423_2_,
+ p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
- this.doubleArray3 = this.noiseGen2.generateNoiseOctaves(this.doubleArray3, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
+ this.doubleArray3 = this.noiseGen2.generateNoiseOctaves(this.doubleArray3, p_147423_1_, p_147423_2_,
+ p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
boolean flag1 = false;
boolean flag = false;
@@ -486,21 +474,18 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
int i1 = 0;
double d4 = 8.5D;
for (int j1 = 0; j1 < 5; j1++) {
- for (int k1 = 0; k1 < 5; k1++)
- {
+ for (int k1 = 0; k1 < 5; k1++) {
float f = 0.0F;
float f1 = 0.0F;
float f2 = 0.0F;
byte b0 = 2;
BiomeGenBase biomegenbase = this.biomesForGeneration[(j1 + 2 + (k1 + 2) * 10)];
for (int l1 = -b0; l1 <= b0; l1++) {
- for (int i2 = -b0; i2 <= b0; i2++)
- {
+ for (int i2 = -b0; i2 <= b0; i2++) {
BiomeGenBase biomegenbase1 = this.biomesForGeneration[(j1 + l1 + 2 + (k1 + i2 + 2) * 10)];
float f3 = biomegenbase1.rootHeight;
float f4 = biomegenbase1.heightVariation;
- if ((this.worldType == WorldType.AMPLIFIED) && (f3 > 0.0F))
- {
+ if ((this.worldType == WorldType.AMPLIFIED) && (f3 > 0.0F)) {
f3 = 1.0F + f3 * 2.0F;
f4 = 1.0F + f4 * 4.0F;
}
@@ -522,17 +507,14 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
d13 = -d13 * 0.3D;
}
d13 = d13 * 3.0D - 2.0D;
- if (d13 < 0.0D)
- {
+ if (d13 < 0.0D) {
d13 /= 2.0D;
if (d13 < -1.0D) {
d13 = -1.0D;
}
d13 /= 1.4D;
d13 /= 2.0D;
- }
- else
- {
+ } else {
if (d13 > 1.0D) {
d13 = 1.0D;
}
@@ -544,8 +526,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
d12 += d13 * 0.2D;
d12 = d12 * 8.5D / 8.0D;
double d5 = 8.5D + d12 * 4.0D;
- for (int j2 = 0; j2 < 33; j2++)
- {
+ for (int j2 = 0; j2 < 33; j2++) {
double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
if (d6 < 0.0D) {
d6 *= 4.0D;
@@ -554,8 +535,7 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
double d8 = this.doubleArray3[l] / 512.0D;
double d9 = (this.doubleArray1[l] / 10.0D + 1.0D) / 2.0D;
double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;
- if (j2 > 29)
- {
+ if (j2 > 29) {
double d11 = (j2 - 29) / 3.0F;
d10 = d10 * (1.0D - d11) + -10.0D * d11;
}
@@ -579,168 +559,190 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
*/
@Override
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
+
+ super.populate(par1IChunkProvider, par2, par3);
+
+ //Maybe Custom stuff?
+ boolean doGen = false;
+ boolean flag = false;
+ int k1;
+ int l1;
+ int i2;
+ int x = par2 * 16;
+ int z = par3 * 16;
+ BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(x + 16, z + 16);
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));
+ doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON);
+ for (k1 = 0; doGen && k1 < 8; ++k1) {
+ l1 = x + this.rand.nextInt(16) + 8;
+ i2 = this.rand.nextInt(256);
+ int j2 = z + this.rand.nextInt(16) + 8;
+ (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
+ }
- boolean generateStructures = true;
-
- BlockFalling.fallInstantly = true;
- int x = par2 * 16;
- int z = par3 * 16;
- BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(x + 16, z + 16);
- this.rand.setSeed(this.worldObj.getSeed());
- long i1 = this.rand.nextLong() / 2L * 2L + 1L;
- long j1 = this.rand.nextLong() / 2L * 2L + 1L;
- this.rand.setSeed(par2 * i1 + par3 * j1 ^ this.worldObj.getSeed());
- boolean flag = false;
-
- MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));
-
- if (generateStructures) {
- this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
- flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
- this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
- }
-
- int k1;
- int l1;
- int i2;
-
-
- if (generateStructures) {
- if (generateStructures) {
- // No specific liquid dimlets specified: we generate default lakes (water and lava were appropriate).
- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0
- && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) {
- k1 = x + this.rand.nextInt(16) + 8;
- l1 = this.rand.nextInt(256);
- i2 = z + this.rand.nextInt(16) + 8;
- (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
- }
-
- if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA) && !flag && this.rand.nextInt(8) == 0) {
- k1 = x + this.rand.nextInt(16) + 8;
- l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
- i2 = z + this.rand.nextInt(16) + 8;
-
- if (l1 < 63 || this.rand.nextInt(10) == 0) {
- (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
- }
- }
- } /*else {
- // Generate lakes for the specified biomes.
- for (Block liquid : dimensionInformation.getFluidsForLakes()) {
- if (!flag && this.rand.nextInt(4) == 0
- && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) {
- k1 = x + this.rand.nextInt(16) + 8;
- l1 = this.rand.nextInt(256);
- i2 = z + this.rand.nextInt(16) + 8;
- (new WorldGenLakes(liquid)).generate(this.worldObj, this.rand, k1, l1, i2);
- }
- }
- }*/
- }
-
- boolean doGen = false;
- if (generateStructures) {
- doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON);
- for (k1 = 0; doGen && k1 < 8; ++k1) {
- l1 = x + this.rand.nextInt(16) + 8;
- i2 = this.rand.nextInt(256);
- int j2 = z + this.rand.nextInt(16) + 8;
- (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
- }
- }
-
- biomegenbase.decorate(this.worldObj, this.rand, x, z);
- if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) {
- SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand);
- }
- x += 8;
- z += 8;
-
- doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE);
- for (k1 = 0; doGen && k1 < 16; ++k1) {
- for (l1 = 0; l1 < 16; ++l1) {
- i2 = this.worldObj.getPrecipitationHeight(x + k1, z + l1);
-
- if (this.worldObj.isBlockFreezable(k1 + x, i2 - 1, l1 + z)) {
- this.worldObj.setBlock(k1 + x, i2 - 1, l1 + z, Blocks.ice, 0, 2);
- }
-
- if (this.worldObj.func_147478_e(k1 + x, i2, l1 + z, true)) {
- this.worldObj.setBlock(k1 + x, i2, l1 + z, Blocks.snow_layer, 0, 2);
- }
- }
- }
-
- MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));
-
- BlockFalling.fallInstantly = false;
- //super.populate(par1IChunkProvider, par2, par3);
- /*net.minecraft.block.BlockFalling.fallInstantly = false;
- int k = par2 * 16;
- int l = par3 * 16;
- BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
+ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) {
+ SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand);
+ SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand);
+ }
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));
+
+ /*boolean generateStructures = true;
+
+ BlockFalling.fallInstantly = true;
+ int x = par2 * 16;
+ int z = par3 * 16;
+ BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(x + 16, z + 16);
this.rand.setSeed(this.worldObj.getSeed());
long i1 = this.rand.nextLong() / 2L * 2L + 1L;
long j1 = this.rand.nextLong() / 2L * 2L + 1L;
this.rand.setSeed(par2 * i1 + par3 * j1 ^ this.worldObj.getSeed());
boolean flag = false;
- MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, this.worldObj, this.rand, par2, par3, flag));
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));
-
- this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
- flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
- this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
- if (flag) {
- Logger.INFO("Did Generate? "+flag);
- }
- else {
- //Logger.INFO("Can village spawn here? "+villageGenerator.villageSpawnBiomes.contains(biomegenbase));
+ if (generateStructures) {
+ this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
+ // flag = this.villageGenerator.generateStructuresInChunk(this.worldObj,
+ // this.rand, par2, par3);
+ this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
}
+ int k1;
+ int l1;
+ int i2;
+
+ if (generateStructures) {
+ if (generateStructures) {
+ // No specific liquid dimlets specified: we generate default lakes (water and
+ // lava were appropriate).
+ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag
+ && this.rand.nextInt(4) == 0
+ && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag,
+ net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) {
+ k1 = x + this.rand.nextInt(16) + 8;
+ l1 = this.rand.nextInt(256);
+ i2 = z + this.rand.nextInt(16) + 8;
+ (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
+ }
+
+ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag,
+ net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA) && !flag
+ && this.rand.nextInt(8) == 0) {
+ k1 = x + this.rand.nextInt(16) + 8;
+ l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
+ i2 = z + this.rand.nextInt(16) + 8;
+
+ if (l1 < 63 || this.rand.nextInt(10) == 0) {
+ (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
+ }
+ }
+ }
+ * else { // Generate lakes for the specified biomes. for (Block liquid :
+ * dimensionInformation.getFluidsForLakes()) { if (!flag && this.rand.nextInt(4)
+ * == 0 && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3,
+ * flag,
+ * net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.
+ * LAKE)) { k1 = x + this.rand.nextInt(16) + 8; l1 = this.rand.nextInt(256); i2
+ * = z + this.rand.nextInt(16) + 8; (new
+ * WorldGenLakes(liquid)).generate(this.worldObj, this.rand, k1, l1, i2); } } }
- if ((biomegenbase != BiomeGenBase.desert) && (biomegenbase != BiomeGenBase.desertHills) && (!flag)) {
- if ((this.rand.nextInt(4) == 0) &&
- (TerrainGen.populate(par1IChunkProvider, this.worldObj, this.rand, par2, par3, flag, PopulateChunkEvent.Populate.EventType.LAKE)))
- {
- int k1 = k + this.rand.nextInt(16) + 8;
- int l1 = this.rand.nextInt(256);
- int i2 = l + this.rand.nextInt(16) + 8;
- new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, k1, l1, i2);
- }
}
- if ((TerrainGen.populate(par1IChunkProvider, this.worldObj, this.rand, par2, par3, flag, PopulateChunkEvent.Populate.EventType.LAVA)) && (!flag) &&
- (this.rand.nextInt(8) == 0))
- {
- int k1 = k + this.rand.nextInt(16) + 8;
- int l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
- int i2 = l + this.rand.nextInt(16) + 8;
- if ((l1 < 63) || (this.rand.nextInt(10) == 0)) {
- new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, k1, l1, i2);
+
+ boolean doGen = false;
+ if (generateStructures) {
+ doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag,
+ net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON);
+ for (k1 = 0; doGen && k1 < 8; ++k1) {
+ l1 = x + this.rand.nextInt(16) + 8;
+ i2 = this.rand.nextInt(256);
+ int j2 = z + this.rand.nextInt(16) + 8;
+ (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
}
}
- int var4 = par2 * 16;
- int var5 = par3 * 16;
-
- biomegenbase.decorate(this.worldObj, this.rand, k, l);
- SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
- if (TerrainGen.populate(this, worldObj, rand, par2, par3, flag, ANIMALS))
- {
- SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
+
+ biomegenbase.decorate(this.worldObj, this.rand, x, z);
+ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) {
+ SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand);
}
- k += 8;
- l += 8;
+ x += 8;
+ z += 8;
+
+ doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag,
+ net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE);
+ for (k1 = 0; doGen && k1 < 16; ++k1) {
+ for (l1 = 0; l1 < 16; ++l1) {
+ i2 = this.worldObj.getPrecipitationHeight(x + k1, z + l1);
- MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, this.worldObj, this.rand, par2, par3, flag));
+ if (this.worldObj.isBlockFreezable(k1 + x, i2 - 1, l1 + z)) {
+ this.worldObj.setBlock(k1 + x, i2 - 1, l1 + z, Blocks.ice, 0, 2);
+ }
+
+ if (this.worldObj.func_147478_e(k1 + x, i2, l1 + z, true)) {
+ this.worldObj.setBlock(k1 + x, i2, l1 + z, Blocks.snow_layer, 0, 2);
+ }
+ }
+ }
- net.minecraft.block.BlockFalling.fallInstantly = false;*/
+ MinecraftForge.EVENT_BUS
+ .post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));
+
+ BlockFalling.fallInstantly = false;*/
+ // super.populate(par1IChunkProvider, par2, par3);
+ /*
+ * net.minecraft.block.BlockFalling.fallInstantly = false; int k = par2 * 16;
+ * int l = par3 * 16; BiomeGenBase biomegenbase =
+ * this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
+ * this.rand.setSeed(this.worldObj.getSeed()); long i1 = this.rand.nextLong() /
+ * 2L * 2L + 1L; long j1 = this.rand.nextLong() / 2L * 2L + 1L;
+ * this.rand.setSeed(par2 * i1 + par3 * j1 ^ this.worldObj.getSeed()); boolean
+ * flag = false;
+ *
+ * MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider,
+ * this.worldObj, this.rand, par2, par3, flag));
+ *
+ *
+ * this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand,
+ * par2, par3); flag =
+ * this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand,
+ * par2, par3);
+ * this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj,
+ * this.rand, par2, par3); if (flag) { Logger.INFO("Did Generate? "+flag); }
+ * else {
+ * //Logger.INFO("Can village spawn here? "+villageGenerator.villageSpawnBiomes.
+ * contains(biomegenbase)); }
+ *
+ *
+ * if ((biomegenbase != BiomeGenBase.desert) && (biomegenbase !=
+ * BiomeGenBase.desertHills) && (!flag)) { if ((this.rand.nextInt(4) == 0) &&
+ * (TerrainGen.populate(par1IChunkProvider, this.worldObj, this.rand, par2,
+ * par3, flag, PopulateChunkEvent.Populate.EventType.LAKE))) { int k1 = k +
+ * this.rand.nextInt(16) + 8; int l1 = this.rand.nextInt(256); int i2 = l +
+ * this.rand.nextInt(16) + 8; new
+ * WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, k1, l1, i2); }
+ * } if ((TerrainGen.populate(par1IChunkProvider, this.worldObj, this.rand,
+ * par2, par3, flag, PopulateChunkEvent.Populate.EventType.LAVA)) && (!flag) &&
+ * (this.rand.nextInt(8) == 0)) { int k1 = k + this.rand.nextInt(16) + 8; int l1
+ * = this.rand.nextInt(this.rand.nextInt(248) + 8); int i2 = l +
+ * this.rand.nextInt(16) + 8; if ((l1 < 63) || (this.rand.nextInt(10) == 0)) {
+ * new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, k1, l1,
+ * i2); } } int var4 = par2 * 16; int var5 = par3 * 16;
+ *
+ * biomegenbase.decorate(this.worldObj, this.rand, k, l);
+ * SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l
+ * + 8, 16, 16, this.rand); if (TerrainGen.populate(this, worldObj, rand, par2,
+ * par3, flag, ANIMALS)) { SpawnerAnimals.performWorldGenSpawning(this.worldObj,
+ * biomegenbase, k + 8, l + 8, 16, 16, this.rand); } k += 8; l += 8;
+ *
+ * MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider,
+ * this.worldObj, this.rand, par2, par3, flag));
+ *
+ * net.minecraft.block.BlockFalling.fallInstantly = false;
+ */
}
/**
- * Two modes of operation: if passed true, save all Chunks in one go. If
- * passed false, save up to two chunks. Return true if all chunks have
- * been saved.
+ * Two modes of operation: if passed true, save all Chunks in one go. If passed
+ * false, save up to two chunks. Return true if all chunks have been saved.
*/
@Override
public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) {
@@ -748,16 +750,17 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
}
/**
- * Save extra data not associated with any Chunk. Not saved during
- * autosave, only during world unload. Currently unimplemented.
+ * Save extra data not associated with any Chunk. Not saved during autosave,
+ * only during world unload. Currently unimplemented.
*/
@Override
public void saveExtraData() {
+ super.saveExtraData();
}
/**
- * Unloads chunks that are marked to be unloaded. This is not guaranteed
- * to unload every such chunk.
+ * Unloads chunks that are marked to be unloaded. This is not guaranteed to
+ * unload every such chunk.
*/
@Override
public boolean unloadQueuedChunks() {
@@ -781,28 +784,29 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
}
/**
- * Returns a list of creatures of the specified type that can spawn at
- * the given location.
+ * Returns a list of creatures of the specified type that can spawn at the given
+ * location.
*/
@SuppressWarnings("rawtypes")
@Override
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) {
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
- return (par1EnumCreatureType == EnumCreatureType.monster) && (this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4)) ? this.scatteredFeatureGenerator
- .getScatteredFeatureSpawnList() : biomegenbase
- .getSpawnableList(par1EnumCreatureType);
+ return (par1EnumCreatureType == EnumCreatureType.monster)
+ && (this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4))
+ ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList()
+ : biomegenbase.getSpawnableList(par1EnumCreatureType);
}
@Override
- public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) {
- Logger.INFO("func_147416_a: "+p_147416_2_);
- //return super.func_147416_a(p_147416_1_, p_147416_2_, p_147416_3_, p_147416_4_, p_147416_5_);
- return
- "ExtendedVillage".equals(p_147416_2_) &&
- this.villageGenerator != null ?
- this.villageGenerator.func_151545_a(p_147416_1_,
- p_147416_3_, p_147416_4_, p_147416_5_) :
- null;
+ public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_,
+ int p_147416_5_) {
+ Logger.INFO("func_147416_a: " + p_147416_2_);
+ return super.func_147416_a(p_147416_1_, p_147416_2_, p_147416_3_, p_147416_4_, p_147416_5_);
+ /*
+ * return "ExtendedVillage".equals(p_147416_2_) && this.villageGenerator != null
+ * ? this.villageGenerator.func_151545_a(p_147416_1_, p_147416_3_, p_147416_4_,
+ * p_147416_5_) : null;
+ */
}
@Override
@@ -812,10 +816,13 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh
@Override
public void recreateStructures(int par1, int par2) {
- //super.recreateStructures(par1, par2);
- this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
- this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
- this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
+ super.recreateStructures(par1, par2);
+ // this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2,
+ // (Block[])null);
+ // this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2,
+ // (Block[])null);
+ // this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2,
+ // (Block[])null);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java b/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java
index 4455c81317..160e734bb7 100644
--- a/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java
+++ b/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java
@@ -10,58 +10,54 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.MapGenRavine;
-public class MapGenLargeRavine extends MapGenRavine
-{
+public class MapGenLargeRavine extends MapGenRavine {
private float[] field_75046_d = new float[1024];
@Override
- protected void func_151540_a(long aSeed, int var1, int var2, Block[] aBlocksInChunkOrPassedIn, double p_151540_6_, double p_151540_8_, double p_151540_10_, float p_151540_12_, float p_151540_13_, float p_151540_14_, int possibleCurrentY, int possibleMaxY, double p_151540_17_)
- {
- //Logger.INFO("Generating Large Ravine.");
+ protected void func_151540_a(long aSeed, int var1, int var2, Block[] aBlocksInChunkOrPassedIn, double p_151540_6_,
+ double p_151540_8_, double p_151540_10_, float p_151540_12_, float p_151540_13_, float p_151540_14_,
+ int possibleCurrentY, int possibleMaxY, double p_151540_17_) {
Random random = CORE.RANDOM;
+ //gtPlusPlus.api.objects.Logger.WORLD("Generating Large Ravine. 1");
this.range *= 2;
- double d4 = (double)(var1 * 24 + 16);
- double d5 = (double)(var2 * 24 + 16);
+ double d4 = (double) (var1 * 24 + 16);
+ double d5 = (double) (var2 * 24 + 16);
float f3 = 0.0F;
float f4 = 0.0F;
- if (possibleMaxY <= 25)
- {
+ if (possibleMaxY <= 25) {
int j1 = Math.min(this.range * 16 - 32, 200);
possibleMaxY = j1 - random.nextInt(j1 / 4);
}
boolean possibleIsUnderGroundFlag = false;
- if (possibleCurrentY <= -1)
- {
+ if (possibleCurrentY <= -1) {
possibleCurrentY = possibleMaxY / 3;
possibleIsUnderGroundFlag = true;
}
float f5 = 1.0F;
- for (int k1 = 0; k1 < 256; ++k1)
- {
- if (k1 == 0 || random.nextInt(3) == 0)
- {
+ for (int k1 = 0; k1 < 256; ++k1) {
+ if (k1 == 0 || random.nextInt(3) == 0) {
f5 = 1.0F + random.nextFloat() * random.nextFloat() * 1.0F;
}
this.field_75046_d[k1] = f5 * f5;
}
- for (; possibleCurrentY < possibleMaxY; ++possibleCurrentY)
- {
- double d12 = 3.5D + (double)(MathHelper.sin((float)possibleCurrentY * CORE.PI / (float)possibleMaxY) * p_151540_12_ * 1.0F);
+ for (; possibleCurrentY < possibleMaxY; ++possibleCurrentY) {
+ double d12 = 3.5D + (double) (MathHelper.sin((float) possibleCurrentY * CORE.PI / (float) possibleMaxY)
+ * p_151540_12_ * 1.0F);
double d6 = d12 * p_151540_17_;
- d12 *= (double)random.nextFloat() * 0.55D + 0.75D;
- d6 *= (double)random.nextFloat() * 0.55D + 0.75D;
+ d12 *= (double) random.nextFloat() * 0.55D + 0.75D;
+ d6 *= (double) random.nextFloat() * 0.55D + 0.75D;
float f6 = MathHelper.cos(p_151540_14_);
float f7 = MathHelper.sin(p_151540_14_);
- p_151540_6_ += (double)(MathHelper.cos(p_151540_13_) * f6);
- p_151540_8_ += (double)f7;
- p_151540_10_ += (double)(MathHelper.sin(p_151540_13_) * f6);
+ p_151540_6_ += (double) (MathHelper.cos(p_151540_13_) * f6);
+ p_151540_8_ += (double) f7;
+ p_151540_10_ += (double) (MathHelper.sin(p_151540_13_) * f6);
p_151540_14_ *= 1.7F;
p_151540_14_ += f4 * 0.25F;
p_151540_13_ += f3 * 0.25F;
@@ -70,20 +66,18 @@ public class MapGenLargeRavine extends MapGenRavine
f4 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F;
f3 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F;
- if (possibleIsUnderGroundFlag || random.nextInt(4) != 0)
- {
+ if (possibleIsUnderGroundFlag || random.nextInt(4) != 0) {
double d7 = p_151540_6_ - d4;
double d8 = p_151540_10_ - d5;
- double d9 = (double)(possibleMaxY - possibleCurrentY);
- double d10 = (double)(p_151540_12_ + 2.0F + 16.0F);
+ double d9 = (double) (possibleMaxY - possibleCurrentY);
+ double d10 = (double) (p_151540_12_ + 2.0F + 16.0F);
- if (d7 * d7 + d8 * d8 - d9 * d9 > d10 * d10)
- {
+ if (d7 * d7 + d8 * d8 - d9 * d9 > d10 * d10) {
return;
}
- if (p_151540_6_ >= d4 - 16.0D - d12 * 2.0D && p_151540_10_ >= d5 - 16.0D - d12 * 2.0D && p_151540_6_ <= d4 + 16.0D + d12 * 2.0D && p_151540_10_ <= d5 + 16.0D + d12 * 2.0D)
- {
+ if (p_151540_6_ >= d4 - 16.0D - d12 * 2.0D && p_151540_10_ >= d5 - 16.0D - d12 * 2.0D
+ && p_151540_6_ <= d4 + 16.0D + d12 * 2.0D && p_151540_10_ <= d5 + 16.0D + d12 * 2.0D) {
int i4 = MathHelper.floor_double(p_151540_6_ - d12) - var1 * 16 - 1;
int l1 = MathHelper.floor_double(p_151540_6_ + d12) - var1 * 16 + 1;
int j4 = MathHelper.floor_double(p_151540_8_ - d6) - 1;
@@ -91,33 +85,27 @@ public class MapGenLargeRavine extends MapGenRavine
int k4 = MathHelper.floor_double(p_151540_10_ - d12) - var2 * 16 - 1;
int j2 = MathHelper.floor_double(p_151540_10_ + d12) - var2 * 16 + 1;
- if (i4 < 0)
- {
+ if (i4 < 0) {
i4 = 0;
}
- if (l1 > 16)
- {
+ if (l1 > 16) {
l1 = 16;
}
- if (j4 < 1)
- {
+ if (j4 < 1) {
j4 = 1;
}
- if (i2 > 248)
- {
+ if (i2 > 248) {
i2 = 248;
}
- if (k4 < 0)
- {
+ if (k4 < 0) {
k4 = 0;
}
- if (j2 > 16)
- {
+ if (j2 > 16) {
j2 = 16;
}
@@ -125,25 +113,19 @@ public class MapGenLargeRavine extends MapGenRavine
int k2;
int j3;
- for (k2 = i4; !flag2 && k2 < l1; ++k2)
- {
- for (int l2 = k4; !flag2 && l2 < j2; ++l2)
- {
- for (int i3 = i2 + 1; !flag2 && i3 >= j4 - 1; --i3)
- {
+ for (k2 = i4; !flag2 && k2 < l1; ++k2) {
+ for (int l2 = k4; !flag2 && l2 < j2; ++l2) {
+ for (int i3 = i2 + 1; !flag2 && i3 >= j4 - 1; --i3) {
j3 = (k2 * 16 + l2) * 256 + i3;
- if (i3 >= 0 && i3 < 256)
- {
+ if (i3 >= 0 && i3 < 256) {
Block block = aBlocksInChunkOrPassedIn[j3];
- if (isOceanBlock(aBlocksInChunkOrPassedIn, j3, k2, i3, l2, var1, var2))
- {
+ if (isOceanBlock(aBlocksInChunkOrPassedIn, j3, k2, i3, l2, var1, var2)) {
flag2 = true;
}
- if (i3 != j4 - 1 && k2 != i4 && k2 != l1 - 1 && l2 != k4 && l2 != j2 - 1)
- {
+ if (i3 != j4 - 1 && k2 != i4 && k2 != l1 - 1 && l2 != k4 && l2 != j2 - 1) {
i3 = j4;
}
}
@@ -151,33 +133,28 @@ public class MapGenLargeRavine extends MapGenRavine
}
}
- if (!flag2)
- {
- for (k2 = i4; k2 < l1; ++k2)
- {
- double d13 = ((double)(k2 + var1 * 16) + 0.5D - p_151540_6_) / d12;
+ if (!flag2) {
+ for (k2 = i4; k2 < l1; ++k2) {
+ double d13 = ((double) (k2 + var1 * 16) + 0.5D - p_151540_6_) / d12;
- for (j3 = k4; j3 < j2; ++j3)
- {
- double d14 = ((double)(j3 + var2 * 16) + 0.5D - p_151540_10_) / d12;
+ for (j3 = k4; j3 < j2; ++j3) {
+ double d14 = ((double) (j3 + var2 * 16) + 0.5D - p_151540_10_) / d12;
int k3 = (k2 * 16 + j3) * 256 + i2;
boolean flag = false;
- if (d13 * d13 + d14 * d14 < 1.0D)
- {
- for (int l3 = i2 - 1; l3 >= j4; --l3)
- {
- double d11 = ((double)l3 + 0.5D - p_151540_8_) / d6;
+ if (d13 * d13 + d14 * d14 < 1.0D) {
+ for (int l3 = i2 - 1; l3 >= j4; --l3) {
+ double d11 = ((double) l3 + 0.5D - p_151540_8_) / d6;
- if ((d13 * d13 + d14 * d14) * (double)this.field_75046_d[l3] + d11 * d11 / 6.0D < 1.0D)
- {
+ if ((d13 * d13 + d14 * d14) * (double) this.field_75046_d[l3]
+ + d11 * d11 / 6.0D < 1.0D) {
Block block1 = aBlocksInChunkOrPassedIn[k3];
- if (checkIfTopBlock(aBlocksInChunkOrPassedIn, k3, k2, l3, j3, var1, var2))
- {
+ if (checkIfTopBlock(aBlocksInChunkOrPassedIn, k3, k2, l3, j3, var1, var2)) {
flag = true;
}
+ gtPlusPlus.api.objects.Logger.WORLD("Generating Large Ravine. 2");
digBlock(aBlocksInChunkOrPassedIn, k3, k2, l3, j3, var1, var2, flag);
}
@@ -187,8 +164,7 @@ public class MapGenLargeRavine extends MapGenRavine
}
}
- if (possibleIsUnderGroundFlag)
- {
+ if (possibleIsUnderGroundFlag) {
break;
}
}
@@ -197,21 +173,18 @@ public class MapGenLargeRavine extends MapGenRavine
}
}
-
- //generate?
- @Override
- protected void func_151538_a(World p_151538_1_, int p_151538_2_, int p_151538_3_, int chunkX, int chunkZ, Block[] blocks)
- {
- if (this.rand.nextInt(50) == 0)
- {
- double d0 = (double)(p_151538_2_ * 16 + this.rand.nextInt(16));
- double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20);
- double d2 = (double)(p_151538_3_ * 16 + this.rand.nextInt(16));
+ // generate?
+ @Override
+ protected void func_151538_a(World p_151538_1_, int p_151538_2_, int p_151538_3_, int chunkX, int chunkZ,
+ Block[] blocks) {
+ if (this.rand.nextInt(50) == 0) {
+ double d0 = (double) (p_151538_2_ * 16 + this.rand.nextInt(16));
+ double d1 = (double) (this.rand.nextInt(this.rand.nextInt(40) + 8) + 20);
+ double d2 = (double) (p_151538_3_ * 16 + this.rand.nextInt(16));
byte b0 = 1;
- for (int i1 = 0; i1 < b0; ++i1)
- {
- float f = this.rand.nextFloat() * (float)Math.PI * 2.0F;
+ for (int i1 = 0; i1 < b0; ++i1) {
+ float f = this.rand.nextFloat() * (float) Math.PI * 2.0F;
float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F;
this.func_151540_a(this.rand.nextLong(), chunkX, chunkZ, blocks, d0, d1, d2, f2, f, f1, 0, 0, 3.0D);
@@ -221,20 +194,21 @@ public class MapGenLargeRavine extends MapGenRavine
private static Method isTopBlock;
- //Determine if the block at the specified location is the top block for the biome, we take into account
- private synchronized boolean checkIfTopBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ){
+ // Determine if the block at the specified location is the top block for the
+ // biome, we take into account
+ private synchronized boolean checkIfTopBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) {
try {
if (isTopBlock == null) {
- isTopBlock = MapGenRavine.class.getDeclaredMethod("isTopBlock", Block[].class, int.class, int.class, int.class, int.class, int.class, int.class);
+ isTopBlock = MapGenRavine.class.getDeclaredMethod("isTopBlock", Block[].class, int.class, int.class,
+ int.class, int.class, int.class, int.class);
}
if (isTopBlock != null) {
return (boolean) isTopBlock.invoke(this, data, index, x, y, z, chunkX, chunkZ);
- }
- else {
+ } else {
return false;
}
- }
- catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException n) {
+ } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException n) {
return false;
}
}
diff --git a/src/Java/gtPlusPlus/australia/gen/map/MapGenVillageLogging.java b/src/Java/gtPlusPlus/australia/gen/map/MapGenVillageLogging.java
deleted file mode 100644
index 69278591fe..0000000000
--- a/src/Java/gtPlusPlus/australia/gen/map/MapGenVillageLogging.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package gtPlusPlus.australia.gen.map;
-
-import java.util.Map;
-import java.util.Random;
-
-import gtPlusPlus.api.objects.Logger;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
-import net.minecraft.world.gen.structure.MapGenVillage;
-import net.minecraft.world.gen.structure.StructureStart;
-
-public class MapGenVillageLogging extends MapGenVillage {
-
- public MapGenVillageLogging() {
- super();
- }
-
- public MapGenVillageLogging(Map p_i2093_1_) {
- super(p_i2093_1_);
- }
-
- @Override
- public String func_143025_a() {
- return super.func_143025_a();
- }
-
- @Override
- protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_) {
- boolean aBool = super.canSpawnStructureAtCoords(p_75047_1_, p_75047_2_);
- if (aBool) {
- Logger.INFO("Is Location Valid for Spawning a Village? "+aBool);
- }
- return aBool;
- }
-
- @Override
- protected StructureStart getStructureStart(int p_75049_1_, int p_75049_2_) {
- Logger.INFO("Created MapGenVillageLogging Start Object");
- return new MapGenVillageLogging.Start(this.worldObj, this.rand, p_75049_1_, p_75049_2_, 0);
- }
-
- public static class StartLogging extends Start {
- /** well ... thats what it does */
- private boolean hasMoreThanTwoComponents;
- private static final String __OBFID = "CL_00000515";
-
- public StartLogging() {
- super();
- Logger.INFO("Created StartLogging Object");
- }
-
- public StartLogging(World p_i2092_1_, Random p_i2092_2_, int p_i2092_3_, int p_i2092_4_, int p_i2092_5_) {
- super(p_i2092_1_, p_i2092_2_, p_i2092_3_, p_i2092_4_, p_i2092_5_);
- Logger.INFO("Created StartLogging Object");
- }
-
- /**
- * currently only defined for Villages, returns true if Village has more than 2
- * non-road components
- */
- public boolean isSizeableStructure() {
- return this.hasMoreThanTwoComponents;
- }
-
- public void func_143022_a(NBTTagCompound p_143022_1_) {
- super.func_143022_a(p_143022_1_);
- }
-
- public void func_143017_b(NBTTagCompound p_143017_1_) {
- super.func_143017_b(p_143017_1_);
- }
- }
-} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java
index de90a91fb1..4af5aa09ab 100644
--- a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java
+++ b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java
@@ -6,6 +6,7 @@ import gtPlusPlus.api.interfaces.IGeneratorWorld;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.australia.GTplusplus_Australia;
import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.plugin.villagers.entity.EntityNativeAustralian;
import net.minecraft.block.Block;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
@@ -30,6 +31,256 @@ public class ComponentHut extends AustraliaComponent {
}
public boolean addComponentParts(World world, Random random) {
+
+ BiomeGenBase biom = world.getBiomeGenForCoords(getXWithOffset(0, 0), getZWithOffset(0, 0));
+ int groundAvg = calcGroundHeight(world, this.boundingBox);
+ if (groundAvg < 0) {
+ return true;
+ }
+ this.boundingBox.offset(0, groundAvg - this.boundingBox.maxY + 10 - 1, 0);
+ if ((isWaterBelow(world, 0, -1, 0, this.boundingBox)) || (isWaterBelow(world, 0, -1, 6, this.boundingBox))
+ || (isWaterBelow(world, 6, -1, 0, this.boundingBox))
+ || (isWaterBelow(world, 6, -1, 6, this.boundingBox))) {
+ return false;
+ }
+
+ Block aWall1, aWall2, aRoof, aFloor;
+
+ if (biom.biomeID == GTplusplus_Australia.Australian_Desert_Biome_3.biomeID) {
+ aWall1 = Blocks.sand;
+ aWall2 = Blocks.sandstone;
+ aRoof = Blocks.sandstone;
+ aFloor = Blocks.sandstone;
+ }
+ else if (biom.biomeID == GTplusplus_Australia.Australian_Outback_Biome.biomeID) {
+ aWall1 = Blocks.clay;
+ aWall2 = Blocks.hardened_clay;
+ aRoof = Blocks.hardened_clay;
+ aFloor = Blocks.stained_hardened_clay;
+ }
+ else {
+ aWall1 = Blocks.sand;
+ aWall2 = Blocks.sandstone;
+ aRoof = Blocks.sandstone;
+ aFloor = Blocks.sandstone;
+ }
+
+ //Empty Area
+ fillWithAir(world, this.boundingBox, 0, 1, 0, 6, 9, 6);
+
+ //Build Floor
+ fillWithMetadataBlocks(world, this.boundingBox, 0, 0, 0, 6, 0, 6, aFloor, 0, aFloor, 1, false);
+
+ //Layer 2
+ int dir = MathUtils.randInt(0, 3);
+
+ //Door First
+ if (dir == 0) {
+ placeDoorAtCurrentPosition(
+ world, this.boundingBox, random, 0, 1, 3, getMetadataWithOffset(Blocks.wooden_door, 1));
+ }
+ else if (dir == 0) {
+ placeDoorAtCurrentPosition(
+ world, this.boundingBox, random, 3, 1, 6, getMetadataWithOffset(Blocks.wooden_door, 1));
+ }
+ else if (dir == 0) {
+ placeDoorAtCurrentPosition(
+ world, this.boundingBox, random, 6, 1, 3, getMetadataWithOffset(Blocks.wooden_door, 1));
+ }
+ else {
+ placeDoorAtCurrentPosition(
+ world, this.boundingBox, random, 3, 1, 0, getMetadataWithOffset(Blocks.wooden_door, 1));
+ }
+
+ //Layer 1
+ //Wall Top
+ place(aWall1, 0, 0, 1, 2, this.boundingBox, world);
+ if (dir != 0) place(aWall1, 0, 0, 1, 3, this.boundingBox, world);
+ place(aWall1, 0, 0, 1, 4, this.boundingBox, world);
+ //Wall Right
+ place(aWall1, 0, 2, 1, 6, this.boundingBox, world);
+ if (dir != 1) place(aWall2, 0, 3, 1, 6, this.boundingBox, world);
+ place(aWall1, 0, 4, 1, 6, this.boundingBox, world);
+ //Wall Bottom
+ place(aWall2, 0, 6, 1, 4, this.boundingBox, world);
+ if (dir != 2) place(aWall1, 0, 6, 1, 3, this.boundingBox, world);
+ place(aWall1, 0, 6, 1, 2, this.boundingBox, world);
+ //Wall Left
+ place(aWall1, 0, 4, 1, 0, this.boundingBox, world);
+ if (dir != 3) place(aWall1, 0, 3, 1, 0, this.boundingBox, world);
+ place(aWall2, 0, 2, 1, 0, this.boundingBox, world);
+ //Corners
+ place(aWall1, 0, 1, 1, 5, this.boundingBox, world);
+ place(aWall2, 0, 5, 1, 5, this.boundingBox, world);
+ place(aWall1, 0, 5, 1, 1, this.boundingBox, world);
+ place(aWall1, 0, 1, 1, 1, this.boundingBox, world);
+
+
+ //Wall Top
+ place(aWall1, 0, 0, 2, 2, this.boundingBox, world);
+ //place(aWall1, 0, 0, 2, 3, this.boundingBox, world);
+ place(aWall2, 0, 0, 2, 4, this.boundingBox, world);
+
+ //Wall Right
+ place(aWall2, 0, 2, 2, 6, this.boundingBox, world);
+ //place(aWall1, 0, 3, 2, 6, this.boundingBox, world);
+ place(aWall1, 0, 4, 2, 6, this.boundingBox, world);
+
+ //Wall Bottom
+ place(aWall1, 0, 6, 2, 4, this.boundingBox, world);
+ //place(aWall1, 0, 6, 2, 3, this.boundingBox, world);
+ place(aWall2, 0, 6, 2, 2, this.boundingBox, world);
+
+ //Wall Left
+ place(aWall1, 0, 4, 2, 0, this.boundingBox, world);
+ //place(aWall2, 0, 4, 2, 0, this.boundingBox, world);
+ place(aWall1, 0, 2, 2, 0, this.boundingBox, world);
+
+ //Corners
+ place(aWall1, 0, 1, 2, 5, this.boundingBox, world);
+ place(aWall1, 0, 5, 2, 5, this.boundingBox, world);
+ place(aWall2, 0, 5, 2, 1, this.boundingBox, world);
+ place(aWall2, 0, 1, 2, 1, this.boundingBox, world);
+
+ //Layer 3
+ //Wall Top
+ place(aWall2, 0, 0, 3, 2, this.boundingBox, world);
+ place(aWall1, 0, 0, 3, 3, this.boundingBox, world);
+ place(aWall1, 0, 0, 3, 4, this.boundingBox, world);
+ //Wall Right
+ place(aWall1, 0, 2, 3, 6, this.boundingBox, world);
+ place(aWall1, 0, 3, 3, 6, this.boundingBox, world);
+ place(aWall1, 0, 4, 3, 6, this.boundingBox, world);
+ //Wall Bottom
+ place(aWall1, 0, 6, 3, 4, this.boundingBox, world);
+ place(aWall2, 0, 6, 3, 3, this.boundingBox, world);
+ place(aWall1, 0, 6, 3, 2, this.boundingBox, world);
+ //Wall Left
+ place(aWall1, 0, 4, 3, 0, this.boundingBox, world);
+ place(aWall2, 0, 3, 3, 0, this.boundingBox, world);
+ place(aWall1, 0, 2, 3, 0, this.boundingBox, world);
+ //Corners
+ place(aWall1, 0, 1, 3, 5, this.boundingBox, world);
+ place(aWall2, 0, 5, 3, 5, this.boundingBox, world);
+ place(aWall1, 0, 5, 3, 1, this.boundingBox, world);
+ place(aWall1, 0, 1, 3, 1, this.boundingBox, world);
+
+ //Roof
+ //Roof 1 Top
+ place(aRoof, 0, 1, 4, 2, this.boundingBox, world);
+ place(aRoof, 0, 1, 4, 3, this.boundingBox, world);
+ place(aRoof, 0, 1, 4, 4, this.boundingBox, world);
+ //Roof 1 Right
+ place(aRoof, 0, 2, 4, 5, this.boundingBox, world);
+ place(aRoof, 0, 3, 4, 5, this.boundingBox, world);
+ place(aRoof, 0, 4, 4, 5, this.boundingBox, world);
+ //Roof 1 Bottom
+ place(aRoof, 0, 5, 4, 4, this.boundingBox, world);
+ place(aRoof, 0, 5, 4, 3, this.boundingBox, world);
+ place(aRoof, 0, 5, 4, 2, this.boundingBox, world);
+ //Roof 1 Left
+ place(aRoof, 0, 4, 4, 1, this.boundingBox, world);
+ place(aRoof, 0, 3, 4, 1, this.boundingBox, world);
+ place(aRoof, 0, 2, 4, 1, this.boundingBox, world);
+
+ //Roof 2 Top
+ place(aRoof, 0, 2, 5, 2, this.boundingBox, world);
+ place(aRoof, 0, 2, 5, 3, this.boundingBox, world);
+ place(aRoof, 0, 2, 5, 4, this.boundingBox, world);
+
+ //Roof 2 Right
+ //place(aWall1, 0, 2, 5, 4, this.boundingBox, world);
+ place(aRoof, 0, 3, 5, 4, this.boundingBox, world);
+ //place(aWall1, 0, 4, 5, 4, this.boundingBox, world);
+
+ //Roof 2 Bottom
+ place(aRoof, 0, 4, 5, 4, this.boundingBox, world);
+ place(aRoof, 0, 4, 5, 3, this.boundingBox, world);
+ place(aRoof, 0, 4, 5, 2, this.boundingBox, world);
+
+ //Roof 2 Left
+ //place(aWall1, 0, 4, 5, 2, this.boundingBox, world);
+ place(aRoof, 0, 3, 5, 2, this.boundingBox, world);
+ //place(aWall1, 0, 2, 5, 2, this.boundingBox, world);
+
+ //Roof 3 Top
+ place(Blocks.glowstone, 0, 3, 5, 3, this.boundingBox, world);
+ /*
+ int logID = MathUtils.randInt(0, 1);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 1, 1, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 2, 1, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 3, 1, this.boundingBox, world);
+
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 1, 5, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 2, 5, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 3, 5, this.boundingBox, world);
+
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 1, 1, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 2, 1, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 3, 1, this.boundingBox, world);
+
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 1, 5, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 2, 5, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 3, 5, this.boundingBox, world);
+
+ int meta = (this.coordBaseMode == 3) || (this.coordBaseMode == 1) ? 4 : 8;
+
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 4, 2, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 4, 3, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 0, 4, 4, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 4, 2, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 4, 3, this.boundingBox, world);
+ place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 4, 4, this.boundingBox, world);
+
+ for (int x = -2; x < 9; x++) {
+ place(Blocks.leaves, MathUtils.randInt(0, 3), x, 3, 0, this.boundingBox, world);
+ place(Blocks.leaves, MathUtils.randInt(0, 3), x, 4, 1, this.boundingBox, world);
+ place(Blocks.leaves, MathUtils.randInt(0, 3), x, 5, 2, this.boundingBox, world);
+ place(Blocks.leaves, MathUtils.randInt(0, 3), x, 5, 3, this.boundingBox, world);
+ place(Blocks.leaves, MathUtils.randInt(0, 3), x, 5, 4, this.boundingBox, world);
+ place(Blocks.leaves, MathUtils.randInt(0, 3), x, 4, 5, this.boundingBox, world);
+ place(Blocks.leaves, MathUtils.randInt(0, 3), x, 3, 6, this.boundingBox, world);
+ }
+
+ int glassMeta = Math.min(16, (coordBaseMode+MathUtils.randInt(0, 8)));
+ if (MathUtils.randInt(0, 5) > 4)
+ place(Blocks.stained_glass, glassMeta, 2, 2, 1, this.boundingBox, world);
+ if (MathUtils.randInt(0, 5) > 4)
+ place(Blocks.stained_glass, glassMeta, 2, 2, 5, this.boundingBox, world);
+ if (MathUtils.randInt(0, 5) > 4)
+ place(Blocks.stained_glass, glassMeta, 4, 2, 5, this.boundingBox, world);
+ if (MathUtils.randInt(0, 5) > 4)
+ place(Blocks.stained_glass, glassMeta, 0, 2, 3, this.boundingBox, world);
+ if (MathUtils.randInt(0, 5) > 4)
+ place(Blocks.stained_glass, glassMeta, 6, 2, 3, this.boundingBox, world);
+
+ placeDoorAtCurrentPosition(world, this.boundingBox, random, 4, 1, 1,
+ getMetadataWithOffset(Blocks.wooden_door, 1));
+
+ place(Blocks.leaves, MathUtils.randInt(0, 3), 1, 1, 4, this.boundingBox, world);
+ place(Blocks.torch, 0, 1, 2, 3, this.boundingBox, world);
+ place(Blocks.torch, 0, 3, 2, 2, this.boundingBox, world);
+ if (!this.hasMadeChest) {
+ int ic = getYWithOffset(0);
+ int jc = getXWithOffset(7, 1);
+ int kc = getZWithOffset(7, 1);
+ if (this.boundingBox.isVecInside(jc, ic, kc)) {
+ this.hasMadeChest = true;
+ generateStructureChestContents(world, this.boundingBox, random, 1, 1, 2, shackChestContents,
+ 1 + random.nextInt(3));
+ }
+ }*/
+ for (int i = 0; i < 7; i++) {
+ for (int j = 0; j < 7; j++) {
+ clearCurrentPositionBlocksUpwards(world, j, 6, i, this.boundingBox);
+ func_151554_b(world, aFloor, 0, j, 0, i, this.boundingBox);
+ }
+ }
+ spawnNatives(world, this.boundingBox, 4, 1, 3, MathUtils.randInt(3, 5));
+
+ return true;
+
+ /*
BiomeGenBase biom = world.getBiomeGenForCoords(getXWithOffset(0, 0), getZWithOffset(0, 0));
int groundAvg = calcGroundHeight(world, this.boundingBox);
if (groundAvg < 0) {
@@ -84,7 +335,7 @@ public class ComponentHut extends AustraliaComponent {
place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 4, 3, this.boundingBox, world);
place(Blocks.dirt, MathUtils.randInt(0, 1), 6, 4, 4, this.boundingBox, world);
- for (int x = 0; x < MathUtils.randInt(5, 9); x++) {
+ for (int x = -2; x < 9; x++) {
place(Blocks.leaves, MathUtils.randInt(0, 3), x, 3, 0, this.boundingBox, world);
place(Blocks.leaves, MathUtils.randInt(0, 3), x, 4, 1, this.boundingBox, world);
place(Blocks.leaves, MathUtils.randInt(0, 3), x, 5, 2, this.boundingBox, world);
@@ -131,7 +382,7 @@ public class ComponentHut extends AustraliaComponent {
spawnNatives(world, this.boundingBox, 4, 1, 3, MathUtils.randInt(3, 5));
return true;
- }
+ */}
private int nativesSpawned = 0;
@@ -146,7 +397,7 @@ public class ComponentHut extends AustraliaComponent {
break;
}
if (par1World.rand.nextInt(MathUtils.randInt(3, 5)) != 0) {
- EntityVillager entityvillager = new EntityVillager(par1World, 7738);
+ EntityNativeAustralian entityvillager = new EntityNativeAustralian(par1World);
entityvillager.func_110163_bv();
entityvillager.setLocationAndAngles(j1 + 0.5D, k1, l1 + 0.5D, 0.0F, 0.0F);
par1World.spawnEntityInWorld(entityvillager);
diff --git a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentShack.java b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentShack.java
index 0bc4249d89..5c40c2b5e8 100644
--- a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentShack.java
+++ b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentShack.java
@@ -96,37 +96,37 @@ public class ComponentShack extends AustraliaComponent {
int mStoneMeta = MathUtils.randInt(0, mStone == Blocks.stained_hardened_clay ? 15 : mStone == Blocks.sandstone ? 2 : 3);
- fillWithAir(world, this.boundingBox, 0, 1, 0, 6, 9, 6);
- fillWithMetadataBlocks(world, this.boundingBox, 0, 0, 1, 6, 1, 5, mStone, mStoneMeta, mStone, mStoneMeta, false);
- fillWithMetadataBlocks(world, this.boundingBox, 0, 2, 1, 6, 3, 5, Blocks.planks, mWoodType, Blocks.planks, mWoodType, false);
- fillWithAir(world, this.boundingBox, 1, 1, 2, 5, 3, 4);
+ fillWithAir(world, this.boundingBox, 0, 0, 0, 7, 7, 7);
+ fillWithMetadataBlocks(world, this.boundingBox, 1, 0, 1, 7, 1, 5, mStone, mStoneMeta, mStone, mStoneMeta, false);
+ fillWithMetadataBlocks(world, this.boundingBox, 1, 2, 1, 7, 3, 5, Blocks.planks, mWoodType, Blocks.planks, mWoodType, false);
+ fillWithAir(world, this.boundingBox, 2, 1, 2, 6, 3, 4);
- place(mLog, logID, 0, 1, 1, this.boundingBox, world);
- place(mLog, logID, 0, 2, 1, this.boundingBox, world);
- place(mLog, logID, 0, 3, 1, this.boundingBox, world);
+ place(mLog, logID, 1, 1, 1, this.boundingBox, world);
+ place(mLog, logID, 1, 2, 1, this.boundingBox, world);
+ place(mLog, logID, 1, 3, 1, this.boundingBox, world);
- place(mLog, logID, 0, 1, 5, this.boundingBox, world);
- place(mLog, logID, 0, 2, 5, this.boundingBox, world);
- place(mLog, logID, 0, 3, 5, this.boundingBox, world);
+ place(mLog, logID, 1, 1, 5, this.boundingBox, world);
+ place(mLog, logID, 1, 2, 5, this.boundingBox, world);
+ place(mLog, logID, 1, 3, 5, this.boundingBox, world);
- place(mLog, logID, 6, 1, 1, this.boundingBox, world);
- place(mLog, logID, 6, 2, 1, this.boundingBox, world);
- place(mLog, logID, 6, 3, 1, this.boundingBox, world);
+ place(mLog, logID, 7, 1, 1, this.boundingBox, world);
+ place(mLog, logID, 7, 2, 1, this.boundingBox, world);
+ place(mLog, logID, 7, 3, 1, this.boundingBox, world);
- place(mLog, logID, 6, 1, 5, this.boundingBox, world);
- place(mLog, logID, 6, 2, 5, this.boundingBox, world);
- place(mLog, logID, 6, 3, 5, this.boundingBox, world);
+ place(mLog, logID, 7, 1, 5, this.boundingBox, world);
+ place(mLog, logID, 7, 2, 5, this.boundingBox, world);
+ place(mLog, logID, 7, 3, 5, this.boundingBox, world);
int meta = (this.coordBaseMode == 3) || (this.coordBaseMode == 1) ? 4 : 8;
- place(mLog, logID, 0, 4, 2, this.boundingBox, world);
- place(mLog, logID, 0, 4, 3, this.boundingBox, world);
- place(mLog, logID, 0, 4, 4, this.boundingBox, world);
- place(mLog, logID, 6, 4, 2, this.boundingBox, world);
- place(mLog, logID, 6, 4, 3, this.boundingBox, world);
- place(mLog, logID, 6, 4, 4, this.boundingBox, world);
+ place(mLog, logID, 1, 4, 2, this.boundingBox, world);
+ place(mLog, logID, 1, 4, 3, this.boundingBox, world);
+ place(mLog, logID, 1, 4, 4, this.boundingBox, world);
+ place(mLog, logID, 7, 4, 2, this.boundingBox, world);
+ place(mLog, logID, 7, 4, 3, this.boundingBox, world);
+ place(mLog, logID, 7, 4, 4, this.boundingBox, world);
- for (int x = 0; x < 7; x++) {
+ for (int x = 0; x < 9; x++) {
place(mWoodenStairs, getMetadataWithOffset(Blocks.oak_stairs, 3), x, 3, 0, this.boundingBox, world);
place(mWoodenStairs, getMetadataWithOffset(Blocks.oak_stairs, 3), x, 4, 1, this.boundingBox, world);
place(mWoodenStairs, getMetadataWithOffset(Blocks.oak_stairs, 3), x, 5, 2, this.boundingBox, world);
@@ -138,38 +138,38 @@ public class ComponentShack extends AustraliaComponent {
int glassMeta = Math.min(16, (coordBaseMode+MathUtils.randInt(0, 8)));
- place(Blocks.stained_glass_pane, glassMeta, 2, 2, 1, this.boundingBox, world);
- place(Blocks.stained_glass_pane, glassMeta, 2, 2, 5, this.boundingBox, world);
- place(Blocks.stained_glass_pane, glassMeta, 4, 2, 5, this.boundingBox, world);
- place(Blocks.stained_glass_pane, glassMeta, 0, 2, 3, this.boundingBox, world);
- place(Blocks.stained_glass_pane, glassMeta, 6, 2, 3, this.boundingBox, world);
+ place(Blocks.stained_glass_pane, glassMeta, 3, 2, 1, this.boundingBox, world);
+ place(Blocks.stained_glass_pane, glassMeta, 3, 2, 5, this.boundingBox, world);
+ place(Blocks.stained_glass_pane, glassMeta, 5, 2, 5, this.boundingBox, world);
+ place(Blocks.stained_glass_pane, glassMeta, 1, 2, 3, this.boundingBox, world);
+ place(Blocks.stained_glass_pane, glassMeta, 7, 2, 3, this.boundingBox, world);
- placeDoorAtCurrentPosition(world, this.boundingBox, random, 4, 1, 1,
+ placeDoorAtCurrentPosition(world, this.boundingBox, random, 5, 1, 1,
getMetadataWithOffset(Blocks.wooden_door, 1));
- place(Blocks.planks, mWoodType, 1, 1, 4, this.boundingBox, world);
- place(Blocks.torch, 0, 1, 2, 4, this.boundingBox, world);
- place(mWoodenStairs, getMetadataWithOffset(mWoodenStairs, 1), 1, 1, 3, this.boundingBox, world);
- place(mWoodenStairs, getMetadataWithOffset(mWoodenStairs, 3), 2, 1, 4, this.boundingBox, world);
- place(Blocks.fence, 0, 2, 1, 3, this.boundingBox, world);
- place(Blocks.stone_pressure_plate, 0, 2, 2, 3, this.boundingBox, world);
+ place(Blocks.glowstone, mWoodType, 2, 1, 4, this.boundingBox, world);
+ place(Blocks.torch, 0, 2, 2, 4, this.boundingBox, world);
+ place(mWoodenStairs, getMetadataWithOffset(mWoodenStairs, 1), 2, 1, 3, this.boundingBox, world);
+ place(mWoodenStairs, getMetadataWithOffset(mWoodenStairs, 3), 3, 1, 4, this.boundingBox, world);
+ place(Blocks.fence, 1, 2, 1, 3, this.boundingBox, world);
+ place(Blocks.stone_pressure_plate, 1, 2, 2, 3, this.boundingBox, world);
if (!this.hasMadeChest) {
int ic = getYWithOffset(0);
int jc = getXWithOffset(7, 1);
int kc = getZWithOffset(7, 1);
if (this.boundingBox.isVecInside(jc, ic, kc)) {
this.hasMadeChest = true;
- generateStructureChestContents(world, this.boundingBox, random, 1, 1, 2, shackChestContents,
+ generateStructureChestContents(world, this.boundingBox, random, 2, 1, 2, shackChestContents,
1 + random.nextInt(3));
}
}
- for (int i = 0; i < 7; i++) {
- for (int j = 0; j < 7; j++) {
+ for (int i = 0; i < 9; i++) {
+ for (int j = 0; j < 9; j++) {
clearCurrentPositionBlocksUpwards(world, j, 6, i, this.boundingBox);
func_151554_b(world, undergroundID, 0, j, 0, i, this.boundingBox);
}
}
- spawnNatives(world, this.boundingBox, 4, 1, 3, MathUtils.randInt(3, 5));
+ spawnNatives(world, this.boundingBox, 3, 2, 3, MathUtils.randInt(3, 5));
return true;
}
@@ -251,7 +251,7 @@ public class ComponentShack extends AustraliaComponent {
if ((MathUtils.randInt(0, 100) < (this.chance/5))) {
int direction = MathUtils.randInt(0, 3);
new ComponentShack(direction, random, x, z).addComponentParts(world, random);
- Logger.WORLD("NativeHut x: " + x + " | z: " + z + " | Dir: " + direction);
+ Logger.WORLD("NativeShack x: " + x + " | z: " + z + " | dir: " + direction);
return true;
}
return false;
diff --git a/src/Java/gtPlusPlus/australia/world/AustraliaWorldGenerator.java b/src/Java/gtPlusPlus/australia/world/AustraliaWorldGenerator.java
index 2bfc909558..93112bb30f 100644
--- a/src/Java/gtPlusPlus/australia/world/AustraliaWorldGenerator.java
+++ b/src/Java/gtPlusPlus/australia/world/AustraliaWorldGenerator.java
@@ -93,15 +93,15 @@ public class AustraliaWorldGenerator implements IWorldGenerator {
}
if (canGenerate) {
- Logger.WORLD("Running World Generator on Australia.");
+ //Logger.WORLD("Running World Generator on Australia.");
boolean a1, a2;
a1 = generator.generate(world, random, x, z);
a2 = nonInRange(world, x, z, generator.getRange());
- Logger.INFO("A1: "+a1+" | A2: "+a2);
+ //Logger.INFO("A1: "+a1+" | A2: "+a2);
if (a1 && a2) {
this.structuresList.add(new ChunkCoordIntPair(x, z));
gen = true;
- Logger.INFO("Generated a structure");
+ //Logger.INFO("Generated a structure");
break;
}
}
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
index 09c4fdfc6b..5be184b3db 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
@@ -2,6 +2,8 @@ package gtPlusPlus.core.item.general;
import java.util.List;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.common.blocks.GT_Block_Ores;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@@ -130,10 +132,12 @@ public class ItemAreaClear extends CoreItem {
for (int j=0; j<20; j++){
for (int i=0; i<50; i++){
- if (!(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof BlockBaseOre)){
+ if (!(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof BlockBaseOre) &&
+ !(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof IGregTechTileEntity) &&
+ !(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof GT_Block_Ores)){
if (!world.isAirBlock(pos.xPos+i, pos.yPos+j, pos.zPos) &&
world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock){
- int chance = MathUtils.randInt(0, 100);
+ int chance = MathUtils.randInt(0, 500);
if (chance <= 0){
if (pos.yPos+j <= 50){
world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.glowstone);
@@ -141,7 +145,7 @@ public class ItemAreaClear extends CoreItem {
}
else {
if ((world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) == Blocks.glowstone && ((pos.yPos+j) > 50)) || world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.glowstone){
- world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.air);
+ world.setBlockToAir(pos.xPos+i, pos.yPos+j, pos.zPos);
}
}
}
diff --git a/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java b/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java
index 8a637a3b76..01fd549c7b 100644
--- a/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java
+++ b/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java
@@ -20,6 +20,7 @@ import gtPlusPlus.core.util.Utils;
import gtPlusPlus.plugin.manager.Core_Manager;
import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner;
import gtPlusPlus.plugin.villagers.entity.EntityBaseVillager;
+import gtPlusPlus.plugin.villagers.entity.EntityNativeAustralian;
import gtPlusPlus.plugin.villagers.trade.TradeHandlerAboriginal;
import gtPlusPlus.plugin.villagers.trade.TradeHandlerBanker;
import gtPlusPlus.plugin.villagers.trade.TradeHandlerTechnician;
@@ -48,6 +49,7 @@ public class Core_VillagerAdditions implements IPlugin {
if (shouldLoad) {
//Register Custom Villager Entity
EntityRegistry.registerGlobalEntityID(EntityBaseVillager.class, "WiseVillager", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(180, 120, 120), Utils.rgbtoHexValue(0, 0, 0));
+ EntityRegistry.registerGlobalEntityID(EntityNativeAustralian.class, "Aboriginal", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(50, 50, 50), Utils.rgbtoHexValue(25, 25, 25));
VillagerUtils.registerNewVillager(0, "Banker", "Banker", "Banker", "banker", new TradeHandlerBanker());
VillagerUtils.registerNewVillager(1, "Technician", "Technician", "Technician", "technician", new TradeHandlerTechnician());
VillagerUtils.registerNewVillager(2, "Trader", "Trader", "Trader", "trader", new TradeHandlerTrader());
@@ -58,7 +60,7 @@ public class Core_VillagerAdditions implements IPlugin {
if (g != null && g.mID >= 0) {
VillagerRegistry.instance().registerVillagerId(7735+g.mID);
log("Registered a Custom Villager with ID of "+g.mID+".");
- Utils.createNewMobSpawner(10+g.mID, EntityBaseVillager.class);
+ //Utils.createNewMobSpawner(10+g.mID, EntityBaseVillager.class);
if (mVillagerSkins.get(g.mID) != null) {
VillagerRegistry.instance().registerVillagerSkin(7735+g.mID, mVillagerSkins.get(g.mID));
log("Registered a Custom Skin for Villager with ID of "+g.mID+".");
diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java
new file mode 100644
index 0000000000..6e7234297e
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java
@@ -0,0 +1,549 @@
+package gtPlusPlus.plugin.villagers.entity;
+
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Random;
+
+import cpw.mods.fml.common.registry.VillagerRegistry;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.plugin.villagers.NameLists;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentData;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityAgeable;
+import net.minecraft.entity.IEntityLivingData;
+import net.minecraft.entity.passive.EntityVillager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.Tuple;
+import net.minecraft.village.MerchantRecipe;
+import net.minecraft.village.MerchantRecipeList;
+import net.minecraft.village.Village;
+import net.minecraft.world.World;
+
+public class EntityNativeAustralian extends EntityVillager {
+
+ // public static final VillagerProfession mProfession;
+
+ /*
+ *
+ * Your problem is that you are extending EntityVillager, but buyingList and
+ * addDefaultEquipment are both PRIVATE members of EntityVillager - you cannot
+ * use or override them without Reflection or ASM.
+ *
+ * What you can do, however, is override getRecipes to return your own list, but
+ * because you override EntityVillager, your mob is still using the villager's
+ * buyingList (which is NULL) when useRecipe or any other villager method is
+ * called. You either have to override every method from EntityVillager which
+ * interacts with buyingList and make it use your own list, or you need to not
+ * extend EntityVillager and just implement IMerchant instead.
+ */
+
+ private final int mRoleID;
+
+ public EntityNativeAustralian(World aWorld) {
+ super(aWorld, 7738);
+ mRoleID = 7738;
+ }
+
+ public EntityVillager createChild(EntityAgeable p_90011_1_){
+ EntityNativeAustralian entityvillager = new EntityNativeAustralian(this.worldObj);
+ entityvillager.onSpawnWithEgg((IEntityLivingData)null);
+ return entityvillager;
+ }
+
+ public boolean allowLeashing()
+ {
+ return true;
+ }
+
+ @Override
+ public void writeEntityToNBT(NBTTagCompound aNBT) {
+ if (this.hasCustomNameTag()) {
+ if (!aNBT.hasKey("aCustomName")) {
+ aNBT.setString("aCustomName", this.getCommandSenderName());
+ }
+ }
+ super.writeEntityToNBT(aNBT);
+ }
+
+ @Override
+ public void readEntityFromNBT(NBTTagCompound aNBT) {
+ if (aNBT.hasKey("aCustomName")) {
+ if (this.getCustomNameTag() != aNBT.getString("aCustomName")) {
+ this.setCustomNameTag(aNBT.getString("aCustomName"));
+ }
+ }
+ super.readEntityFromNBT(aNBT);
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound aNBT) {
+ // TODO Auto-generated method stub
+ super.writeToNBT(aNBT);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound aNBT) {
+ // TODO Auto-generated method stub
+ super.readFromNBT(aNBT);
+ }
+
+ @Override
+ protected boolean canDespawn() {
+ return !false;
+ }
+
+ @Override
+ public void setProfession(int p_70938_1_) {
+ super.setProfession(mRoleID);
+ }
+
+ @Override
+ public int getProfession() {
+ return mRoleID;
+ }
+
+ @Override
+ public void useRecipe(MerchantRecipe p_70933_1_) {
+ super.useRecipe(p_70933_1_);
+ }
+
+ @Override
+ public void setRecipes(MerchantRecipeList p_70930_1_) {
+ super.setRecipes(p_70930_1_);
+ }
+
+ public boolean shouldAlwaysSprint() {
+ return false;
+ };
+
+ @Override
+ public void onLivingUpdate() {
+ super.onLivingUpdate();
+ }
+
+ @Override
+ public Entity getEntityToAttack() {
+ return super.getEntityToAttack();
+ }
+
+ @Override
+ public boolean getAlwaysRenderNameTag() {
+ return hasCustomNameTag();
+ }
+
+ @Override
+ public Random getRNG() {
+ return CORE.RANDOM;
+ }
+
+ @Override
+ public void setSprinting(boolean bool) {
+ super.setSprinting(bool);
+ }
+
+ /**
+ * Custom Shit
+ */
+
+ protected float getField_82191_bN() {
+ Field v82191;
+ try {
+ v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN");
+ try {
+ return v82191 != null ? v82191.getFloat(this) : 0f;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return 0f;
+ }
+ } catch (NoSuchFieldException e1) {
+ return 0f;
+ }
+ }
+
+ protected void setField_82191_bN(float f) {
+ try {
+ ReflectionUtils.setField(this, "field_82191_bN", f);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ protected boolean getNeedsInitilization() {
+ Field v82191;
+ try {
+ v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization");
+ try {
+ return v82191 != null ? v82191.getBoolean(this) : false;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return false;
+ }
+ } catch (NoSuchFieldException e1) {
+ return false;
+ }
+ }
+
+ protected void setNeedsInitilization(boolean f) {
+ try {
+ ReflectionUtils.setField(this, "needsInitilization", f);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ protected MerchantRecipeList getBuyingList() {
+ Field v82191;
+ MerchantRecipeList o;
+ try {
+ v82191 = ReflectionUtils.getField(getClass(), "buyingList");
+ try {
+ o = (MerchantRecipeList) v82191.get(this);
+ Logger.WARNING("Is BuyingList Valid? "+(v82191 != null));
+ return v82191 != null ? o : null;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ e.printStackTrace();
+ return null;
+ }
+ } catch (NoSuchFieldException e1) {
+ e1.printStackTrace();
+ return null;
+ }
+ }
+
+ protected void setBuyingList(MerchantRecipeList f) {
+ try {
+ Logger.WARNING("set BuyingList? "+(ReflectionUtils.setField(this, "buyingList", f)));
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected Village getVillageObject() {
+ Field v82191;
+ try {
+ v82191 = ReflectionUtils.getField(getClass(), "villageObj");
+ try {
+ return v82191 != null ? (Village) v82191.get(this) : null;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return null;
+ }
+ } catch (NoSuchFieldException e1) {
+ return null;
+ }
+ }
+
+ protected String getLastBuyingPlayer() {
+ Field v82191;
+ try {
+ v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer");
+ try {
+ return v82191 != null ? (String) v82191.get(this) : "";
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return "";
+ }
+ } catch (NoSuchFieldException e1) {
+ return "";
+ }
+ }
+
+ public MerchantRecipeList getRecipes(EntityPlayer p_70934_1_) {
+ if (getBuyingList() == null) {
+ this.addDefaultEquipmentAndRecipies(1);
+ }
+ return getBuyingList();
+ }
+
+ /**
+ * Adjusts the probability of obtaining a given recipe being offered by a
+ * villager
+ */
+ private float adjustProbability(float p_82188_1_) {
+ float f1 = p_82188_1_ + getField_82191_bN();
+ return f1 > 0.9F ? 0.9F - (f1 - 0.9F) : f1;
+ }
+
+ /**
+ * based on the villagers profession add items, equipment, and recipies adds
+ * par1 random items to the list of things that the villager wants to buy. (at
+ * most 1 of each wanted type is added)
+ */
+ private void addDefaultEquipmentAndRecipies(int p_70950_1_) {
+ if (this.getBuyingList() != null) {
+ setField_82191_bN(MathHelper.sqrt_float((float) this.getBuyingList().size()) * 0.2F);
+ } else {
+ setField_82191_bN(0.0F);
+ }
+
+ MerchantRecipeList merchantrecipelist;
+ merchantrecipelist = new MerchantRecipeList();
+ VillagerRegistry.manageVillagerTrades(merchantrecipelist, this, this.getProfession(), this.rand);
+ int k;
+ label50:
+
+ switch (this.getProfession()) {
+ case 0:
+ addPurchaseRecipe(merchantrecipelist, Items.wheat, this.rand, this.adjustProbability(0.9F));
+ addPurchaseRecipe(merchantrecipelist, Item.getItemFromBlock(Blocks.wool), this.rand,
+ this.adjustProbability(0.5F));
+ addPurchaseRecipe(merchantrecipelist, Items.chicken, this.rand, this.adjustProbability(0.5F));
+ addPurchaseRecipe(merchantrecipelist, Items.cooked_fished, this.rand, this.adjustProbability(0.4F));
+ addEmeraldTrade(merchantrecipelist, Items.bread, this.rand, this.adjustProbability(0.9F));
+ addEmeraldTrade(merchantrecipelist, Items.melon, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.apple, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.cookie, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.shears, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.flint_and_steel, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.cooked_chicken, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.arrow, this.rand, this.adjustProbability(0.5F));
+
+ if (this.rand.nextFloat() < this.adjustProbability(0.5F)) {
+ merchantrecipelist.add(new MerchantRecipe(new ItemStack(Blocks.gravel, 10),
+ new ItemStack(Items.emerald), new ItemStack(Items.flint, 4 + this.rand.nextInt(2), 0)));
+ }
+
+ break;
+ case 1:
+ addPurchaseRecipe(merchantrecipelist, Items.paper, this.rand, this.adjustProbability(0.8F));
+ addPurchaseRecipe(merchantrecipelist, Items.book, this.rand, this.adjustProbability(0.8F));
+ addPurchaseRecipe(merchantrecipelist, Items.written_book, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Item.getItemFromBlock(Blocks.bookshelf), this.rand,
+ this.adjustProbability(0.8F));
+ addEmeraldTrade(merchantrecipelist, Item.getItemFromBlock(Blocks.glass), this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.compass, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.clock, this.rand, this.adjustProbability(0.2F));
+
+ if (this.rand.nextFloat() < this.adjustProbability(0.07F)) {
+ Enchantment enchantment = Enchantment.enchantmentsBookList[this.rand
+ .nextInt(Enchantment.enchantmentsBookList.length)];
+ int i1 = MathHelper.getRandomIntegerInRange(this.rand, enchantment.getMinLevel(),
+ enchantment.getMaxLevel());
+ ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, i1));
+ k = 2 + this.rand.nextInt(5 + i1 * 10) + 3 * i1;
+ merchantrecipelist
+ .add(new MerchantRecipe(new ItemStack(Items.book), new ItemStack(Items.emerald, k), itemstack));
+ }
+
+ break;
+ case 2:
+ addEmeraldTrade(merchantrecipelist, Items.ender_eye, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.experience_bottle, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.redstone, this.rand, this.adjustProbability(0.4F));
+ addEmeraldTrade(merchantrecipelist, Item.getItemFromBlock(Blocks.glowstone), this.rand,
+ this.adjustProbability(0.3F));
+ Item[] aitem = new Item[] { Items.iron_sword, Items.diamond_sword, Items.iron_chestplate,
+ Items.diamond_chestplate, Items.iron_axe, Items.diamond_axe, Items.iron_pickaxe,
+ Items.diamond_pickaxe };
+ Item[] aitem1 = aitem;
+ int j = aitem.length;
+ k = 0;
+
+ while (true) {
+ if (k >= j) {
+ break label50;
+ }
+
+ Item item = aitem1[k];
+
+ if (this.rand.nextFloat() < this.adjustProbability(0.05F)) {
+ merchantrecipelist.add(new MerchantRecipe(new ItemStack(item, 1, 0),
+ new ItemStack(Items.emerald, 2 + this.rand.nextInt(3), 0),
+ EnchantmentHelper.addRandomEnchantment(this.rand, new ItemStack(item, 1, 0),
+ 5 + this.rand.nextInt(15))));
+ }
+
+ ++k;
+ }
+ case 3:
+ addPurchaseRecipe(merchantrecipelist, Items.coal, this.rand, this.adjustProbability(0.7F));
+ addPurchaseRecipe(merchantrecipelist, Items.iron_ingot, this.rand, this.adjustProbability(0.5F));
+ addPurchaseRecipe(merchantrecipelist, Items.gold_ingot, this.rand, this.adjustProbability(0.5F));
+ addPurchaseRecipe(merchantrecipelist, Items.diamond, this.rand, this.adjustProbability(0.5F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_sword, this.rand, this.adjustProbability(0.5F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_sword, this.rand, this.adjustProbability(0.5F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_axe, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_axe, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_pickaxe, this.rand, this.adjustProbability(0.5F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_pickaxe, this.rand, this.adjustProbability(0.5F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_shovel, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_shovel, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_hoe, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_hoe, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_boots, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_boots, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_helmet, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_helmet, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_chestplate, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_chestplate, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.iron_leggings, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.diamond_leggings, this.rand, this.adjustProbability(0.2F));
+ addEmeraldTrade(merchantrecipelist, Items.chainmail_boots, this.rand, this.adjustProbability(0.1F));
+ addEmeraldTrade(merchantrecipelist, Items.chainmail_helmet, this.rand, this.adjustProbability(0.1F));
+ addEmeraldTrade(merchantrecipelist, Items.chainmail_chestplate, this.rand, this.adjustProbability(0.1F));
+ addEmeraldTrade(merchantrecipelist, Items.chainmail_leggings, this.rand, this.adjustProbability(0.1F));
+ break;
+ case 4:
+ addPurchaseRecipe(merchantrecipelist, Items.coal, this.rand, this.adjustProbability(0.7F));
+ addPurchaseRecipe(merchantrecipelist, Items.porkchop, this.rand, this.adjustProbability(0.5F));
+ addPurchaseRecipe(merchantrecipelist, Items.beef, this.rand, this.adjustProbability(0.5F));
+ addEmeraldTrade(merchantrecipelist, Items.saddle, this.rand, this.adjustProbability(0.1F));
+ addEmeraldTrade(merchantrecipelist, Items.leather_chestplate, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.leather_boots, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.leather_helmet, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.leather_leggings, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.cooked_porkchop, this.rand, this.adjustProbability(0.3F));
+ addEmeraldTrade(merchantrecipelist, Items.cooked_beef, this.rand, this.adjustProbability(0.3F));
+ }
+
+ if (merchantrecipelist.isEmpty()) {
+ addPurchaseRecipe(merchantrecipelist, Items.gold_ingot, this.rand, 1.0F);
+ }
+
+ Collections.shuffle(merchantrecipelist);
+
+ if (this.getBuyingList() == null) {
+ this.setBuyingList(new MerchantRecipeList());
+ }
+
+ for (int l = 0; l < p_70950_1_ && l < merchantrecipelist.size(); ++l) {
+ try {
+ this.getBuyingList().addToListWithCheck((MerchantRecipe) merchantrecipelist.get(l));
+ }
+ catch (Throwable t) {
+ Logger.INFO("Villager with ID "+this.entityUniqueID.toString()+" at | X: "+this.posX+" Y: "+this.posY+" Z: "+this.posZ+" may have corrupt trades, it is advised to remove/kill it.");
+ }
+ }
+
+ try {
+ if (this.getBuyingList() != null) {
+ for (Object g : this.getBuyingList()) {
+ if (g != null) {
+ if (g instanceof MerchantRecipe) {
+ MerchantRecipe m = (MerchantRecipe) g;
+ ItemStack selling = m.getItemToSell();
+ ItemStack[] buying = new ItemStack[] {m.getItemToBuy(), m.getSecondItemToBuy() != null ? m.getSecondItemToBuy() : null};
+ if (selling == null) {
+ Logger.WARNING("Villager is Selling an invalid item");
+ }
+ else if (buying[0] == null && buying[1] == null) {
+ Logger.WARNING("Villager is buying two invalid items");
+ }
+ else {
+ Logger.WARNING("Villager is Selling x"+selling.stackSize+selling.getDisplayName()+" for x"+buying[0].stackSize+" "+buying[0].getDisplayName()+buying[1] != null ? " and for x"+buying[1].stackSize+" "+buying[1].getDisplayName() : "");
+ }
+ }
+ else
+ Logger.WARNING("Found: "+g.getClass().getName());
+ }
+ }
+ }
+ else {
+
+ }
+ }
+ catch (Throwable t) {
+
+ }
+
+ }
+
+ /**
+ * main AI tick function, replaces updateEntityActionState
+ */
+ @Override
+ protected void updateAITick() {
+ if (!this.isTrading()) {
+ if (this.getNeedsInitilization()) {
+ if (this.getBuyingList().size() > 1) {
+ Iterator<MerchantRecipe> iterator = this.getBuyingList().iterator();
+
+ while (iterator.hasNext()) {
+ MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
+
+ if (merchantrecipe.isRecipeDisabled()) {
+ merchantrecipe.func_82783_a(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
+ }
+ }
+ }
+
+ this.addDefaultEquipmentAndRecipies(1);
+ this.setNeedsInitilization(false);
+
+ if (this.getVillageObject() != null && this.getLastBuyingPlayer() != null) {
+ this.worldObj.setEntityState(this, (byte) 14);
+ this.getVillageObject().setReputationForPlayer(this.getLastBuyingPlayer(), 1);
+ }
+ }
+ }
+ super.updateAITick();
+ }
+
+ public static void addEmeraldTrade(MerchantRecipeList aRecipeList, Item aItem, Random aRand, float aChance) {
+ if (aRand.nextFloat() < aChance) {
+ int i = getLootAmount_BlacksmithSellingList(aItem, aRand);
+ ItemStack itemstack;
+ ItemStack itemstack1;
+
+ if (i < 0) {
+ itemstack = new ItemStack(Items.emerald, 1, 0);
+ itemstack1 = new ItemStack(aItem, -i, 0);
+ } else {
+ itemstack = new ItemStack(Items.emerald, i, 0);
+ itemstack1 = new ItemStack(aItem, 1, 0);
+ }
+
+ aRecipeList.add(new MerchantRecipe(itemstack, itemstack1));
+ }
+ }
+
+ public static void addCustomTrade(MerchantRecipeList aRecipeList, ItemStack aItem1, ItemStack aItem2, ItemStack aItem3, Random aRand, float aChance) {
+ if (aRand.nextFloat() < aChance) {
+ aRecipeList.add(new MerchantRecipe(aItem1, aItem2, aItem3));
+ }
+ }
+
+ private static int getLootAmount_BlacksmithSellingList(Item aItem, Random aRand) {
+ Tuple tuple = (Tuple) blacksmithSellingList.get(aItem);
+ return tuple == null ? 1
+ : (((Integer) tuple.getFirst()).intValue() >= ((Integer) tuple.getSecond()).intValue()
+ ? ((Integer) tuple.getFirst()).intValue()
+ : ((Integer) tuple.getFirst()).intValue() + aRand.nextInt(
+ ((Integer) tuple.getSecond()).intValue() - ((Integer) tuple.getFirst()).intValue()));
+ }
+
+ public static void addPurchaseRecipe(MerchantRecipeList aTradeList, Item aItem, Random aRand, float aChance) {
+ if (aRand.nextFloat() < aChance) {
+ aTradeList.add(new MerchantRecipe(getSimpleLootStack(aItem, aRand), Items.emerald));
+ }
+ }
+
+ private static ItemStack getSimpleLootStack(Item aItem, Random aRand) {
+ return new ItemStack(aItem, getLootAmount_VillagerSellingList(aItem, aRand), 0);
+ }
+
+ public static void addPurchaseRecipe(MerchantRecipeList aTradeList, Item aItem, int aMeta, Random aRand, float aChance) {
+ if (aRand.nextFloat() < aChance) {
+ aTradeList.add(new MerchantRecipe(getComplexLootStack(aItem, aMeta, aRand), Items.emerald));
+ }
+ }
+
+ private static ItemStack getComplexLootStack(Item aItem, int aMeta, Random aRand) {
+ return new ItemStack(aItem, getLootAmount_VillagerSellingList(aItem, aRand), aMeta);
+ }
+
+ private static int getLootAmount_VillagerSellingList(Item aItem, Random aRand) {
+ Tuple tuple = (Tuple) villagersSellingList.get(aItem);
+ return tuple == null ? 1
+ : (((Integer) tuple.getFirst()).intValue() >= ((Integer) tuple.getSecond()).intValue()
+ ? ((Integer) tuple.getFirst()).intValue()
+ : ((Integer) tuple.getFirst()).intValue() + aRand.nextInt(
+ ((Integer) tuple.getSecond()).intValue() - ((Integer) tuple.getFirst()).intValue()));
+ }
+
+}